/* Chai Rush — a roadside tapri at dusk on the Khel ON night look. */
:root {
  --desk: #141721; --panel: #20253a; --panel-2: #2a3049; --line: #363d5c; --ink: #f5f3ff; --muted: #a9abc6;
  --orange: #ff9a3c; --pink: #f04fa8; --violet: #8b5cf6; --teal: #2fd4c8; --acc: #ff9a3c; --gold: #ffc23d;
  --grad: linear-gradient(100deg, var(--orange), var(--pink) 50%, var(--violet));
  --display: "Outfit", "Trebuchet MS", system-ui, sans-serif; --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-x: hidden; }
body { background: var(--desk); color: var(--ink); font-family: var(--body); font-size: 16px; -webkit-tap-highlight-color: transparent; min-height: 100vh; -webkit-user-select: none; user-select: none; overflow-x: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 10px; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
p { margin: 0; }
svg { display: block; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: 999px; font-family: var(--display); font-weight: 800; font-size: 17px; color: var(--ink); white-space: nowrap; text-decoration: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(240, 79, 168, .28); }
.btn.teal { background: var(--teal); color: #08221f; }
.btn.ghost { border: 2px solid var(--line); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- day picker and stall ---------- */
.days, .stallv { max-width: 960px; margin: 0 auto; padding: 14px 16px 60px; display: flex; flex-direction: column; gap: 18px; }
.ptop { display: flex; gap: 14px; align-items: flex-start; }
.ptop h1 { font-size: clamp(26px, 4.4vw, 38px); font-weight: 800; }
.ptop .sub { color: var(--muted); font-weight: 700; margin-top: 4px; }
.back { min-height: 44px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); font-weight: 800; white-space: nowrap; }
.kind { font-size: 21px; font-weight: 800; margin: 6px 0 10px; }
.kind span { display: block; color: var(--muted); font-size: 14px; font-weight: 700; font-family: var(--body); margin-top: 2px; }
.week { margin-bottom: 18px; }
.dgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .dgrid { grid-template-columns: repeat(10, minmax(0, 1fr)); } }
.dcard { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 76px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); padding: 6px 2px; }
.dcard b { font-family: var(--display); font-size: 22px; line-height: 1; }
.dcard small { font-size: 10.5px; font-weight: 800; color: var(--muted); }
.dcard .st { font-size: 13px; letter-spacing: 1px; color: #4a5070; line-height: 1; }
.dcard .st .on { color: var(--gold); }
.dcard.next { border: 2px solid var(--orange); box-shadow: 0 0 0 3px rgba(255, 154, 60, .18); }
.dcard.locked { opacity: .42; cursor: default; }
.dcard .new { position: absolute; top: -6px; right: -4px; width: 26px; height: 26px; border-radius: 50%; background: #2a3049; border: 1px solid var(--line); }
.dcard .new svg { width: 100%; height: 100%; }
.dtop { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.tot { font-weight: 800; color: var(--gold); }
.spreview { position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 400 / 230; max-height: 340px; width: 100%; background: #2a2350; }
.spreview > svg { position: absolute; left: 0; width: 100%; }
.spreview .p-street { top: 0; height: 100%; }
.spreview .p-awn { top: 0; height: 22%; }
.spreview .p-ctr { bottom: 0; height: 17%; }
.spreview .p-stove { left: 4%; bottom: 10%; width: 22%; height: auto; }
.spreview .p-shelf { right: 4%; top: 25%; left: auto; width: 14%; }
.spreview .p-radio { right: 22%; bottom: 17%; left: auto; width: 12%; }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.names .btn { white-space: normal; min-height: 48px; font-size: 15px; }
.names .btn[aria-pressed="true"] { border-color: var(--orange); background: rgba(255, 154, 60, .14); }
.ups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.up { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); min-height: 64px; }
.up b { display: block; font-family: var(--display); font-size: 17px; }
.up small { display: block; color: var(--muted); font-weight: 700; font-size: 13px; }
.up .sw { margin-left: auto; flex: none; font-weight: 800; font-size: 13px; padding: 6px 10px; border-radius: 999px; background: #2a3049; }
.up.on .sw { background: var(--teal); color: #08221f; }
.up.locked { opacity: .5; cursor: default; }
.up .ic { flex: none; width: 48px; height: 48px; border-radius: 12px; background: #2a3049; display: grid; place-items: center; padding: 4px; }
.up .ic svg { width: 100%; height: 100%; }
.dcard small svg { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }

/* ---------- playing ---------- */
.play { --gap: 8px; max-width: 760px; margin: 0 auto; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: var(--gap); min-height: calc(100vh - var(--kd-h, 68px)); min-height: calc(100dvh - var(--kd-h, 68px)); position: relative; }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-l { display: flex; flex-direction: column; min-width: 0; }
.hud-l b { font-family: var(--display); font-size: 21px; font-weight: 800; color: var(--acc); line-height: 1.1; }
.hud-l span { color: var(--muted); font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-r { display: flex; gap: 6px; flex: none; }
.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 900; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 52px; text-align: center; }
.pill.time.low { background: #5a1f2c; border-color: #ff6b7a; color: #fff; }
.pill.score::after { content: " pts"; font-size: 12px; color: var(--muted); }
.goal { position: relative; height: 10px; border-radius: 99px; background: #2a3049; margin: 2px 8px 4px; }
.goal i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--grad); width: 0; transition: width .3s; }
.goal .gs { position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 17px; color: #4a5070; line-height: 1; text-shadow: 0 0 3px #141721; }
.goal .gs.on { color: var(--gold); }

.stall { position: relative; border-radius: 18px; overflow: hidden; height: clamp(206px, 34vh, 300px); background: #2a2350; flex: none; touch-action: manipulation; }
.stall .street { position: absolute; inset: 0; width: 100%; height: 100%; }
.stall .awn { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 34px; z-index: 3; pointer-events: none; }
.stall .ctr { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 26px; z-index: 3; pointer-events: none; }
.stall.rush::after { content: ""; position: absolute; inset: 0; background: radial-gradient(80% 70% at 50% 100%, rgba(255, 120, 40, .3), transparent 70%); pointer-events: none; z-index: 1; animation: rushglow 1s ease-in-out infinite alternate; }
@keyframes rushglow { from { opacity: .5; } to { opacity: 1; } }
.deco { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.deco .d-shelf { position: absolute; right: 3%; top: 44%; width: 15%; max-width: 76px; }
.deco .d-radio { position: absolute; left: 3%; top: 50%; width: 12%; max-width: 64px; }
.deco .notes { animation: notes 1.6s ease-in-out infinite; }
@keyframes notes { 50% { transform: translateY(-3px); opacity: .6; } }
.spots { position: absolute; left: 4px; right: 4px; top: 30px; bottom: 25px; z-index: 2; display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 4px; }
.spot { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; min-width: 0; border-radius: 14px; padding: 2px 2px 6px; transition: background .15s; }
.spot.hover, .spot:hover { background: rgba(255, 255, 255, .08); }
.spot.empty { cursor: default; background: none; }
.cust { display: flex; flex-direction: column; align-items: center; width: 100%; height: 100%; justify-content: flex-end; gap: 3px; animation: walkin .45s ease-out both; }
.cust.gone { animation: walkout .6s ease-in both; }
.cust.gone.happy { animation: walkhappy .6s ease-in both; }
@keyframes walkin { from { transform: translateX(40px); opacity: 0; } }
@keyframes walkout { to { transform: translateX(-50px); opacity: 0; } }
@keyframes walkhappy { 30% { transform: translateY(-8px); } to { transform: translate(40px, -4px); opacity: 0; } }
.bubble { position: relative; display: flex; flex-direction: column; align-items: center; background: #fffaf0; color: #2a1a12; border-radius: 12px; padding: 3px 5px 4px; width: 100%; max-width: 132px; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.bubble::after { content: ""; position: absolute; bottom: -6px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: #fffaf0; }
.bubble svg { width: 54px; height: 37px; }
.bubble span { font-weight: 900; font-size: 11.5px; line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.bubble span i { font-style: normal; color: #a0521c; }
.who { width: 100%; max-width: 92px; flex: 0 1 130px; min-height: 0; display: flex; align-items: flex-end; justify-content: center; }
.who svg { width: auto; height: 100%; max-width: 100%; max-height: 130px; }
.pat { width: 86%; max-width: 90px; height: 8px; border: 1px solid rgba(255,255,255,.35); border-radius: 9px; background: rgba(0, 0, 0, .45); overflow: hidden; flex: none; }
.pat i { display: block; height: 100%; width: 100%; border-radius: 9px; background: #52d36a; transform-origin: left; }
.cust.wrong .who { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.float { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); font-family: var(--display); font-weight: 800; font-size: 20px; color: #ffe27a; text-shadow: 0 2px 0 #6b3b1f, 0 0 10px rgba(0, 0, 0, .6); white-space: nowrap; pointer-events: none; animation: floatup 1s ease-out forwards; z-index: 5; }
.float small { display: block; font-size: 12px; color: #fff; text-align: center; }
@keyframes floatup { to { transform: translate(-50%, -46px); opacity: 0; } }
.waitn { position: absolute; right: 8px; bottom: 30px; z-index: 4; background: rgba(20, 23, 33, .85); border-radius: 999px; padding: 3px 9px; font-weight: 900; font-size: 12px; }
.rushb { position: absolute; left: 50%; top: 5px; transform: translateX(-50%); z-index: 4; background: #d61f3c; color: #fff; font-family: var(--display); font-weight: 800; font-size: 14px; padding: 4px 12px; border-radius: 999px; white-space: nowrap; animation: pulse 1s ease-in-out infinite alternate; box-shadow: 0 4px 14px rgba(214, 31, 60, .5); }
@keyframes pulse { to { transform: translateX(-50%) scale(1.06); } }
.combo { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 6; font-family: var(--display); font-weight: 800; font-size: 30px; color: #fff; text-shadow: 0 3px 0 #b03a7a, 0 0 18px rgba(240, 79, 168, .8); pointer-events: none; animation: comboin .9s ease-out forwards; white-space: nowrap; }
@keyframes comboin { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1); opacity: 0; } }
.bulb { animation: twinkle 1.4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .45; } }
.steam path { animation: steam 2.4s ease-in-out infinite; }
@keyframes steam { 50% { opacity: .2; transform: translateY(-3px); } }

.bench { display: grid; grid-template-columns: 74px 1fr 74px; align-items: center; gap: 8px; background: linear-gradient(#5a3a22, #47301e); border-radius: 18px; padding: 6px 8px; border-top: 4px solid #c98a4a; flex: none; }
.stove svg { width: 74px; height: 74px; }
.cupwrap { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.cup { width: 112px; height: 88px; flex: none; touch-action: none; cursor: grab; border-radius: 14px; }
.cup svg { width: 100%; height: 100%; }
.cup.has { animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2px); } }
.cup.lift { opacity: .35; }
.cuptxt { font-weight: 900; font-size: 13.5px; line-height: 1.2; color: #ffe9c8; min-width: 0; max-width: 110px; }
.binb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; border-radius: 14px; background: rgba(0, 0, 0, .25); font-weight: 900; font-size: 12.5px; }
.binb svg { width: 34px; height: 34px; }
.binb:disabled { opacity: .4; }
.makers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; flex: none; }
.makers.snacks { grid-template-columns: repeat(var(--sn, 4), minmax(0, 1fr)); }
@media (min-width: 700px) { .makers { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.mk { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 54px; padding: 4px 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-weight: 900; font-size: 14px; min-width: 0; transition: transform .08s, background .15s; }
.mk svg { width: 38px; height: 38px; flex: none; }
.mk span { min-width: 0; overflow-wrap: anywhere; line-height: 1.05; text-align: left; }
.mk:active { transform: scale(.95); background: var(--panel-2); }
.mk.fresh { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(47, 212, 200, .25); }
.mk.flash { background: #3a4470; }
.snacks .mk { background: #2a2540; }
.makers .mk.ph { visibility: hidden; }
.ready { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(10, 12, 22, .55); border-radius: 18px; }
.ready b { font-family: var(--display); font-size: 56px; font-weight: 800; color: #fff; text-shadow: 0 4px 0 #b03a7a, 0 0 30px rgba(255, 154, 60, .7); animation: comboin 1s ease-out both; }
.drag { position: fixed; left: 0; top: 0; width: 100px; height: 80px; z-index: 2147483200; pointer-events: none; transform: translate(-50%, -60%); filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .5)); }
.drag svg { width: 100%; height: 100%; }
body.paused .play *, body.paused .play *::after { animation-play-state: paused !important; }

/* short phones (320 x 640 and the like) */
@media (max-height: 700px) {
  .play { --gap: 6px; padding-top: 6px; }
  .stall { height: clamp(186px, 33vh, 240px); }
  .bench { padding: 3px 8px; }
  .stove svg { width: 58px; height: 58px; }
  .cup { width: 92px; height: 72px; }
  .mk { min-height: 48px; }
  .mk svg { width: 32px; height: 32px; }
  .binb { min-height: 54px; }
  .hud-l b { font-size: 19px; }
}
@media (max-width: 360px) {
  .mk { font-size: 12.5px; gap: 2px; padding: 4px 3px; }
  .mk svg { width: 30px; height: 30px; }
  .bench { grid-template-columns: 56px 1fr 60px; }
  .stove svg { width: 56px; height: 56px; }
  .cuptxt { font-size: 12.5px; }
  .bubble span { font-size: 10.5px; }
  .bubble svg { width: 46px; height: 32px; }
}
@media (min-width: 900px) { .stall { height: clamp(240px, 38vh, 330px); } }
@media (min-height: 900px) and (min-width: 600px) { .stall { height: clamp(300px, 40vh, 420px); } .who svg { max-height: 170px; } .who { flex-basis: 170px; max-width: 120px; } }
.float.sad { top: 58%; color: #ffb4c0; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 2147483000; background: rgba(8, 10, 18, .72); display: grid; place-items: center; padding: 14px; }
.box { width: min(480px, 100%); max-height: calc(100vh - 28px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.box h2 { font-size: 25px; font-weight: 800; }
.box h3 { font-size: 18px; }
.box p { color: #d2d1e8; line-height: 1.5; }
.box .small, .small { font-size: 13px; color: var(--muted); }
.box .kick { color: var(--acc); font-weight: 800; font-size: 14px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; }
.btns.col { flex-direction: column; align-items: stretch; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; color: #d2d1e8; }
.newitems { display: flex; flex-direction: column; gap: 8px; }
.newitem { display: flex; gap: 10px; align-items: center; background: #2a3049; border-radius: 14px; padding: 8px 10px; }
.newitem svg { width: 46px; height: 46px; flex: none; }
.newitem b { display: block; font-family: var(--display); }
.newitem small { color: var(--muted); font-weight: 700; }
.box.win { text-align: center; }
.win-stars { display: flex; justify-content: center; gap: 8px; font-size: 52px; line-height: 1; }
.win-stars span { color: #3a4060; }
.win-stars span.on { color: var(--gold); animation: starin .5s cubic-bezier(.2, 1.6, .4, 1) both; text-shadow: 0 0 20px rgba(255, 194, 61, .5); }
@keyframes starin { from { transform: scale(0) rotate(-40deg); } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: #2a3049; border-radius: 14px; padding: 8px 4px; }
.stats b { display: block; font-family: var(--display); font-size: 22px; }
.stats small { color: var(--muted); font-weight: 800; font-size: 12px; }
.card-text { white-space: pre-wrap; background: #141721; border: 1px solid var(--line); border-radius: 14px; padding: 12px; font: 700 14px/1.5 var(--body); color: #f5f3ff; margin: 0; text-align: left; -webkit-user-select: text; user-select: text; }
.unlock { background: linear-gradient(100deg, rgba(47, 212, 200, .2), rgba(139, 92, 246, .2)); border: 1px solid var(--teal); border-radius: 14px; padding: 10px; font-weight: 800; }
.toast { position: fixed; left: 50%; bottom: calc(var(--kd-h, 0px) + 18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 2147483100; background: #f5f3ff; color: #141721; font-weight: 800; padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); max-width: calc(100vw - 32px); text-align: center; pointer-events: none; }
body.playing .toast { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 104px); }
@media (max-width: 640px) { .scrim { align-items: end; padding: 0; } .box { width: 100%; border-radius: 24px 24px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .float { display: none; }
}
@media (max-width: 520px) {
  .makers .mk { flex-direction: column; gap: 1px; min-height: 58px; padding: 4px 2px; }
  .makers .mk span { text-align: center; font-size: 12.5px; }
  .makers .mk svg { width: 32px; height: 32px; }
}
@media (max-width: 520px) and (max-height: 700px) { .makers .mk { min-height: 50px; } .makers .mk svg { width: 26px; height: 26px; } }
