/* Gully Cricket — Khel ON brand: navy, orange→pink→purple gradient, teal; Outfit + Nunito (self-hosted) */
:root {
  --navy: #141721; --navy2: #1c2030; --navy3: #262b3f; --line: #343a52;
  --ink: #f5f3ff; --dim: #a9adc2;
  --orange: #ff9a3c; --pink: #f04fa8; --purple: #8b5cf6; --teal: #2fd4c8; --gold: #f2c14e;
  --grad: linear-gradient(100deg, var(--orange), var(--pink) 55%, var(--purple));
  --head: 'Outfit', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--navy); color: var(--ink); font-family: var(--body); }
body { overflow-x: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }

#app { max-width: 620px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 8px env(safe-area-inset-bottom); }
html.kd-on #app { min-height: calc(100dvh - var(--kd-h, 0px)); }
.bar { display: flex; align-items: center; gap: 10px; height: 50px; flex: none; padding: 0 6px; }
.home { display: flex; align-items: center; min-height: 44px; flex: none; }
.home img { display: block; height: 26px; width: auto; }
.ttl { flex: 1; min-width: 0; text-align: center; }
.bar::after { content: ''; flex: none; width: 78px; }
.title { margin: 0; font-family: var(--head); font-size: 19px; font-weight: 800; line-height: 1.1; letter-spacing: .2px; }
#app:not(.playing) .bar { display: none; }

