:root {
  --bg: #17130e; --bg2: #1f1912; --panel: #262017; --panel2: #2f281d; --ink: #f2e8d6; --muted: #a8987f; --line: #4a3f30;
  --accent: #d9a441; --accent-ink: #1b140b; --warn: #e38a5c; --good: #8fbf6a;
  --era: #b07a3a;
  --k-tech: #7d9a5b; --k-gov: #b5734a; --k-leader: #9b74b8; --k-wonder: #d9a441; --k-action: #5d97b0; --k-legacy: #c45c6a;
  --k-formation: #a65d4f; --k-aggression: #c0473a; --k-defense: #6f7f8f;
  --kit-bg: var(--panel); --kit-ink: var(--ink); --kit-muted: var(--muted); --kit-line: var(--line); --kit-accent: var(--accent);
  --kit-p0: #d0583e; --kit-p1: #3f82cf; --kit-p2: #4fa35e; --kit-p3: #d4ad3b;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
body[data-era="1"] { --era: #b07a3a; } body[data-era="2"] { --era: #7f95b8; } body[data-era="3"] { --era: #b0656e; }
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 14px/1.4 var(--sans);
  background: radial-gradient(1200px 600px at 50% -200px, #2c2216, transparent), var(--bg); }
#app { max-width: 1600px; margin: 0 auto; padding: 12px 16px 60px; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; margin: 0; }
small { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .warn { color: var(--warn); }
button, input, select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
button { cursor: pointer; } button:hover:not(:disabled) { border-color: var(--accent); }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.primary:hover { filter: brightness(1.08); }
.ghost { background: transparent; }
.big { font-size: 1.1rem; padding: 12px 18px; width: 100%; }
.error { color: var(--warn); min-height: 1.2em; margin: 6px 0 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.ic { width: 1em; height: 1em; vertical-align: -0.14em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-cul { fill: currentColor; stroke: none; color: #e8c46a; } .ic-food { color: #b9cf6a; } .ic-ore { color: #c9b8a4; fill: currentColor; stroke: none; }
.ic-sci { color: #7fc3e0; } .ic-hap { color: #f0b46b; } .ic-str { color: #e0796a; } .ic-wkr { color: #e8dccb; }

/* ---------- title ---------- */
#title { position: relative; min-height: calc(100vh - 40px); display: grid; align-items: center; }
.hero { position: absolute; inset: -12px -16px; background: center/cover no-repeat; opacity: .45;
  mask-image: linear-gradient(90deg, transparent 0%, #000 45%); -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%); }
.title-inner { position: relative; max-width: 520px; padding: 24px 0; }
h1 { font-size: clamp(3rem, 7vw, 5.2rem); line-height: .95; letter-spacing: .01em; }
h1 span { color: var(--accent); font-style: italic; }
.sub { color: var(--muted); font-size: 1.1rem; margin: 10px 0 28px; }
.menu { display: grid; gap: 10px; }
.menu .row > button { flex: 1 1 200px; }
.menu label { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); }
.online { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
#joinForm { display: flex; gap: 8px; } #joinForm input { flex: 1; text-transform: uppercase; letter-spacing: .15em; }
#handoff { text-align: center; padding-top: 100px; } #handoff h2 { font-size: 2.2rem; margin-bottom: 20px; }

/* ---------- top bar ---------- */
#topbar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px;
  background: linear-gradient(90deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-top: 3px solid var(--era); border-radius: 10px; }
.era-badge { display: grid; line-height: 1; } .era-badge span { color: var(--era); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.era-badge b { font-family: var(--serif); font-size: 1.6rem; }
.round { display: grid; font-weight: 600; } .round small { font-weight: 400; }
.scores { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--line); }
.chip.now { box-shadow: 0 0 0 1px var(--accent); } .chip.rival { border-left-color: #888; }
.event { margin-left: auto; display: flex; gap: 10px; align-items: center; max-width: 440px; }
.event img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.event div { display: grid; line-height: 1.2; } .event small { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.event span { color: var(--muted); font-size: .85rem; }

/* ---------- cards ---------- */
.card { --kc: var(--line); position: relative; display: flex; flex-direction: column; background: #f2e6cc; color: #2b2114;
  border-radius: 9px; overflow: hidden; box-shadow: 0 2px 0 #0004, 0 6px 14px #0005; border: 1px solid #0006;
  outline: none; transition: transform .14s ease, box-shadow .14s ease; }
.card .art { aspect-ratio: 4 / 3; background: linear-gradient(135deg, color-mix(in srgb, var(--kc) 60%, #000), color-mix(in srgb, var(--kc) 30%, #000)); overflow: hidden; }
.card .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .body { padding: 6px 8px 8px; border-top: 4px solid var(--kc); display: grid; gap: 3px; flex: 1; align-content: start;
  background: linear-gradient(#f4ead3, #e9dabb); }
.card .kind { font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; color: color-mix(in srgb, var(--kc) 70%, #000); font-weight: 600; }
.era-tag { display: inline-block; padding: 0 4px; margin-left: 2px; border-radius: 3px; background: #0001; color: #5b4a33; }
.card .name { font-family: var(--serif); font-weight: 700; font-size: 1.08rem; line-height: 1.05; }
.card .fx { font-size: .78rem; line-height: 1.3; color: #3d3020; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
.card .fx .o { white-space: nowrap; font-weight: 600; } .card .fx .per { color: #7a6a52; font-size: .7rem; }
.card .price { display: flex; gap: 10px; font-size: .78rem; font-weight: 600; color: #4a3b26; margin-top: 2px; }
.card .ic-cul { color: #b98a17; } .card .ic-food { color: #6a8a1c; } .card .ic-ore { color: #7a6a58; } .card .ic-sci { color: #2f7fa3; }
.card .ic-hap { color: #c4752a; } .card .ic-str { color: #b2402f; }
.k-tech { --kc: var(--k-tech); } .k-gov { --kc: var(--k-gov); } .k-leader { --kc: var(--k-leader); } .k-wonder { --kc: var(--k-wonder); }
.k-action { --kc: var(--k-action); } .k-legacy { --kc: var(--k-legacy); } .k-formation { --kc: var(--k-formation); }
.k-aggression { --kc: var(--k-aggression); } .k-defense { --kc: var(--k-defense); }
.card.can { cursor: pointer; box-shadow: 0 0 0 2px var(--accent), 0 6px 18px #000a; }
.card.can:hover, .card.can:focus-visible { transform: translateY(-4px); }
.card.cant { filter: saturate(.55) brightness(.75); }
.card.ghost { background: transparent; border: 1px dashed var(--line); box-shadow: none; color: var(--muted); }
.card.ghost .body { background: transparent; border-top-color: transparent; }

.card.mini { flex-direction: row; min-height: 64px; }
.card.mini .art { aspect-ratio: auto; width: 64px; flex: none; }
.card.mini .body { border-top: none; border-left: 4px solid var(--kc); padding: 5px 7px; gap: 2px; }
.card.mini .name { font-size: .95rem; } .card.mini .price { display: none; }
.card.mini .fx { font-size: .72rem; }

/* ---------- the card row ---------- */
#row { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.slot { display: grid; gap: 5px; grid-template-rows: auto 1fr; }
.slot .card { height: 100%; }
.slot.empty { border: 1px dashed var(--line); border-radius: 9px; min-height: 180px; align-content: start; padding-top: 0; }
.cost-pips { display: flex; justify-content: center; gap: 4px; height: 14px; align-items: center; }
.cost-pips i { width: 12px; height: 12px; border-radius: 50%; background: #efe3cc; box-shadow: inset 0 -2px 0 #0003, 0 0 0 1px #0006; }
.cost-pips em { font-size: .7rem; color: var(--good); font-style: normal; }

/* ---------- the table ---------- */
.table { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
#board { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; border-top: 4px solid var(--line); }
#board.seat0 { border-top-color: var(--kit-p0); } #board.seat1 { border-top-color: var(--kit-p1); } #board.seat2 { border-top-color: var(--kit-p2); } #board.seat3 { border-top-color: var(--kit-p3); }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.board-head h2 { font-size: 1.7rem; } .board-head h2 small { font-family: var(--sans); font-size: .85rem; margin-left: 10px; }
.actions-left { display: flex; align-items: center; gap: 8px; }
.pips { display: flex; gap: 4px; } .pips i { width: 18px; height: 18px; border-radius: 50%; display: block; }
.pips.ca i { background: #efe3cc; box-shadow: inset 0 -3px 0 #0003; } .pips.ma i { background: #c9493b; box-shadow: inset 0 -3px 0 #0004; }
.pips i.used { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.actions-left small { margin-right: 10px; }

.resources { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.res { position: relative; display: flex; gap: 8px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.res > .ic { width: 26px; height: 26px; flex: none; }
.res div { display: grid; line-height: 1.1; } .res b { font-size: 1.35rem; font-family: var(--serif); } .res small { font-size: .7rem; }
.res em { position: absolute; top: 4px; right: 8px; font-style: normal; font-size: .72rem; color: var(--good); }
.res.warn { border-color: var(--warn); } .res.warn em { color: var(--warn); }
.res.can { cursor: pointer; box-shadow: 0 0 0 2px var(--accent); } .res.can em { color: var(--accent); }

.tableau { display: flex; flex-wrap: wrap; gap: 10px 10px; padding-bottom: 6px; align-items: start; }
.tableau .col { display: grid; gap: 6px; min-width: 0; flex: 1 1 190px; max-width: 300px; align-content: start; }
.tableau .col.civic { flex-basis: 210px; }
.tableau h4 { font-size: .95rem; color: var(--muted); display: flex; justify-content: space-between; margin-top: 2px; }
.tableau h4 small { font-family: var(--sans); font-size: .75rem; }
.tokens { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; } .tokens .none { font-size: .68rem; color: #8a7a62; }
.wk { width: 13px; height: 13px; border-radius: 50%; display: inline-block; box-shadow: inset 0 -2px 0 #0004, 0 0 0 1px #0005; }
.wk.seat0 { background: var(--kit-p0); } .wk.seat1 { background: var(--kit-p1); } .wk.seat2 { background: var(--kit-p2); } .wk.seat3 { background: var(--kit-p3); }
.stages { display: flex; gap: 4px; margin-top: 2px; }
.stages i { font-style: normal; font-size: .7rem; font-weight: 600; width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center;
  border: 1px dashed #7a6a52; color: #5b4a33; }
.stages i.done { background: var(--k-wonder); border: 1px solid #7a5a13; color: #2b2114; }

.hands { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.hand h4 { margin-bottom: 6px; } .hand h4 small { font-family: var(--sans); font-size: .8rem; }
.fan { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.hand:not(.mil) .fan .card { width: 150px; }
.hand.mil .fan .card { width: 100%; }
.empty-hand { margin: 4px 0; }

/* ---------- side ---------- */
#side { display: grid; gap: 10px; position: sticky; top: 10px; }
.turn-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
#waiting { margin: 0; text-align: center; font-family: var(--serif); font-size: 1.15rem; }
.other { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.other.now { box-shadow: 0 0 0 1px var(--accent); }
.other h3 { font-size: 1.2rem; } .other h3 small { font-family: var(--sans); font-size: .78rem; }
.mini-res { display: flex; flex-wrap: wrap; gap: 4px 12px; font-weight: 600; } .mini-res small { margin-left: 2px; }
.seat0 { border-left-color: var(--kit-p0); } .seat1 { border-left-color: var(--kit-p1); } .seat2 { border-left-color: var(--kit-p2); } .seat3 { border-left-color: var(--kit-p3); }
.rival-panel { border-left-color: #8a8a8a; }
#log { display: none; margin: 0; padding: 10px 12px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  max-height: 340px; overflow: auto; font-size: .82rem; color: var(--muted); }
body.log-open #log { display: block; }
#log li { padding: 2px 0; } #log li span { display: inline-block; min-width: 30px; color: #6d5f4b; }

/* ---------- menu ---------- */
.menu-pop { position: absolute; z-index: 50; display: grid; gap: 4px; padding: 6px; min-width: 220px; max-width: 360px;
  background: #1c1610; border: 1px solid var(--accent); border-radius: 10px; box-shadow: 0 12px 30px #000c; }
.menu-pop button { text-align: left; border-color: transparent; background: var(--panel); }
.menu-pop button:hover { background: var(--panel2); }
.menu-pop .ghost { background: transparent; color: var(--muted); }

/* ---------- final ---------- */
#final { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(#000a, #000c), var(--final-art, none) center/cover no-repeat, #000; }
.final-card { box-shadow: 0 20px 60px #000c; }
.final-card { background: var(--panel); border: 1px solid var(--accent); border-radius: 14px; padding: 24px 28px; max-width: 640px; width: 100%; }
.final-card h2 { font-size: 2.4rem; margin-bottom: 12px; }
.final-card table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.final-card td, .final-card th { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.final-card th { color: var(--muted); font-weight: 500; font-size: .85rem; }
.final-card tr[class^="seat"] td:first-child { border-left: 4px solid; }
.final-card tr.seat0 td:first-child { border-left-color: var(--kit-p0); } .final-card tr.seat1 td:first-child { border-left-color: var(--kit-p1); }
.final-card tr.seat2 td:first-child { border-left-color: var(--kit-p2); } .final-card tr.seat3 td:first-child { border-left-color: var(--kit-p3); }

/* ---------- smaller screens ---------- */
@media (max-width: 1280px) { .resources { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  #row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .table { grid-template-columns: minmax(0, 1fr); } #side { position: static; }
  .hands { grid-template-columns: minmax(0, 1fr); }
  #endTurn { position: fixed; left: 12px; right: 12px; bottom: 12px; width: auto; z-index: 30; box-shadow: 0 8px 24px #000c; }
  #app { padding-bottom: 90px; }
}
@media (max-width: 640px) {
  #app { padding: 8px 10px 40px; }
  #row { grid-template-columns: repeat(10, 150px); overflow-x: auto; padding-bottom: 6px; }
  .resources { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tableau .col { flex-basis: 100%; max-width: none; }
  #board { padding: 10px; }
  .event { margin-left: 0; }
  .hand:not(.mil) .fan .card { width: calc(50% - 4px); }
}
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card.can:hover { transform: none; } }

/* ---------- era banner ---------- */
#eraSplash { position: fixed; inset: 0; z-index: 45; display: grid; align-items: end; background: #000d; animation: fadeIn .35s ease; cursor: pointer; }
#eraSplash.out { opacity: 0; transition: opacity .35s ease; }
.splash-art { position: absolute; inset: 0; background: center/cover no-repeat; animation: drift 7s ease-out forwards; }
.splash-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 35%, #000e 92%); }
.splash-text { position: relative; padding: 0 max(24px, 6vw) max(40px, 7vh); max-width: 760px; cursor: default; }
.splash-text small { color: var(--accent); text-transform: uppercase; letter-spacing: .2em; font-weight: 600; }
.splash-text h2 { font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1; margin: 6px 0 12px; text-shadow: 0 2px 20px #000; }
.splash-text p { font-size: 1.1rem; color: #e8dcc6; margin: 0 0 20px; text-shadow: 0 1px 8px #000; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes drift { from { transform: scale(1.08); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .splash-art, #eraSplash { animation: none; } }

/* era art behind the era name in the top bar */
#topbar { position: relative; overflow: hidden; }
#topbar::before { content: ""; position: absolute; inset: 0; width: 340px; background: var(--era-art) center/cover; opacity: .32;
  mask-image: linear-gradient(90deg, #000 30%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 30%, transparent); pointer-events: none; }
#topbar > * { position: relative; }

/* =================== full-screen play =================== */
body.playing { overflow: hidden; }
body.playing #app { max-width: none; padding: 0; }
#play #topbar { margin: 0; padding: 4px 10px; gap: 14px; flex-wrap: nowrap; min-height: 52px; }
#play #topbar .era-badge b { font-size: 1.35rem; }
#play #topbar .round { white-space: nowrap; }
#play #topbar .event { margin-left: auto; min-width: 0; }
#play #topbar .event span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
button.chip { font: inherit; color: inherit; cursor: pointer; }
button.chip:hover { border-color: var(--accent); }
.tools { display: flex; gap: 4px; flex: none; }
.tool { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border-radius: 9px; background: var(--panel2); color: var(--ink); }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool.on { border-color: var(--accent); color: var(--accent); }

/* end turn on the board */
.end-turn { min-width: 150px; font-size: 1.15rem; padding: 12px 20px; border-radius: 12px; box-shadow: 0 6px 18px #0009; }
.end-turn.waiting { display: flex; align-items: center; gap: 8px; background: #1c150de0; border: 1px solid #e9d9b433; color: #e8dcc6; font-family: var(--serif); font-size: 1rem; }
.end-turn .dots { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: glow 1.2s ease-in-out infinite; }
.board-head .end-turn { margin-left: 12px; }


/* drop-down panel (players, log) */
#panel { position: fixed; top: 62px; right: 10px; z-index: 160; width: min(400px, calc(100vw - 20px)); max-height: calc(100vh - 80px); overflow: auto;
  display: grid; gap: 8px; padding: 10px; background: #1c150df5; border: 1px solid var(--accent); border-radius: 12px; box-shadow: 0 16px 40px #000c; }
#panel header { display: flex; justify-content: space-between; align-items: center; }
#panel .log { margin: 0; padding: 0; list-style: none; font-size: .84rem; color: var(--muted); }
#panel .log li { padding: 3px 0; border-bottom: 1px solid #ffffff0d; } #panel .log li span { display: inline-block; min-width: 30px; color: #6d5f4b; }

/* toast for refused moves and connection messages */
.toast { position: fixed; left: 50%; top: 70px; transform: translate(-50%, -10px); z-index: 170; margin: 0; padding: 8px 16px; border-radius: 10px;
  background: #3a1f15f2; border: 1px solid var(--warn); color: #ffd8c4; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* confirm box */
#confirm:not([hidden]) { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: #000a; }
.confirm-card { max-width: 420px; margin: 16px; padding: 20px 22px; background: var(--panel); border: 1px solid var(--accent); border-radius: 14px; box-shadow: 0 20px 50px #000c; }
.confirm-card p { font-size: 1.05rem; margin: 0 0 16px; }


/* =================== tutorial coach =================== */
.tutorial-btn { text-align: left; border-color: var(--accent); background: linear-gradient(90deg, #3a2a12, var(--panel)); }
.tutorial-btn b { color: var(--accent); }
#coach:not([hidden]) { position: fixed; z-index: 180; right: 112px; top: 130px; width: min(370px, calc(100vw - 28px));
  padding: 12px 14px 10px; border-radius: 14px; background: #1c150df7; border: 1px solid var(--accent); box-shadow: 0 16px 40px #000c;
  display: grid; gap: 6px; animation: fadeIn .25s ease; }
.coach-head { display: flex; justify-content: space-between; align-items: center; }
.coach-head small { color: var(--accent); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; font-size: .72rem; }
.coach-head .tool { width: 28px; height: 28px; }
#coach h3 { font-size: 1.35rem; }
#coach p { margin: 0; font-size: .92rem; line-height: 1.45; color: #e8dcc6; }
#coach p b { color: #fff; }
#coach .row { align-items: center; margin-top: 4px; }
#coach .coach-wait { color: var(--accent); font-size: .85rem; flex: 1; }
#coach .coach-note { color: var(--warn); font-size: .85rem; }
#coach .small { font-size: .8rem; padding: 5px 9px; }
.coach-bar { height: 3px; background: #ffffff14; border-radius: 3px; overflow: hidden; }
.coach-bar i { display: block; height: 100%; background: var(--accent); }
.coach-target { outline: 3px solid var(--accent) !important; outline-offset: 3px; border-radius: 10px; animation: coachPulse 1.4s ease-in-out infinite; }
.piece.coach-target { outline: none !important; filter: drop-shadow(0 0 14px #f3c25e) drop-shadow(0 0 4px #f3c25e); }
.land.coach-target { outline-offset: -3px; }
@keyframes coachPulse { 50% { outline-color: #f3c25e55; } }
@media (max-width: 900px) { #coach:not([hidden]) { top: auto; bottom: 10px; right: 10px; max-height: 45vh; overflow: auto; } }
@media (prefers-reduced-motion: reduce) { .coach-target { animation: none; } }

.end-turn { white-space: nowrap; }

/* =================== the board, laid out like the app =================== */
/* card colours by kind, as on the app's row: buildings stone, army red, actions gold, leaders green */
:root { --k-prod: #8c7a52; --k-urban: #7b8691; --k-mil: #a8473b; --k-action: #c49a2c; --k-leader: #5d8c46;
  --k-gov: #b8683a; --k-wonder: #8a62a8; --k-legacy: #b3566a; --k-formation: #9a4d40; --k-aggression: #b8382c; --k-defense: #66788a; }
.card.ln-production { --kc: var(--k-prod); } .card.ln-urban { --kc: var(--k-urban); } .card.ln-military { --kc: var(--k-mil); }
.stages i.done { background: var(--accent); }

#play:not([hidden]) { position: fixed; inset: 0; display: grid; gap: 6px; padding: 6px 8px 8px;
  grid-template-columns: minmax(0, 1fr) 96px; grid-template-rows: auto auto minmax(0, 1fr); }
#play #topbar { grid-column: 1 / -1; }
#play #row { grid-column: 1; grid-row: 2; margin: 0; }
#players { grid-column: 2; grid-row: 2 / 4; }
#play #board { grid-column: 1; grid-row: 3; min-height: 0; overflow: auto; }

/* --- the row: a slim strip in three price bands --- */
#row { display: flex; gap: 10px; }
.band { flex: var(--n) 1 0; min-width: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 5px;
  padding: 5px 5px 3px; border-radius: 10px; background: #00000038; border: 1px solid #e9d9b41f; }
.band2 { background: #0000004d; } .band3 { background: #00000066; }
.slot { display: grid; gap: 3px; grid-template-rows: 1fr auto; min-width: 0; }
.slot.empty { min-height: 0; border: 1px dashed var(--line); border-radius: 8px; grid-template-rows: 1fr auto; }
.cost-pips { height: 12px; gap: 3px; } .cost-pips i { width: 10px; height: 10px; }

.card.row-card, .card.hand-card { border: 2px solid color-mix(in srgb, var(--kc) 70%, #000); background: var(--kc); border-radius: 8px; }
.card.row-card .art, .card.hand-card .art { aspect-ratio: 16 / 10; }
.card.row-card .body, .card.hand-card .body { border: none; padding: 2px 6px 3px; background: linear-gradient(color-mix(in srgb, var(--kc) 85%, #fff), var(--kc)); }
.card.row-card .kind, .card.hand-card .kind, .card.row-card .fx, .card.hand-card .fx,
.card.row-card .price, .card.hand-card .price, .card.row-card .stages { display: none; }
.card.row-card .name, .card.hand-card .name { font-size: .92rem; line-height: 1.1; color: #fff; text-shadow: 0 1px 2px #0009;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.row-card.can:hover, .card.row-card.can:focus-visible { transform: translateY(-3px); }

/* the full card while pointing at a slim one */
#peek { position: fixed; z-index: 190; width: 230px; pointer-events: none; animation: fadeIn .12s ease; }
#peek .card { box-shadow: 0 16px 40px #000c, 0 0 0 2px var(--kc); }
#peek .card .name { font-size: 1.25rem; } #peek .card .fx { font-size: .85rem; } #peek .card .price { font-size: .85rem; }

/* --- players down the right edge --- */
#players { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 4px; min-height: 0; overflow: auto; }
.medallion { position: relative; display: grid; justify-items: center; gap: 0; padding: 0; background: none; border: none; width: 92px; }
.medallion .disc { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font: 700 1.9rem/1 var(--serif); color: #fff;
  text-shadow: 0 2px 4px #0008; background: radial-gradient(circle at 35% 30%, #fff5 0 12%, transparent 50%), var(--mc, #777);
  border: 3px solid #e9d9b4; box-shadow: 0 4px 12px #0009; transition: box-shadow .2s; }
.medallion.seat0 { --mc: var(--kit-p0); } .medallion.seat1 { --mc: var(--kit-p1); } .medallion.seat2 { --mc: var(--kit-p2); } .medallion.seat3 { --mc: var(--kit-p3); }
.medallion.rival { --mc: #5a5148; }
.medallion .disc { order: 1; } .medallion .m-cul { position: absolute; left: 0; top: 34px; min-width: 34px; padding: 0 5px; border-radius: 99px; font: 700 1.45rem/1.2 var(--serif); color: #fff3d0;
  background: #1c150de8; border: 1px solid #e9d9b466; text-align: center; }
.medallion .m-str { order: 3; display: flex; align-items: center; gap: 2px; margin-top: 2px; font-size: .8rem; font-weight: 600; color: #e8dcc6; }
.medallion .m-str .ic { width: .95em; height: .95em; }
.medallion small { order: 2; margin-top: -6px; z-index: 1; max-width: 92px; padding: 0 8px; border-radius: 6px; font-size: .78rem; font-weight: 600; color: #2b2114;
  background: #e9d9b4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.medallion.now .disc { box-shadow: 0 0 0 3px var(--accent), 0 0 22px var(--accent); }
.medallion.me small { background: var(--accent); }
.medallion:hover .disc { border-color: var(--accent); }

/* --- the landscape --- */
#play #board.landmode { padding: 0; overflow: clip; display: grid; border-radius: 12px; border: 1px solid var(--line); }
.land { position: relative; isolation: isolate; height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto;
  background: var(--land) center 70% / cover no-repeat, #4a5a3a; }
.scene { position: relative; min-height: 0; container-type: size; overflow: clip; }
.scene::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(#0000 55%, #0003), radial-gradient(130% 90% at 50% 45%, #0000 65%, #0003); }

/* the four numbers that matter, big, top centre */
.land-res { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 140; display: flex; align-items: center;
  padding: 5px 6px; border-radius: 12px; background: linear-gradient(#3f5b2e, #2a411f); border: 2px solid #cdb57c;
  box-shadow: 0 6px 18px #0009, inset 0 1px 0 #fff3; white-space: nowrap; }
.land-res span { display: flex; align-items: center; gap: 5px; padding: 0 12px; }
.land-res span + span { border-left: 1px solid #ffffff26; }
.land-res b { font: 700 2rem/1 var(--serif); color: #fff; text-shadow: 0 1px 3px #0008; }
.land-res .ic { width: 24px; height: 24px; filter: drop-shadow(0 1px 1px #0008); }
.land-res em { font-style: normal; font-size: .82rem; font-weight: 600; color: #dff2b8; }
.land-res .sep { width: 2px; height: 30px; margin: 0 4px; background: #cdb57c66; }
.land-res .sep + span { border-left: none; }
.land-res .sep ~ span b { font-size: 1.5rem; } .land-res .sep ~ span .ic { width: 20px; height: 20px; }
.land-res .warn b, .land-res .warn em { color: #ffb08a; }

.land-top { position: absolute; left: 10px; top: 10px; z-index: 130; display: grid; gap: 6px; }
.plaque { display: flex; gap: 8px; align-items: center; width: 190px; padding: 4px 10px 4px 4px; border-radius: 10px;
  background: #1c150dd9; border: 1px solid #e9d9b444; box-shadow: 0 4px 14px #0007; }
.plaque img { width: 40px; height: 40px; object-fit: cover; border-radius: 7px; }
.plaque div { display: grid; line-height: 1.15; min-width: 0; }
.plaque small { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: #cdb995; }
.plaque b { font-family: var(--serif); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plaque.empty { opacity: .7; }

/* buildings: one band across the meadow, same scale, name plate and workers always showing */
.piece { position: absolute; z-index: 50; left: var(--x); bottom: 3cqh; width: min(calc(var(--w) * 1cqw), 42cqh); transform: translateX(-50%);
  display: grid; justify-items: center; outline: none; transition: transform .15s ease, filter .15s ease; }
.piece-img { width: 100%; max-height: 44cqh; object-fit: contain; object-position: 50% 100%; display: block; filter: drop-shadow(0 8px 8px #0007); }
.piece-img.nopiece { width: 62%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 3px solid #e9d9b4; }
.piece.idle .piece-img { filter: saturate(.55) brightness(.78) drop-shadow(0 8px 8px #0007); }
.piece.can { cursor: pointer; }
.piece.can:hover, .piece.can:focus-visible { transform: translate(-50%, -4px); filter: drop-shadow(0 0 10px #f3c25e); }
.piece:hover, .piece:focus-visible { z-index: 150; }
.wtokens { display: flex; align-items: center; gap: 3px; margin-top: -10px; padding: 3px 6px; border-radius: 99px; z-index: 1;
  background: #1c150dd0; border: 1px solid #e9d9b433; }
.wtokens b { font-size: .8rem; color: #fff; margin-left: 2px; }
.wtokens.empty span { font-size: .7rem; color: #cdb995; }
.wt { width: 14px; height: 14px; border-radius: 4px; display: inline-block; background: var(--oc, #f5c84a);
  box-shadow: inset 0 -3px 0 #0005, inset 0 2px 0 #fff6, 0 1px 2px #000a; }
.wt.seat0 { --oc: #e8613f; } .wt.seat1 { --oc: #4d93e6; } .wt.seat2 { --oc: #58b86a; } .wt.seat3 { --oc: #e8bf3a; }
.plate { margin-top: 3px; display: grid; justify-items: center; padding: 1px 10px 2px; border-radius: 6px; white-space: nowrap; line-height: 1.2;
  background: #1c150de6; border: 1px solid #e9d9b455; color: #f2e8d6; font-size: .78rem; z-index: 1; }
.plate b { font-family: var(--serif); font-size: 1rem; } .plate b small { font-family: var(--sans); font-size: .72rem; color: #cdb995; }
.plate .ic { width: 1em; height: 1em; } .plate .off { color: #cdb995; }

.piece.wonder { bottom: auto; top: 53cqh; width: calc(var(--s) * 52cqh); transform: translate(-50%, -100%); z-index: 10; }
.piece.wonder .piece-img { max-height: 30cqh; filter: drop-shadow(0 4px 6px #0006) saturate(.95); }
.piece.site .stages.float { position: absolute; top: 30%; display: flex; gap: 3px; }
.piece.site .stages.float i { background: #1c150dcc; border: 1px solid #e9d9b466; color: #f2e8d6; width: auto; min-width: 22px; padding: 0 4px; }
.piece.site .stages.float i.done { background: var(--accent); color: #2b2114; }

/* --- the bottom strip: hand, workers, actions, end turn --- */
.land-bar { position: relative; z-index: 130; display: flex; align-items: flex-end; gap: 12px; padding: 6px 12px 10px;
  background: linear-gradient(#120d08b0, #120d08f2 40%); border-top: 1px solid #e9d9b433; }
.land-hand { flex: 1; min-width: 0; display: grid; gap: 3px; }
.tray-tab { font-size: .72rem; color: #cdb995; text-transform: uppercase; letter-spacing: .08em; }
.tray-cards { display: flex; gap: 6px; align-items: flex-end; min-height: 84px; }
.card.hand-card { width: 104px; flex: 0 1 104px; min-width: 64px; }
.card.hand-card.can:hover, .card.hand-card.can:focus-visible, .card.hand-card.coach-target { transform: translateY(-8px); z-index: 5; }
.tray-empty { color: #cdb995; font-size: .85rem; align-self: center; }
.tray-sep { width: 2px; align-self: stretch; margin: 6px 4px 0; background: #e9d9b433; flex: none; }
.land-pool { display: grid; gap: 4px; padding: 6px 10px; border-radius: 10px; background: #ffffff0a; border: 1px solid #e9d9b433; flex: none; }
.land-pool.can { cursor: pointer; box-shadow: 0 0 0 2px var(--accent); }
.pool-row { display: flex; align-items: center; gap: 8px; }
.pool-row > small { width: 32px; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #cdb995; }
.pool-row .wtokens { margin: 0; background: none; border: none; padding: 0; }
.pool-row .bank { font: 700 1.3rem/1 var(--serif); }
.raise { font-size: .8rem; font-weight: 600; color: var(--accent); } .raise.off { color: #cdb995; font-weight: 400; }
.none-idle { font-size: .75rem; color: #a8987f; }
.land-actions { display: grid; gap: 6px; justify-items: end; flex: none; }
.land-actions .pips i { width: 28px; height: 28px; }
.land-actions .pips.ca i:not(.used) { background: radial-gradient(circle at 35% 30%, #fff 0 15%, #e9e6e0 40%, #a9a39a); box-shadow: 0 2px 4px #0008; }
.land-actions .pips.ma i:not(.used) { background: radial-gradient(circle at 35% 30%, #ffb3a8 0 15%, #d33a2c 45%, #7d150d); box-shadow: 0 2px 4px #0008; }
.land-actions .pips i.used { background: #0004; box-shadow: inset 0 0 0 2px #e9d9b444; }
.land-bar .end-turn { flex: none; align-self: center; min-width: 160px; font: 700 1.35rem var(--serif); padding: 14px 22px;
  border: 2px solid #f3d58a; box-shadow: 0 6px 18px #0009, inset 0 1px 0 #fff8; }

/* --- phones and small windows --- */
@media (max-width: 900px) {
  #play:not([hidden]) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); padding: 4px; gap: 4px; }
  #play #topbar { flex-wrap: nowrap; gap: 8px; } #play #topbar .event { margin-left: auto; flex: none; } #play #topbar .event div { display: none; } #play #topbar .event img { width: 44px; height: 36px; } #play #topbar .round small { display: none; }
  #players { grid-column: 1; grid-row: 2; flex-direction: row; justify-content: center; gap: 6px; padding: 0; overflow: visible; }
  .medallion { width: auto; grid-template-columns: auto auto; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; border-radius: 99px;
    background: #1c150dd9; border: 1px solid #e9d9b433; }
  .medallion .disc { width: 28px; height: 28px; font-size: 1rem; border-width: 2px; }
  .medallion .m-cul { position: static; background: none; border: none; padding: 0; font-size: 1.15rem; min-width: 0; }
  .medallion .m-str, .medallion small { display: none; }
  .medallion.now { box-shadow: 0 0 0 2px var(--accent); } .medallion.now .disc { box-shadow: none; }
  #play #row { grid-row: 3; overflow-x: auto; padding-bottom: 2px; }
  .band { flex: none; grid-template-columns: repeat(var(--n), 84px); }
  #play #board { grid-row: 4; }
  .land-res { top: 6px; padding: 3px 2px; } .land-res span { padding: 0 6px; gap: 3px; }
  .land-res b { font-size: 1.3rem; } .land-res .ic { width: 18px; height: 18px; } .land-res em { display: none; }
  .land-res .sep ~ span b { font-size: 1.1rem; } .land-res .sep { height: 20px; }
  .land-top { top: 54px; left: 6px; } .plaque { width: auto; padding: 3px; } .plaque div { display: none; }
  .plaque img { width: 30px; height: 30px; }
  .plate { font-size: .7rem; padding: 0 5px; } .plate span, .plate b small { display: none; } .plate b { font-size: .82rem; }
  .wtokens.empty { display: none; } .wt { width: 10px; height: 10px; } .wtokens { margin-top: -6px; padding: 2px 4px; gap: 2px; }
  .piece { width: min(calc(var(--w) * 1.05cqw), 30cqh); }
  .land-bar { flex-wrap: wrap; gap: 6px 8px; padding: 4px 6px 6px; }
  .land-hand { flex-basis: 100%; } .tray-cards { min-height: 64px; overflow-x: auto; }
  .card.hand-card { width: 78px; flex: none; }
  .land-pool { flex: 1; padding: 4px 8px; } .land-actions .pips i { width: 22px; height: 22px; }
  .land-bar .end-turn { min-width: 0; font-size: 1.1rem; padding: 10px 14px; }
  #peek { width: 200px; }
}
@media (max-width: 900px) {
  #coach:not([hidden]) { left: 8px; right: 8px; width: auto; bottom: 8px; top: auto; max-height: 38vh; overflow: auto; padding: 8px 10px; gap: 4px; }
  #coach.high:not([hidden]) { top: 8px; bottom: auto; }
  #coach h3 { font-size: 1.1rem; } #coach p { font-size: .84rem; }
  .medallion .m-cul { order: 2; } .plaque.empty { display: none; }
}

#coach.left:not([hidden]) { right: auto; left: 14px; }

/* =================== motion =================== */
.fly { position: fixed; z-index: 185; pointer-events: none; transform-origin: 0 0; filter: drop-shadow(0 14px 20px #000a); }
.fly .card { width: 100%; height: 100%; }
.bump .wtokens, .land-pool.bump .wtokens, .piece.site.bump .stages { animation: bump .45s cubic-bezier(.3,1.6,.5,1); }
.piece.bump .piece-img { animation: settle .45s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes settle { 0% { transform: translateY(-10px); } 60% { transform: translateY(2px); } 100% { transform: none; } }
.land-res span.up b, .land-res span.down b, .res.up b, .res.down b { animation: tick .9s ease-out; }
.land-res span.up b, .res.up b { --tc: #fff3a6; } .land-res span.down b, .res.down b { --tc: #ffb08a; }
@keyframes tick { 0% { color: var(--tc); transform: scale(1.45); text-shadow: 0 0 14px var(--tc); } 100% { transform: scale(1); } }
.land-res b { display: inline-block; }
@media (prefers-reduced-motion: reduce) { .fly { display: none; } }

/* portraits in the player medallions (initial shows underneath until one loads) */
.medallion .disc { position: relative; overflow: hidden; }
.medallion .disc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.medallion .disc::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--mc), inset 0 -10px 16px #0007; }

/* =================== frame kit: walnut panels with bronze edges =================== */
:root { --wood: url("art/ui/wood.webp"); --bronze: linear-gradient(#f0d48c, #b8893a 45%, #7a5520); }
#play #topbar { background: linear-gradient(#1c120acc, #120b06e6), var(--wood) center / 768px auto repeat; border: 1px solid #000;
  border-top: 3px solid var(--era); box-shadow: inset 0 -2px 0 #c9a25a55, 0 3px 10px #0008; }
#play #row { padding: 5px; border-radius: 12px; background: linear-gradient(#20140acc, #140c06d9), var(--wood) center / 768px auto repeat;
  box-shadow: inset 0 0 0 1px #000, inset 0 0 0 3px #b8893a88, 0 4px 12px #0009; }
.band { background: #0000002e; border-color: #e9c98a26; }
.land-bar { background: linear-gradient(#1a1009d9, #0f0905f2), var(--wood) center / 768px auto repeat;
  border-top: 2px solid #b8893a; box-shadow: 0 -1px 0 #f0d48c55, 0 -10px 24px #0007; }
.land-res { border: 2px solid transparent; background: linear-gradient(#41602f, #2a411f) padding-box, var(--bronze) border-box; }
.plaque { border: 1px solid transparent; background: linear-gradient(#1c150de6, #1c150de6) padding-box, var(--bronze) border-box; }
.land-bar .end-turn { border: 3px solid transparent; border-radius: 14px; color: #2b1a08;
  background: linear-gradient(#f6d27a, #d9a441 55%, #b67f27) padding-box, linear-gradient(#fff2c4, #8a5c1c) border-box;
  text-shadow: 0 1px 0 #fff6; box-shadow: 0 6px 18px #000a, inset 0 2px 0 #fff9, inset 0 -3px 0 #0003; }
.land-bar .end-turn:hover { filter: brightness(1.07); }
.land-pool { background: #0000004d; border-color: #b8893a66; }
.medallion .disc { border-color: #d9b36a; }

.medallion .m-cul { z-index: 2; }
/* tall narrow boards (phones): two rows of buildings, the wonder site and finished wonders smaller */
@container (max-aspect-ratio: 4/3) {
  .piece { left: var(--x2); width: calc(var(--w2) * 1cqw); bottom: 2cqh; }
  .piece.back { bottom: 30cqh; z-index: 40; }
  .piece.back .piece-img, .piece:not(.wonder):not(.site) .piece-img { max-height: 24cqh; }
  .piece.site { left: auto; right: -2%; bottom: 58cqh; width: 26cqw; transform: none; }
  .piece.wonder { left: var(--x); top: 30cqh; bottom: auto; width: calc(var(--s) * 50cqw); }
  .piece.wonder .piece-img { max-height: 14cqh; }
}
.land-bar .end-turn.waiting { background: #1c150de0; border: 1px solid #e9d9b433; color: #e8dcc6; font: 600 1rem var(--serif); text-shadow: none;
  box-shadow: none; padding: 10px 14px; }

/* title: full screen, install, download */
.app-row { gap: 8px; } .app-row > * { flex: 1 1 160px; font-size: .9rem; }
a.button { display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; } a.button:hover { border-color: var(--accent); }
.install-help img { float: right; border-radius: 14px; margin: 0 0 8px 12px; }
.install-help h3 { font-size: 1.4rem; margin-bottom: 6px; } .install-help ol { padding-left: 20px; margin: 8px 0 14px; } .install-help li { margin: 4px 0; }
/* the installed app: room for the notch and the home bar */
body.app #play:not([hidden]) { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom));
  padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }

/* food and ore in store as token rows, the storage limit as outlines */
.land-stores { display: grid; gap: 5px; padding: 6px 10px; border-radius: 10px; background: #0000004d; border: 1px solid #b8893a66; flex: none; }
.store-row { display: flex; align-items: center; gap: 6px; }
.store-row .sname .ic { width: 16px; height: 16px; }
.store-row b { font: 700 1.05rem/1 var(--serif); min-width: 22px; text-align: right; }
.stokens { display: grid; grid-template-columns: repeat(8, 12px); grid-auto-flow: row; gap: 2px; direction: ltr; }
.stokens i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px #e9d9b444; }
.store-row.food .stokens i.on { background: radial-gradient(circle at 35% 30%, #fff6c2 0 18%, #e8c24a 50%, #9a7414); box-shadow: 0 1px 1px #0008; }
.store-row.ore .stokens i.on { background: radial-gradient(circle at 35% 30%, #f2eee8 0 18%, #a9a39a 50%, #5d574f); box-shadow: 0 1px 1px #0008; border-radius: 2px; }
@media (max-width: 1100px) { .land-stores { display: none; } }

/* calmer highlights: playable cards and buildings are bright and lift when pointed at; the rest are dimmed.
   The gold ring shows only on the one you point at (and on the tutorial's target). */
.card.can { box-shadow: 0 2px 0 #0004, 0 6px 14px #0005; }
.card.can:hover, .card.can:focus-visible { box-shadow: 0 0 0 2px var(--accent), 0 10px 20px #000a; }
.card.cant { filter: saturate(.45) brightness(.62); }
#row .card:not(.can):not(.cant) { filter: none; }
.piece.can .plate { border-color: #e9c36a; box-shadow: 0 0 0 1px #e9c36a55; }
.land-pool.can { box-shadow: none; border-color: var(--accent); }
.land-pool.can:hover { box-shadow: 0 0 0 2px var(--accent); }
#appHelp:not([hidden]) { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: #000a; }

/* =================== the guide, second edition =================== */
#coach:not([hidden]) { right: auto; bottom: auto; width: min(400px, calc(100vw - 16px)); max-height: min(62vh, 460px); overflow: auto; }
#coach p { font-size: .95rem; line-height: 1.5; }
.coach-head small { letter-spacing: .06em; }
.menu-pop .menu-guide { margin: 0 0 2px; padding: 6px 8px; border-radius: 8px; background: #3a2a12; color: #f3e2b8; font-size: .84rem; line-height: 1.35; }
.menu-pop button.taught { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: #3a2a12; }
.menu-pop button.off { opacity: .45; cursor: not-allowed; }
@media (max-width: 900px) {
  #coach:not([hidden]) { width: calc(100vw - 16px); max-height: 40vh; }
  #coach p { font-size: .86rem; line-height: 1.4; }
}

/* Early access badge on the title (remove with its line in index.html when early access ends) */
.early { display: inline-block; margin: -16px 0 22px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  color: #f0cf7a; background: #2a1e0ecc; border: 1px solid #d9a44188; }
/* links home to punatic.org (title screen and final scores): keep them */
.home-link { margin: 14px 0 0; }
a.moregames { min-height: 44px; width: 100%; font-size: .9rem; color: var(--muted); }
.final-card .row a.moregames { width: auto; min-height: 44px; }
@media (max-width: 520px) {
  .final-card { padding: 16px 14px; } .final-card h2 { font-size: 1.9rem; }
  .final-card table { font-size: .82rem; } .final-card td, .final-card th { padding: 5px 4px; }
}
