/* Acorn Siege — everything here is local to /acorn/; web/style.css is NOT
   loaded, so none of its shared traps (.volume-slider, .overlay-card, #hud)
   apply. The audio strip is the shared .mps-audio-* one. */
:root {
  --bg: #1b140d;
  --panel: rgba(38, 27, 16, 0.95);
  --panel2: #3a2a18;
  --line: rgba(255, 214, 150, 0.2);
  --text: #fbf1e0;
  --muted: #c4ad8c;
  --accent: #f0a23a;
  --accent2: #ffd36a;
  --good: #8fd066;
  --danger: #ff7a5a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg);
  color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#view.aiming { cursor: grabbing; }
#view.tappable { cursor: pointer; }
[hidden] { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; }
.primary, .secondary { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; }
.primary { background: linear-gradient(180deg, #ffbe55, #e0862a); color: #2a1604;
  box-shadow: 0 3px 0 #8a4a10; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a4a10; }
.primary:disabled { filter: grayscale(0.8); opacity: 0.6; cursor: not-allowed; }
.secondary { background: var(--panel2); border: 1px solid var(--line); }
.link-btn { background: none; border: 0; color: var(--accent2); text-decoration: underline;
  padding: 6px 8px; display: block; margin: 6px auto 0; }
.back-link { display: block; margin-top: 10px; color: var(--muted); font-size: 13px;
  text-align: center; }

/* ── overlays ─────────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; display: flex; align-items: flex-start;
  justify-content: center; overflow-y: auto; padding: 18px 12px 28px;
  background: radial-gradient(ellipse at top, rgba(120, 80, 30, 0.5), rgba(14, 9, 4, 0.93));
  z-index: 20; }
.results-overlay { background: radial-gradient(ellipse at top, rgba(120, 80, 30, 0.25), rgba(14, 9, 4, 0.72)); }
.card { width: 100%; max-width: 860px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 18px 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  position: relative; }
.res-card, .rules-card { max-width: 620px; }
.logo { margin: 4px 0 2px; font-size: 40px; letter-spacing: 3px; font-weight: 900;
  color: #f0a23a; text-shadow: 0 3px 0 #6b3a0a, 0 0 22px rgba(240, 162, 58, 0.35); }
.logo span { color: #8fd066; margin-left: 10px; text-shadow: 0 3px 0 #2f5a1c; }
.logo.small { font-size: 30px; text-align: center; }
.tagline { color: var(--muted); margin: 4px 0 12px; font-size: 14px; }
.menu-audio { position: absolute; top: 10px; right: 12px; }

.namebox { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.namebox label { font-size: 12px; color: var(--muted); }
.namebox input { background: #1a1209; border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); padding: 8px 10px; font-size: 16px; max-width: 260px; }
.net-note { font-size: 12.5px; color: #ffd9a0; background: rgba(255, 160, 60, 0.12);
  border: 1px solid rgba(255, 160, 60, 0.3); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; }

.world-tabs { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; margin: 6px 0 6px;
  padding-bottom: 5px; scrollbar-width: thin; }
.world-tab { flex: 0 0 auto; min-width: 116px; border: 1px solid var(--line); background: var(--panel2);
  border-radius: 10px; padding: 7px 8px; font-weight: 700; font-size: 13.5px; }
.world-tab small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.world-tab.on { border-color: var(--accent2); box-shadow: inset 0 -3px 0 var(--accent2); }
.world-tab.locked { opacity: 0.5; }
.world-blurb { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }

.level-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 12px; }
.lv-btn { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 7px 4px 5px;
  background: linear-gradient(180deg, #4a3620, #33240f); text-align: center; min-height: 62px; }
.lv-btn b { display: block; font-size: 21px; }
.lv-btn .st { display: block; color: var(--accent2); font-size: 12px; letter-spacing: 1px; min-height: 15px; }
.lv-btn .st i { color: rgba(255, 255, 255, 0.22); font-style: normal; }
.lv-btn.sel { border-color: var(--accent2); box-shadow: 0 0 0 2px rgba(255, 211, 106, 0.35); }
.lv-btn.done { background: linear-gradient(180deg, #3f5a2a, #26381a); }
.lv-btn.locked { opacity: 0.42; }
.lv-btn.locked::after { content: "🔒"; position: absolute; top: 3px; right: 5px; font-size: 11px; }
.lv-btn .tut { position: absolute; top: 3px; left: 5px; font-size: 10px; font-style: normal; }

.level-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #2a1d0f; }
.lc-head { display: flex; align-items: center; gap: 10px; }
.lc-head h2 { margin: 0; font-size: 20px; }
.lc-head small { color: var(--muted); }
.lc-num { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: #2a1604; font-weight: 900; font-size: 20px; flex: none; }
.lc-stars { margin-left: auto; color: var(--accent2); font-size: 20px; letter-spacing: 2px; white-space: nowrap; }
.lc-stars i { color: rgba(255, 255, 255, 0.22); font-style: normal; }
.lc-hint { color: #f0dfc2; margin: 8px 0; font-size: 14px; }
.lc-nuts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lc-nuts canvas { vertical-align: middle; }
.lc-nuts .nut-chip { display: inline-flex; align-items: center; gap: 4px; background: #1a1209;
  border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px 2px 4px; color: var(--text); }
.lc-best { font-size: 13px; color: var(--muted); margin: 8px 0 2px; }
.lc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ── HUD ──────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center;
  gap: 6px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(20, 12, 4, 0.7), rgba(20, 12, 4, 0)); font-size: 14px;
  pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(50, 34, 16, 0.92); font-weight: 800; flex: none; font-size: 16px; padding: 0; }
.hud-level { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; flex: 0 1 auto;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); pointer-events: none; }
.hud-level b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-level small { color: #f3e2c4; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-stats { display: flex; gap: 10px; margin-left: auto; white-space: nowrap;
  background: rgba(30, 20, 8, 0.8); padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); }
.hud-stats b { color: var(--accent2); }
.hud-plate { display: flex; align-items: center; gap: 4px; max-width: 24vw; min-width: 0;
  background: rgba(30, 20, 8, 0.8); padding: 5px 8px; border-radius: 9px; border: 1px solid var(--line);
  font-size: 13px; }
.plate-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.hud-plate .mg-name-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-gear { position: relative; flex: none; }
.hud-gear summary { list-style: none; width: 36px; height: 36px; border-radius: 9px; display: grid;
  place-items: center; border: 1px solid var(--line); background: rgba(50, 34, 16, 0.92); cursor: pointer; }
.hud-gear summary::-webkit-details-marker { display: none; }
/* the shared rule pins #hudAudio to the viewport corner; here it is a dropdown
   under the ♪ button, so all four placement properties are restated */
.hud-gear #hudAudio { position: absolute; right: 0; left: auto; top: 42px; bottom: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }

.pouch { position: absolute; left: 8px; bottom: max(10px, env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; gap: 4px; background: rgba(30, 20, 8, 0.78);
  border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; }
.pouch .nut { position: relative; opacity: 0.85; }
.pouch .nut.next { opacity: 1; filter: drop-shadow(0 0 5px rgba(255, 211, 106, 0.9)); }
.pouch .nut.used { opacity: 0.18; filter: grayscale(1); }
.pouch .lbl { font-size: 11px; color: var(--muted); align-self: center; margin-right: 4px; }
.ability-hint { position: absolute; left: 50%; transform: translateX(-50%); top: 58px;
  background: rgba(255, 211, 106, 0.95); color: #2a1604; font-weight: 800; font-size: 14px;
  padding: 6px 14px; border-radius: 999px; pointer-events: none; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); animation: pulse 0.7s ease-in-out infinite alternate; }
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.07); } }
.recentre { position: absolute; right: 8px; bottom: max(10px, env(safe-area-inset-bottom));
  border: 1px solid var(--line); background: rgba(50, 34, 16, 0.92); border-radius: 999px;
  padding: 8px 12px; font-size: 13px; font-weight: 700; }
