:root {
  --butter: #FFC93C;
  --fry: #FF7A1A;
  --ketchup: #E8352B;
  --ink: #2B1A0E;
  --cream: #FFF4DC;
  --skin: #C98A4B;
  --heat: 0;
  --display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--butter); color: var(--ink); font-family: var(--body); }
body { overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

#app { height: 100dvh; max-width: 560px; margin: 0 auto; position: relative; overflow: hidden; }
.screen {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  gap: 12px; overflow-y: auto;
}
.screen.active { display: flex; }

.topbar { width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.topbar h2 { font-family: var(--display); font-weight: 400; margin: 0; font-size: 1.5rem; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink); background: var(--cream); font-size: 1.2rem; box-shadow: 0 3px 0 var(--ink); }
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.pack-chip { border: 3px solid var(--ink); background: var(--ketchup); color: #fff; font-weight: 800; border-radius: 999px; padding: 8px 14px; box-shadow: 0 3px 0 var(--ink); }
.pack-chip.owned { background: var(--cream); color: var(--ink); }

.hero { text-align: center; margin-top: 2vh; }
.logo-potato { width: clamp(110px, 32vw, 160px); display: block; margin: 0 auto; animation: wobble 2.4s ease-in-out infinite; filter: drop-shadow(0 6px 0 rgba(43,26,14,.25)); }
.logo { font-family: var(--display); font-weight: 400; font-size: clamp(56px, 17vw, 88px); line-height: .9; margin: 6px 0 0;
  color: var(--ketchup); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); letter-spacing: 1px; }
.tag { font-weight: 800; font-size: 1.1rem; margin: 10px 0 0; }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin-top: 8px; }
.mode { border: 3px solid var(--ink); background: var(--cream); border-radius: 16px; padding: 10px 6px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 3px 0 var(--ink); }
.mode b { font-family: var(--display); font-weight: 400; font-size: 1.1rem; }
.mode span { font-size: .72rem; line-height: 1.2; }
.mode.active { background: var(--fry); color: #fff; }

.big-btn {
  display: block; width: 100%; text-align: center; text-decoration: none; border: 4px solid var(--ink); border-radius: 20px;
  background: var(--ketchup); color: #fff; font-family: var(--display); font-size: 1.9rem; padding: 14px; box-shadow: 0 6px 0 var(--ink); margin-top: 6px;
}
.big-btn:active { transform: translateY(6px); box-shadow: none; }
.ghost-btn { width: 100%; border: 3px dashed var(--ink); background: transparent; border-radius: 16px; padding: 12px; font-weight: 800; }
.link-btn { border: 0; background: none; font-weight: 800; text-decoration: underline; padding: 8px; }
.link-btn.small { font-size: .9rem; }
.small-btn { border: 3px solid var(--ink); background: var(--ink); color: var(--cream); border-radius: 12px; padding: 10px 14px; font-weight: 800; }
.danger { color: var(--ketchup); }
.hint { margin: 0; font-weight: 700; text-align: center; opacity: .85; }
.row { display: flex; gap: 8px; width: 100%; align-items: center; }
input, select, textarea { border: 3px solid var(--ink); border-radius: 12px; background: #fff; padding: 10px 12px; width: 100%; }
.row input { flex: 1; }

.deck-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; }
.deck { position: relative; text-align: left; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream); padding: 12px; box-shadow: 0 3px 0 var(--ink); min-height: 104px; }
.deck .e { font-size: 1.6rem; }
.deck b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.1rem; }
.deck small { display: block; font-size: .75rem; line-height: 1.2; }
.deck.on { background: var(--fry); color: #fff; }
.deck.locked { opacity: .75; }
.deck .lock { position: absolute; top: 8px; right: 10px; }
.deck .edit { position: absolute; bottom: 8px; right: 10px; font-size: .8rem; text-decoration: underline; }

.player-list { list-style: none; padding: 0; margin: 0; width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.player-list li { border: 3px solid var(--ink); background: var(--cream); border-radius: 999px; padding: 6px 8px 6px 14px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.player-list li.t1 { background: #FFE08A; } .player-list li.t2 { background: #FFB27A; }
.player-list button { border: 0; background: none; font-size: 1rem; }
.target { justify-content: center; font-weight: 800; flex-wrap: wrap; }
.target select { width: auto; }

/* GAME: background heats from butter to ketchup */
#s-game { background: color-mix(in srgb, var(--ketchup) calc(var(--heat) * 100%), var(--butter)); transition: background .3s; }
.stage { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.round-label { font-family: var(--display); font-size: 1.2rem; }
.prompt-kicker { margin: 0; text-align: center; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.prompt { font-family: var(--display); font-weight: 400; text-align: center; font-size: clamp(34px, 10vw, 56px); line-height: 1.05; margin: 0; padding: 0 4px; text-wrap: balance; }
.prompt.secret { opacity: .35; letter-spacing: .1em; }
.counting .prompt { font-size: clamp(96px, 32vw, 160px); opacity: 1; animation: slam .4s cubic-bezier(.2, 1.6, .4, 1); }
.potato-wrap { position: relative; }
.potato { width: clamp(150px, 46vw, 230px); display: block; filter: drop-shadow(0 8px 0 rgba(43,26,14,.3)) saturate(calc(1 + var(--heat))) hue-rotate(calc(var(--heat) * -25deg)); }
.cooking .potato { animation: shake calc(0.5s - var(--heat) * 0.42s) linear infinite; }
.steam { position: absolute; inset: -20px 0 auto; height: 40px; opacity: var(--heat); text-align: center; }
.cooking .steam::before { content: "〰️〰️〰️"; font-size: 1.6rem; animation: rise 1s linear infinite; display: block; }
.watermark { position: absolute; bottom: max(8px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-weight: 800; opacity: .55; font-size: .9rem; pointer-events: none; }
.no-wm .watermark { display: none; }

/* COOKED */
#s-cooked { background: var(--ketchup); color: #fff; justify-content: center; }
.cooked-inner { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.cooked-word { font-family: var(--display); font-size: clamp(72px, 22vw, 120px); line-height: 1; color: var(--butter); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink); animation: slam .45s cubic-bezier(.2, 1.6, .4, 1); }
.roast { font-family: var(--display); font-size: clamp(24px, 7vw, 34px); line-height: 1.15; margin: 0; text-wrap: balance; }
.who-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.who-grid button { border: 3px solid var(--ink); background: var(--cream); color: var(--ink); border-radius: 999px; padding: 10px 16px; font-weight: 800; font-size: 1.05rem; box-shadow: 0 3px 0 var(--ink); }
.scoreboard { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.scoreboard span { background: rgba(0,0,0,.18); border-radius: 999px; padding: 4px 10px; font-weight: 800; }
#s-cooked .big-btn { background: var(--butter); color: var(--ink); }
#s-over { background: var(--fry); color: #fff; justify-content: center; }
.crown { font-size: 90px; animation: wobble 2s ease-in-out infinite; }
.loser { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 14vw, 72px); margin: 0; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); }
#s-over .big-btn { background: var(--butter); color: var(--ink); }
#s-over .ghost-btn { color: #fff; border-color: #fff; }

/* MODALS */
.modal { position: fixed; inset: 0; background: rgba(43,26,14,.55); display: none; align-items: flex-end; justify-content: center; z-index: 10; }
.modal.open { display: flex; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--cream); border: 4px solid var(--ink); border-bottom: 0; border-radius: 28px 28px 0 0; padding: 22px 16px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: up .25s ease-out; }
.sheet h2 { font-family: var(--display); font-weight: 400; margin: 0; font-size: 2rem; text-align: center; }
.close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 1.4rem; }
.pack-emoji { width: 96px; margin: 0 auto; display: block; }
.pack-price { text-align: center; margin: 0; font-size: 1.2rem; }
.pack-price b { font-family: var(--display); font-weight: 400; font-size: 2.2rem; color: var(--ketchup); }
.pack-price s { opacity: .6; }
.perks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.perks li { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 800; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; }
.setting input[type=range] { width: 50%; padding: 0; border: 0; accent-color: var(--ketchup); }
.setting input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--ketchup); flex: 0 0 auto; }
.setting select { width: auto; }
.setting.disabled { opacity: .45; }
.fine { font-size: .8rem; margin: 0; opacity: .75; }
.rules { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 1.05rem; }
.pin { text-align: center; font-size: 2rem; letter-spacing: .5em; }
textarea { resize: vertical; min-height: 160px; }

.flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 20; }
.flash.go { animation: flash .6s ease-out; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); background: var(--ink); color: var(--cream); padding: 12px 18px; border-radius: 999px; font-weight: 800; transition: transform .25s; z-index: 30; max-width: 90vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); }

@keyframes wobble { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.04); } }
@keyframes shake { 0% { transform: translate(0,0) rotate(0); } 25% { transform: translate(-4px,2px) rotate(-5deg); } 50% { transform: translate(3px,-3px) rotate(4deg); } 75% { transform: translate(-2px,3px) rotate(-3deg); } 100% { transform: translate(0,0) rotate(0); } }
@keyframes rise { from { transform: translateY(10px); opacity: 1; } to { transform: translateY(-20px); opacity: 0; } }
@keyframes slam { from { transform: scale(2.4) rotate(-8deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .logo-potato, .crown, .cooking .potato, .cooked-word { animation: none !important; } }
