:root {
  --green-900: #0d4f1c;
  --green-800: #1b5e20;
  --green-700: #2e7d32;
  --green-300: #81c784;
  --green-50: #e8f5e9;
  --gold: #c9a227;
  --ink: #1a1a1a;
  --muted: #5f6b62;
  --line: #e0e4e0;
  --bg: #f1f5f0;
  --card: #ffffff;
  --danger: #b3261e;
  --charcoal: #121212;
  --wood: #5c3d24;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(13, 79, 28, 0.08);
  --font-display: "Syne", "Segoe UI", sans-serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(201, 162, 39, 0.14), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(27, 94, 32, 0.12), transparent 50%),
    linear-gradient(180deg, #f5f8f4 0%, var(--bg) 42%, #e8eee8 100%);
  line-height: 1.5;
}

a { color: var(--green-800); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
header.topbar {
  background: linear-gradient(135deg, #0a1f0e 0%, var(--green-900) 42%, var(--green-800) 100%);
  color: #fff;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: 0.01em;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 0;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--charcoal);
}
.brand-text { white-space: nowrap; }
.brand-text-short { display: none; }
.nav-session { display: none; }
nav.tabs { display: flex; gap: 0.2rem; flex-wrap: wrap; margin-left: auto; }
nav.tabs button {
  background: transparent; color: #eaf5ec; border: 0; padding: 0.5rem 0.75rem;
  border-radius: 10px; cursor: pointer; font-size: 0.88rem; font-weight: 600;
  font-family: inherit;
}
nav.tabs button:hover { background: rgba(255,255,255,0.12); }
nav.tabs button.active { background: #fff; color: var(--green-800); }
nav.tabs a.tab-earn {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, var(--gold), #e8c547);
  color: #3d2e00;
  border: 0;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  font-family: inherit;
  text-decoration: none;
}
nav.tabs a.tab-earn:hover { filter: brightness(1.05); text-decoration: none; }
.session { display: flex; align-items: center; gap: 0.5rem; }

/* ── Layout ── */
main { max-width: none; margin: 0; padding: 0 0 3rem; }
.view { display: none; }
.view.active { display: block; animation: fade 0.2s ease; }
.view:not(.view-home) {
  max-width: 1080px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; }
h1 { font-size: 1.6rem; margin: 0.2rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.4rem 0 0.7rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ── Cards & tables ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.rating-explain {
  background: linear-gradient(180deg, #f3faf4 0%, #fff 70%);
  border-color: #cfe3d3;
}
.rating-explain-list {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.rating-explain-list li { margin: 0.35rem 0; }
.rating-explain-list strong { color: var(--ink); }
.tier-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--green-50);
  color: var(--green-800);
}
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; }
tbody tr:hover { background: var(--green-50); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: var(--green-50); color: var(--green-800); }
.badge.gold { background: #fbf3d5; color: #7a5c00; }
.badge.grey { background: #eef0ee; color: #555; }
.practice-anon-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7f6f2;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.45;
}
.practice-live-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(201, 162, 39, 0.55);
  background: linear-gradient(135deg, #fff8e6 0%, #f7f0d8 100%);
  box-shadow: 0 1px 0 rgba(201, 162, 39, 0.2);
}
.practice-live-cta-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: min(100%, 16rem);
  flex: 1 1 14rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--ink);
}
.practice-live-cta-copy strong:first-child {
  font-size: 0.98rem;
}
.practice-live-cta .btn {
  flex: 0 0 auto;
}
.practice-board-tag {
  margin: 0;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a6a3a;
}
.play-surface.immersive .practice-board-tag,
.play-surface:fullscreen .practice-board-tag,
.play-surface:-webkit-full-screen .practice-board-tag {
  color: #e8c547;
}
.pill-public { background: #e3f0ff; color: #12467e; }
.pill-private { background: #fbe9ef; color: #8e2350; }

/* ── Buttons & forms ── */
button.btn, a.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  border: 0; border-radius: 10px; padding: 0.55rem 0.95rem; font-weight: 700; font-size: 0.9rem;
}
.btn.primary { background: var(--green-700); color: #fff; }
.btn.primary:hover { background: var(--green-800); text-decoration: none; }
.btn.gold { background: linear-gradient(135deg, var(--gold), #e8c547); color: #4a3800; }
.btn.ghost { background: #fff; color: var(--green-800); border: 1px solid var(--line); }
.btn.small { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin: 0.6rem 0 0.2rem; }
input, select, textarea {
  width: 100%; padding: 0.55rem 0.65rem; border: 1px solid var(--line); border-radius: 10px;
  font-size: 0.92rem; font-family: inherit; background: #fff;
}
input[type="checkbox"] { width: auto; margin-right: 0.4rem; }
.checkbox-row { display: flex; align-items: flex-start; gap: 0.3rem; margin-top: 0.7rem; }
.checkbox-row label { margin: 0; font-weight: 500; color: var(--ink); }

/* ── Funnel banner ── */
.funnel {
  background: linear-gradient(120deg, var(--green-800), var(--green-700));
  color: #fff; border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 1.2rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.funnel h3 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.funnel p { margin: 0; opacity: 0.92; font-size: 0.9rem; }
.funnel .spacer { margin-left: auto; }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(13,79,28,0.45); display: none; place-items: center; z-index: 300; padding: 1rem; }
.modal-backdrop.open { display: grid; }
body.auth-open { overflow: hidden; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.4rem;
  width: min(440px, 100%);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal h2 { margin-top: 0; }
.modal .close { float: right; background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
.tabsmall { display: flex; gap: 0.5rem; margin-bottom: 0.8rem; }
.tabsmall button { flex: 1; background: var(--green-50); color: var(--green-800); border: 0; padding: 0.5rem; border-radius: 8px; cursor: pointer; font-weight: 700; }
.tabsmall button.active { background: var(--green-700); color: #fff; }

/* ── Toast & msg ── */
.msg { padding: 0.6rem 0.8rem; border-radius: 10px; margin: 0.6rem 0; font-size: 0.88rem; }
.msg.error { background: #fdecea; color: var(--danger); }
.msg.ok { background: var(--green-50); color: var(--green-800); }
#toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 0.7rem 1.1rem; border-radius: 10px; opacity: 0; transition: opacity 0.25s; z-index: 80; pointer-events: none; }
#toast.show { opacity: 0.96; }

/* ── Practice variant picker ── */
.variant-picker { margin: 1rem 0 1.5rem; }
.variant-card {
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  background:
    radial-gradient(120% 80% at 10% 0%, rgba(201, 162, 39, 0.12), transparent 50%),
    var(--card);
  box-shadow: var(--shadow);
  font: inherit;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
button.variant-card:hover {
  transform: translateY(-2px);
  border-color: #c9a227;
  box-shadow: 0 10px 28px rgba(13, 79, 28, 0.12);
}
.variant-card.is-disabled {
  cursor: default;
  opacity: 0.92;
  background:
    radial-gradient(120% 80% at 10% 0%, rgba(120, 120, 120, 0.08), transparent 50%),
    #f7f7f5;
}
.variant-card.is-disabled:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.variant-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-800);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.coming-soon {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #f0e6c8;
  color: #7a5c00;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
}
.variant-title {
  margin: 0 0 0.7rem;
  font-size: 1.35rem;
  color: var(--ink);
}
.variant-body {
  margin: 0.85rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.variant-meta {
  font-size: 0.8rem;
  font-weight: 700;
  color: #5c4030;
  margin-bottom: 0.9rem;
}
.variant-cta {
  font-weight: 800;
  color: var(--green-800);
  font-size: 0.92rem;
}
.variant-cta.muted { color: var(--muted); font-weight: 700; }

/* Mini start-state boards on practice cards */
.mini-board-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 14px;
  background: linear-gradient(145deg, #8b5a2b 0%, #6b4226 45%, #3a2414 100%);
  border: 1px solid #4a2e18;
  box-shadow: inset 0 1px 0 rgba(255, 230, 180, 0.18);
}
.mini-store {
  flex: 0 0 18px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1a0f08, #2a180c 60%, #3d2614);
  border: 1px solid rgba(70, 42, 20, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px;
  color: #f6e7c5;
  font-size: 0.58rem;
  font-weight: 800;
}
.mini-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}
.mini-pit {
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 55%, #1a0f08 0%, #2a180c 60%, #3d2614 100%);
  border: 1px solid rgba(70, 42, 20, 0.85);
  display: grid;
  place-items: center;
  font-size: 0.55rem;
  font-weight: 800;
  color: #f0d9a8;
  line-height: 1;
  min-height: 0;
}
.mini-pit.nyumba {
  border-radius: 22%;
  box-shadow: inset 0 0 0 1.5px rgba(201, 162, 39, 0.9);
}
.mini-pit.is-empty { color: rgba(246, 231, 197, 0.25); }
.practice-table[hidden], .variant-picker[hidden], .online-lobby[hidden] { display: none !important; }
.online-banner {
  margin-bottom: 0.9rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--green-50);
  color: var(--green-800);
  font-weight: 700;
  font-size: 0.92rem;
}
.online-banner.waiting { background: #fff6d8; color: #7a5c00; }
.online-banner.yours {
  background: #fde8e8;
  color: #8b1a1a;
  animation: turn-banner-pulse 1.1s ease-in-out infinite;
}
.online-banner.theirs { background: #eef0ee; color: #555; }
.online-banner.bot-turn {
  background: linear-gradient(135deg, #e8f3ff 0%, #d6eaff 100%);
  color: #0b3a6e;
  box-shadow: inset 0 0 0 1px rgba(30, 120, 200, 0.28);
  animation: turn-banner-pulse 1.15s ease-in-out infinite;
}
.online-banner.handoff {
  background: #fff4e5;
  color: #7a4a00;
}
.online-wait-earn {
  display: inline;
  font-weight: 600;
  opacity: 0.9;
  margin-left: 0.35rem;
}
.online-wait-earn a { color: var(--green-800); font-weight: 800; }
.online-code {
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.12em;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--green-900);
}
@keyframes turn-banner-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 40, 40, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(180, 40, 40, 0.18); }
}
#onlineTable .board-wrap.your-turn .board-frame {
  outline: 3px solid #c62828;
  outline-offset: 6px;
  border-radius: 18px;
  animation: turn-board-pulse 1.15s ease-in-out infinite;
}
@keyframes turn-board-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(198, 40, 40, 0); }
}
#onlineBoard .pit.opponent-pick {
  outline: 3px solid #e65100;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(230, 81, 0, 0.28);
  z-index: 2;
}
.online-abandon-bar {
  margin: 0 0 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #fde8e8;
  color: #7a1f1f;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
}
.online-abandon-bar[hidden] { display: none !important; }
.online-abandon-bar .abandon-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.online-chat {
  width: 100%;
  max-width: 560px;
  margin: 0.35rem auto 0;
  border-radius: 12px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(255, 248, 230, 0.92);
  overflow: hidden;
}
.play-surface.immersive .online-chat,
.play-surface:fullscreen .online-chat,
.play-surface:-webkit-full-screen .online-chat {
  background: rgba(30, 20, 12, 0.88);
  border-color: rgba(232, 197, 71, 0.35);
  color: #f6e7c5;
  max-width: none;
}
.online-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem 0.25rem;
  font-size: 0.82rem;
}
.online-chat-log {
  max-height: 7.5rem;
  overflow-y: auto;
  padding: 0.25rem 0.65rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.online-chat-msg {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.84rem;
  line-height: 1.35;
}
.online-chat-msg.mine {
  background: rgba(232, 197, 71, 0.28);
  align-self: flex-end;
  max-width: 92%;
}
.play-surface.immersive .online-chat-msg {
  background: rgba(255, 248, 230, 0.08);
}
.play-surface.immersive .online-chat-msg.mine {
  background: rgba(232, 197, 71, 0.18);
}
.online-chat-name {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a6a3a;
}
.play-surface.immersive .online-chat-name { color: #e8c547; }
.online-chat-body { word-break: break-word; }
.online-chat-empty { margin: 0.35rem 0; }
.online-chat-compose {
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem 0.55rem;
  border-top: 1px solid rgba(201, 162, 39, 0.25);
}
.online-chat-compose input {
  flex: 1;
  margin: 0;
  font-size: 0.88rem;
}
@media (max-width: 720px) {
  .online-chat-log { max-height: 6.2rem; }
}
.online-banner.abandoned { background: #f0e6e6; color: #5c3030; }
.online-banner.missed {
  background: #fde8e8;
  color: #8b1a1a;
  animation: turn-banner-pulse 0.9s ease-in-out 2;
}

/* Full-screen / immersive play surface (practice + online) */
.play-surface { position: relative; width: 100%; }
.play-surface .fs-exit {
  display: none !important; /* .btn { display:inline-flex } would otherwise override [hidden] */
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 5;
}
.play-surface:fullscreen,
.play-surface:-webkit-full-screen,
.play-surface.immersive {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 1.25rem 1.5rem 1.75rem;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(90, 55, 28, 0.55), transparent 55%),
    #1a120c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  overflow: auto;
}
.play-surface.immersive {
  position: fixed;
  inset: 0;
  z-index: 200;
  width: 100vw;
  height: 100vh;
  max-width: none;
}
body.play-immersive { overflow: hidden; }
.play-surface:fullscreen .fs-exit,
.play-surface:-webkit-full-screen .fs-exit,
.play-surface.immersive .fs-exit { display: inline-flex !important; }
.play-surface:fullscreen .board-stage,
.play-surface:-webkit-full-screen .board-stage,
.play-surface.immersive .board-stage {
  max-width: min(920px, 96vw);
  width: 100%;
}
.play-surface:fullscreen .online-banner,
.play-surface:-webkit-full-screen .online-banner,
.play-surface.immersive .online-banner {
  width: min(920px, 96vw);
}
.play-surface:fullscreen .board-frame,
.play-surface:-webkit-full-screen .board-frame,
.play-surface.immersive .board-frame {
  max-width: min(920px, 96vw);
}
.play-surface:fullscreen .board-side,
.play-surface:-webkit-full-screen .board-side,
.play-surface.immersive .board-side {
  color: #f0e0c8;
}
.play-surface:fullscreen .online-banner.yours,
.play-surface.immersive .online-banner.yours {
  width: min(920px, 96vw);
}

/* Desktop fullscreen only — larger, more marble-like seeds */
@media (min-width: 721px) {
  .play-surface:fullscreen .seeds,
  .play-surface:-webkit-full-screen .seeds,
  .play-surface.immersive .seeds {
    width: 84%;
    gap: 3px;
  }
  .play-surface:fullscreen .seed,
  .play-surface:-webkit-full-screen .seed,
  .play-surface.immersive .seed {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background:
      radial-gradient(circle at 30% 26%, rgba(255, 246, 220, 0.95) 0%, rgba(255, 246, 220, 0.15) 18%, transparent 42%),
      radial-gradient(circle at 50% 55%, #e8c48a 0%, #c4924a 42%, #8a5524 72%, #4a2a12 100%);
    box-shadow:
      inset 0 -2px 3px rgba(40, 18, 6, 0.45),
      inset 0 1px 1px rgba(255, 240, 200, 0.35),
      0 1px 2px rgba(0, 0, 0, 0.4);
  }
  .play-surface:fullscreen .seed:nth-child(3n+1),
  .play-surface:-webkit-full-screen .seed:nth-child(3n+1),
  .play-surface.immersive .seed:nth-child(3n+1) {
    transform: translate(0.5px, -0.5px) scale(1.04);
    background:
      radial-gradient(circle at 30% 26%, rgba(255, 246, 220, 0.95) 0%, rgba(255, 246, 220, 0.15) 18%, transparent 42%),
      radial-gradient(circle at 50% 55%, #edd09a 0%, #c99a52 42%, #915c28 72%, #4a2a12 100%);
  }
  .play-surface:fullscreen .seed:nth-child(3n+2),
  .play-surface:-webkit-full-screen .seed:nth-child(3n+2),
  .play-surface.immersive .seed:nth-child(3n+2) {
    transform: translate(-0.5px, 0.5px) scale(0.96);
    background:
      radial-gradient(circle at 28% 24%, rgba(255, 246, 220, 0.9) 0%, transparent 40%),
      radial-gradient(circle at 50% 55%, #d4a86a 0%, #b07f3e 45%, #7a4a1e 75%, #3d2410 100%);
  }
  .play-surface:fullscreen .seed:nth-child(3n),
  .play-surface:-webkit-full-screen .seed:nth-child(3n),
  .play-surface.immersive .seed:nth-child(3n) {
    transform: translate(0.4px, 0.4px);
  }
  .play-surface:fullscreen .seed.count-badge,
  .play-surface:-webkit-full-screen .seed.count-badge,
  .play-surface.immersive .seed.count-badge {
    width: auto;
    height: auto;
    transform: none;
    font-size: 0.78rem;
    padding: 0.12rem 0.45rem;
    background: rgba(20, 10, 4, 0.72);
    box-shadow: none;
  }
}

/* ── Bawo board (carved wood) ── */
.board-wrap { display: grid; place-items: center; position: relative; }
.board-stage {
  width: 100%;
  max-width: 560px;
  display: grid;
  gap: 0.55rem;
}
/* Online host (seat 0): name labels swap so "you" sit under the board.
   Pit cells are remapped in JS (180°) so Player 1's holes land at the bottom. */
#onlineTable .board-stage.seat-flip {
  display: flex;
  flex-direction: column-reverse;
}
.board-side {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5c4030;
  letter-spacing: 0.02em;
}
.board-side .turn {
  font-weight: 600;
  color: #8a6a3a;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.board-side.active .turn { opacity: 1; }
.board-side.active { color: #3d2918; }
.board-player {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.board-avatar {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: #0a1628;
  box-shadow: 0 0 0 2px rgba(255, 230, 180, 0.5), 0 1px 3px rgba(0, 0, 0, 0.25);
}
.online-vs-bot-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}
.online-vs-bot-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: #0a1628;
  box-shadow: 0 0 0 2px rgba(40, 120, 200, 0.35), 0 4px 12px rgba(0, 0, 0, 0.12);
}
.online-bot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}
.online-bot-card {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f7faf7, #fff);
}
.online-bot-card h3 {
  margin: 0;
  font-size: 1rem;
}
.online-bot-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.online-bot-card p {
  margin: 0 0 0.55rem;
  line-height: 1.4;
}
@media (max-width: 900px) {
  .online-bot-grid { grid-template-columns: 1fr; }
}
.rank-player {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.rank-avatar {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: #0a1628;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.anim-speed-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted, #5c4030);
}
.anim-speed-row select {
  margin: 0;
  max-width: 9.5rem;
  font-weight: 600;
}
.play-speed-chip {
  display: none;
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.2rem 0.45rem 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 248, 230, 0.92);
  border: 1px solid rgba(201, 162, 39, 0.45);
  color: #3d2918;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.play-speed-chip-label { letter-spacing: 0.02em; }
.play-speed-chip select {
  margin: 0;
  padding: 0.15rem 0.35rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  max-width: 6.5rem;
}
.play-surface:fullscreen .play-speed-chip,
.play-surface:-webkit-full-screen .play-speed-chip,
.play-surface.immersive .play-speed-chip {
  display: inline-flex;
}
.board-frame {
  --wood-deep: #3a2414;
  --wood-mid: #6b4226;
  --wood-lit: #8b5a2b;
  --pit-hollow: #2a180c;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 16px 14px;
  border-radius: 26px;
  width: 100%;
  max-width: 620px;
  overflow: visible;
  background:
    radial-gradient(120% 80% at 20% 15%, rgba(255, 220, 160, 0.18), transparent 45%),
    radial-gradient(90% 70% at 80% 85%, rgba(20, 8, 0, 0.35), transparent 50%),
    linear-gradient(145deg, var(--wood-lit) 0%, var(--wood-mid) 42%, var(--wood-deep) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 230, 180, 0.22),
    inset 0 -3px 8px rgba(0, 0, 0, 0.35),
    0 14px 28px rgba(40, 20, 8, 0.28);
  border: 1px solid #4a2e18;
  position: relative;
}
.board-frame::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 20px;
  border: 1px solid rgba(255, 220, 160, 0.12);
  pointer-events: none;
}
.board-stack {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  overflow: visible;
}
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 9px;
  position: relative;
}
/* Midline between the two sides (rows 2 and 3 of the 4×8 pit grid). */
.board::after {
  content: "";
  position: absolute;
  left: 1%;
  right: 1%;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 2px;
  background:
    linear-gradient(90deg,
      transparent 0%,
      rgba(255, 220, 160, 0.15) 8%,
      rgba(255, 230, 180, 0.55) 50%,
      rgba(255, 220, 160, 0.15) 92%,
      transparent 100%);
  box-shadow:
    0 1px 0 rgba(20, 8, 0, 0.35),
    inset 0 1px 0 rgba(255, 240, 200, 0.2);
  pointer-events: none;
  z-index: 1;
}
.pit.selected {
  box-shadow:
    inset 0 6px 10px rgba(0, 0, 0, 0.55),
    0 0 0 3px #fff3c4,
    0 0 16px rgba(255, 230, 150, 0.55);
  z-index: 2;
}
.pit.path-preview {
  box-shadow:
    inset 0 6px 10px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(120, 200, 255, 0.85);
  filter: brightness(1.12);
}
.pit.path-preview-a {
  box-shadow:
    inset 0 6px 10px rgba(0, 0, 0, 0.55),
    0 0 0 2.5px rgba(232, 197, 71, 0.95);
  filter: brightness(1.14);
}
.pit.path-preview-b {
  box-shadow:
    inset 0 6px 10px rgba(0, 0, 0, 0.55),
    0 0 0 2.5px rgba(110, 190, 255, 0.95);
  filter: brightness(1.12);
}
.pit.path-preview.nyumba {
  box-shadow:
    inset 0 6px 12px rgba(0, 0, 0, 0.6),
    inset 0 0 0 3px rgba(201, 162, 39, 0.8),
    0 0 0 2px rgba(120, 200, 255, 0.85);
}
.pit.path-preview-a.nyumba {
  box-shadow:
    inset 0 6px 12px rgba(0, 0, 0, 0.6),
    inset 0 0 0 3px rgba(201, 162, 39, 0.8),
    0 0 0 2.5px rgba(232, 197, 71, 0.95);
}
.pit.path-preview-b.nyumba {
  box-shadow:
    inset 0 6px 12px rgba(0, 0, 0, 0.6),
    inset 0 0 0 3px rgba(201, 162, 39, 0.8),
    0 0 0 2.5px rgba(110, 190, 255, 0.95);
}

/* Direction chooser — curved arrows near the selected pit */
.dir-chooser {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}
.dir-chooser:not([hidden]) { display: block; }
.dir-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -1.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #f6e7c5;
  text-shadow: 0 1px 3px rgba(0,0,0,0.65);
  white-space: nowrap;
  pointer-events: none;
}
.dir-btn {
  pointer-events: auto;
  position: absolute;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 35% 30%, #fff6d0, #e8c547 55%, #a8841a 100%);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.45);
  color: #3d2918;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  padding: 0;
}
.dir-btn:hover { transform: scale(1.1); }
.dir-btn:active { transform: scale(0.96); }
.dir-btn svg { width: 26px; height: 26px; display: block; }
.dir-btn.tone-a {
  background:
    radial-gradient(circle at 35% 30%, #fff8d8, #e8c547 55%, #a8841a 100%);
  color: #3d2918;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), 0 0 0 2px rgba(232, 197, 71, 0.85);
}
.dir-btn.tone-b {
  background:
    radial-gradient(circle at 35% 30%, #e8f6ff, #6ec0ff 55%, #2a6ea8 100%);
  color: #0d2a44;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), 0 0 0 2px rgba(110, 190, 255, 0.9);
}
.dir-btn[hidden] { display: none !important; }
@media (max-width: 720px) {
  .dir-btn { width: 52px; height: 52px; }
  .dir-btn svg { width: 30px; height: 30px; }
  .dir-hint {
    top: auto;
    bottom: -1.55rem;
    font-size: 0.72rem;
    max-width: 94%;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }
}
.dir-cancel {
  pointer-events: auto;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 10, 4, 0.65);
  color: #f6e7c5;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
}
/* Side stores hold captured / out-of-play seeds */
.store {
  flex: 0 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 40% 12%, rgba(120, 80, 40, 0.35), transparent 45%),
    linear-gradient(180deg, #1a0f08 0%, var(--pit-hollow) 55%, #3d2614 100%);
  border: 2px solid rgba(70, 42, 20, 0.9);
  box-shadow:
    inset 0 8px 14px rgba(0, 0, 0, 0.6),
    inset 0 -2px 4px rgba(255, 210, 140, 0.08);
}
.store-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: rgba(246, 231, 197, 0.55);
}
.store-count {
  font-size: 0.9rem;
  font-weight: 800;
  color: #f6e7c5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.pit {
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(120, 80, 40, 0.35), transparent 40%),
    radial-gradient(circle at 50% 55%, #1a0f08 0%, var(--pit-hollow) 55%, #3d2614 100%);
  border: 2px solid rgba(70, 42, 20, 0.9);
  box-shadow:
    inset 0 6px 10px rgba(0, 0, 0, 0.55),
    inset 0 -2px 4px rgba(255, 210, 140, 0.08),
    0 1px 0 rgba(255, 220, 160, 0.12);
  display: grid;
  place-items: center;
  cursor: default;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
/* Nyumba / Kuu — the special "house" is a carved SQUARE hole, not round */
.pit.nyumba {
  border-radius: 20%;
  background:
    radial-gradient(circle at 35% 28%, rgba(120, 80, 40, 0.35), transparent 40%),
    radial-gradient(circle at 50% 55%, #1a0f08 0%, var(--pit-hollow) 55%, #3d2614 100%);
  box-shadow:
    inset 0 6px 12px rgba(0, 0, 0, 0.6),
    inset 0 0 0 3px rgba(201, 162, 39, 0.8),
    0 1px 0 rgba(255, 220, 160, 0.12);
}
.pit.nyumba .seeds { border-radius: 12%; }
/* Practice: gold ring = legal starting pits (teaching aid). */
.pit.nyumba.selectable {
  box-shadow:
    inset 0 6px 12px rgba(0, 0, 0, 0.6),
    0 0 0 3px rgba(232, 197, 71, 0.95),
    0 0 14px rgba(232, 197, 71, 0.4);
}
.pit.selectable {
  cursor: pointer;
  box-shadow:
    inset 0 6px 10px rgba(0, 0, 0, 0.55),
    0 0 0 3px rgba(232, 197, 71, 0.95),
    0 0 14px rgba(232, 197, 71, 0.35);
}
.pit.selectable:hover { transform: scale(1.06); }
/* Online: soft pointer on your side only — not a legality / mtaji hint. */
.pit.tappable { cursor: pointer; }
.pit.tappable:hover { filter: brightness(1.06); }
.pit.missed-mtaji {
  outline: 3px solid #c62828;
  outline-offset: 2px;
  box-shadow: 0 0 0 8px rgba(198, 40, 40, 0.35);
  animation: missedMtajiFlash 0.9s ease;
  z-index: 3;
}
@keyframes missedMtajiFlash {
  0%, 100% { filter: brightness(1); }
  30% { filter: brightness(1.35); }
  60% { filter: brightness(0.85); }
}

/* ── Sowing playback (wagona) ── */
.board.busy { cursor: progress; }
.board.busy .pit { cursor: progress; }
.pit.drop-anim {
  animation: pitDrop 0.32s ease;
  filter: drop-shadow(0 0 7px rgba(232, 197, 71, 0.95));
  z-index: 2;
}
.pit.lift-anim {
  animation: pitLift 0.24s ease;
  filter: brightness(0.62);
  z-index: 2;
}
.pit.capture-anim {
  animation: pitCapture 0.7s ease;
  filter: drop-shadow(0 0 14px rgba(224, 82, 58, 1));
  z-index: 3;
  outline: 3px solid rgba(224, 82, 58, 0.9);
  outline-offset: 2px;
}
/* First drop after a capture — seeds return via the kichwa ("bring it back") */
.pit.bringback-anim {
  animation: pitBringBack 0.45s ease;
  filter: drop-shadow(0 0 12px rgba(80, 180, 255, 0.95));
  z-index: 3;
  outline: 3px solid rgba(80, 160, 230, 0.9);
  outline-offset: 2px;
}
.pit.empty-front {
  outline: 2px dashed rgba(224, 82, 58, 0.75);
  outline-offset: 1px;
  filter: saturate(0.55) brightness(0.85);
}
@keyframes pitDrop {
  0% { transform: scale(1); }
  45% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
@keyframes pitLift {
  0% { transform: scale(1); }
  50% { transform: scale(0.88); }
  100% { transform: scale(1); }
}
@keyframes pitCapture {
  0% { transform: scale(1); box-shadow: inset 0 6px 10px rgba(0,0,0,0.55); }
  25% { transform: scale(1.22); }
  55% { transform: scale(0.92); }
  100% { transform: scale(1); }
}
@keyframes pitBringBack {
  0% { transform: scale(1); }
  35% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .pit.drop-anim, .pit.lift-anim, .pit.capture-anim, .pit.bringback-anim { animation: none; }
}

/* ── Game over overlay (must live inside .play-surface so immersive/fullscreen shows it) ── */
.gameover-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(20, 10, 4, 0.48);
  border-radius: 18px;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.play-surface:fullscreen .gameover-overlay,
.play-surface:-webkit-full-screen .gameover-overlay,
.play-surface.immersive .gameover-overlay {
  border-radius: 0;
  background: rgba(10, 6, 2, 0.62);
}
.gameover-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.gameover-overlay[hidden] { display: none !important; }
.gameover-card {
  background: linear-gradient(160deg, #fff8ea 0%, #f3e4c4 100%);
  border: 1px solid #c9a227;
  border-radius: 16px;
  padding: 1.35rem 1.5rem;
  width: min(360px, 92%);
  text-align: center;
  box-shadow: 0 18px 40px rgba(20, 10, 4, 0.35);
  animation: gameoverIn 0.4s ease;
}
.gameover-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a6a3a;
}
.gameover-winner {
  font-size: 1.45rem;
  font-weight: 800;
  color: #2e7d32;
  margin: 0.35rem 0 0.45rem;
}
.gameover-sub {
  font-size: 0.88rem;
  color: #5c4030;
  margin-bottom: 0.55rem;
  line-height: 1.4;
}
.gameover-pivot {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  color: #4a5c42;
  line-height: 1.4;
}
.gameover-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
@keyframes gameoverIn {
  from { transform: translateY(10px) scale(0.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.board-wrap.game-ended .board-frame {
  box-shadow:
    inset 0 2px 0 rgba(255, 230, 180, 0.22),
    inset 0 -3px 8px rgba(0, 0, 0, 0.35),
    0 0 0 3px rgba(201, 162, 39, 0.55),
    0 14px 28px rgba(40, 20, 8, 0.28);
}
.seeds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  width: 72%;
  place-items: center;
  pointer-events: none;
}
.seed {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #f0d9a8 0%, #b8894a 55%, #6e4420 100%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}
.seed.count-badge {
  grid-column: 1 / -1;
  width: auto;
  height: auto;
  border-radius: 999px;
  padding: 0 4px;
  font-size: 0.62rem;
  font-weight: 800;
  color: #f6e7c5;
  background: rgba(20, 10, 4, 0.55);
  box-shadow: none;
  letter-spacing: 0.02em;
}
.legend { display: flex; gap: 1rem; margin: 0.8rem 0; flex-wrap: wrap; font-size: 0.85rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.swatch.square { border-radius: 3px; }
.swatch.wood {
  background: linear-gradient(145deg, #8b5a2b, #3a2414);
  border: 1px solid #4a2e18;
  border-radius: 50%;
}
.swatch.store-swatch {
  background: linear-gradient(180deg, #1a0f08, #3d2614);
  border: 1px solid #4a2e18;
  border-radius: 6px;
  height: 18px;
}

footer.site-footer {
  margin-top: 2rem;
  padding: 2rem 1.25rem 2.5rem;
  color: #d7d2c8;
  background:
    linear-gradient(180deg, transparent, rgba(18, 18, 18, 0.04)),
    linear-gradient(160deg, #1a1510 0%, var(--charcoal) 55%, #0c120e 100%);
  font-size: 0.88rem;
}
.site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  gap: 1.1rem;
}
.site-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
}
.site-footer-brand img {
  border-radius: 10px;
  background: #000;
}
.site-footer-brand strong {
  display: block;
  font-family: var(--font-display);
  color: #f4efe4;
  font-size: 1.05rem;
}
.site-footer-brand p {
  margin: 0.15rem 0 0;
  color: #a59e92;
  font-size: 0.86rem;
}
.site-footer-meta {
  margin: 0;
  color: #8f887c;
  text-align: left;
}
.site-footer a { color: #e8c547; }
.footer-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: #e8c547;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.kpi { font-size: 1.9rem; font-weight: 800; color: var(--green-800); }

/* ── Marketing landing ── */
.view-home { padding: 0; }
.land-hero {
  min-height: calc(100vh - 64px);
  min-height: calc(100svh - 64px);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background:
    radial-gradient(80% 70% at 20% 30%, rgba(201, 162, 39, 0.12), transparent 55%),
    linear-gradient(125deg, #0e0e0e 0%, #171717 45%, #1a2418 100%);
  color: #f4efe4;
  overflow: hidden;
}
.land-hero-visual {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.06), transparent 42%),
    linear-gradient(180deg, #101010, #0a0a0a);
}
.land-hero-visual img {
  width: min(72%, 420px);
  height: auto;
  display: block;
  animation: landMarkIn 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.land-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  gap: 0.85rem;
  animation: landCopyIn 0.9s ease 0.12s both;
}
.land-brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #fff;
}
.land-hero-copy h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.8vw, 2.15rem);
  font-weight: 700;
  line-height: 1.2;
  color: #e8c547;
  max-width: 18ch;
}
.land-casual {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.02rem;
  font-weight: 600;
  font-style: italic;
  color: #e8c547;
  max-width: 34ch;
  line-height: 1.4;
}
.land-lead {
  margin: 0;
  max-width: 36ch;
  font-size: 1.05rem;
  color: #c9c2b4;
  line-height: 1.55;
}
.land-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.55rem;
}
.btn.land-ghost {
  background: transparent;
  color: #f4efe4;
  border: 1px solid rgba(244, 239, 228, 0.35);
}
.btn.land-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}
.land-block {
  padding: clamp(2.4rem, 5vw, 4rem) 1.25rem;
}
.land-inner {
  max-width: 1080px;
  margin: 0 auto;
}
.land-block h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.55rem, 2.6vw, 2.1rem);
  color: var(--ink);
}
.land-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wood);
}
.land-copy {
  margin: 0 0 1.25rem;
  max-width: 54ch;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.6;
}
.land-copy strong { color: var(--ink); }
.land-prize {
  background:
    linear-gradient(110deg, rgba(201, 162, 39, 0.22), transparent 42%),
    linear-gradient(180deg, #eef6ee 0%, #e4efe4 100%);
  border-block: 1px solid rgba(13, 79, 28, 0.12);
}
.land-prize .land-copy { color: #3d5240; }
.land-audience {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem 1.25rem;
  margin-top: 1.5rem;
}
.land-audience h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--green-900);
}
.land-audience p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}
.land-pivot {
  background:
    radial-gradient(70% 80% at 15% 20%, rgba(201, 162, 39, 0.14), transparent 50%),
    linear-gradient(135deg, #0d1f12 0%, #122818 48%, #1a1a1a 100%);
  color: #f4efe4;
}
.land-pivot h2 { color: #fff; max-width: 22ch; }
.land-kicker-light { color: #e8c547; }
.land-copy-light { color: #c9c2b4; }
.land-copy-light strong { color: #fff; }
.land-pivot-list {
  margin: 0 0 1.35rem;
  padding-left: 1.15rem;
  color: #d7d0c2;
  font-size: 1.02rem;
  line-height: 1.65;
  max-width: 42ch;
}
.land-pivot-list li { margin: 0.35rem 0; }
.land-pivot .btn.land-ghost {
  border-color: rgba(244, 239, 228, 0.35);
  color: #f4efe4;
}
.land-path {
  background: linear-gradient(180deg, #e9f0e9, #e2ebe2);
}
.land-steps {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}
.land-steps li { margin: 0.45rem 0; }
.land-step-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 800;
  color: var(--green-800);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
@keyframes landMarkIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes landCopyIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 900px) {
  .land-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .land-hero-visual {
    min-height: 42vw;
    max-height: 320px;
  }
  .land-hero-visual img { width: min(58%, 260px); }
  .land-audience {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .land-audience {
    grid-template-columns: 1fr;
  }
  .land-hero-copy h1 { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .land-hero-visual img,
  .land-hero-copy { animation: none; }
}

/* ── Account page (login / register) ── */
.account-page {
  max-width: 440px;
  margin: 0 auto;
  padding: 0.25rem 0 2rem;
}
.account-page h1 { margin-bottom: 0.35rem; }
.account-back { margin-bottom: 0.75rem; }
.account-card { margin-top: 1rem; }
.nav-session a.btn {
  width: 100%;
  justify-content: center;
  text-decoration: none;
}
.session a.btn { text-decoration: none; }

/* ── Profile modal ── */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.4rem 0 0.8rem;
}
.profile-avatar-row img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: #e8eee8;
  border: 1px solid var(--line);
}
.profile-avatar-row .muted { margin: 0; }
.admin-users-toolbar {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 0.75rem;
}
.admin-users-toolbar label { margin: 0; flex: 1 1 140px; }
.admin-users-toolbar input,
.admin-users-toolbar select { margin-top: 0.2rem; }
.admin-user-detail dl {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}
.admin-user-detail dt { color: var(--muted); font-weight: 600; }
.admin-user-detail dd { margin: 0; word-break: break-word; }
.admin-users-table tr { cursor: pointer; }
.admin-users-table tr.is-selected { background: var(--green-50); }

/* ── Shared list cards (lobby) ── */
.list-cards { display: grid; gap: 0.65rem; }
.list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafcfb;
}
.list-card-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.list-card-main strong { font-size: 0.95rem; }
.nav-menu-btn { display: none; }
.nav-backdrop { display: none; }
.sheet-close,
.mobile-sheet-open { display: none !important; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Mobile UX (desktop rules above stay untouched) ── */
@media (max-width: 720px) {
  body {
    overflow-x: hidden;
  }

  /* Topbar + hamburger drawer */
  header.topbar {
    padding: 0.55rem 0.75rem;
    padding-top: max(0.55rem, env(safe-area-inset-top));
    gap: 0.45rem;
    flex-wrap: nowrap;
    align-items: center;
  }
  .brand {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    order: 1;
  }
  .brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
  .brand-text {
    font-size: 0.95rem;
    overflow: hidden;
    min-width: 0;
  }
  .brand-text-full { display: none; }
  .brand-text-short { display: inline; }

  /* Always keep auth controls visible beside the menu */
  .session {
    display: flex !important;
    margin-left: auto;
    flex: 0 0 auto;
    z-index: 2;
    order: 2;
  }
  .session .small { display: none; }
  .session .btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 40px;
  }
  .session .btn.gold {
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset;
  }
  .session .btn.ghost {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
  }

  .nav-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-left: 0;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    flex: 0 0 auto;
    order: 3;
  }
  .nav-menu-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.22); }
  .nav-menu-bars,
  .nav-menu-bars::before,
  .nav-menu-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    position: relative;
  }
  .nav-menu-bars::before,
  .nav-menu-bars::after {
    content: "";
    position: absolute;
    left: 0;
  }
  .nav-menu-bars::before { top: -6px; }
  .nav-menu-bars::after { top: 6px; }

  /*
   * Header is position:sticky; z-index:40 → creates a stacking context.
   * The drawer lives inside that context, so a backdrop at z-index:50 sat
   * ABOVE the whole menu and ate every tap (close only, never navigate).
   * Raise the header above the backdrop while the menu is open.
   */
  body.nav-open header.topbar {
    z-index: 60;
  }
  nav.tabs {
    display: none;
    position: fixed;
    top: calc(56px + env(safe-area-inset-top, 0px));
    left: 0.75rem;
    right: 0.75rem;
    margin: 0;
    padding: 0.55rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    background: #0f2414;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    z-index: 2;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    pointer-events: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.nav-open nav.tabs { display: flex; }
  /* Slimmer phone menu — keep play paths, drop secondary links */
  nav.tabs .nav-desktop-only { display: none !important; }
  nav.tabs button {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
  }
  .nav-session {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.45rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }
  .nav-session .btn,
  .nav-session a.btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    box-sizing: border-box;
  }
  .nav-session .nav-session-name {
    color: #d7e8d9;
    font-size: 0.85rem;
    text-align: center;
  }
  .account-page {
    max-width: none;
    padding: 0.15rem 0 2.5rem;
  }
  .account-card {
    border-radius: 16px;
  }
  #accountForm input,
  #accountForm select {
    font-size: 16px; /* prevent iOS zoom */
    min-height: 44px;
  }
  #accountSubmit {
    min-height: 48px;
    font-size: 1rem;
  }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 16, 10, 0.45);
    /* Below open header/drawer (60), above page content */
    z-index: 50;
  }
  .nav-backdrop[hidden] { display: none !important; }

  .view:not(.view-home) {
    margin-top: 1rem;
    padding: 0 0.75rem;
  }

  /* Landing */
  .land-hero-copy {
    padding: 1.25rem 1rem 1.75rem;
    gap: 0.65rem;
  }
  .land-brand { font-size: clamp(1.75rem, 9vw, 2.4rem); }
  .land-cta { flex-direction: column; }
  .land-cta .btn { width: 100%; justify-content: center; }
  .land-inner { padding-left: 1rem; padding-right: 1rem; }
  .land-hero-visual { min-height: 38vw; max-height: 240px; }

  /* Forms & buttons */
  input, select, textarea { font-size: 16px; padding: 0.7rem 0.75rem; }
  button.btn, a.btn { min-height: 44px; padding: 0.65rem 1rem; }
  .btn.small { min-height: 40px; }
  .modal {
    width: 100%;
    max-height: min(92dvh, 720px);
    padding: 1.15rem;
    padding-bottom: max(1.15rem, env(safe-area-inset-bottom));
  }

  /* Funnel / rankings */
  .funnel { flex-direction: column; align-items: stretch; }
  .funnel .spacer { display: none; }
  .funnel .btn { width: 100%; justify-content: center; }
  .table-scroll { margin: 0 -0.2rem; }
  .col-band,
  .col-optional { display: none; }
  #rankingsTable,
  #collegeRankingsTable { font-size: 0.84rem; }
  #rankingsTable th,
  #rankingsTable td,
  #collegeRankingsTable th,
  #collegeRankingsTable td { padding: 0.45rem 0.4rem; }

  /* Lobby */
  #onlineLobby .grid.cols-2 { grid-template-columns: 1fr; }
  #view-tournaments .grid.cols-2 { grid-template-columns: 1fr; }
  #onlineJoinCode { font-size: 1.1rem; letter-spacing: 0.08em; }
  .list-card { padding: 0.9rem 1rem; }
  .list-card .btn { flex: 0 0 auto; min-width: 5.5rem; justify-content: center; }
  .card:has(table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Practice variant picker */
  .variant-picker .grid.cols-2 { grid-template-columns: 1fr; }

  /* ── Play shell: portrait board ── */
  .play-layout {
    grid-template-columns: 1fr !important;
    gap: 0;
  }
  .play-board-card {
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin: 0;
  }
  .play-board-card .legend { display: none; }
  .desktop-only-fs { display: none !important; }

  .board-stage {
    max-width: none;
    gap: 0.35rem;
  }
  .board-side {
    font-size: 0.9rem;
    padding: 0.15rem 0.2rem;
  }
  .board-frame {
    flex-direction: column-reverse;
    gap: 8px;
    padding: 10px 8px;
    border-radius: 18px;
    max-width: none;
  }
  #onlineTable .board-stage.seat-flip .board-frame {
    flex-direction: column;
  }
  .board {
    gap: 5px;
  }
  .store {
    flex: 0 0 auto;
    flex-direction: row;
    width: 100%;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 14px;
    justify-content: space-between;
    align-items: center;
  }
  .store-label { font-size: 0.7rem; }
  .store-count { font-size: 1.05rem; }
  .pit {
    min-width: 0;
    touch-action: manipulation;
  }
  .pit.selectable:hover,
  .pit.tappable:hover { transform: none; filter: none; }
  .seed { width: 6px; height: 6px; }
  .seed.count-badge {
    font-size: 0.72rem;
    padding: 0 5px;
    background: rgba(20, 10, 4, 0.72);
  }
  .dir-btn {
    width: 52px;
    height: 52px;
  }
  .dir-btn svg { width: 30px; height: 30px; }
  .dir-cancel {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  .dir-hint {
    top: -1.35rem;
    font-size: 0.85rem;
  }
  .online-banner {
    font-size: 0.9rem;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
  }

  /* Side card → bottom sheet */
  .sheet-close {
    display: inline-flex !important;
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #eef2ee;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 2;
  }
  .play-side-card {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 220;
    margin: 0;
    max-height: min(78dvh, 640px);
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    padding: 1.15rem 1rem max(1.25rem, env(safe-area-inset-bottom));
    padding-top: 2.6rem;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
    transform: translateY(105%);
    transition: transform 0.22s ease;
  }
  .play-side-card.sheet-open {
    display: block;
    transform: translateY(0);
  }
  .mobile-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(10, 8, 4, 0.45);
  }
  .mobile-sheet-backdrop[hidden] { display: none !important; }
  .mobile-sheet-open {
    display: inline-flex !important;
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 5;
  }
  /* Close / Expand always available while a phone match is open */
  #practiceTable:not([hidden]) .fs-exit,
  #onlineTable:not([hidden]) .fs-exit {
    display: inline-flex !important;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 5;
  }

  /* Immersive mobile play (auto) */
  body.play-immersive header.topbar,
  body.play-immersive footer.site-footer,
  body.play-immersive .nav-backdrop {
    display: none !important;
  }
  body.play-immersive { overflow: hidden; }
  body.play-immersive .view:not(.active) { display: none !important; }
  body.play-immersive #view-play,
  body.play-immersive #view-online {
    margin: 0;
    padding: 0;
    max-width: none;
  }
  body.play-immersive .play-board-card { margin: 0; }

  .play-surface.immersive {
    padding:
      max(3.1rem, calc(env(safe-area-inset-top) + 2.6rem))
      max(0.45rem, env(safe-area-inset-right))
      max(0.55rem, env(safe-area-inset-bottom))
      max(0.45rem, env(safe-area-inset-left));
    gap: 0.4rem;
    justify-content: flex-start;
    background:
      radial-gradient(90% 50% at 50% 0%, rgba(90, 55, 28, 0.5), transparent 55%),
      #1a120c;
  }
  .play-surface.immersive .board-stage,
  .play-surface.immersive .online-banner,
  .play-surface.immersive .board-frame {
    max-width: none;
    width: 100%;
  }
  .play-surface.immersive .fs-exit,
  .play-surface.immersive .mobile-sheet-open,
  .play-surface.immersive .play-speed-chip {
    background: rgba(255, 248, 230, 0.92);
    border-color: rgba(201, 162, 39, 0.45);
    color: #3d2918;
  }
  .play-surface.immersive .fs-exit {
    top: max(0.45rem, env(safe-area-inset-top));
    right: max(0.45rem, env(safe-area-inset-right));
  }
  .play-surface.immersive .mobile-sheet-open {
    top: max(0.45rem, env(safe-area-inset-top));
    left: max(0.45rem, env(safe-area-inset-left));
  }
  .play-surface.immersive .play-speed-chip {
    top: max(0.45rem, env(safe-area-inset-top));
  }
  .play-surface.immersive .board-side { color: #f0e0c8; }
  .play-surface.immersive .board-side.active { color: #ffe7a8; }
  .play-surface.immersive .board-side .turn { color: #e8c547; }

  /* Prefer seed count readability on small pits */
  .seeds {
    width: 78%;
    gap: 1px;
  }
}

@media (max-width: 720px) and (max-height: 720px) {
  .play-surface.immersive .board-frame { padding: 8px 6px; gap: 6px; }
  .board { gap: 4px; }
  .store { min-height: 32px; padding: 4px 10px; }
}
