/* GRUBFIRE — turn-based artillery · Pocket Arcade game 06 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --soil: #4a2c18;
  --soil-deep: #2b1a0e;
  --leaf: #57a83c;
  --sun: #ffd94a;
  --ember: #ff8a3c;
  --sky: #a8ddf5;
  --panel: #1d1409;
  --panel-edge: #6e4a26;
  --ink: #f3e8d2;
}

html,
body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(ellipse at 50% -10%, #3a2b16 0%, transparent 55%),
    linear-gradient(180deg, #17110a, #0c0805);
  color: var(--ink);
  font-family: "Courier New", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100svh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#screen-menu,
#screen-howto,
#screen-debrief {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

[hidden] {
  display: none !important;
}

button {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ------------------------------------------------------------------ menu */

.brand {
  margin: clamp(18px, 6svh, 48px) 0 18px;
  text-align: center;
}

.brand-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--leaf);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3em;
}

.brand-title {
  color: var(--sun);
  font-size: clamp(44px, 14vw, 64px);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0.02em;
  text-shadow:
    0 3px 0 #7a4a12,
    0 6px 0 rgba(0, 0, 0, 0.45);
}

.brand-title i {
  color: var(--ember);
  font-style: normal;
}

.brand-sub {
  margin-top: 10px;
  color: rgba(243, 232, 210, 0.75);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.brand-worm {
  display: block;
  width: 84px;
  height: 34px;
  margin: 14px auto 0;
  border-radius: 999px 999px 999px 12px;
  background:
    radial-gradient(circle at 74% 34%, #fff 0 5%, transparent 6%),
    radial-gradient(circle at 76% 36%, #222 0 2.4%, transparent 3%),
    linear-gradient(180deg, #f2b3c4, #d684a0);
  box-shadow: inset 0 -6px 0 rgba(120, 50, 70, 0.35);
  position: relative;
}

.brand-worm::before {
  content: "";
  position: absolute;
  left: 12%;
  top: -6px;
  width: 76%;
  height: 7px;
  border-radius: 4px;
  background: #3e7fe0;
}

.menu-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 16px;
  border: 2px solid var(--panel-edge);
  border-radius: 10px;
  color: var(--ink);
  background: linear-gradient(160deg, #2c1f10, var(--panel));
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.4);
  text-align: left;
}

.menu-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  border-color: var(--sun);
}

.menu-btn strong {
  color: var(--sun);
  font-size: 15px;
  letter-spacing: 0.1em;
}

.menu-btn span {
  color: rgba(243, 232, 210, 0.62);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.menu-btn-minor strong {
  color: var(--ink);
}

.menu-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 18px;
}

.foot-link {
  color: var(--sky);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.foot-btn {
  padding: 8px 12px;
  border: 2px solid var(--panel-edge);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.foot-btn:active {
  border-color: var(--sun);
}

.build-tag {
  color: rgba(243, 232, 210, 0.35);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.streak-strip {
  margin: 0 auto 12px;
  padding: 7px 14px;
  border: 1px dashed rgba(255, 217, 74, 0.5);
  border-radius: 999px;
  color: var(--sun);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

/* ------------------------------------------------------------ sub screens */

.screen-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.screen-head h2 {
  color: var(--sun);
  font-size: 18px;
  letter-spacing: 0.14em;
}

.back-btn {
  width: 38px;
  height: 38px;
  border: 2px solid var(--panel-edge);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  font-size: 15px;
}

.manual-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px 20px;
  -webkit-overflow-scrolling: touch;
}

.manual-scroll h3 {
  margin: 16px 0 6px;
  color: var(--ember);
  font-size: 12px;
  letter-spacing: 0.2em;
}

.manual-scroll p {
  color: rgba(243, 232, 210, 0.85);
  font-size: 12px;
  line-height: 1.65;
}

.manual-scroll kbd {
  padding: 1px 5px;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  background: var(--panel);
  font-size: 10px;
}

/* ----------------------------------------------------------------- battle */

#screen-battle {
  gap: 8px;
}

.battle-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.head-corner-btn {
  width: 34px;
  height: 34px;
  border: 2px solid var(--panel-edge);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  font-size: 13px;
}

#hud-turn {
  flex: 1;
  overflow: hidden;
  color: var(--sun);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hud-turn.is-enemy {
  color: #ff9d7a;
}

.team-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.team-bar {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.6);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.45);
}

.team-bar i {
  display: block;
  height: 100%;
  transition: width 0.35s ease;
}

.team-bar.blue i { background: linear-gradient(90deg, #2a5cb0, #5ea0ff); }
.team-bar.red { transform: scaleX(-1); }
.team-bar.red i { background: linear-gradient(90deg, #b03226, #ff7a5e); }

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid var(--panel-edge);
  border-radius: 12px;
  background: #87ceeb;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

#battle {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage-inner {
  position: relative;
  flex: 0 0 auto;
}

.hud-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.hud-chip {
  padding: 5px 9px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 14, 8, 0.62);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 0 #000;
}

/* The weapon name now carries an ammo count, so cap it rather than let a
   long one shove the wind and timer chips off a narrow phone. */
#hud-weapon {
  overflow: hidden;
  max-width: 52%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hud-timer {
  min-width: 34px;
  text-align: center;
}

#hud-timer.is-low {
  color: #ff7a5e;
  animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
  to { transform: scale(1.12); }
}

.power-track {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 62px;
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 5px;
  background: rgba(20, 14, 8, 0.55);
  pointer-events: none;
}

#power-meter {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #7cc957, var(--sun) 65%, var(--ember));
  transition: width 0.05s linear;
}

#power-meter.is-hot {
  background: linear-gradient(90deg, var(--ember), #ff4433);
}

/* coach mark for the aim gesture — shown on the first turn, then retired */

/* Sits above the round buttons, which sit above the walk strip. */
.aim-hint {
  position: absolute;
  left: 50%;
  bottom: 136px;
  z-index: 4;
  margin: 0;
  padding: 7px 13px;
  transform: translateX(-50%);
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 14, 8, 0.78);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
  animation: hint-pulse 1.5s ease-in-out infinite alternate;
}

.aim-hint[hidden] { display: none; }

@keyframes hint-pulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* arsenal — a full-stage sheet with thumb-sized rows, like the modern
   mobile Worms weapon grid rather than the old cramped drop-up */

.weapon-panel {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(8, 5, 2, 0.72);
}

.weapon-panel[hidden] { display: none; }

.weapon-sheet {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  max-width: 320px;
  max-height: 100%;
  overflow-y: auto;
  padding: 12px;
  border: 2px solid var(--panel-edge);
  border-radius: 14px;
  background: rgba(29, 20, 9, 0.97);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.weapon-sheet h3 {
  margin: 0 0 2px;
  color: var(--sun);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-align: center;
}

.weapon-sheet button {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 6px 11px;
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  background: #2c1f10;
  text-align: left;
}

.weapon-sheet button b {
  font-size: 22px;
  line-height: 1;
}

.weapon-sheet button span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.weapon-sheet button small {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 0.66;
}

.weapon-sheet button span {
  flex: 1;
  min-width: 0;
}

/* Ammo tag — the whole point of the scarce weapons is seeing what's left. */
.weapon-sheet .ammo {
  flex: 0 0 auto;
  min-width: 26px;
  color: var(--sun);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: right;
}

.weapon-sheet button.is-selected {
  border-color: var(--sun);
  color: var(--sun);
  background: #3a2913;
}

.weapon-sheet button.is-spent {
  opacity: 0.34;
}

.weapon-sheet button.is-spent .ammo {
  color: #d06a55;
}

/* The battlefield is the control surface — walking, jumping and firing are
   all gestures on it. The arsenal is the one thing that still needs a
   discrete control, so it floats in the thumb corner instead of a dock. */

/* Three round controls floating over the field: mode on the left, arsenal in
   the middle, fire on the right. No dock bar, so the hill keeps the screen. */

.pad-fab {
  position: absolute;
  bottom: 66px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 2px solid var(--panel-edge);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(29, 20, 9, 0.86);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.pad-fab b {
  font-size: 20px;
  line-height: 1;
}

.pad-fab small {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.14em;
  opacity: 0.72;
}

.pad-fab:active {
  border-color: var(--sun);
  background: rgba(58, 41, 19, 0.95);
}

.arms-fab {
  left: 10px;
  width: 58px;
  height: 58px;
}

.arms-fab b { font-size: 20px; }

.fire-fab {
  right: 10px;
  width: 66px;
  height: 66px;
  border-color: #8a3a22;
  color: #ffd8c4;
  background: linear-gradient(180deg, rgba(160, 62, 32, 0.92), rgba(104, 34, 16, 0.92));
}

.fire-fab.is-ready {
  border-color: #ffb08a;
  color: #fff;
  background: linear-gradient(180deg, #d8552f, #8f2c14);
}

.fire-fab:active {
  border-color: var(--sun);
  background: linear-gradient(180deg, #f06a3c, #a83418);
}

/* Walk strip: a band across the foot of the battlefield, split left and
   right with JUMP between them. Holding a half walks. Everything above it
   belongs to the camera, so one finger can look around the hill without the
   worm setting off. */

.walk-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: flex;
  gap: 3px;
  align-items: stretch;
  height: 58px;
  padding: 3px;
  border-top: 1px solid rgba(255, 209, 102, 0.28);
  background: linear-gradient(180deg, rgba(20, 14, 8, 0.32), rgba(20, 14, 8, 0.74));
}

.walk-half,
.jump-btn {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 209, 102, 0.26);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(29, 20, 9, 0.5);
}

.walk-half { flex: 1 1 0; min-width: 0; }

.jump-btn {
  flex: 0 0 auto;
  width: 82px;
  border-color: rgba(255, 209, 102, 0.4);
  background: rgba(50, 36, 15, 0.72);
}

.walk-half b,
.jump-btn b {
  font-size: 19px;
  line-height: 1;
}

.walk-half small,
.jump-btn small {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.14em;
  opacity: 0.7;
}

.walk-half.is-on,
.walk-half:active,
.jump-btn:active {
  border-color: var(--sun);
  color: var(--sun);
  background: rgba(74, 54, 20, 0.86);
}

/* ---------------------------------------------------------------- debrief */

.debrief-brand {
  margin-top: clamp(24px, 9svh, 64px);
}

#debrief-title {
  color: var(--sun);
  font-size: clamp(40px, 13vw, 58px);
  font-weight: 900;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
}

#debrief-title.is-loss {
  color: #ff7a5e;
}

.debrief-stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px 18px;
  margin: 26px 8px 0;
  padding: 18px;
  border: 2px solid var(--panel-edge);
  border-radius: 12px;
  background: var(--panel);
}

.debrief-stats dt {
  color: rgba(243, 232, 210, 0.65);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.debrief-stats dd {
  color: var(--sun);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

#debrief-score-status {
  min-height: 16px;
  margin: 14px 0 0;
  color: var(--leaf);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
}

.debrief-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.cta-btn {
  padding: 14px 26px;
  border: 2px solid #8a6a12;
  border-radius: 10px;
  color: #241a04;
  background: linear-gradient(180deg, #ffe27a, #e8b62e);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.4);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.cta-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

@media (max-height: 700px) {
  .brand { margin-top: 10px; }
}

@media (max-height: 640px) {
  .weapon-sheet button { min-height: 50px; }
  .battle-top { gap: 6px; }
  .head-corner-btn {
    width: 30px;
    height: 30px;
  }
}
