/* The phone page: one thumb, big targets, few words (doc 07). The look is in doc 16. */
/* Served by the game, never from the web: phones on home Wi-Fi may have no internet. Text doesn't wait for a font on a slow link. */
@font-face { font-family: Fredoka; src: url("fonts/fredoka.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Grenze Gotisch"; src: url("fonts/grenze-gotisch-900.woff2") format("woff2"); font-weight: 900; font-display: swap; }
:root {
  --bg: #241A33;
  --panel: #35284A;
  --panel-2: #46345F;
  --text: #FFF3D6;
  --dim: #D9CFE6;
  --gold: #F5C542;
  --gold-shadow: #A97F12;
  --line: #6E5B8C;
  --coral: #E9806E;
  --field: #3E5237;
  --go: var(--gold);
  --chosen: var(--gold);
  --bad: #E9806E;
  --title: "Grenze Gotisch", Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 18px/1.35 Fredoka, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
main { display: flex; flex-direction: column; min-height: 100dvh; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); gap: 10px; max-width: 560px; margin: 0 auto; }
h1 { font-family: var(--title); font-weight: 900; color: var(--gold); font-size: 46px; margin: 4px 0; line-height: 1; }
h2 { font-size: 20px; margin: 10px 0 2px; color: var(--dim); font-weight: 600; }
p { margin: 4px 0; }
.dim { color: var(--dim); font-size: 16px; }
.big { font-size: 30px; font-weight: 700; text-align: center; margin: auto 0; }
.grow { flex: 1; }
button {
  font: inherit; font-weight: 600; color: var(--text); background: var(--panel); border: 2px solid var(--line);
  border-radius: 12px; min-height: 60px; padding: 10px 14px; width: 100%; touch-action: manipulation; cursor: pointer;
  transition: transform 80ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out;
}
button:active:not(:disabled) { filter: brightness(1.25); transform: scale(0.98); }
button:disabled { opacity: 0.4; }
button.go { background: var(--gold); border: 0; box-shadow: 0 5px 0 var(--gold-shadow); color: var(--bg); font-weight: 700; font-size: 24px; min-height: 66px; border-radius: 14px; }
main > button.go { position: sticky; bottom: 10px; z-index: 1; }
button.offer { text-align: left; font-weight: 400; display: block; min-height: 0; padding: 11px 14px; border-radius: 14px; flex: none; }
button.offer.chosen { background: var(--gold); border-color: var(--gold); color: var(--bg); }
button.offer.chosen .card-text { font-weight: 500; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-title b { font-size: 24px; font-weight: 700; }
.card-cost { font-size: 17px; font-weight: 600; white-space: nowrap; }
.card-text { font-size: 18px; line-height: 1.22; margin-top: 4px; }
.scout-unit { margin-top: 4px; }
.stage-title { margin: 0; font-size: 50px; }
button.claim { margin-top: 12px; }
.recap-title { font-size: 44px; line-height: 1; }
.lead { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 500; }
.budget-line { margin: 0 0 4px; font-size: 18px; line-height: 1.2; color: var(--dim); }
input {
  font: inherit; width: 100%; min-height: 56px; padding: 10px 14px; color: var(--text); background: var(--panel);
  border: 2px solid var(--line); border-radius: 12px;
}
.timer { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--dim); }
.timer b { font-size: 26px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.budget { height: 10px; background: var(--panel); border-radius: 5px; overflow: hidden; }
.budget i { display: block; height: 100%; background: var(--gold); transition: width 140ms ease-out; }
ul { list-style: none; margin: 0; padding: 0; }
li { padding: 3px 0; }
.players li { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.chip { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.me { font-weight: 700; }
/* Over the screen, not above it: pushing the army screen down would put Ready out of reach while it shows. */
#note { position: fixed; top: 0; left: 0; right: 0; z-index: 6; background: var(--bad); color: var(--bg); padding: 10px 14px; text-align: center; font-weight: 600; }

/* The army screen fits one phone screen: the field never scrolls away, and only the unit list moves. */
main:has(> .send) { height: 100dvh; min-height: 0; padding: 12px 14px calc(10px + env(safe-area-inset-bottom)); }
.send { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; user-select: none; -webkit-user-select: none; }
.send > * { flex: none; }
.send-title { margin: 0; font-size: 36px; }
.send .timer { align-items: center; }
.send-head { display: grid; grid-template-columns: minmax(0, 1fr) clamp(84px, 14dvh, 118px); column-gap: 12px; align-items: center; }
.send-head.square { grid-template-columns: minmax(0, 1fr) clamp(64px, 11dvh, 96px); }
.head-map { width: 100%; height: auto; }
.left-line { margin: 0; font-size: 21px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.same-line { margin: 1px 0 5px; font-size: 15px; line-height: 1.2; color: var(--dim); }
.cap-line { margin: 5px 0 0; font-size: 16px; line-height: 1.2; color: var(--dim); font-variant-numeric: tabular-nums; }
.cap-line.full { color: var(--gold); font-weight: 700; }
.side-title { margin: 2px 0 0; font-size: 17px; font-weight: 700; color: var(--text); }
.scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 6px; }

.segment { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border-radius: 12px; padding: 4px; gap: 4px; }
.segment button { min-height: 44px; padding: 2px 4px; border: 0; background: none; border-radius: 9px; font-size: 17px; }
.segment button.on { background: var(--text); color: var(--bg); font-weight: 700; }

.field-wrap { display: flex; flex-direction: column; gap: 5px; }
.field-side { display: grid; }
.field-side.sideways { grid-template-columns: 22px minmax(0, 1fr) 22px; column-gap: 5px; align-items: stretch; }
.field-side.upright { grid-template-columns: minmax(0, 1fr); row-gap: 3px; }
.edge { font-size: 14px; font-weight: 600; color: var(--dim); text-align: center; line-height: 1.2; }
.edge.front { font-weight: 700; color: var(--gold); }
.sideways .edge { writing-mode: vertical-rl; }
.sideways:not(.front-first) .edge:not(.front), .sideways.front-first .edge.front { transform: rotate(180deg); }
.field { display: grid; gap: 5px; }
button.cell {
  min-height: clamp(44px, 7.8dvh, 66px); padding: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 10px; font-weight: 400; overflow: hidden; min-width: 0;
}
button.cell.full { border-color: var(--text); }
button.cell.line { min-height: 38px; flex-direction: row; flex-wrap: wrap; border-style: dashed; background: none; padding: 3px 8px; }
button.cell.line .tag { width: auto; }
button.cell.over { border-color: var(--gold); background: var(--panel-2); }
button.cell.bump { animation: bump 160ms ease-out; }
@keyframes bump { 40% { transform: scale(1.05); background-color: var(--panel-2); } }
.faint { color: var(--dim); font-size: 14px; }
.tag {
  display: block; width: 100%; box-sizing: border-box; padding: 0 3px; font-size: 14px; font-weight: 700; line-height: 1.25; border-radius: 5px; text-align: center;
  background: var(--unit); color: var(--bg); touch-action: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ghost {
  position: fixed; left: 0; top: 0; z-index: 5; pointer-events: none; margin: -40px 0 0 -30px; padding: 6px 12px; font-size: 16px; font-weight: 700;
  border-radius: 10px; color: var(--bg); background: var(--unit); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.next-tap { margin: 0; text-align: center; font-size: 17px; line-height: 1.2; font-weight: 600; }
.next-tap.warn { color: var(--gold); }

button.unit { flex: none; display: flex; flex-direction: column; gap: 2px; min-height: 46px; padding: 8px 12px; text-align: left; background: var(--panel); border: 2px solid var(--line); border-radius: 12px; font-weight: 400; }
button.unit.on { border: 3px solid var(--gold); padding: 7px 12px; }
.unit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; }
.unit-name { font-size: 20px; font-weight: 700; }
.unit-buys { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.unit-text { font-size: 16px; line-height: 1.22; }

.card { flex: none; background: var(--panel); border-radius: 10px; padding: 8px 12px; font-size: 16px; }
.card h2 { margin-top: 0; color: var(--text); }
.scout-where { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mini-map { width: 96px; height: auto; flex: none; }
.field.mini { margin: 6px 0; }
.mini-cell { min-height: 44px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; line-height: 1.2; text-align: center; }

.bar { display: grid; grid-template-columns: 72px 72px minmax(0, 1fr); gap: 6px; }
.bar button { min-height: 58px; padding: 4px; border-radius: 14px; }
.bar button.small { font-size: 17px; line-height: 1.1; }
.bar button.go { font-size: 22px; min-height: 58px; line-height: 1.1; box-shadow: 0 5px 0 var(--gold-shadow); margin-bottom: 5px; }
.bar button.go.long { font-size: 16px; }
button.go.done { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--gold); color: var(--text); opacity: 1; }

/* Short screens, like a phone with Safari's bars showing: keep the grid, tools and Ready, and drop what's only a reminder. */
@media (max-height: 720px) {
  .side-title, .more-hint, .same-line { display: none; }
  .send-title { font-size: 30px; }
  .left-line { margin-bottom: 4px; }
  .send { gap: 6px; }
  .segment button { min-height: 40px; }
  .bar button, .bar button.go { min-height: 50px; }
  button.unit { min-height: 40px; padding: 4px 10px; }
  button.unit.on { padding: 3px 10px; }
}

/* The lobby: the goal comes first, because that's what players were missing. */
main:has(> .you-row) { gap: 14px; padding: 20px 18px calc(14px + env(safe-area-inset-bottom)); }
.you-row { display: flex; align-items: center; gap: 14px; }
.you-row h1 { margin: 0; overflow-wrap: anywhere; }
.shield { width: 52px; height: 60px; flex: none; }
.shield.small { width: 20px; height: 23px; }
.goal { background: var(--gold); color: var(--bg); border-radius: 16px; padding: 14px 18px; }
.goal h2 { margin: 0 0 6px; font-family: var(--title); font-weight: 900; font-size: 34px; line-height: 1; color: var(--bg); }
.goal p { margin: 0; font-size: 21px; line-height: 1.25; font-weight: 600; }
.each-round { background: var(--panel); border-radius: 16px; padding: 14px 18px; }
.each-round h2, .here h2 { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--text); }
.each-round ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 18px; line-height: 1.25; }
.each-round li { padding: 0; }
.each-round p { margin: 10px 0 0; font-size: 18px; line-height: 1.25; }
.here ul { font-size: 20px; }
.here li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.here li:last-child { border-bottom: 0; }
.here .who { flex: 1; overflow-wrap: anywhere; }
.here .me .who { font-weight: 600; }
.me { font-weight: 400; }
.waiting { text-align: center; min-height: 40px; }
@media (max-height: 720px) {
  main:has(> .you-row) { gap: 9px; padding-top: 12px; }
  .you-row h1 { font-size: 36px; }
  .shield { width: 40px; height: 46px; }
  .goal, .each-round { padding: 9px 14px; }
  .goal h2 { font-size: 28px; margin-bottom: 3px; }
  .goal p { font-size: 17px; }
  .each-round ol, .each-round p { font-size: 15px; }
  .each-round ol { gap: 2px; }
  .each-round p { margin-top: 4px; }
  .each-round h2, .here h2 { font-size: 17px; margin-bottom: 3px; }
  .here ul { font-size: 17px; }
  .here li { padding: 3px 0; }
}

/* Phase cards: what this phase is for, with its timer waiting behind. */
main:has(> .phase) { height: 100dvh; min-height: 0; }
.phase { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.phase-body { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; overflow-y: auto; }
.round-line { margin: 0; font-size: 18px; font-weight: 600; color: var(--dim); text-align: center; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; font-size: 15px; font-weight: 600; align-items: center; }
.steps li { border: 2px solid var(--line); color: var(--dim); border-radius: 999px; padding: 4px 11px; }
.steps li.on { background: var(--gold); border-color: var(--gold); color: var(--bg); padding: 6px 13px; }
.phase h1 { margin: 4px 0 0; font-size: clamp(44px, 8.5dvh, 58px); line-height: 0.95; text-align: center; }
.map { display: block; font-family: Fredoka, system-ui, sans-serif; }
.big-map { width: min(300px, 78vw); max-height: 27dvh; flex: none; }
.card-icon { flex: none; }
.icon { display: block; width: min(240px, 60vw); max-height: 22dvh; }
.card-words { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; width: 100%; }
.card-words h2 { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 700; color: var(--text); }
.card-words p { margin: 4px 0 0; font-size: 18px; line-height: 1.25; color: var(--dim); }
.gold { color: var(--gold); }
button.quiet { flex: none; min-height: 56px; border-radius: 14px; font-size: 21px; }
@media (max-height: 720px) {
  .phase-body { gap: 7px; }
  .phase h1 { font-size: 40px; margin: 0; }
  .big-map { width: auto; height: 21dvh; }
  .icon { max-height: 18dvh; }
  .card-words { gap: 8px; }
  .card-words h2 { font-size: 20px; }
  .card-words p { font-size: 16px; }
  button.quiet { min-height: 48px; }
  .stage-title { font-size: 38px; }
  .lead { font-size: 18px; }
  .budget-line { font-size: 16px; margin: 0; }
  button.offer { padding: 6px 12px; }
  .card-title b { font-size: 20px; }
  .card-cost { font-size: 15px; }
  .card-text { font-size: 15px; margin-top: 1px; }
  button.go { min-height: 54px; font-size: 21px; }
}

/* The results (mockups: Results-Phone): one screen, no scrolling. */
.center { text-align: center; }
.standings { list-style: none; margin: 0; padding: 4px 16px; background: var(--panel); border-radius: 16px; }
.standings li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 20px; font-weight: 600; }
.standings li:last-child { border-bottom: 0; }
.standings .who { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.standings .dim { font-size: inherit; font-weight: 500; }
.standings li.me .who { color: var(--gold); }
/* The page never scrolls: on a small phone with a big army, only the army's table does, and Play again stays in view. */
main:has(> .army-all-game) { height: 100dvh; }
main:has(> .army-all-game) > * { flex-shrink: 0; }
main:has(> .army-all-game) > .army-all-game { flex-shrink: 1; min-height: 0; display: flex; flex-direction: column; }
.army-all-game .units { min-height: 0; overflow-y: auto; }
.pips { display: flex; gap: 6px; }
.pips i { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--gold); }
.pips i.on { background: var(--gold); }
.standings .points { color: var(--gold); font-weight: 700; white-space: nowrap; }
.army-all-game { background: var(--panel); border-radius: 16px; padding: 12px 16px 6px; }
.army-all-game h2 { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--text); }
.units { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; column-gap: 12px; row-gap: 1px; align-items: baseline; }
.units .h { font-size: 14px; font-weight: 600; color: var(--dim); text-align: right; }
.units .u { font-size: 18px; font-weight: 600; }
.units .n { font-size: 19px; font-weight: 700; text-align: right; }
.units .k { color: var(--gold); }
.units .note { grid-column: 1 / -1; font-size: 15px; line-height: 1.2; color: var(--dim); margin-bottom: 4px; }
/* A short screen: the standings go two to a row, the type gets smaller, and the line about replays goes. */
@media (max-height: 700px) {
  main:has(> .standings) { gap: 8px; }
  .standings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; padding: 4px 12px; }
  .standings li { padding: 6px 0; font-size: 16px; gap: 6px; border-bottom: 0; }
  .pips { gap: 3px; }
  .pips i { width: 11px; height: 11px; border-width: 2px; }
  .army-all-game { padding: 8px 14px 4px; }
  .army-all-game h2 { font-size: 17px; margin-bottom: 2px; }
  .units .u { font-size: 16px; }
  .units .n { font-size: 17px; }
  .units .note { font-size: 13px; margin-bottom: 2px; }
  .tv-replay, .standings .you { display: none; }
}
