/* Patang — Khel ON brand: navy, orange→pink→purple gradient, teal; Outfit + Nunito (self-hosted) */
:root {
  --navy: #141721; --navy2: #1c2030; --navy3: #262b3f; --line: #343a52;
  --ink: #f4f1ea; --dim: #a9adc2;
  --orange: #ff9a3c; --pink: #f04fa8; --purple: #8b5cf6; --teal: #2fd4c8; --gold: #f2c14e; --sky: #55b7ff;
  --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;
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; 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: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 16px env(safe-area-inset-bottom); }
#app.wide { max-width: 1100px; }
.bar { display: flex; align-items: center; gap: 10px; height: 52px; flex: none; }
.home { display: flex; align-items: center; min-height: 44px; flex: none; }
.home img { display: block; height: 28px; width: auto; }
.ttl { flex: 1; min-width: 0; text-align: center; }
.bar::after { content: ''; flex: none; width: 84px; }
.title { margin: 0; text-align: center; font-family: var(--head); font-size: 20px; font-weight: 800; letter-spacing: .3px; line-height: 1.1; }
html.kd-on #app { min-height: calc(100dvh - var(--kd-h, 0px)); }
.stage { display: contents; }
.sp { display: none; }

/* ---------- play ---------- */
#play { flex: 1; display: flex; flex-direction: column; min-height: 0; user-select: none; -webkit-user-select: none; touch-action: none; }
#app.playing { padding-top: env(safe-area-inset-top); }
#app.playing .bar { height: 46px; }
.hud-row { display: flex; align-items: center; gap: 8px; margin: 0 auto; flex: none; max-width: 100%; }
.hud { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 4px 0 6px; min-height: 38px; }
.hud-cell { background: var(--navy2); border-radius: 12px; padding: 3px 10px; font-weight: 800; font-size: 14px; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.hud-cell b { font-family: var(--head); font-size: 17px; font-variant-numeric: tabular-nums; }
.hud-cell .kl { color: var(--orange); letter-spacing: 1px; font-size: 15px; }
.hud-cell .kl .off { color: #3a3f57; }
.chip-t { display: flex; align-items: center; gap: 5px; background: var(--navy2); border-radius: 999px; padding: 3px 10px 3px 4px; font-weight: 800; font-size: 13.5px; border: 2px solid transparent; white-space: nowrap; }
.chip-t i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; color: #141721; }
.chip-t b { font-family: var(--head); font-size: 17px; font-variant-numeric: tabular-nums; }
.chip-t.lead { border-color: var(--gold); }
.chip-t.me { box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.wind { display: inline-block; transition: transform .6s; }
.sky-wrap { position: relative; flex: none; margin: 0 auto; }
#cv { display: block; border-radius: 16px; box-shadow: 0 0 0 3px #2a2f45, 0 0 0 5px rgba(85,183,255,.3), 0 10px 30px rgba(0,0,0,.45); background: #3e8ad6; touch-action: none; }
.pop { position: absolute; left: 8px; right: 8px; top: 30%; text-align: center; font-size: clamp(21px, 7vw, 30px) !important; line-height: 1.15; pointer-events: none; font-family: var(--head); font-weight: 900; font-size: 30px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 18px var(--pink); opacity: 0; }
.pop.show { animation: pop 1.3s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.08); } 70% { opacity: 1; transform: translateY(-14px) scale(1); } 100% { opacity: 0; transform: translateY(-34px); } }
.coach { position: absolute; left: 8px; right: 8px; top: 8px; background: rgba(20,23,33,.94); border: 2px solid var(--teal); border-radius: 14px; padding: 8px 12px; font-weight: 800; font-size: 15px; line-height: 1.3; text-align: center; pointer-events: none; }
.coach small { display: block; font-weight: 600; color: var(--dim); font-size: 13px; margin-top: 2px; }
.say { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); max-width: calc(100% - 20px); background: rgba(20,23,33,.94); border: 2px solid var(--teal); border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.say[hidden] { display: none; }
.phrases { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.phrases .btn { min-height: 48px; font-size: 15px; padding: 6px 8px; }
.coach[data-low="1"] { top: auto; bottom: 8px; }

/* the hold pads under the sky (the whole play area works too) */
.pads { flex: 1; min-height: 110px; display: flex; gap: 10px; padding: 10px 0 10px; }
.pad { flex: 1; border-radius: 20px; background: radial-gradient(circle at 50% 40%, rgba(255,154,60,.16), transparent 70%), var(--navy2); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 8px; pointer-events: none; transition: transform .08s, background .08s; }
.pad b { font-family: var(--head); font-size: 22px; font-weight: 800; color: #fff; }
.pad span { color: var(--dim); font-weight: 700; font-size: 13.5px; }
.pad.on { background: radial-gradient(circle at 50% 40%, rgba(255,154,60,.42), transparent 75%), var(--navy3); transform: scale(.985); border-color: var(--orange); }
.pad.p2 { background: radial-gradient(circle at 50% 40%, rgba(47,212,200,.16), transparent 70%), var(--navy2); }
.pad.p2.on { background: radial-gradient(circle at 50% 40%, rgba(47,212,200,.42), transparent 75%), var(--navy3); border-color: var(--teal); }
.pad.hint-pulse { animation: hint 1s ease-in-out infinite; }
@keyframes hint { 0%, 100% { box-shadow: 0 0 0 0 rgba(47,212,200,0); } 50% { box-shadow: 0 0 0 4px var(--teal), 0 0 22px var(--teal); } }
.no-touch .pads { display: none; }
#play.land .pads { display: none; }
#play.land .hud-row { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); z-index: 2; }
#play.land { position: relative; padding-top: 42px; align-items: center; }

/* ---------- 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(85,183,255,.14), transparent 70%), #141721; backdrop-filter: none; }
.card { width: 100%; max-width: 400px; 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 h2 { font-family: var(--head); font-size: 26px; margin: 4px 0 6px; }
.card h2.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card h3 { font-family: var(--head); font-size: 17px; margin: 14px 0 6px; text-align: left; }
.card p { color: var(--dim); margin: 6px 0 12px; line-height: 1.4; }
.card .big-emoji { font-size: 46px; }
.stars { font-size: 38px; letter-spacing: 6px; margin: 4px 0 6px; }
.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: 4px 0 10px; text-align: left; display: inline-block; }
.star-why li { color: var(--dim); font-size: 14px; margin: 2px 0; }
.star-why li.on { color: var(--ink); }
.star-why li::before { content: '☆ '; color: #3a3f57; }
.star-why li.on::before { content: '★ '; color: var(--gold); }
.btns { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.btn { min-height: 50px; border-radius: 14px; font-weight: 900; font-size: 16.5px; background: var(--navy3); border: 1px solid var(--line); }
.btn.primary { background: var(--grad); border: 0; color: #fff; }
.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; min-width: 0; }
.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 { text-align: left; margin: 6px 0; padding-left: 18px; color: var(--ink); line-height: 1.45; }
.howto li { margin: 5px 0; }
.howto kbd { background: var(--navy); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; font-size: 13px; }
.safety { text-align: left; background: rgba(47,212,200,.08); border: 1px solid rgba(47,212,200,.45); border-radius: 14px; padding: 10px 12px; margin: 12px 0 4px; font-size: 14.5px; line-height: 1.4; }
.safety b { color: var(--teal); }
.result-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.result-list div { display: flex; justify-content: space-between; align-items: center; background: var(--navy); border-radius: 12px; padding: 8px 12px; font-weight: 800; gap: 8px; }
.result-list div.win { box-shadow: inset 0 0 0 2px var(--gold); }
.result-list .dot { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; color: #141721; margin-right: 8px; vertical-align: -3px; }
.result-list small { color: var(--dim); font-weight: 700; }

/* my kite: designs, manja colours, size, strength, Plus */
.look { text-align: left; }
.look .lk-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.look .lk { position: relative; border-radius: 14px; background: var(--navy); border: 1px solid var(--line); padding: 6px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.look .lk canvas { width: 44px; height: 44px; display: block; }
.look .lk span { font-size: 11.5px; font-weight: 800; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.look .lk.on { box-shadow: inset 0 0 0 2px var(--orange); background: #22263a; }
.look .lk.on span { color: #fff; }
.look .lk.locked { opacity: .55; cursor: default; }
.look .lk .lock { position: absolute; top: 4px; right: 4px; width: 15px; height: 15px; color: #c9cbe0; }
.look .mc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.look .mc { position: relative; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-height: 44px; border-radius: 12px; background: var(--navy); border: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-weight: 800; font-size: 13px; min-width: 0; }
.look .mc i { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.look .mc.on { box-shadow: inset 0 0 0 2px var(--orange); }
.look .mc.locked { opacity: .55; cursor: default; }
.look .mc .lock { position: absolute; top: 3px; right: 3px; width: 13px; height: 13px; }
.look .seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.look .seg button { min-height: 54px; border-radius: 12px; background: var(--navy3); border: 1px solid var(--line); font-weight: 800; font-size: 14.5px; padding: 6px 6px; }
.look .seg button small { display: block; font-weight: 700; font-size: 11.5px; color: var(--dim); line-height: 1.2; }
.look .seg button.on { background: var(--teal); color: var(--navy); border-color: var(--teal); }
.look .seg button.on small { color: var(--navy); }
.look .seg button:disabled { opacity: .45; cursor: default; }
.plus-note { color: var(--dim); font-size: 13px; margin: 6px 0 0; }
.pass { margin-top: 14px; display: flex; gap: 12px; align-items: center; text-align: left; border-radius: 16px; padding: 12px 14px; background: linear-gradient(120deg, rgba(255,154,60,.14), rgba(139,92,246,.16)); border: 1px dashed rgba(242,193,78,.55); }
.pass .pi { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(242,193,78,.16); color: var(--gold); font-size: 24px; }
.pass b { display: block; font-family: var(--head); font-size: 16px; }
.pass small { display: block; color: var(--dim); font-size: 13px; font-weight: 700; line-height: 1.3; }
.pass .tag { display: inline-block; margin-top: 4px; font-size: 11.5px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }

@media (prefers-reduced-motion: reduce) { .pop.show, .stars i.on, .hint-pulse { animation: none; opacity: 1; } }
@media (max-width: 345px) { .bar { gap: 8px; } .title { font-size: 17px; letter-spacing: 0; } .home img { height: 21px; } .look .lk-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .look .mc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pad b { font-size: 19px; } }
.keys-hint { text-align: center; color: var(--dim); font-size: 13px; font-weight: 700; margin: 8px 0 0; }
.keys-hint:empty { display: none; }
#app.net-play ~ .kn-pill { display: none; }

/* ---------- mouse, caret and focus hygiene ---------- */
html, body { caret-color: transparent; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#kn-panel input { caret-color: auto; -webkit-user-select: text; user-select: text; }
canvas { -webkit-user-select: none; user-select: none; touch-action: none; }
:focus:not(:focus-visible) { outline: none; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #2fd4c8; outline-offset: 2px; }
body.ptr-idle #play, body.ptr-idle #play * { cursor: none !important; }
#ov-card:focus { outline: none; }
.card.wide { max-width: 580px; }
@media (min-width: 700px) { .card.wide { padding: 26px 30px 24px; } .card.wide .howto { font-size: 16px; } }
#app.no-touch.playing .hud { gap: 10px; padding: 8px 0 8px; }
#app.no-touch.playing .chip-t { font-size: 15.5px; padding: 4px 14px 4px 5px; }
#app.no-touch.playing .chip-t b, #app.no-touch.playing .hud-cell b { font-size: 20px; }
#app.no-touch.playing .hud-cell { font-size: 15.5px; padding: 5px 14px; }
#app.no-touch .keys-hint { font-size: 14px; }
#app.no-touch .coach { font-size: 16.5px; }
body, body * { cursor: default; }
button:not(:disabled), button:not(:disabled) *, a[href], a[href] *, [role="button"], label { cursor: pointer; }
#kn-panel input { cursor: text; }
#play:not(.desk) #cv, #play.desk #cv { cursor: pointer; }

/* ---------- desktop with a mouse: slim header, the sky big on the left, the side panel fills the rest ---------- */
#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; }
#play.desk { flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; height: calc(100dvh - 62px - var(--kd-h, 0px) - 18px); margin-bottom: 18px; }
#play.desk .hud-row, #play.desk .keys-hint, #play.desk .pads { display: none !important; }
#play.desk .stage { display: grid; place-items: center; min-height: 0; padding: 0 20px; border-radius: 22px;
  background: radial-gradient(60% 60% at 50% 40%, rgba(255,154,60,.09), transparent 70%), radial-gradient(50% 60% at 100% 100%, rgba(85,183,255,.09), 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 { display: flex; height: 100%; overflow: hidden; }
#play.desk .sp.two { display: grid; }
.sp-name { font-size: 28px; }
.sp-marks { width: auto !important; min-width: 28px; background: transparent !important; gap: 3px; display: inline-flex !important; }
.sp-marks i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 13px; color: #141721; }
.sp-list.sp-goals li .sp-star { background: #262c44; color: #f2c14e; font-size: 14px; }
.sp-goals li.ok { box-shadow: inset 0 0 0 2px rgba(155,225,93,.55); }
.sp-goals li.lost { opacity: .5; }
.sp-pw .sp-dot { background: #262c44 !important; color: #fff !important; font-size: 15px !important; }
.sp-keys-card .sp-h i { width: 12px; height: 12px; border-radius: 50%; }
.sp-meter { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; color: #d9dbee; font-size: 14px; font-weight: 700; }
.sp-meter i { width: 34px; height: 12px; border-radius: 4px; display: block; }
@media (max-width: 600px) {
  .hud-row { gap: 6px; }
  #play.two .chip-t { font-size: 12.5px; padding: 2px 8px 2px 3px; gap: 4px; }
  #play.two .chip-t b, #play.two .hud-cell b { font-size: 15px; }
  #play.two .hud-cell { padding: 2px 8px; font-size: 12.5px; }
}
