/* Ghee Kahan Hai?: warm ghee colours, a cream paper for cards, Pappu Dairy red. */
:root {
  --bg: #2a1606; --slate: rgba(40, 24, 10, .94); --slate2: #3a2410; --ink: #fff6dc; --dim: rgba(255, 246, 220, .68); --line: rgba(255, 246, 220, .2);
  --paper: #fff3d6; --ghee: #ffcf33; --red: #c62828; --maroon: #7a1f0e; --green: #7ed36b; --blue: #4fb3ff; --pink: #ff7ab6; --gold: #ffcf33;
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --f: 'Nunito', system-ui, sans-serif; --hand: 'Chalkboard SE', 'Chalkboard', 'Comic Sans MS', 'Nunito', cursive;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--f); -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button { font-family: inherit; color: inherit; cursor: pointer; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
kbd { display: inline-block; padding: 0 5px; border: 1px solid rgba(255,255,255,.4); border-bottom-width: 2px; border-radius: 4px; background: rgba(255,255,255,.1); font: 700 12px/1.5 var(--f); }
body.touch .key-only, body:not(.touch) .touch-only { display: none !important; }
#loading { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; background: var(--bg); z-index: 50; transition: opacity .5s; }
#loading b { font: 900 34px var(--f); letter-spacing: .1em; color: var(--ghee); }
#loading span { font: 16px var(--hand); color: var(--dim); }
#loading.gone { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.h-left { position: absolute; left: calc(12px + var(--sl)); top: calc(10px + var(--st)); display: flex; gap: 8px; align-items: flex-start; }
.h-card { background: var(--slate); border-radius: 12px; padding: 5px 12px 6px; box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 0 0 1px var(--line); text-shadow: none; display: flex; flex-direction: column; min-width: 84px; }
.h-card small { font-size: 10px; letter-spacing: .16em; color: var(--dim); font-weight: 800; }
.h-card b { font: 900 24px var(--f); font-variant-numeric: tabular-nums; line-height: 1.05; color: var(--ghee); }
.h-card.tubs { flex-direction: row; align-items: center; gap: 6px; min-width: 0; }
.h-card.tubs b { color: var(--ink); }
.h-card.tubs.low b { color: #ff8a80; animation: blinkr .5s infinite; }
.tubicon { width: 18px; height: 20px; border-radius: 3px 3px 6px 6px; background: linear-gradient(#c62828 0 18%, #fff3d6 18% 55%, #ffcf33 55% 72%, #fff3d6 72%); display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.h-combo { align-self: center; font: 900 18px var(--f); color: #fff; background: linear-gradient(135deg, #ff5a1f, #ffcf33); border-radius: 10px; padding: 3px 10px; opacity: 0; transform: scale(.7); transition: opacity .2s, transform .2s; text-shadow: 0 1px 0 rgba(0,0,0,.3); }
.h-combo.on { opacity: 1; transform: scale(1); }
.h-mid { position: absolute; left: 50%; top: calc(10px + var(--st)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.h-next { background: var(--paper); color: #2a1606; border-radius: 14px; padding: 5px 14px 5px 8px; display: flex; align-items: center; gap: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.35); text-shadow: none; max-width: 46vw; }
.h-next .arrow { width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font: 900 18px var(--f); flex: none; transition: transform .2s; }
.h-next b { font: 900 15px var(--f); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-next small { font-size: 12px; color: #6b4a2a; font-weight: 700; white-space: nowrap; }
.h-next.close { animation: pulse .6s infinite; }
.h-next.close .arrow { background: #2e7d32; }
.h-clock { background: var(--slate); border-radius: 14px; padding: 2px 16px 4px; text-align: center; box-shadow: inset 0 0 0 1px var(--line); }
.h-clock b { font: 900 34px var(--f); font-variant-numeric: tabular-nums; color: #fff; line-height: 1; }
.h-clock small { display: block; font-size: 9px; letter-spacing: .2em; color: var(--dim); }
.h-clock.low b { color: #ff6b5a; animation: blinkr .5s infinite; }
.h-clock.add b { color: var(--green); }
.h-route { width: 220px; height: 6px; border-radius: 3px; background: rgba(0,0,0,.35); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); position: relative; }
.h-route i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ghee); border-radius: 3px; }
.h-route em { position: absolute; top: -2px; width: 4px; height: 10px; margin-left: -2px; border-radius: 2px; background: #fff; }
.h-route em.done { background: var(--green); } .h-route em.miss { background: #ff6b5a; }
.h-right { position: absolute; right: calc(12px + var(--sr)); top: calc(10px + var(--st)); display: flex; gap: 8px; align-items: center; }
.h-speed { text-align: right; } .h-speed b { font: 900 26px var(--f); font-variant-numeric: tabular-nums; } .h-speed small { display: block; font-size: 10px; color: var(--dim); letter-spacing: .1em; margin-top: -4px; }
.hbtn { pointer-events: auto; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--slate); color: var(--ink); font-size: 15px; flex: none; }
#wobble { position: absolute; left: calc(14px + var(--sl)); top: calc(76px + var(--st)); width: 96px; text-align: center; }
#wobble small { font-size: 10px; letter-spacing: .18em; color: var(--dim); font-weight: 800; }
.w-arc { position: relative; width: 96px; height: 50px; border-radius: 96px 96px 0 0; overflow: hidden;
  background: conic-gradient(from -90deg at 50% 100%, #e53935 0 18deg, #ffb300 18deg 40deg, #7ed36b 40deg 140deg, #ffb300 140deg 162deg, #e53935 162deg 180deg, transparent 180deg); box-shadow: inset 0 0 0 2px rgba(0,0,0,.3); }
.w-arc::after { content: ''; position: absolute; left: 14px; right: 14px; top: 14px; bottom: -36px; border-radius: 50%; background: rgba(40, 24, 10, .9); }
.w-arc i { position: absolute; left: 50%; bottom: 0; width: 4px; height: 44px; margin-left: -2px; background: #fff; border-radius: 2px; transform-origin: 50% 100%; z-index: 1; box-shadow: 0 0 6px rgba(0,0,0,.6); }
#wobble.warn .w-arc { animation: shake .15s infinite; }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
#shout { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); text-align: center; pointer-events: none; }
#shout .s { display: block; font: 900 30px var(--f); color: #fff; -webkit-text-stroke: 1px rgba(0,0,0,.35); text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.4); animation: shout 1.2s ease-out forwards; white-space: nowrap; }
#shout .s.big { font-size: 46px; color: var(--ghee); }
#shout .s.bad { color: #ff8a80; }
#shout .s.good { color: #b9f6a0; }
#shout .s small { display: block; font: 700 16px var(--hand); color: #fff; -webkit-text-stroke: 0; }
@keyframes shout { 0% { transform: translateY(14px) scale(.6); opacity: 0; } 14% { transform: translateY(0) scale(1.08); opacity: 1; } 24% { transform: scale(1); } 80% { opacity: 1; } 100% { transform: translateY(-30px); opacity: 0; } }
#toast { position: absolute; left: 50%; bottom: calc(18px + var(--sb)); transform: translate(-50%, 20px); display: flex; align-items: center; gap: 10px; background: var(--paper); color: #2a1606; border-radius: 40px 16px 16px 40px; padding: 5px 16px 5px 5px; max-width: min(560px, 64vw); opacity: 0; transition: opacity .25s, transform .25s; text-shadow: none; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast img { width: 44px; height: 44px; border-radius: 50%; background: var(--slate2); object-fit: cover; }
#toast img[src=""] { display: none; }
#toast b { font: 900 13px var(--f); letter-spacing: .04em; }
#toast p { margin: 0; font: 15px/1.3 var(--hand); }
body.touch #toast { bottom: auto; top: calc(66px + var(--st)); }
#power { position: absolute; left: calc(14px + var(--sl)); top: calc(150px + var(--st)); display: flex; flex-direction: column; gap: 6px; }
#power .pw { background: var(--slate); border-radius: 10px; padding: 4px 10px; font: 800 13px var(--f); box-shadow: inset 0 0 0 1px var(--line); position: relative; overflow: hidden; }
#power .pw i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--ghee); }
#keys { position: absolute; right: calc(14px + var(--sr)); bottom: calc(12px + var(--sb)); font-size: 12px; color: var(--dim); }

/* ---------------------------------------------------------------- touch controls */
#touchui { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
#steerpad { position: absolute; left: 0; top: 30%; bottom: 0; width: 58%; pointer-events: auto; touch-action: none; }
.sp-track { position: absolute; left: calc(24px + var(--sl)); bottom: calc(26px + var(--sb)); width: 210px; height: 14px; border-radius: 7px; background: rgba(40,24,10,.55); border: 2px solid rgba(255,255,255,.35); }
.sp-track i { position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff3a8, #ffcf33 70%); box-shadow: 0 2px 8px rgba(0,0,0,.45); transition: left .05s; }
#steerpad span { position: absolute; left: calc(24px + var(--sl)); bottom: calc(50px + var(--sb)); width: 210px; text-align: center; font-size: 10px; font-weight: 800; letter-spacing: .16em; color: rgba(255,255,255,.7); }
#steerpad.on .sp-track { border-color: var(--ghee); }
#steerpad.used span { opacity: 0; transition: opacity 1s; }
.tb { position: absolute; pointer-events: auto; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); background: rgba(40, 24, 10, .55); color: #fff; font: 900 18px var(--f); display: grid; place-items: center; line-height: 1; touch-action: none; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.tb span { display: block; font-size: 9px; letter-spacing: .14em; margin-top: 2px; font-weight: 800; }
.tb:active, .tb.on { background: rgba(255,255,255,.35); }
#t-brake { right: calc(20px + var(--sr)); bottom: calc(20px + var(--sb)); width: 104px; height: 104px; font-size: 18px; border-color: #ff8a80; background: rgba(198, 40, 40, .5); }
#t-brake.on { background: rgba(255, 82, 82, .85); }
#t-horn { right: calc(138px + var(--sr)); bottom: calc(26px + var(--sb)); width: 64px; height: 64px; font-size: 22px; }
@media (max-height: 360px) { #t-brake { width: 86px; height: 86px; } #t-horn { width: 54px; height: 54px; right: calc(118px + var(--sr)); } .sp-track { width: 170px; } #steerpad span { width: 170px; } }

/* the doorstep card */
#door { position: fixed; z-index: 8; left: 50%; bottom: calc(14px + var(--sb)); transform: translateX(-50%); width: min(560px, calc(100vw - 24px - var(--sl) - var(--sr))); background: var(--paper); color: #2a1606; border-radius: 18px; padding: 10px 14px 10px 10px; display: flex; gap: 12px; align-items: flex-start; box-shadow: 0 14px 40px rgba(0,0,0,.5); animation: up .3s cubic-bezier(.2, 1.2, .4, 1); pointer-events: auto; }
@keyframes up { from { transform: translate(-50%, 30px); opacity: 0; } }
#door img { width: 72px; height: 72px; border-radius: 50%; background: #e8d9b8; flex: none; object-fit: cover; }
#door .d-body { flex: 1; min-width: 0; }
#door b { font: 900 16px var(--f); }
#door p { margin: 2px 0 4px; font: 17px/1.3 var(--hand); }
.d-paid { font: 800 13px var(--f); color: #2e7d32; }
.d-paid .bad { color: #c62828; }
.d-choices { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.d-choices button { border: 0; border-radius: 12px; padding: 9px 14px; font: 800 14px var(--f); background: #2a1606; color: var(--paper); flex: 1 1 180px; text-align: left; }
.d-choices button:nth-child(2) { background: #7a5a3a; }
.d-choices .timer { flex-basis: 100%; height: 3px; border-radius: 2px; background: rgba(0,0,0,.12); overflow: hidden; }
.d-choices .timer i { display: block; height: 100%; background: var(--red); animation: drain linear forwards; }
@keyframes drain { from { width: 100%; } to { width: 0; } }
#rotate { display: none; }
@media (orientation: portrait) {
  body.touch.playing #rotate { display: flex; position: fixed; inset: 0; z-index: 60; background: var(--bg); flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 30px; }
  #rotate b { font-size: 60px; animation: spin 2s infinite; }
}
@keyframes spin { 50% { transform: rotate(90deg); } }
@keyframes pulse { 50% { transform: scale(1.05); } }
@keyframes blinkr { 50% { opacity: .5; } }

/* ---------------------------------------------------------------- screens */
#ui { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.screen { display: none; position: absolute; inset: 0; pointer-events: auto; overflow-y: auto; padding: calc(16px + var(--st)) calc(18px + var(--sr)) calc(16px + var(--sb)) calc(18px + var(--sl)); }
.screen.on { display: flex; }
#title { background: linear-gradient(90deg, rgba(42, 22, 6, .94) 0%, rgba(42, 22, 6, .74) 42%, rgba(42, 22, 6, 0) 70%); gap: 24px; align-items: safe center; justify-content: space-between; }
.t-main { max-width: 540px; display: flex; flex-direction: column; gap: 10px; }
.kicker { margin: 0; font: 15px var(--hand); color: var(--ghee); }
.logo { margin: 0; line-height: .88; display: flex; flex-direction: column; }
.logo span { font: 900 82px var(--f); letter-spacing: .02em; color: var(--ghee); text-shadow: 0 4px 0 #8a4b00, 0 10px 26px rgba(0,0,0,.5); }
.logo span:last-child { color: var(--paper); font-size: 50px; letter-spacing: .06em; text-shadow: 0 4px 0 var(--maroon), 0 10px 26px rgba(0,0,0,.5); }
.lead { margin: 0; font-size: 15.5px; line-height: 1.5; color: rgba(255, 246, 220, .9); }
.counter { margin: 0; font: 15px var(--hand); color: var(--ghee); }
.counter:empty { display: none; }
.challenge:empty { display: none; }
.challenge { background: rgba(255, 207, 51, .15); border: 1px solid var(--ghee); border-radius: 10px; padding: 8px 12px; font-size: 15px; }
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu .row { display: flex; gap: 8px; flex-wrap: wrap; }
.menu button, .buttons button, .ghost { border: 1px solid var(--line); background: rgba(255,255,255,.07); border-radius: 14px; padding: 10px 18px; font-size: 15px; font-weight: 700; }
.menu button:hover, .buttons button:hover { background: rgba(255,255,255,.15); }
.menu .row button { flex: 1; display: flex; flex-direction: column; align-items: flex-start; }
.menu .row button small { font: 12.5px var(--hand); color: var(--dim); font-weight: 400; }
button.primary { background: var(--paper) !important; color: #2a1606 !important; font-weight: 900; font-size: 20px !important; border: 0 !important; padding: 12px 22px !important; box-shadow: 0 4px 0 #b8a073; text-align: left; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
button.primary small { font: 14px var(--hand); color: #7a5a3a; }
button.primary.alt { background: var(--ghee) !important; color: #2a1606 !important; box-shadow: 0 4px 0 #a37a00; }
button.primary.alt small { color: #5a3a00; }
button.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #b8a073; }
button.primary.big { font-size: 22px !important; padding: 14px 28px !important; }
.menu button.daily { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-color: rgba(126, 211, 107, .5); background: rgba(126, 211, 107, .1); font-size: 17px; font-weight: 900; }
.menu button.daily small { font: 13px var(--hand); color: var(--dim); font-weight: 400; }
.menu button.daily.done { opacity: .85; }
.list { background: rgba(255, 246, 220, .07); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: 13px; }
.list:empty { display: none; }
.list h5 { margin: 0 0 4px; font-size: 12px; letter-spacing: .12em; color: var(--ghee); display: flex; justify-content: space-between; }
.list ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.list li { display: flex; gap: 8px; align-items: center; }
.list li i { flex: none; width: 16px; height: 16px; border-radius: 5px; border: 2px solid var(--line); font-style: normal; font-size: 11px; display: grid; place-items: center; }
.list li.ok i { background: var(--green); border-color: var(--green); color: #1a2e14; }
.list li u { margin-left: auto; text-decoration: none; color: var(--dim); font-variant-numeric: tabular-nums; }
.disclaimer { margin: 0; font-size: 11.5px; line-height: 1.45; color: rgba(255,246,220,.5); }
.disclaimer a { color: inherit; }
.t-side { width: 300px; flex: none; display: flex; flex-direction: column; gap: 10px; align-self: center; }
.sheet { margin: auto; background: var(--slate); border-radius: 18px; padding: 18px 20px; width: 100%; box-shadow: 0 16px 40px rgba(0,0,0,.45), inset 0 0 0 1px var(--line); backdrop-filter: blur(6px); }
.sheet.narrow { max-width: 460px; } .sheet.wide { max-width: 980px; }
.sheet header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.sheet header h2 { margin: 0 auto 0 0; font: 900 24px var(--f); letter-spacing: .02em; }
.sheet header h2 small { font: 700 15px var(--f); color: var(--ghee); margin-left: 8px; }
.hdr-btns { display: flex; gap: 6px; }
.sheet h3 { font: 900 17px var(--f); margin: 14px 0 6px; }
.sub { margin: 0 0 12px; color: var(--dim); font-size: 14px; line-height: 1.45; }
.ghost { padding: 7px 14px !important; font-size: 13px !important; }
#pause, #settings, #help, #end, #story, #load, #garage, #clues, #chirpi, #vote, #tiffin, #post { background: rgba(20, 10, 2, .58); }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.buttons .primary { text-align: center; justify-content: center; }

/* story */
.acts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.acts button { border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 14px; font: 800 14px var(--f); text-align: left; }
.acts button small { display: block; font: 12px var(--hand); color: var(--dim); font-weight: 400; }
.acts button.on { background: var(--paper); color: #2a1606; } .acts button.on small { color: #7a5a3a; }
.acts button.locked { opacity: .55; }
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.ep { border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px 12px; text-align: left; display: flex; flex-direction: column; gap: 3px; min-height: 92px; }
.ep b { font: 900 15px var(--f); } .ep small { color: var(--dim); font-size: 12px; } .ep em { font-style: normal; color: var(--ghee); letter-spacing: 2px; font-size: 16px; }
.ep.next { border-color: var(--ghee); box-shadow: inset 0 0 0 1px var(--ghee); background: rgba(255, 207, 51, .1); }
.ep.locked { opacity: .45; cursor: default; }
.ep .num { font-size: 11px; letter-spacing: .14em; color: var(--dim); font-weight: 800; }
.gate { grid-column: 1 / -1; border: 1px dashed var(--ghee); border-radius: 14px; padding: 12px 14px; background: rgba(255, 207, 51, .08); font-size: 14px; line-height: 1.5; }
.gate b { color: var(--ghee); font-size: 22px; font-variant-numeric: tabular-nums; }

/* load screen */
.ld-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.orders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.orders li { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06); border-radius: 12px; padding: 6px 10px; }
.orders img, .orders .av { width: 38px; height: 38px; border-radius: 50%; background: var(--slate2); object-fit: cover; flex: none; display: grid; place-items: center; font-size: 20px; }
.orders b { font-size: 14px; } .orders small { display: block; color: var(--dim); font-size: 12px; }
.orders u { margin-left: auto; text-decoration: none; font: 900 16px var(--f); color: var(--ghee); white-space: nowrap; }
.ld-load { background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px 14px; }
.ld-load label { font-weight: 800; font-size: 15px; } .ld-load label b { color: var(--ghee); font-size: 20px; }
.ld-load span { font: 13px var(--hand); margin-left: 6px; }
.ld-load input { width: 100%; margin: 10px 0 4px; accent-color: var(--ghee); height: 28px; }
.stars { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.stars li::before { content: '☆ '; color: var(--ghee); } .stars li.ok::before { content: '★ '; }

/* dialogue */
#scene { background: linear-gradient(0deg, rgba(20, 10, 2, .82), rgba(20, 10, 2, .1) 60%); flex-direction: column; justify-content: flex-end; align-items: center; gap: 10px; }
.sc-title { font: 900 13px var(--f); letter-spacing: .18em; color: var(--ghee); text-transform: uppercase; }
.sc-title:empty { display: none; }
.sc-bub { width: min(720px, 100%); background: var(--paper); color: #2a1606; border-radius: 20px; padding: 12px 18px 12px 12px; display: flex; gap: 14px; align-items: center; box-shadow: 0 14px 40px rgba(0,0,0,.5); min-height: 96px; }
.sc-bub img { width: 84px; height: 84px; border-radius: 50%; background: #e8d9b8; flex: none; object-fit: cover; }
.sc-bub img.none { display: none; }
.sc-bub b { font: 900 15px var(--f); letter-spacing: .04em; } .sc-bub b small { font-weight: 600; color: #7a5a3a; margin-left: 6px; font-size: 12px; }
.sc-bub p { margin: 4px 0 0; font: 19px/1.38 var(--hand); }
.sc-bub.phone { background: #1f2933; color: #e8eef3; } .sc-bub.phone b small { color: #9fb0bf; }
.sc-bar { display: flex; gap: 10px; align-items: center; width: min(720px, 100%); }
.sc-dots { margin-right: auto; color: var(--dim); font-size: 12px; letter-spacing: .1em; }
.sc-next { border: 0; border-radius: 14px; background: var(--ghee); color: #2a1606; font: 900 20px var(--f); padding: 8px 22px; }

/* posts */
.post { background: #fff; color: #14171a; border-radius: 16px; padding: 14px; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; }
.post .ph { display: flex; gap: 10px; align-items: center; }
.post .ph img { width: 44px; height: 44px; border-radius: 50%; background: #ddd; object-fit: cover; }
.post .ph b { font-size: 15px; } .post .ph b i { color: #1d9bf0; font-style: normal; margin-left: 2px; } .post .ph small { display: block; color: #657786; font-size: 13px; }
.post p { margin: 10px 0; font-size: 17px; line-height: 1.4; }
.post .pm { color: #657786; font-size: 13px; display: flex; gap: 16px; }
.post .pr { margin-top: 10px; border-top: 1px solid #e6ecf0; padding-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.post .pr span { color: #14171a; } .post .pr span b { color: #657786; font-weight: 600; margin-right: 6px; }
.post .brand { float: right; font-weight: 900; color: #1d9bf0; font-size: 13px; }
.feed { display: flex; flex-direction: column; gap: 10px; }

/* end */
.end-top { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.end-why { margin: 0; font: 15px var(--hand); color: var(--ghee); }
.end-big { font: 900 52px var(--f); line-height: 1; margin: 4px 0; color: var(--ghee); font-variant-numeric: tabular-nums; }
.end-rank { font: 800 16px var(--f); }
.end-stars { font-size: 34px; letter-spacing: 6px; color: var(--ghee); margin: 4px 0; }
.end-stars .off { color: rgba(255,255,255,.2); }
.end-best { display: inline-block; background: var(--green); color: #1a2e14; font: 900 13px var(--f); border-radius: 8px; padding: 2px 8px; margin-top: 4px; }
.bd { width: 100%; border-collapse: collapse; font-size: 14px; }
.bd td { padding: 3px 0; border-bottom: 1px solid var(--line); } .bd td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; }
.bd tr.neg td:last-child { color: #ff8a80; }
.bd tr.tot td { font-weight: 900; color: var(--ghee); border-bottom: 0; font-size: 16px; }
.emo { font-size: 22px; letter-spacing: 2px; margin: 6px 0; }
.goals { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.goals li::before { content: '☆ '; color: rgba(255,255,255,.4); } .goals li.ok::before { content: '★ '; color: var(--ghee); }
.misup { margin-top: 10px; background: rgba(126, 211, 107, .12); border: 1px solid rgba(126, 211, 107, .4); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.misup b { color: var(--green); }
.cliff { margin-top: 10px; background: rgba(255, 207, 51, .1); border: 1px dashed var(--ghee); border-radius: 12px; padding: 10px 12px; font: 16px/1.4 var(--hand); }
.e-board { margin: 10px 0 0; font-size: 14px; color: var(--dim); }
.e-board:empty { display: none; }
.reel { display: flex; gap: 10px; align-items: center; background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045); border-radius: 14px; padding: 8px 12px; margin-top: 10px; color: #fff; }
.reel b { font-size: 14px; } .reel small { display: block; font-size: 12px; opacity: .9; }
.reel i { font-style: normal; font-size: 26px; }

/* garage */
.garage { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.up { background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.up b { font-size: 15px; } .up small { color: var(--dim); font-size: 12.5px; }
.pips { display: flex; gap: 4px; } .pips i { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); } .pips i.on { background: var(--ghee); }
.up button { margin-top: 4px; border: 0; border-radius: 10px; padding: 8px 10px; font: 900 14px var(--f); background: var(--ghee); color: #2a1606; }
.up button:disabled { background: rgba(255,255,255,.12); color: var(--dim); cursor: default; }
.skins { display: flex; gap: 8px; flex-wrap: wrap; }
.skin { border: 2px solid transparent; background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; font-size: 13px; text-align: left; }
.skin i { width: 26px; height: 26px; border-radius: 50%; flex: none; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.skin.on { border-color: var(--ghee); }
.skin small { display: block; color: var(--dim); font-size: 11.5px; }

/* clues, suspects, tiffin */
.clues { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.clue { background: #f3e2b8; color: #2a1606; border-radius: 4px; padding: 12px 14px; box-shadow: 0 6px 14px rgba(0,0,0,.35); transform: rotate(var(--r, -1deg)); font: 15px/1.4 var(--hand); }
.clue b { display: block; font: 900 14px var(--f); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.clue.lock { background: rgba(255,255,255,.08); color: var(--dim); }
.suspects { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.suspect { border: 2px solid var(--line); background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.suspect img { width: 72px; height: 72px; border-radius: 50%; background: var(--slate2); object-fit: cover; }
.suspect .cat { width: 72px; height: 72px; border-radius: 50%; background: #ffcc80; display: grid; place-items: center; font-size: 40px; }
.suspect b { font-size: 15px; } .suspect small { color: var(--dim); font-size: 12.5px; }
.suspect:hover { border-color: var(--ghee); }
.tiffin { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.tf { border-radius: 10px; background: rgba(255,255,255,.06); padding: 6px 2px; text-align: center; font-size: 11px; display: flex; flex-direction: column; gap: 2px; align-items: center; }
.tf i { font-style: normal; font-size: 20px; } .tf b { font-size: 12px; }
.tf.got { background: rgba(126, 211, 107, .18); } .tf.today { box-shadow: inset 0 0 0 2px var(--ghee); }

/* settings, help */
.set { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center; font-size: 15px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 14px; font-size: 14px; font-weight: 800; color: var(--dim); }
.seg button.on { background: var(--paper); color: #2a1606; }
.set input[type=range] { width: 150px; accent-color: var(--ghee); }
.help { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; font-size: 14px; line-height: 1.55; }
.help h4 { margin: 0 0 6px; font-size: 16px; color: var(--ghee); }
.help p { margin: 0 0 8px; }
.rules { margin: 0; padding-left: 18px; }
.rules li { margin-bottom: 4px; }

/* phones and short landscape screens */
@media (max-width: 860px) {
  .t-side { display: none; }
  .help { grid-template-columns: 1fr; }
}
@media (max-width: 600px) { .ld-grid, .end-top { grid-template-columns: 1fr; } }
@media (max-height: 500px) {
  .logo span { font-size: 48px; } .logo span:last-child { font-size: 30px; }
  .lead { font-size: 13px; line-height: 1.4; }
  .t-main { gap: 7px; }
  button.primary { font-size: 17px !important; padding: 8px 16px !important; }
  .menu button, .buttons button { padding: 7px 12px; font-size: 14px; }
  .menu { gap: 6px; }
  .sheet { padding: 12px 14px; }
  .sheet header h2 { font-size: 20px; }
  .h-card b { font-size: 19px; } .h-card { min-width: 70px; padding: 4px 9px; }
  #wobble { top: calc(62px + var(--st)); transform: scale(.85); transform-origin: left top; }
  .h-route { width: 160px; }
  .h-clock b { font-size: 26px; }
  .sc-bub { min-height: 0; padding: 8px 14px 8px 8px; } .sc-bub img { width: 58px; height: 58px; } .sc-bub p { font-size: 16px; }
  #door img { width: 54px; height: 54px; } #door p { font-size: 15px; } .d-choices button { padding: 7px 10px; font-size: 13px; }
  .end-big { font-size: 38px; }
  .eps { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; } .ep { min-height: 0; padding: 7px 10px; }
  .list { display: none; }
  .orders { gap: 3px; } .orders li { padding: 3px 8px; } .orders img, .orders .av { width: 28px; height: 28px; font-size: 15px; } .orders small { display: none; }
  #load .buttons { position: sticky; bottom: -12px; margin: 8px -14px -12px; padding: 8px 14px 12px; background: linear-gradient(transparent, var(--slate) 30%); }
  .ld-load { padding: 6px 12px; } .stars { margin-top: 6px; gap: 2px; font-size: 13px; }
  #power { top: calc(124px + var(--st)); }
}
@media (max-height: 340px) {
  .lead { display: none; }
  .h-next { padding: 3px 10px 3px 5px; } .h-next .arrow { width: 24px; height: 24px; font-size: 14px; }
}
body.touch #keys { display: none; }
/* phone: keep the road clear; next stop, route and task stack down the right edge, the clock sits in the top-right row */
@media (max-height: 500px) {
  body.touch .h-mid { left: auto; right: calc(12px + var(--sr)); top: calc(62px + var(--st)); transform: none; align-items: flex-end; gap: 5px; }
  body.touch .h-next { max-width: 34vw; padding: 3px 10px 3px 5px; } body.touch .h-next .arrow { width: 24px; height: 24px; font-size: 14px; }
  body.touch .h-next b { font-size: 13px; } body.touch .h-next small { font-size: 11px; white-space: normal; display: block; line-height: 1.15; }
  body.touch .h-route { width: min(160px, 30vw); }
  body.touch .h-task { min-width: 0; width: min(200px, 30vw); }
  body.touch .h-clock { padding: 2px 10px 3px; } body.touch .h-clock b { font-size: 22px; } body.touch .h-clock small { font-size: 7px; }
  body.touch #h-new { left: calc(112px + var(--sl)); top: calc(62px + var(--st)); width: min(300px, 34vw); transform: translateY(-8px); text-align: left; padding: 8px 12px 10px; }
  body.touch #h-new.on { transform: none; }
  body.touch #h-hint { left: calc(112px + var(--sl)); top: calc(62px + var(--st)); transform: none; max-width: 34vw; text-align: left; font-size: 12px; padding: 6px 10px; }
}
body.touch.playing #door { bottom: auto; top: calc(10px + var(--st)); }
body.atdoor .h-mid, body.atdoor #power { visibility: hidden; }
body.touch.atdoor .h-left, body.touch.atdoor #wobble { visibility: hidden; }
body.touch.atdoor #touchui { visibility: hidden; }

/* ------------------------------------------------------------------ gears, money pops, the first-shift hint */
.h-gear { position: relative; background: var(--slate); border-radius: 12px; padding: 4px 10px 8px; box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 0 0 1px var(--line); text-align: center; min-width: 52px; transition: transform .12s; }
.h-gear small { display: block; font-size: 9px; letter-spacing: .16em; color: var(--dim); font-weight: 800; }
.h-gear b { font: 900 26px var(--f); line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.h-gear .rev { position: absolute; left: 8px; right: 8px; bottom: 4px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; }
.h-gear .rev u { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ghee); }
.h-gear .rev::after { content: ''; position: absolute; left: 85%; right: 0; top: 0; bottom: 0; background: rgba(126, 211, 107, .35); }
.h-gear.shift { box-shadow: 0 0 0 2px #7ed36b, 0 0 18px rgba(126, 211, 107, .7); }
.h-gear.shift .rev u { background: #7ed36b; }
.h-gear.shift b { color: #b9f6a0; }
.h-gear.kick { transform: scale(1.14); }
.h-gear.auto small::after { content: ' AUTO'; }
#h-money { position: relative; transition: box-shadow .2s; }
#h-money.up { box-shadow: 0 0 0 2px #7ed36b, 0 6px 18px rgba(0,0,0,.35); }
#h-money.up b { color: #b9f6a0; }
#h-money.down { box-shadow: 0 0 0 2px #ff8a80, 0 6px 18px rgba(0,0,0,.35); }
#h-money.down b { color: #ff8a80; }
#pops { position: absolute; left: 96px; top: 100%; margin-top: 6px; width: 200px; height: 0; pointer-events: none; }
#pops .pop { position: absolute; left: 0; top: 0; white-space: nowrap; font: 900 17px var(--f); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.45), 0 0 10px rgba(0,0,0,.4); animation: moneypop 1.25s ease-out forwards; }
#pops .pop.good, #pops .pop.coin { color: #b9f6a0; }
#pops .pop.ride { color: #ffe082; font-size: 14px; }
#pops .pop.bad { color: #ff8a80; }
#pops .pop.big { color: var(--ghee); font-size: 30px; }
@keyframes moneypop { 0% { opacity: 0; transform: translateY(14px) scale(.8); } 15% { opacity: 1; transform: translateY(0) scale(1.06); } 70% { opacity: 1; transform: translateY(-8px) scale(1); } 100% { opacity: 0; transform: translateY(-26px); } }
#h-hint { position: absolute; left: 50%; bottom: calc(14px + var(--sb)); transform: translateX(-50%); max-width: min(560px, 70vw); text-align: center; background: rgba(24,18,12,.82); color: #fff; border-radius: 12px; padding: 7px 14px; font: 800 13px var(--f); box-shadow: inset 0 0 0 1px var(--line); opacity: 0; transition: opacity .6s; pointer-events: none; }
#h-hint.on { opacity: 1; }
body.touch #h-hint { bottom: auto; top: calc(110px + var(--st)); }
#t-gear { right: calc(138px + var(--sr)); bottom: calc(22px + var(--sb)); width: 84px; height: 84px; border-color: #ffd23f; background: rgba(120, 90, 10, .5); }
#t-gear b { font: 900 26px var(--f); line-height: 1; }
#t-gear.ready { background: rgba(76, 175, 80, .75); border-color: #b9f6a0; animation: gearglow .5s infinite alternate; }
#t-gear.on { transform: scale(.92); }
#t-gear.hidden { display: none; }
@keyframes gearglow { to { box-shadow: 0 0 22px rgba(126, 211, 107, .9); } }
#t-horn { right: calc(34px + var(--sr)); bottom: calc(136px + var(--sb)); }
@media (max-height: 360px) { #t-gear { width: 70px; height: 70px; right: calc(116px + var(--sr)); } #t-horn { right: calc(30px + var(--sr)); bottom: calc(116px + var(--sb)); } .h-gear b { font-size: 21px; } }
@media (max-height: 280px) { #t-horn { right: calc(196px + var(--sr)); bottom: calc(22px + var(--sb)); } }

/* ------------------------------------------------------------------ the episode's twist: the NEW card, the task bar, the rival on the route */
#h-new { position: absolute; left: 50%; top: calc(112px + var(--st)); transform: translate(-50%, -8px); width: min(400px, 60vw); background: rgba(24,18,12,.9); border-radius: 16px; padding: 12px 18px 14px; text-align: center; box-shadow: 0 0 0 2px var(--ghee), 0 12px 30px rgba(0,0,0,.45); opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none; }
#h-new.on { opacity: 1; transform: translate(-50%, 0); }
#h-new small { display: block; font: 800 11px var(--f); letter-spacing: .18em; color: var(--ghee); }
#h-new b { display: block; font: 900 24px var(--f); color: #fff; margin: 2px 0 4px; }
#h-new p { margin: 0; font: 700 14px var(--f); color: #f3e6c8; line-height: 1.35; }
.h-task { display: none; background: var(--slate); border-radius: 10px; padding: 4px 10px 7px; box-shadow: inset 0 0 0 1px var(--line); position: relative; font: 800 13px var(--f); text-align: center; min-width: 220px; }
.h-task.on { display: block; }
.h-task.warn { box-shadow: inset 0 0 0 2px #ff8a80; }
.h-task i { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; }
.h-task u { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ghee); }
.h-task.warn u { background: #ff8a80; }
#h-rival { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #1f8f4e; box-shadow: 0 0 0 2px #fff; z-index: 2; }
.ep .new { display: block; font-style: normal; font: 800 11px var(--f); color: #7a1f0e; background: #ffd23f; border-radius: 6px; padding: 1px 6px; margin: 3px 0 2px; width: fit-content; }
.ep.locked .new { opacity: .5; }
.ld-new { background: rgba(255, 210, 63, .12); border-left: 3px solid var(--ghee); border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; font-size: 13px; line-height: 1.4; }
.ld-new:empty { display: none; }
.ld-new b { display: block; color: var(--ghee); font-size: 14px; margin-bottom: 2px; }
@media (max-height: 500px) { .h-task { font-size: 11px; min-width: 180px; padding: 3px 8px 6px; } #h-new { top: calc(88px + var(--st)); padding: 6px 12px 8px; } #h-new b { font-size: 19px; } #h-new p { font-size: 12px; } }
#h-route:has(#h-rival) { overflow: visible; }

body:has(#h-new.on) #h-hint { opacity: 0; }