.toast { position: absolute; left: 50%; top: 96px; transform: translate(-50%, -8px);
  background: rgba(20, 12, 4, 0.9); border: 1px solid var(--line); padding: 7px 14px;
  border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity 0.2s, transform 0.2s;
  pointer-events: none; max-width: 92vw; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.coach { position: absolute; left: 50%; transform: translateX(-50%); bottom: 74px;
  width: min(480px, calc(100vw - 20px)); background: rgba(34, 24, 12, 0.96);
  border: 2px solid var(--accent2); border-radius: 14px; padding: 10px 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
.coach-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.coach-badge { color: var(--accent2); font-weight: 800; }
.coach-skip { margin-left: auto; background: none; border: 0; color: var(--muted);
  text-decoration: underline; font-size: 12px; padding: 4px; }
.coach p { margin: 6px 0 4px; font-size: 15px; line-height: 1.35; }
.coach-next { border: 0; border-radius: 8px; padding: 7px 12px; font-weight: 800;
  background: var(--accent2); color: #2a1604; }

/* ── results ──────────────────────────────────────────────────────── */
.res-stars { text-align: center; font-size: 54px; letter-spacing: 8px; color: var(--accent2);
  min-height: 66px; text-shadow: 0 3px 0 #7a5208; }
.res-stars span { display: inline-block; transform: scale(0); }
.res-stars span.in { animation: starpop 0.45s cubic-bezier(.2, 1.6, .4, 1) forwards; }
.res-stars span.off { color: rgba(255, 255, 255, 0.16); text-shadow: none; }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.res-card .tagline { text-align: center; font-size: 15px; color: var(--text); }
.res-verify { text-align: center; font-size: 13px; color: var(--muted); min-height: 18px; margin: 0 0 8px; }
.res-verify.ok { color: var(--good); }
.res-verify.bad { color: var(--danger); }
.res-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* ── rules ────────────────────────────────────────────────────────── */
.rules-card h2 { margin: 2px 0 8px; }
.rules-card h3 { margin: 12px 0 6px; font-size: 15px; color: var(--accent2); }
.rules-list { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.45; color: #f0dfc2; }
.rules-list li { margin-bottom: 4px; }
.rules-nuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.rule-nut { display: flex; gap: 10px; align-items: center; background: #2a1d0f;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.rule-nut b { display: block; font-size: 14px; }
.rule-nut span { color: var(--muted); }
.m-glass { color: #a8e0ff; } .m-wood { color: #e0a860; } .m-stone { color: #b4bac4; }
.rules-card .primary { display: block; margin: 14px auto 0; }

/* the shared leaderboard, in this game's colours (overlay form: both nodes) */
.lb-panel, .lb-card { --lb-panel: #2a1d0f; --lb-edge: rgba(255, 214, 150, 0.2); --lb-text: #fbf1e0;
  --lb-dim: #c4ad8c; --lb-accent: #ffd36a; }

@media (max-width: 640px) {
  .logo { font-size: 30px; letter-spacing: 2px; }
  .logo.small { font-size: 24px; }
  .card { padding: 14px 12px 12px; }
  .menu-audio { position: static; margin-bottom: 6px; display: flex; justify-content: flex-end; }
  .world-tab { min-width: 31%; font-size: 12.5px; padding: 6px 4px; }
  .level-grid { grid-template-columns: repeat(4, 1fr); }
  .hud-level small, .plate-ico { display: none; }
  .hud-level b { max-width: 24vw; font-size: 13px; }
  .hud-plate { max-width: 22vw; padding: 5px 6px; }
  .hud-stats { gap: 7px; padding: 6px 7px; font-size: 13px; }
  .hud-btn, .hud-gear summary { width: 34px; height: 34px; }
  .res-stars { font-size: 44px; }
  .coach { bottom: 78px; }
}
@media (orientation: portrait) and (max-width: 640px) {
  .toast { top: 47%; }                     /* clear of the spyglass at the top of a tall screen */
  .ability-hint { top: 44%; }
}
@media (max-width: 400px) {
  #fsBtn { display: none; }                /* the top bar is full; the browser's own gesture remains */
  .hud-top { gap: 4px; padding-left: 5px; padding-right: 5px; }
}
/* the overlay card's own background is not a token in the shared sheet */
.lb-overlay .lb-card { background: #241809; border-color: rgba(255, 214, 150, 0.25); }
/* the shared results table has seven columns here: let it scroll rather than
   push the card wider than a phone, and tighten it where every pixel counts */
#resTable { overflow-x: auto; max-width: 100%; }
.res-stars:empty { display: none; }
@media (max-width: 640px) {
  .res-card .fs-table th, .res-card .fs-table td { padding: 6px 4px; font-size: 11.5px; letter-spacing: 0; }
}