/* ---------- play ---------- */
#play { flex: 1; display: flex; flex-direction: column; align-items: center; min-height: 0; -webkit-user-select: none; user-select: none; }
.hud { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 8px; padding: 2px 0 6px; min-height: 44px; width: 100%; font-weight: 800; }
.hud > div { background: var(--navy2); border-radius: 12px; padding: 4px 10px; display: flex; align-items: center; gap: 6px; font-size: 13.5px; white-space: nowrap; }
.hud b { font-family: var(--head); font-size: 18px; font-variant-numeric: tabular-nums; }
.hud small { color: var(--dim); font-size: 13px; }
.h-sc i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.h-sc span { color: var(--dim); font-size: 12.5px; letter-spacing: .06em; }
.h-sc b { font-size: 21px; }
.h-need { color: #ffe3b0; }
.h-need b { color: #fff; }
.h-balls { gap: 4px !important; padding: 4px 8px !important; }
.h-balls .b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 900; background: #2c3248; color: #d9dcef; }
.h-balls .bx { background: transparent; box-shadow: inset 0 0 0 1.5px #3a4060; }
.h-balls .b4 { background: var(--teal); color: #0e2422; }
.h-balls .b6 { background: var(--gold); color: #2a1d02; }
.h-balls .bW { background: var(--pink); color: #fff; }
.h-balls .bWd { background: #4a3c66; color: #e5dcff; font-size: 8px; }
.stage { display: flex; flex-direction: column; align-items: center; width: 100%; }
.field { position: relative; border-radius: 20px; overflow: hidden; box-shadow: 0 0 0 2px #2a2f45, 0 12px 34px rgba(0,0,0,.45); touch-action: none; cursor: pointer; }
#cv { display: block; touch-action: none; }
.pop { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; font-family: var(--head); font-weight: 900; font-size: 40px; letter-spacing: .02em; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.3), 0 0 24px rgba(240,79,168,.9); opacity: 0; padding: 0 12px; }
.pop.six { font-size: 64px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)) drop-shadow(0 0 18px rgba(255,154,60,.6)); }
.pop.four { font-size: 54px; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.3), 0 0 22px var(--teal); }
.pop.out { font-size: 36px; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 22px var(--pink); }
.pop.small { font-size: 26px; top: 38%; text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 14px rgba(0,0,0,.6); }
.pop.good { font-size: 30px; color: #fff; text-shadow: 0 0 18px var(--teal); }
.pop.show { animation: pop 1.5s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: scale(.5); } 12% { opacity: 1; transform: scale(1.12); } 22% { transform: scale(1); } 75% { opacity: 1; transform: translateY(-10px); } 100% { opacity: 0; transform: translateY(-30px); } }
.comm { position: absolute; left: 10px; right: 10px; bottom: 10px; margin: 0; padding: 7px 12px; border-radius: 12px; background: rgba(20,23,33,.78); color: #fff; font-weight: 800; font-size: 14.5px; line-height: 1.3; text-align: center; pointer-events: none; }
.comm:empty { display: none; }
.coach { position: absolute; left: 10px; right: 10px; top: 10px; background: rgba(20,23,33,.94); border: 2px solid var(--teal); border-radius: 14px; padding: 9px 12px; font-weight: 800; font-size: 15.5px; line-height: 1.3; text-align: center; pointer-events: none; }
.coach small { display: block; font-weight: 700; color: var(--dim); font-size: 13.5px; margin-top: 3px; }
.coach .cstep { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 999px; background: var(--teal); color: #0e2422; font-size: 12px; vertical-align: 2px; }

/* controls under the lane */
.ctl { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 600px; min-height: 64px; padding: 8px 4px; }
.ctl .hint { flex: 1; margin: 0; color: var(--dim); font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.ctl .hint.wait { color: #d9dcef; }
.seg { display: flex; gap: 6px; flex: none; }
.seg button { min-height: 50px; min-width: 70px; border-radius: 14px; background: var(--navy2); border: 1px solid var(--line); font-weight: 900; font-size: 15.5px; padding: 4px 10px; line-height: 1.1; }
.seg button small { display: block; font-weight: 700; font-size: 11px; color: var(--dim); }
.seg button[aria-pressed="true"] { background: var(--teal); color: var(--navy); border-color: var(--teal); }
.seg button[aria-pressed="true"] small { color: #0e3a36; }
.go { flex: 1; min-height: 50px; border-radius: 14px; background: var(--grad); color: #fff; font-family: var(--head); font-weight: 900; font-size: 16.5px; padding: 6px 12px; box-shadow: 0 5px 0 rgba(0,0,0,.25); }
.go:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.tog { flex: none; display: flex; align-items: center; gap: 6px; min-height: 50px; border-radius: 14px; background: var(--navy2); border: 1px solid var(--line); padding: 4px 12px; font-weight: 900; font-size: 14.5px; line-height: 1.05; text-align: left; }
.tog small { display: block; color: var(--dim); font-weight: 700; font-size: 11.5px; }
.tog .tog-i { font-size: 20px; color: var(--dim); }
.tog[aria-pressed="true"] { background: rgba(255,154,60,.16); border-color: var(--orange); }
.tog[aria-pressed="true"] .tog-i, .tog[aria-pressed="true"] small { color: var(--orange); }
.tog { flex-direction: row; }
.tog > small { margin-left: 2px; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8,10,16,.72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 2147482950; }
.overlay.solid { background: radial-gradient(70% 55% at 50% 0%, rgba(255,154,60,.14), transparent 70%), radial-gradient(60% 50% at 100% 100%, rgba(47,212,200,.12), transparent 70%), #141721; backdrop-filter: none; }
.card { width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--navy2); border: 1px solid var(--line); border-radius: 22px; padding: 22px 18px 18px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.card.wide { max-width: 580px; }
.card:focus { outline: none; }
.card h2 { font-family: var(--head); font-size: 26px; margin: 4px 0 6px; }
.card h3 { font-family: var(--head); font-size: 18px; margin: 14px 0 4px; text-align: left; }
.card h2.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 30px; }
.card p { color: var(--dim); margin: 6px 0 12px; line-height: 1.45; }
.card p b { color: var(--ink); }
.card .res { color: var(--ink); font-weight: 800; font-size: 17px; }
.card .cupline { color: var(--gold); font-weight: 800; }
.card .small { font-size: 13.5px; }
.big-emoji { font-size: 46px; }
.btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.btn { min-height: 50px; border-radius: 14px; font-weight: 900; font-size: 16.5px; background: var(--navy3); border: 1px solid var(--line); padding: 8px 14px; }
.btn:hover { border-color: var(--teal); }
.btn.primary { background: var(--grad); border: 0; color: #fff; }
.stars { font-size: 38px; letter-spacing: 6px; margin: 2px 0 2px; }
.stars i { font-style: normal; color: #3a3f57; display: inline-block; }
.stars i.on { color: var(--gold); animation: star .5s backwards; text-shadow: 0 0 16px rgba(242,193,78,.6); }
.stars i.on:nth-child(2) { animation-delay: .25s; } .stars i.on:nth-child(3) { animation-delay: .5s; }
@keyframes star { from { transform: scale(0) rotate(-60deg); } to { transform: scale(1) rotate(0); } }
.star-why { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; }
.star-why li { color: var(--dim); font-size: 13.5px; font-weight: 700; }
.star-why li.on { color: var(--ink); }
.star-why li::before { content: '☆ '; color: #4a5070; }
.star-why li.on::before { content: '★ '; color: var(--gold); }
.earned { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0; }
.chip { background: var(--navy); border: 1px solid var(--gold); color: var(--gold); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 800; }
.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; margin: 10px 0; }
.badge { background: var(--navy); border-radius: 12px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; opacity: .45; }
.badge.got { opacity: 1; box-shadow: inset 0 0 0 1px var(--gold); }
.badge .bi { font-size: 24px; flex: none; }
.badge b { display: block; font-size: 13.5px; }
.badge small { color: var(--dim); font-size: 12px; line-height: 1.2; display: block; }
.howto, .rules { text-align: left; margin: 6px 0; padding-left: 20px; color: var(--ink); line-height: 1.45; font-size: 15px; }
.howto li, .rules li { margin: 6px 0; }
.rules { color: #d6d8ea; font-size: 14.5px; }
kbd { background: var(--navy); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; font-size: 13px; font-family: var(--body); }
.hand { display: inline-block; text-align: left; font-size: 18px; font-weight: 800; line-height: 1.7; background: var(--navy); border-radius: 14px; padding: 8px 16px; margin-top: 4px; }
.hand .dot, .sc-card h3 i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.phrases { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.phrases .btn { font-size: 15px; min-height: 48px; }
.sc-cards { display: grid; gap: 8px; margin: 10px 0 2px; text-align: left; }
@media (min-width: 560px) { .sc-cards { grid-template-columns: 1fr 1fr; } }
.sc-card { background: var(--navy); border-radius: 14px; padding: 8px 12px; min-width: 0; }
.sc-card h3 { display: flex; align-items: center; margin: 0 0 4px; font-size: 15px; }
.sc-card h3 span { margin-left: auto; font-size: 17px; }
.sc-card h3 small { color: var(--dim); font-size: 12px; }
.sc-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sc-card td { padding: 2px 0; color: #d6d8ea; }
.sc-card td:nth-child(2) { color: var(--dim); font-size: 12px; }
.sc-card td:last-child { text-align: right; white-space: nowrap; }
.sc-card td small { color: var(--dim); }
.sc-x { margin: 4px 0 0 !important; font-size: 12px; text-align: left; }
.toast { position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 2147483000; max-width: calc(100vw - 32px); background: #262b3f; color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 10px 16px; font-weight: 800; font-size: 14.5px; box-shadow: 0 10px 30px rgba(0,0,0,.45); text-align: center; pointer-events: none; }
.toast[hidden] { display: none; }

/* ---------- small phones ---------- */
@media (max-width: 360px) {
  .bar { height: 44px; } .home img { height: 21px; } .title { font-size: 16px; } .bar::after { width: 60px; }
  .hud > div { padding: 3px 7px; font-size: 12px; } .hud b { font-size: 16px; } .h-sc b { font-size: 18px; } .h-balls .b { width: 17px; height: 17px; }
  .seg button { min-width: 58px; font-size: 14px; } .go { font-size: 15px; } .tog { padding: 4px 8px; font-size: 13px; }
  .ctl .hint { font-size: 12.5px; }
  .pop.six { font-size: 52px; } .pop.four { font-size: 44px; } .pop.out { font-size: 28px; }
  .badge-grid, .phrases { grid-template-columns: 1fr; }
}
@media (max-height: 640px) { .bar { height: 40px; } .hud { min-height: 38px; padding-bottom: 4px; } .ctl { min-height: 56px; padding: 4px; } .seg button, .go, .tog { min-height: 46px; } }

/* ---------- desktop with a mouse (Option A): slim header, the lane big on the left, the side panel on the right ---------- */
#app.desk-play { max-width: none; padding: 0 24px; }
#app.desk-play .bar { height: 62px; gap: 16px; }
#app.desk-play .bar::after { display: none; }
#app.desk-play .ttl { text-align: left; padding-left: 16px; border-left: 1px solid rgba(255,255,255,.12); }
#app.desk-play .title { text-align: left; font-size: 22px; }
.sp { display: none; }
#play.desk { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto minmax(0, 1fr); gap: 0 20px; width: 100%; height: calc(100dvh - 62px - var(--kd-h, 0px) - 18px); margin-bottom: 18px; align-items: stretch; }
#play.desk .hud { grid-column: 1; grid-row: 1; }
#play.desk .stage { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; border-radius: 22px; padding: 16px;
  background: radial-gradient(60% 60% at 50% 40%, rgba(255,154,60,.08), transparent 70%), radial-gradient(50% 60% at 100% 100%, rgba(47,212,200,.08), transparent 70%), radial-gradient(rgba(255,255,255,.05) 1.2px, transparent 1.4px) 0 0 / 26px 26px, #171b2b; box-shadow: 0 0 0 1px rgba(255,255,255,.05); }
#play.desk .sp { grid-column: 2; grid-row: 1 / span 2; display: flex; height: 100%; overflow: hidden; }
#play.desk .ctl { max-width: none; }

/* ---------- mouse, caret and focus hygiene ---------- */
html, body { caret-color: transparent; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#kn-panel input { caret-color: auto; -webkit-user-select: text; user-select: text; cursor: text; }
:focus:not(:focus-visible) { outline: none; }
button:focus-visible, a:focus-visible { outline: 3px solid #2fd4c8; outline-offset: 2px; }
body, body * { cursor: default; }
button:not(:disabled), button:not(:disabled) *, a[href], a[href] *, .field, .field * { cursor: pointer; }
#app.net-play ~ .kn-pill { display: none; }
@media (prefers-reduced-motion: reduce) { .pop.show, .stars i.on { animation: none; opacity: 1; } }
/* screenshot mode (tests only): just the lane */
body.poster #bar, body.poster .hud, body.poster .ctl, body.poster .sp, body.poster #kd-dock { display: none !important; }
body.poster #app, body.poster #play, body.poster .stage { padding: 0 !important; margin: 0 !important; max-width: none !important; display: block !important; background: none !important; box-shadow: none !important; }
body.poster .field { position: fixed; left: 0; top: 0; border-radius: 0; box-shadow: none; }
