@font-face { font-family: 'Luckiest Guy'; src: url(/fonts/luckiest-guy-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 400; src: url(/fonts/rubik-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 600; src: url(/fonts/rubik-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Rubik'; font-weight: 800; src: url(/fonts/rubik-latin-800-normal.woff2) format('woff2'); font-display: swap; }

:root {
  --cream: #fff3dc; --paper: #fffaf0; --ink: #3b2416; --muted: #8a6a55; --line: #ecd6b0;
  --tomato: #ff5a4e; --tomato-dark: #b52e25; --mint: #2fbf8f; --mint-dark: #17805d;
  --butter: #ffc93c; --butter-dark: #b8860b; --sky: #5ab8f0; --plum: #7a4a9e;
  --display: 'Luckiest Guy', 'Arial Black', Impact, sans-serif;
  --body: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.45 var(--body); overscroll-behavior: none;
  background: var(--cream);
  background-image: radial-gradient(circle at 12px 12px, rgba(255, 90, 78, .09) 3px, transparent 4px);
  background-size: 28px 28px;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
.screen { width: min(520px, 100%); display: flex; flex-direction: column; gap: 14px; flex: 1; }
button { font: inherit; color: inherit; cursor: pointer; }
.img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.emo { display: grid; place-items: center; width: 100%; height: 100%; line-height: 1; }

/* top bar */
.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.bar .sp { flex: 1; }
.logo { font: 30px/1 var(--display); color: var(--tomato); letter-spacing: .5px; text-shadow: 0 3px 0 var(--tomato-dark); padding-top: 5px; text-decoration: none; }
.logo span { color: var(--mint); text-shadow: 0 3px 0 var(--mint-dark); }
.chip { border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: var(--paper); font-size: 18px; display: grid; place-items: center; }

/* cards + buttons */
.card { background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; padding: 18px; box-shadow: 0 6px 0 rgba(59, 36, 22, .18); }
h1 { font: 44px/1 var(--display); margin: 4px 0 0; text-align: center; letter-spacing: .5px; }
h2 { font: 28px/1.05 var(--display); margin: 0; letter-spacing: .3px; }
p { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.btn { border: 3px solid var(--ink); border-radius: 16px; padding: 14px 18px 10px; font: 22px/1 var(--display); letter-spacing: .5px; background: var(--paper); box-shadow: 0 5px 0 var(--ink); transition: transform .08s, box-shadow .08s; width: 100%; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.red { background: var(--tomato); color: #fff; }
.btn.green { background: var(--mint); color: #fff; }
.btn.yellow { background: var(--butter); }
.btn.small { font-size: 17px; padding: 10px 14px 7px; width: auto; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; color: var(--muted); }
input[type=text] { font: 600 18px var(--body); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 11px 14px; background: #fff; width: 100%; }
input[type=text]:focus { outline: 3px solid var(--butter); }

/* pet picker */
.pets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pet { border: 3px solid var(--line); border-radius: 18px; background: #fff; padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 600; font-size: 13px; }
.pet .pic { width: 100%; aspect-ratio: 1; font-size: 46px; }
.pet[aria-pressed=true] { border-color: var(--ink); background: var(--butter); box-shadow: 0 4px 0 var(--ink); transform: translateY(-2px); }
.hero-pet { width: 150px; height: 150px; margin: 0 auto; font-size: 110px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }

/* lobby */
.code { font: 54px/1 var(--display); letter-spacing: 6px; text-align: center; color: var(--tomato); padding-top: 8px; }
.linkbox { display: flex; gap: 8px; align-items: center; background: #fff; border: 2px dashed var(--line); border-radius: 14px; padding: 8px 8px 8px 12px; font-size: 14px; }
.linkbox span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.count { font: 120px/1 var(--display); text-align: center; color: var(--tomato); text-shadow: 0 6px 0 var(--tomato-dark); }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.versus .who { display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 800; }
.versus .who .pic { width: 84px; height: 84px; font-size: 62px; }
.versus .vs { font: 30px/1 var(--display); color: var(--plum); }

/* cooking */
.cookhead { display: flex; align-items: center; gap: 10px; }
.cookhead .dish { width: 54px; height: 54px; font-size: 40px; flex: none; }
.cookhead b { font: 22px/1 var(--display); letter-spacing: .3px; display: block; padding-top: 4px; }
.cookhead small { color: var(--muted); font-weight: 600; }
.pips { display: flex; gap: 6px; }
.pip { flex: 1; height: 10px; border-radius: 6px; background: var(--line); border: 2px solid var(--ink); }
.pip.on { background: var(--mint); }
.pip.now { background: var(--butter); }
.opp { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.opp .pic { width: 28px; height: 28px; font-size: 22px; flex: none; }
.opp .pips { flex: 1; }
.opp .pip { height: 7px; }
.stage { position: relative; flex: 1; min-height: 340px; background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; overflow: hidden; touch-action: none; user-select: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 18px 16px; box-shadow: 0 6px 0 rgba(59, 36, 22, .18); }
.stage .title { font: 30px/1 var(--display); text-align: center; letter-spacing: .3px; }
.stage .hint { text-align: center; color: var(--muted); font-weight: 600; max-width: 320px; }
.timer { position: absolute; left: 0; top: 0; height: 8px; background: var(--tomato); width: 100%; transform-origin: left; }
.big { width: 130px; height: 130px; font-size: 96px; }
.pop { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font: 46px/1 var(--display); letter-spacing: .5px; pointer-events: none; animation: pop .8s ease-out forwards; text-shadow: 0 3px 0 rgba(0,0,0,.18); white-space: nowrap; z-index: 3; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -110%) scale(1); } }
.tally { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 34px; }
.tally i { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; font: 800 12px/26px var(--body); text-align: center; font-style: normal; }
.tally i.g { background: var(--mint); color: #fff; } .tally i.o { background: var(--butter); } .tally i.b { background: var(--tomato); color: #fff; }

/* chop */
.track { position: relative; width: min(360px, 100%); height: 46px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; overflow: hidden; }
.zone { position: absolute; top: 0; bottom: 0; background: var(--mint); opacity: .85; }
.marker { position: absolute; top: -3px; bottom: -3px; width: 8px; margin-left: -4px; background: var(--ink); border-radius: 4px; }
.knife { transition: transform .08s; transform-origin: 80% 80%; }
.knife.down { transform: rotate(-38deg) translateY(14px); }
/* stir */
.pot { position: relative; width: 230px; height: 230px; border-radius: 50%; border: 10px solid var(--ink); background: radial-gradient(circle at 50% 45%, #ffd98a, #f2a93b 70%); display: grid; place-items: center; }
.pot .swirl { position: absolute; inset: 22px; border-radius: 50%; border: 6px dashed rgba(255,255,255,.75); }
.pot .spoon { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px; font-size: 48px; }
.pot .n { font: 44px/1 var(--display); color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); position: relative; padding-top: 6px; }
/* pour */
.pourrow { display: flex; align-items: flex-end; gap: 22px; }
.glass { position: relative; width: 110px; height: 210px; border: 6px solid var(--ink); border-top: 0; border-radius: 0 0 22px 22px; background: #fff; overflow: hidden; }
.glass .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--sky); }
.glass .mark { position: absolute; left: 0; right: 0; height: 0; border-top: 5px dashed var(--tomato); }
.jug { width: 96px; height: 96px; font-size: 76px; transition: transform .15s; transform-origin: 30% 80%; }
.jug.tilt { transform: rotate(-42deg) translateY(-10px); }
/* cook */
.heat { position: relative; width: min(360px, 100%); height: 40px; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; background: linear-gradient(90deg, #cfe9ff 0%, #ffe9a8 45%, #ffb347 60%, #8a4b12 82%, #2b1608 100%); }
.heat .gold { position: absolute; top: 0; bottom: 0; border-left: 3px solid #fff; border-right: 3px solid #fff; background: rgba(255,255,255,.28); }
.heat .needle { position: absolute; top: -3px; bottom: -3px; width: 8px; margin-left: -4px; background: var(--ink); border-radius: 4px; }
.pan { position: relative; width: 190px; height: 150px; }
.pan .food { position: absolute; left: 50%; top: 20px; width: 110px; height: 110px; margin-left: -55px; font-size: 84px; }
.pan .food.flip { animation: flip .5s ease-out; }
@keyframes flip { 50% { transform: translateY(-70px) rotate(180deg) scale(1.1); } 100% { transform: rotate(360deg); } }
/* plate */
.tops { display: grid; grid-template-columns: repeat(3, 84px); gap: 10px; }
.top { width: 84px; height: 84px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; font-size: 48px; padding: 6px; transition: transform .1s, background .1s; }
.top.lit { background: var(--butter); transform: scale(1.12); box-shadow: 0 0 0 5px rgba(255, 201, 60, .5); }
.top.ok { background: var(--mint); } .top.no { background: var(--tomato); }
.tops.locked .top { pointer-events: none; }

/* result */
.stars { font-size: 40px; text-align: center; letter-spacing: 4px; }
.stars .off { opacity: .22; filter: grayscale(1); }
.steps { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-weight: 600; }
.steps b { font-weight: 800; text-align: right; }
.duel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.duel .side { border: 3px solid var(--line); border-radius: 18px; background: #fff; padding: 12px 10px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.duel .side.win { border-color: var(--ink); background: #fff7d1; box-shadow: 0 5px 0 var(--butter-dark); }
.duel .pic { width: 86px; height: 86px; font-size: 64px; }
.duel .tot { font: 40px/1 var(--display); padding-top: 6px; }
.duel .mini { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.banner { font: 34px/1.05 var(--display); text-align: center; letter-spacing: .3px; color: var(--tomato); padding-top: 6px; }
.dishpic { width: 120px; height: 120px; font-size: 90px; margin: 0 auto; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff; font-weight: 600; padding: 10px 16px; border-radius: 999px; z-index: 9; }

/* progression */
.cookhead .sp { flex: 1; }
.tier { display: inline-block; flex: none; font-size: 11.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: #3b2416; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; }
.rank { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.rankrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rankrow small { display: block; font-weight: 600; }
.rankrow b { font: 24px/1 var(--display); letter-spacing: .3px; padding-top: 4px; display: block; }
.starcount { font: 24px/1 var(--display); padding-top: 4px; }
.xpbar { height: 14px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: var(--butter); border-right: 2px solid var(--ink); }
.chapter { font: 20px/1.1 var(--display); letter-spacing: .3px; color: var(--plum); margin-top: 8px; padding-top: 4px; }
.recipe { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 10px 12px; box-shadow: 0 4px 0 rgba(59,36,22,.18); width: 100%; }
.recipe:active { transform: translateY(3px); box-shadow: none; }
.recipe .pic { width: 62px; height: 62px; font-size: 40px; flex: none; }
.recipe .pic.lock { display: grid; place-items: center; background: var(--line); border-radius: 14px; font-size: 26px; }
.recipe .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recipe .meta b { font: 19px/1.1 var(--display); letter-spacing: .3px; padding-top: 3px; }
.recipe.locked { opacity: .6; border-style: dashed; box-shadow: none; }
.stars.sm { font-size: 15px; letter-spacing: 1px; text-align: left; }
.story { font-size: 17px; font-weight: 600; font-style: italic; }
.skillchips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.skillchips span { font-size: 12.5px; font-weight: 600; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.news { background: #fff7d1; display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
/* dish wheel */
.wheel { position: relative; width: min(300px, 78vw); aspect-ratio: 1; margin: 6px auto 0; }
.disc { position: absolute; inset: 0; border-radius: 50%; border: 6px solid var(--ink); box-shadow: 0 8px 0 rgba(59,36,22,.2); }
.slice { position: absolute; inset: 0; display: flex; justify-content: center; pointer-events: none; }
.slice .spic { width: 15%; height: 15%; margin-top: 5%; font-size: 26px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.25)); }
.pin { position: absolute; left: 50%; top: -12px; margin-left: -14px; border: 14px solid transparent; border-top: 26px solid var(--ink); border-bottom: 0; z-index: 2; }
.hub { position: absolute; left: 50%; top: 50%; width: 26%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: var(--paper); border: 5px solid var(--ink); display: grid; place-items: center; font: 34px/1 var(--display); padding-top: 6px; }
.reveal { min-height: 28px; display: flex; gap: 8px; align-items: center; justify-content: center; }
.count.small { font-size: 72px; min-height: 76px; }
/* crack */
.cwrap { position: relative; width: 230px; height: 230px; display: grid; place-items: center; }
.ctarget, .cring { position: absolute; inset: 45px; border-radius: 50%; }
.ctarget { border: 6px dashed var(--mint-dark); }
.cring { border: 7px solid var(--tomato); }
.cegg { width: 96px; height: 96px; font-size: 76px; transition: transform .12s; }
.cegg.split { transform: scale(1.18) rotate(-14deg); }
/* season */
.smeter { position: relative; width: 74px; height: 230px; border: 5px solid var(--ink); border-radius: 18px; background: #fff; overflow: hidden; }
.sband { position: absolute; left: 0; right: 0; background: var(--mint); opacity: .8; }
.slevel { position: absolute; left: -4px; right: -4px; height: 10px; margin-bottom: -5px; background: var(--ink); border-radius: 5px; }
.shaker.shake { animation: shake .16s; }
@keyframes shake { 50% { transform: rotate(-24deg) translateY(10px); } }

/* info dialog */
dialog { border: 3px solid var(--ink); border-radius: 22px; background: var(--paper); color: var(--ink); padding: 22px 20px 18px; width: min(460px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(59, 36, 22, .55); }
dialog ol { margin: 8px 0 14px; padding-left: 22px; } dialog li { margin: 4px 0; }

@media (max-height: 640px) { .stage { min-height: 280px; } h1 { font-size: 36px; } .hero-pet { width: 110px; height: 110px; font-size: 80px; } }
@media (prefers-reduced-motion: reduce) { .hero-pet, .pop, .pan .food.flip { animation: none; } }
