/* Khel ON — Pallanguzhi */
:root {
  --navy: #141721;
  --navy-2: #1c2030;
  --navy-3: #262b3f;
  --line: rgba(255,255,255,.09);
  --text: #f4f2fb;
  --muted: #a9aec4;
  --orange: #ff9a3c;
  --pink: #f04fa8;
  --purple: #8b5cf6;
  --teal: #2fd4c8;
  --grad: linear-gradient(100deg, var(--orange), var(--pink) 55%, var(--purple));
  --wood-1: #8a4f2a;
  --wood-2: #6d3b1d;
  --wood-3: #4e2913;
  --pit: #3a1e0e;
  --head: 'Outfit', 'Lilita One', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pit-size: min(calc((100vw - 32px - 16px - 6 * 5px) / 7), 84px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--navy); color: var(--text); }
body {
  font-family: var(--body); font-size: 16px; line-height: 1.4;
  min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(139,92,246,.22), transparent 70%),
    radial-gradient(600px 400px at 100% 100%, rgba(47,212,200,.08), transparent 70%),
    var(--navy);
}
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
#app { max-width: 760px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }

/* top bar */
.bar { display: flex; align-items: center; gap: 6px; height: 56px; position: sticky; top: 0; z-index: 20; background: rgba(20,23,33,.86); backdrop-filter: blur(8px); margin: 0 -16px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; display: grid; place-items: center; flex: none; }
.icon-btn:hover, .icon-btn:focus-visible { background: rgba(255,255,255,.07); }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .dot { fill: var(--text); }
#btnSound .mute { display: none; }
#btnSound[aria-pressed="false"] .wave { display: none; }
#btnSound[aria-pressed="false"] .mute { display: inline; }
.brand { display: flex; align-items: center; min-height: 44px; flex: none; }
.brand img { display: block; height: 26px; width: auto; }
.bar-title { font-family: var(--head); font-size: 17px; font-weight: 700; margin: 0 0 0 8px; padding-left: 10px; border-left: 1px solid var(--line); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* buttons */
.btn { border: 0; border-radius: 14px; min-height: 48px; padding: 0 20px; font-weight: 800; font-size: 16px; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 20px rgba(240,79,168,.3); }
.btn-teal { background: var(--teal); color: #0b2b29; }
.btn-ghost { background: var(--navy-3); color: var(--text); border: 1px solid var(--line); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-wide { width: 100%; margin: 10px 0 0; min-height: 54px; font-size: 17px; }
.link { background: none; border: 0; color: var(--teal); font-weight: 700; text-decoration: none; min-height: 44px; padding: 0 6px; display: inline-flex; align-items: center; }

/* menu */
.hero { text-align: center; padding: 22px 0 6px; }
.hero-board { width: 220px; margin: 0 auto 14px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; padding: 9px; border-radius: 40px; background: linear-gradient(180deg, var(--wood-1), var(--wood-2)); box-shadow: inset 0 2px 0 rgba(255,255,255,.18), 0 10px 26px rgba(0,0,0,.4); }
.hero-board span { aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #2a1408, var(--pit)); box-shadow: inset 0 3px 5px rgba(0,0,0,.6); position: relative; }
.hero-board span::after { content: ''; position: absolute; inset: 32%; border-radius: 50%; background: var(--orange); opacity: .9; animation: seedpop 3.6s infinite; }
.hero-board span:nth-child(3n)::after { background: var(--pink); animation-delay: .4s; }
.hero-board span:nth-child(3n+1)::after { background: var(--teal); animation-delay: .9s; }
.hero-board span:nth-child(4n)::after { background: var(--purple); animation-delay: 1.5s; }
@keyframes seedpop { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.35); } }
.hero-title { font-family: var(--head); font-size: 38px; line-height: 1.05; margin: 0; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--muted); margin: 8px auto 10px; max-width: 30em; }
.stars-pill { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 14px; border-radius: 99px; background: var(--navy-3); border: 1px solid var(--line); font-size: 14px; color: var(--muted); cursor: pointer; }
.stars-pill b { color: #ffd166; }
.card { background: var(--navy-2); border: 1px solid var(--line); border-radius: 20px; padding: 14px 14px 16px; margin-top: 14px; }
.card-h { font-family: var(--head); font-size: 14px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 6px 2px 8px; font-weight: 700; }
.seg { display: grid; gap: 6px; margin-bottom: 8px; }
.seg-2 { grid-template-columns: 1fr 1fr; }
.seg-4 { grid-template-columns: repeat(4, 1fr); }
.seg button { min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--navy-3); font-weight: 700; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.seg button small { font-weight: 600; color: var(--muted); font-size: 12px; margin-top: 2px; }
.seg button[aria-checked="true"] { border-color: var(--teal); background: rgba(47,212,200,.13); box-shadow: 0 0 0 1px var(--teal) inset; }
.seg-sm { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.seg-sm button { min-height: 40px; padding: 0 12px; flex: none; font-size: 14px; }
.more { margin: 4px 0 8px; }
.more summary { min-height: 44px; display: flex; align-items: center; color: var(--teal); font-weight: 700; cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: '+'; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--teal); margin-right: 8px; font-size: 15px; }
.more[open] summary::before { content: '–'; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.opt > span { font-weight: 700; color: var(--muted); font-size: 14px; }
body.m-kalah .classic-only, body.m-classic .kalah-only { display: none; }
.menu-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px; }
.fine { text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* game */
#game { padding-top: 10px; }
.player { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 16px; background: var(--navy-2); border: 1.5px solid var(--line); transition: border-color .25s, box-shadow .25s; }
.player.active { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,212,200,.16); }
.who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chip { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.chip.c0 { background: var(--orange); }
.chip.c1 { background: var(--purple); }
.name { font-family: var(--head); font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); opacity: 0; flex: none; }
.player.active .turn-dot { opacity: 1; animation: blink 1.2s infinite; }
.player.thinking .turn-dot { animation: blink .5s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.haul { display: flex; align-items: center; gap: 8px; }
.haul b { font-family: var(--head); font-size: 24px; min-width: 2ch; text-align: right; }
.haul-tray { width: 44px; height: 24px; border-radius: 12px; background: linear-gradient(180deg, var(--wood-2), var(--wood-3)); box-shadow: inset 0 2px 4px rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; gap: 3px; }
.haul-tray i { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.haul-tray i:nth-child(2) { background: var(--pink); }
.haul-tray i:nth-child(3) { background: var(--teal); }
.haul.bump b { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.35); color: #ffd166; } }

.board-wrap { position: relative; margin: 10px 0; }
.board { position: relative; display: grid; gap: 5px; padding: 8px; border-radius: calc(var(--pit-size) * .6); background: repeating-linear-gradient(95deg, rgba(255,255,255,.03) 0 6px, transparent 6px 15px), linear-gradient(180deg, var(--wood-1), var(--wood-2) 60%, var(--wood-3)); box-shadow: inset 0 2px 0 rgba(255,255,255,.2), inset 0 -3px 0 rgba(0,0,0,.25), 0 14px 30px rgba(0,0,0,.45); }
.board.classic { grid-template-columns: repeat(7, var(--pit-size)); justify-content: center; }
.board.kalah { --pit-size: min(calc((100vw - 32px - 16px - 7 * 5px) / 8), 76px); grid-template-columns: repeat(8, var(--pit-size)); justify-content: center; }
@media (min-width: 760px) { .board.classic { --pit-size: 84px; } .board.kalah { --pit-size: 76px; } }
.board .divider { grid-column: 1 / -1; height: 0; }
.board { --pit-h: var(--pit-size); }
@media (max-width: 560px) { .board { --pit-h: calc(var(--pit-size) * 1.5); } .board-wrap { margin: 16px 0; } }
.pit { position: relative; width: var(--pit-size); height: var(--pit-h); border-radius: 50% / 42%; border: 0; padding: 0; background: radial-gradient(circle at 50% 30%, #2b1509, var(--pit) 70%); box-shadow: inset 0 4px 8px rgba(0,0,0,.65), 0 1px 0 rgba(255,255,255,.12); overflow: visible; }
.pit .seeds { position: absolute; inset: 12%; border-radius: 50%; overflow: hidden; }
.pit .s { position: absolute; width: calc(var(--pit-size) * .17); height: calc(var(--pit-size) * .135); border-radius: 50%; box-shadow: inset -1px -1px 0 rgba(0,0,0,.3), inset 1px 1px 0 rgba(255,255,255,.35); transform: translate(-50%, -50%) rotate(var(--r, 0deg)); }
.pit .n { position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%); min-width: 22px; height: 18px; padding: 0 5px; border-radius: 9px; background: rgba(20,23,33,.92); color: #fff; font-family: var(--head); font-weight: 800; font-size: 12px; line-height: 18px; text-align: center; pointer-events: none; border: 1px solid rgba(255,255,255,.12); }
.pit.zero .n { opacity: .45; }
.pit.store { height: calc(var(--pit-h) * 2 + 5px); border-radius: calc(var(--pit-size) / 2); grid-row: span 2; }
.pit.store .seeds { inset: 10% 14%; border-radius: calc(var(--pit-size) / 2.5); }

.pit.store::before { content: attr(data-label); position: absolute; top: 8px; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 800; letter-spacing: .3px; color: rgba(255,255,255,.6); text-transform: uppercase; }
.pit.store .n { font-size: 14px; height: 22px; line-height: 22px; min-width: 28px; bottom: 4px; }
.pit.rest { background: repeating-linear-gradient(45deg, rgba(0,0,0,.25) 0 4px, transparent 4px 8px), radial-gradient(circle at 50% 30%, #3b2516, #2a170b 70%); opacity: .6; }
.pit.rest .n { display: none; }
.pit.rest::after { content: 'rest'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: rgba(255,255,255,.55); letter-spacing: .5px; }
.pit.playable { cursor: pointer; box-shadow: inset 0 4px 8px rgba(0,0,0,.65), 0 0 0 2.5px var(--teal), 0 0 14px rgba(47,212,200,.55); animation: glow 1.6s infinite; }
@keyframes glow { 50% { box-shadow: inset 0 4px 8px rgba(0,0,0,.65), 0 0 0 2.5px var(--teal), 0 0 4px rgba(47,212,200,.2); } }
.pit.hinted { box-shadow: inset 0 4px 8px rgba(0,0,0,.65), 0 0 0 3.5px #ffd166, 0 0 18px rgba(255,209,102,.8); animation: none; }
.pit.cur { box-shadow: inset 0 4px 8px rgba(0,0,0,.65), 0 0 0 3px #fff; }
.pit.pulse { animation: pulse .25s; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.pit.mark-empty { box-shadow: inset 0 4px 8px rgba(0,0,0,.65), 0 0 0 3px rgba(255,255,255,.5); }
.pit.mark-cap { box-shadow: inset 0 4px 8px rgba(0,0,0,.65), 0 0 0 3.5px #ffd166, 0 0 20px rgba(255,209,102,.9); }
.pit.mark-pasu { box-shadow: inset 0 4px 8px rgba(0,0,0,.65), 0 0 0 3.5px var(--pink), 0 0 20px rgba(240,79,168,.9); }
.pit:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.toast { position: absolute; z-index: 5; pointer-events: none; font-family: var(--head); font-weight: 800; font-size: 15px; white-space: nowrap; padding: 3px 9px; border-radius: 99px; background: #fff; color: var(--navy); transform: translate(-50%, -50%); animation: rise 1.1s forwards; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.toast.pasu { background: var(--pink); color: #fff; }
.toast.cap { background: #ffd166; }
.toast.relay { background: var(--teal); color: #0b2b29; }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -180%) scale(1); } }
.hand { position: absolute; z-index: 6; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: #fff; color: var(--navy); display: grid; place-items: center; font-family: var(--head); font-weight: 800; font-size: 15px; box-shadow: 0 6px 16px rgba(0,0,0,.45); transition: left .12s ease-out, top .12s ease-out; pointer-events: none; }
.hand::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--teal); }
.coach { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(47,212,200,.09); border: 1px solid rgba(47,212,200,.28); min-height: 58px; }
.coach-face { width: 32px; height: 32px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 40%, var(--navy) 0 9%, transparent 10%), radial-gradient(circle at 65% 40%, var(--navy) 0 9%, transparent 10%), radial-gradient(ellipse 22% 10% at 50% 66%, var(--navy) 0 90%, transparent 100%), var(--teal); }
.coach p { margin: 0; font-weight: 700; font-size: 15px; }
.coach.off { background: var(--navy-2); border-color: var(--line); }
.coach.off .coach-face { display: none; }
.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.controls .btn { padding: 0 8px; }
.round-info { text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0 0; min-height: 1em; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(8,10,16,.72); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); overflow: auto; background: var(--navy-2); border: 1px solid var(--line); border-radius: 22px; padding: 22px 18px 18px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.sheet h2 { font-family: var(--head); font-size: 28px; margin: 4px 0 6px; }
.res-score { font-family: var(--head); font-size: 22px; margin: 0 0 6px; }
.res-score .c0 { color: var(--orange); } .res-score .c1 { color: #b493ff; }
.res-note { color: var(--muted); margin: 6px 0; }
.res-stars { font-size: 40px; letter-spacing: 6px; color: var(--navy-3); margin: 6px 0; }
.res-stars span.on { color: #ffd166; animation: starin .5s backwards; text-shadow: 0 0 16px rgba(255,209,102,.6); }
.res-stars span.on:nth-child(2) { animation-delay: .2s; } .res-stars span.on:nth-child(3) { animation-delay: .4s; }
@keyframes starin { from { transform: scale(0) rotate(-90deg); } }
.res-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.sheet-btns { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.sheet-btns .btn { flex: 1; min-width: 120px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; background: var(--navy-3); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.badge-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 14px; font-family: var(--head); font-weight: 800; flex: none; }
.badge-list { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; display: grid; gap: 8px; }
.badge-list li { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--navy-3); }
.badge-list li.locked { opacity: .45; }
.badge-list li.locked .badge-ico { background: #3b4058; }
.badge-list b { display: block; }
.badge-list small { color: var(--muted); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 22px; }
.confetti i { position: absolute; top: -10px; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translateY(420px) rotate(540deg); opacity: 0; } }

/* how to play */
.sheet-how { text-align: left; }
.sheet-how .seg { margin-bottom: 12px; justify-content: center; }
.slide h3 { font-family: var(--head); font-size: 22px; margin: 4px 0 8px; }
.slide p { margin: 6px 0; }
.mini { display: flex; gap: 4px; justify-content: center; margin: 12px 0 8px; padding: 6px; border-radius: 22px; background: linear-gradient(180deg, var(--wood-1), var(--wood-2)); width: max-content; max-width: 100%; margin-left: auto; margin-right: auto; }
.mini span { width: 30px; height: 30px; border-radius: 50%; background: var(--pit); box-shadow: inset 0 3px 5px rgba(0,0,0,.6); display: grid; place-items: center; font-family: var(--head); font-weight: 800; font-size: 13px; color: #fff; }
.mini span.h { box-shadow: inset 0 3px 5px rgba(0,0,0,.6), 0 0 0 2.5px var(--teal); }
.mini span.y { box-shadow: inset 0 3px 5px rgba(0,0,0,.6), 0 0 0 2.5px #ffd166; }
.mini span.p { box-shadow: inset 0 3px 5px rgba(0,0,0,.6), 0 0 0 2.5px var(--pink); }
.mini span.e { box-shadow: inset 0 3px 5px rgba(0,0,0,.6), 0 0 0 2px rgba(255,255,255,.5); }
.mini-cap { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.how-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--navy-3); }
.dots i.on { background: var(--teal); }

@media (max-width: 400px) {
  .bar-title { font-size: 15px; margin-left: 4px; padding-left: 8px; }
  .brand img { height: 22px; }
  .hero-title { font-size: 32px; }
  .seg-4 button { font-size: 14px; }
  .name { font-size: 15px; }
  .controls .btn { font-size: 15px; }
}
@media (min-width: 700px) {
  .pit .n { font-size: 14px; height: 22px; line-height: 22px; min-width: 26px; }
  .coach p { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
