/* Style ① from the mockups: white paper, thick black hand-drawn lines, flat fills. Wireframe-level for now. */
:root { --ink: #222; --paper: #fff; --soft: #f4f1ea; --accent: #ffb547; --good: #5cbf6a; --warn: #f08a4b; --quiet: #777; --r: 255px 15px 225px 15px / 15px 225px 15px 255px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: 'Jua', system-ui, sans-serif; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0; font-weight: 400; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
.muted { color: var(--quiet); font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }
.center { text-align: center; }
.hand { border: 3px solid var(--ink); border-radius: var(--r); background: var(--paper); }
.card { border: 3px solid var(--ink); border-radius: var(--r); padding: 12px 14px; background: var(--paper); }
.btn { font: inherit; font-size: 18px; color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); background: var(--paper); padding: 10px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; }
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--accent); }
.btn.good { background: #c9efcf; }
.btn.small { font-size: 15px; min-height: 36px; padding: 4px 10px; }
.btn[disabled] { opacity: .45; }
.btn.block { width: 100%; }
input.hand { font: inherit; font-size: 18px; padding: 10px 12px; width: 100%; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.badge { display: inline-block; border: 2.5px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 15px; background: var(--paper); }
.screen { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.spacer { flex: 1; }
.big { font-size: 46px; line-height: 1; }
.timer { font-size: 54px; line-height: 1; letter-spacing: 1px; }
.cat-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { width: 30px; height: 30px; border: 2.5px solid var(--ink); border-radius: 50%; cursor: pointer; }
.sw.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.lineup { display: flex; gap: 4px; overflow-x: auto; padding: 6px 2px 2px; min-height: 108px; border-bottom: 3px solid var(--ink); }
.lineup .who { display: flex; flex-direction: column; align-items: center; min-width: 74px; position: relative; font-size: 13px; }
.bubble { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); background: var(--paper); border: 2.5px solid var(--ink); border-radius: 12px; padding: 1px 8px; font-size: 13px; white-space: nowrap; animation: pop 1.6s ease forwards; z-index: 2; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -8px); } }
.stickers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tabs { display: flex; gap: 6px; }
.tabs .btn { flex: 1; font-size: 15px; min-height: 38px; padding: 4px 6px; }
.tabs .btn.on { background: var(--soft); }
.quiz .q { font-size: 22px; text-align: center; padding: 6px 0 10px; min-height: 44px; }
.quiz .choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quiz .choices .btn { font-size: 16px; min-height: 52px; }
.quiz .choices .btn.right { background: #c9efcf; } .quiz .choices .btn.wrong { background: #ffd0c4; }
.gauge { height: 16px; border: 2.5px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper); }
.gauge > i { display: block; height: 100%; background: var(--good); transition: width .3s; }
.dash { display: flex; gap: 4px; } .dash i { flex: 1; height: 14px; border: 2.5px solid var(--ink); border-radius: 6px; } .dash i.on { background: var(--accent); }
.track { position: relative; border: 3px solid var(--ink); border-radius: 14px; background: #fbe3d3; overflow: hidden; }
.lane { position: relative; height: 74px; border-bottom: 2px dashed #d98d6a; }
.lane:last-child { border-bottom: 0; }
.lane.me { background: #fff1c7; }
.lane .name { position: absolute; left: 6px; top: 4px; font-size: 13px; z-index: 3; background: rgba(255,255,255,.8); border-radius: 8px; padding: 0 6px; }
.lane .runner { position: absolute; bottom: 2px; transform: translateX(-50%); z-index: 2; }
.lane .ghost { position: absolute; bottom: 2px; transform: translateX(-50%); z-index: 1; }
.lane .say { position: absolute; bottom: 58px; transform: translateX(-50%); font-size: 12px; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 0 6px; white-space: nowrap; z-index: 4; }
.finishline { position: absolute; top: 0; bottom: 0; width: 10px; transform: translateX(-50%); background: repeating-linear-gradient(0deg, #222 0 8px, #fff 8px 16px); z-index: 1; }
.results .r { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 2px dashed #ccc; }
.results .r.me { background: #fff1c7; border-radius: 10px; }
.medal { width: 70px; height: 70px; border: 3px solid var(--ink); border-radius: 50%; display: grid; place-items: center; font-size: 22px; margin: 0 auto; }
.medal.gold { background: #ffd54a; } .medal.silver { background: #dfe4ea; } .medal.bronze { background: #e6a46b; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal .card { max-width: 420px; width: 100%; }
.code { font-family: ui-monospace, monospace; font-size: 26px; letter-spacing: 2px; text-align: center; padding: 10px; background: var(--soft); border-radius: 10px; user-select: all; }
.deck { max-height: 30dvh; overflow: auto; }
.deck .item { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 2px dashed #ddd; }
.dev { background: #e8f3ff; border: 2px dashed #3b7dd8; border-radius: 10px; padding: 4px 8px; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 12px; z-index: 60; font-size: 15px; }
.cat { display: block; overflow: visible; }
.warm { cursor: pointer; }

.lobby { gap: 10px; }
.small-timer { font-size: 34px; }
.lobby .lineup { min-height: 86px; }
.stickers-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.stickers-row .btn { flex: 0 0 auto; }
.warmcard { padding: 6px 10px; }

/* race camera */
.scenery { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: repeating-linear-gradient(90deg, transparent 0 46px, rgba(255,255,255,.55) 46px 49px, transparent 49px 96px),
    radial-gradient(circle at 20px 70%, rgba(120,170,90,.25) 0 6px, transparent 7px); background-size: 96px 100%, 140px 100%; }
.marks { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.marks i { position: absolute; top: 0; bottom: 0; border-left: 2px solid rgba(255,255,255,.9); }
.marks b { position: absolute; bottom: 2px; left: 3px; font-size: 11px; font-weight: 400; color: #8a4a2a; background: rgba(255,255,255,.75); border-radius: 6px; padding: 0 4px; }
.lane { z-index: 2; }
.off { position: absolute; top: 28px; font-size: 13px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 999px; padding: 1px 8px; z-index: 3; white-space: nowrap; }
.off-l { left: 4px; } .off-r { right: 4px; }
.progress { position: relative; height: 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper); }
.progress > i { position: absolute; left: 0; top: 0; bottom: 0; background: #fff1c7; border-radius: 999px; }
.progress .pdot { position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%; background: #999; border: 1.5px solid var(--ink); transform: translate(-50%, -50%); }
.progress .pdot.me { background: var(--accent); width: 12px; height: 12px; z-index: 2; }
.catchbox { background: #fffbea; }
/* 따라잡기 찬스 = bottom sheet over the hint / cheer / quit row, so it is the first thing you see on return */
#catch:not(:empty) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-width: 480px; margin: 0 auto; padding: 0 8px max(8px, env(safe-area-inset-bottom)); animation: sheetUp .25s ease-out; }
#catch .catchbox { gap: 6px; padding: 10px 12px; box-shadow: 0 -4px 0 rgba(0,0,0,.08); }
#catch .quiz .q { font-size: 20px; padding: 2px 0 6px; min-height: 32px; }
#catch .quiz .choices .btn { min-height: 44px; }
#catch .muted.small { font-size: 13px; }
#catch .tabs .btn { min-height: 34px; padding: 2px 6px; font-size: 14px; }
#catch .quiz .choices .btn { min-height: 40px; font-size: 15px; }
#catch #cskip { min-height: 34px; }
/* while the sheet is open the track shrinks so all five lanes (and my cat) stay visible above it */
.race.catching .lane { height: 42px; }
.race.catching .lane .runner, .race.catching .lane .ghost { transform: translateX(-50%) scale(.6); transform-origin: 50% 100%; }
.race.catching .lane .say { bottom: 28px; }
.race.catching .lane .name { font-size: 11px; top: 2px; }
.race.catching .off { top: 12px; font-size: 12px; padding: 0 6px; }
.race.catching #hint, .race.catching .stickers-row { display: none; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.race { gap: 8px; }
