:root {
  --night: #151a36;
  --night2: #2a2350;
  --cream: #fff6e6;
  --ink: #3a2414;
  --orange: #ff8a3d;
  --orange-d: #e8661a;
  --gold: #ffcb52;
  --red: #e2463c;
  --green: #36b37e;
  --font: 'Jua', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--cream);
  background: radial-gradient(ellipse at 50% -10%, #3b3170 0%, var(--night) 55%, #0c0f22 100%) fixed;
  overflow: hidden; user-select: none; -webkit-user-select: none; overscroll-behavior: none;
}
button { font-family: inherit; cursor: pointer; touch-action: manipulation; }
#app { height: 100%; max-width: 560px; margin: 0 auto; position: relative; }

/* ===== 버튼 ===== */
.btn { border: 0; border-radius: 14px; padding: 12px 18px; font-size: 17px; color: var(--ink); background: var(--cream); box-shadow: 0 4px 0 rgba(0,0,0,.25); transition: transform .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn:disabled { opacity: .6; }
.btn-lg { font-size: 20px; padding: 15px 22px; width: 100%; }
.btn-primary { background: linear-gradient(#ffa35c, var(--orange-d)); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.2); }
.btn-gold { background: linear-gradient(#ffe08a, #f5b72e); color: #5a3b00; }
.btn-ghost { background: rgba(255,255,255,.12); color: var(--cream); box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.modal .btn-ghost { background: #f1e3cb; color: var(--ink); }

/* ===== 홈 ===== */
.home { height: 100%; display: flex; flex-direction: column; padding: 0 18px calc(18px + env(safe-area-inset-bottom)); position: relative; overflow-y: auto; }
.awning { height: 44px; margin: 0 -18px; flex-shrink: 0;
  background: repeating-linear-gradient(90deg, var(--red) 0 36px, #fff 36px 72px);
  -webkit-mask: radial-gradient(18px 12px at 18px 100%, transparent 98%, #000) 0 0 / 36px 100%;
  mask: radial-gradient(18px 12px at 18px 100%, transparent 98%, #000) 0 0 / 36px 100%; }
.brand { text-align: center; padding: 26px 0 18px; position: relative; }
.brand-sub { color: var(--gold); font-size: 16px; letter-spacing: 2px; }
.brand h1 { margin: 4px 0 0; font-size: clamp(40px, 12vw, 58px); font-weight: 400; line-height: 1.1; text-shadow: 0 4px 0 #0007, 0 0 30px #ff8a3d55; }
.brand h1 em { font-style: normal; color: var(--orange); }
.brand-lamp { position: absolute; right: 6px; top: 10px; font-size: 34px; animation: sway 3s ease-in-out infinite; transform-origin: top center; }
@keyframes sway { 50% { transform: rotate(8deg); } }
.game-list { display: flex; flex-direction: column; gap: 12px; }
.game-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 0; border-radius: 20px; text-align: left; color: var(--ink);
  background: var(--cream); box-shadow: 0 6px 0 color-mix(in srgb, var(--accent, #aaa) 70%, #000), 0 10px 30px #0006; border-left: 8px solid var(--accent); transition: transform .1s; }
.game-card:active { transform: translateY(4px); }
.game-card.soon { opacity: .55; filter: grayscale(.6); box-shadow: none; border-left-color: #999; }
.gc-emoji { font-size: 46px; width: 60px; text-align: center; }
.gc-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.gc-text strong { font-size: 24px; font-weight: 400; }
.gc-text span { color: #8a6a4f; font-size: 15px; }
.gc-text small { color: var(--orange-d); font-size: 13px; }
.gc-play { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 18px; }
.home-actions { display: flex; gap: 10px; margin-top: 18px; }
.home-actions .btn-lg { flex: 1; }
.home-foot { margin-top: auto; padding-top: 18px; text-align: center; font-size: 13px; color: #fff8; }
.snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.snow i { position: absolute; top: -10px; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: fall linear infinite; }
@keyframes fall { to { transform: translate(30px, 105vh); } }

/* ===== 게임 레이아웃 ===== */
.game { height: 100%; display: flex; flex-direction: column; position: relative; overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
.hud { display: flex; align-items: center; gap: 10px; padding: 10px 12px 6px; }
.hud-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 18px; }
.hud-timer, .hud-score { background: rgba(0,0,0,.35); border-radius: 12px; padding: 7px 12px; font-size: 20px; }
.hud-timer { margin-right: auto; min-width: 88px; }
.hud-score b { color: var(--gold); }
.hud.hurry .hud-timer { background: var(--red); animation: beat .5s infinite; }
@keyframes beat { 50% { transform: scale(1.06); } }

.customers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 12px; min-height: 128px; align-items: end; }
.customer { display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.customer.enter { animation: enter .35s ease-out; }
@keyframes enter { from { transform: translateY(30px); opacity: 0; } }
.customer.leave-happy { animation: leaveUp .45s forwards; }
.customer.leave-angry { animation: leaveShake .45s forwards; }
@keyframes leaveUp { to { transform: translateY(-30px) scale(.8); opacity: 0; } }
@keyframes leaveShake { 30% { transform: translateX(-6px); } 60% { transform: translateX(6px); } to { transform: translateX(40px); opacity: 0; } }
.cu-bubble { background: var(--cream); color: var(--ink); border-radius: 12px; padding: 5px 7px; display: flex; flex-direction: column; gap: 1px; position: relative; min-width: 84px; box-shadow: 0 3px 0 #0003; }
.cu-bubble::after { content: ''; position: absolute; bottom: -7px; left: 50%; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: var(--cream); }
.cu-item { display: flex; align-items: center; gap: 3px; font-size: 16px; white-space: nowrap; }
.cu-item small { font-size: 12px; color: #8a6a4f; flex: 1; }
.cu-item b { font-weight: 400; color: var(--orange-d); }
.cu-face { font-size: 38px; line-height: 1; }
.customer.hurry .cu-face { animation: beat .4s infinite; }
.cu-bar { width: 70px; height: 6px; background: #0005; border-radius: 3px; overflow: hidden; }
.cu-bar i { display: block; height: 100%; background: var(--green); transform-origin: left; }
.customer.hurry .cu-bar i { background: var(--red); }

.tray { margin: 4px 12px; padding: 6px 8px 8px; border-radius: 12px; background: linear-gradient(#9a6640, #6b3f22); box-shadow: inset 0 2px 0 #ffffff22, 0 4px 0 #3e2414, 0 6px 14px #0006; display: flex; flex-direction: column; gap: 5px; }
.tray-head { display: flex; align-items: center; gap: 8px; }
.tray-label { background: #0005; padding: 2px 8px; border-radius: 6px; font-size: 14px; color: var(--gold); }
.tray-hint { font-size: 12px; color: #fffb; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-count { font-size: 13px; color: #fff; background: #0004; padding: 1px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.tray-shelf { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; padding: 4px; border-radius: 8px; background: linear-gradient(#ffffff26, #ffffff0a); box-shadow: inset 0 -4px 0 #00000033; }
.tray-slot, .tray-item { aspect-ratio: 1; border-radius: 6px; position: relative; }
.tray-slot { border: 1.5px dashed #ffffff30; }
.tray-item { background: #fff3; display: grid; place-items: center; animation: pop .3s; }
.tray-art { width: 92%; font-size: 16px; line-height: 1; display: grid; place-items: center; }
.tray-art svg { width: 100%; height: auto; display: block; }
.tray-badge { position: absolute; right: -3px; bottom: -4px; font-size: 10px; }
@media (max-width: 360px) { .tray-shelf { grid-template-columns: repeat(6, 1fr); } }
.station { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.cart { background: linear-gradient(#5a5f6b, #3a3d46); border-radius: 18px; padding: 12px; box-shadow: inset 0 2px 0 #fff2, 0 8px 0 #22242b, 0 14px 30px #0008; position: relative; }
.cart-sign { text-align: center; margin-top: 8px; font-size: 14px; color: var(--gold); background: #0005; border-radius: 8px; padding: 3px; }

.toolbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px 12px 12px; background: rgba(0,0,0,.3); }
.tool { position: relative; border: 0; border-radius: 12px; padding: 6px 2px; background: var(--cream); color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 1px; box-shadow: 0 3px 0 #0005; transition: transform .06s; }
.tool:active { transform: translateY(2px); }
.tool-icon { font-size: 24px; line-height: 1.15; }
.tool-icon svg { display: block; width: 32px; height: 27px; }
.tool-label { font-size: 13px; }
.tool-key { position: absolute; top: 3px; left: 6px; font-size: 10px; color: #b39a80; }
.tool.active { background: linear-gradient(#ffb877, var(--orange)); color: #fff; box-shadow: 0 0 0 3px var(--gold), 0 3px 0 #0005; transform: translateY(-2px); }
.tool.active .tool-key { color: #fff9; }
.tool-action { background: #ffe9c7; }
.tool.pulse { animation: pulse .25s; }
@keyframes pulse { 50% { transform: scale(.9); } }
@media (hover: none) { .tool-key { display: none; } }

/* ===== 붕어빵 틀 ===== */
.mold-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 420px) and (min-height: 780px) { .mold-grid { gap: 12px; } }
.mold { position: relative; border: 0; padding: 0; background: none; aspect-ratio: 13 / 8; border-radius: 14px; }
.mold:active .mold-inner { transform: scale(.97); }
.mold-inner { width: 100%; height: 100%; position: relative; transition: transform .08s; }
.mold-inner.flip { animation: flipY .35s ease-in-out; }
@keyframes flipY { 50% { transform: perspective(500px) rotateX(90deg) scale(.95); } }
.mold svg { display: block; width: 100%; height: 100%; }
.plate { fill: #2b2c31; stroke: #18191c; stroke-width: 3; }
.cavity { fill: #1b1c20; stroke: #0f1012; stroke-width: 2; }
.s-oiled .cavity { fill: #4a4232; }
.shine { fill: none; stroke: #fff; stroke-opacity: 0; stroke-width: 3; stroke-linecap: round; }
.s-oiled .shine { stroke-opacity: .45; }
.bread, .blob, .lid { display: none; }
.s-batter1 .bread, .s-filled .bread, .s-batter2 .bread, .s-filled .blob, .s-batter2 .blob, .s-closed .lid { display: inline; }
.s-batter1 .bread { animation: fillIn .6s ease-out; }
.s-batter2 .blob { opacity: .25; transition: opacity .5s; }
.s-closed .lid { animation: lidClose .3s ease-in; transform-box: view-box; transform-origin: 100% 50%; }
@keyframes fillIn { from { opacity: 0; } }
@keyframes lidClose { from { transform: scaleX(0); } }
/* 주전자 */
.kettle { position: absolute; left: 50%; top: -14px; width: 0; height: 0; pointer-events: none; z-index: 5; }
.kettle-art { position: absolute; left: 8px; top: -30px; width: 46px; opacity: 0; transform-origin: 70% 80%; filter: drop-shadow(0 4px 3px #0007); }
.kettle-art svg { display: block; width: 100%; height: auto; }
.kettle i { position: absolute; left: 2px; top: 5px; width: 6px; height: 0; border-radius: 3px; background: linear-gradient(90deg, #e9cf92, #fbeec8, #e9cf92); }
.kettle.go .kettle-art { animation: kettle .8s ease-in-out; }
.kettle.go i { animation: stream .8s ease-in-out; }
@keyframes kettle { 0% { opacity: 0; transform: translateY(-10px) rotate(0); } 25%, 75% { opacity: 1; transform: translateY(0) rotate(-40deg); } 100% { opacity: 0; transform: translateY(-10px) rotate(0); } }
@keyframes stream { 0%, 25% { height: 0; top: 5px; } 35%, 70% { height: 48px; top: 5px; } 85%, 100% { height: 0; top: 53px; } }
@media (prefers-reduced-motion: reduce) { .kettle.go .kettle-art, .kettle.go i, .s-closed .lid, .s-batter1 .bread { animation-duration: .01s; } }
.bread-body, .pk-down, .pk-up { stroke: rgba(90,45,10,.5); stroke-width: 2; }
.eye { fill: rgba(60,30,10,.55); }
.gill, .scales { fill: none; stroke: rgba(80,40,10,.4); stroke-width: 2; stroke-linecap: round; }
.blob { stroke: rgba(0,0,0,.2); stroke-width: 1.5; }
.lid-plate { fill: #454750; stroke: #1c1d21; stroke-width: 3; }
.lid-emboss { fill: #3b3d45; stroke: #5d606b; stroke-width: 3; }
.lid-eye { fill: #5d606b; }
.lid-handle { fill: #8b5a35; }
.mold .m-peek { position: absolute; inset: 0; display: none; }
.pk-label { fill: #ffe9c7; font-size: 13px; text-anchor: middle; font-family: var(--font); }
.peeking .m-main { visibility: hidden; }
.mold.peeking .m-peek { display: block; }
.m-tag { position: absolute; top: 4px; right: 18px; font-size: 16px; pointer-events: none; }
.peeking .m-tag { display: none; }

/* 김/연기: 단계별로 양·색이 달라짐 */
.steam { position: absolute; left: 0; right: 0; top: 0; height: 0; display: none; justify-content: center; gap: 10%; pointer-events: none; z-index: 3; }
.cooking .steam { display: flex; }
.steam i { width: 10px; height: 18px; border-radius: 50%; background: #fff; opacity: 0; filter: blur(3px); animation: steam 2s ease-out infinite; --o: .25; }
.steam i:nth-child(2) { animation-delay: .4s; }
.steam i:nth-child(3) { animation-delay: .8s; }
.steam i:nth-child(4) { animation-delay: 1.2s; }
.steam i:nth-child(5) { animation-delay: 1.6s; }
@keyframes steam { 0% { transform: translateY(10px) scale(.6); opacity: 0; } 30% { opacity: var(--o); } 100% { transform: translateY(-30px) scale(1.5); opacity: 0; } }
/* 1: 살짝 */
.smoke-1 .steam i:nth-child(n+2) { display: none; }
/* 2: 조금 */
.smoke-2 .steam i { --o: .45; }
.smoke-2 .steam i:nth-child(n+4) { display: none; }
/* 3: 모락모락 (뒤집을 때) */
.smoke-3 .steam i { --o: .85; width: 14px; height: 24px; animation-duration: 1.5s; }
/* 4: 회색 연기 (곧 탐) */
.smoke-4 .steam i { --o: .9; background: #8d8a86; width: 16px; height: 26px; animation-duration: 1.2s; }
/* 5: 검은 연기 (탐) */
.smoke-5 .steam i { --o: .95; background: #1a1614; width: 20px; height: 30px; filter: blur(4px); animation-duration: .9s; }

/* ===== 호떡 ===== */
.prep { display: flex; gap: 10px; align-items: stretch; margin-bottom: 10px; }
.board { flex: 1; min-height: 74px; border-radius: 12px; background: repeating-linear-gradient(100deg, #d8a86c 0 14px, #cf9d60 14px 28px); box-shadow: inset 0 -4px 0 #0002; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink); }
.board-hint { font-size: 15px; }
.ball { width: 50px; height: 50px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fffaf0, #f2dfb8); box-shadow: 0 4px 0 #0002; display: grid; place-items: center; font-size: 20px; animation: pop .25s; }
.ball.closed { border-radius: 50% 50% 46% 46%; }
@keyframes pop { from { transform: scale(.4); } }
.oil-gauge { width: 90px; border-radius: 12px; background: #0004; padding: 8px; display: flex; flex-direction: column; justify-content: center; gap: 6px; font-size: 14px; text-align: center; }
.oil-bar { height: 10px; border-radius: 5px; background: #0006; overflow: hidden; }
.oil-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f7c948, #ffe27a); transform-origin: left; transition: transform .2s; }
.oil-gauge.low { animation: beat .8s infinite; color: #ffb3ab; }
.griddle { --oil: 0; position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px; border-radius: 16px; background: radial-gradient(circle at 50% 40%, #3e4048, #24252b); box-shadow: inset 0 0 0 4px #17181c; }
.griddle::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: var(--oil); transition: opacity .3s;
  background: radial-gradient(circle at 30% 30%, #ffe8a055, transparent 40%), radial-gradient(circle at 75% 65%, #ffe8a044, transparent 45%), #c9a04022; }
.slot { position: relative; aspect-ratio: 1; border: 2px dashed #ffffff22; border-radius: 50%; background: #0002; padding: 0; z-index: 1; }
.slot.cooking { border-color: transparent; }
.hot { position: absolute; inset: 7%; border-radius: 50%; display: none; border: 6px solid transparent; box-shadow: 0 3px 6px #0007, inset 0 -4px 8px #0002; }
.slot.cooking .hot { display: block; }
.hot.placed { animation: press .35s ease-out; }
@keyframes press { from { transform: scale(.45); border-radius: 50% 50% 45% 45%; } 60% { transform: scale(1.06); } }
.hot.flip { animation: flipY .3s ease-in-out; }
.hot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; opacity: .55; }
.hot.t-seed::after { background-image: radial-gradient(circle, #6b4a1f 1.6px, transparent 2.2px), radial-gradient(circle, #3f2a12 1.4px, transparent 2px); background-size: 13px 13px, 17px 17px; background-position: 0 0, 6px 8px; }
.hot.t-honey::after { background: radial-gradient(circle at 60% 55%, #7a3c0a66, transparent 35%); }
.hot.t-cheese::after { background: radial-gradient(ellipse at 40% 60%, #ffe06688, transparent 30%), radial-gradient(ellipse at 65% 35%, #ffe06666, transparent 25%); }
.hot-badge { position: absolute; right: -8px; top: -8px; font-size: 15px; z-index: 2; }
.slot .steam { top: 8%; }

/* ===== 떠다니는 글자 ===== */
.float { position: absolute; transform: translate(-50%, -50%); pointer-events: none; z-index: 20; white-space: nowrap; font-size: 17px; padding: 3px 10px; border-radius: 10px; background: #000b; color: #fff; animation: floatUp 1.1s ease-out forwards; }
.float.perfect { background: var(--gold); color: #5a3b00; font-size: 20px; }
.float.good { background: var(--green); }
.float.bad { background: var(--red); }
.float.warn { background: #ff7a00; }
.float.plus { background: none; color: var(--gold); font-size: 24px; text-shadow: 0 2px 0 #000a; }
.float.bonus { background: linear-gradient(90deg, #ff8a3d, #ffcb52); color: #fff; font-size: 18px; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -160%); } }

.countdown { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: #0007; pointer-events: all; }
.countdown span { font-size: 72px; color: var(--gold); text-shadow: 0 5px 0 #0008; animation: pop .4s; }

/* ===== 모달 ===== */
.modal-back { position: fixed; inset: 0; z-index: 100; background: #0009; display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.modal-back.show { opacity: 1; }
.modal { position: relative; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--cream); color: var(--ink); border-radius: 22px; padding: 22px 18px 18px; box-shadow: 0 10px 0 #0004, 0 20px 60px #000a; transform: translateY(20px) scale(.97); transition: transform .2s; }
.modal-back.show .modal { transform: none; }
.modal h2 { margin: 0 0 12px; font-weight: 400; font-size: 26px; text-align: center; }
.modal-x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #0001; font-size: 16px; color: var(--ink); }
.modal-tall { height: min(640px, calc(100dvh - 32px)); display: flex; flex-direction: column; }

.howto { text-align: center; }
.howto-emoji { font-size: 54px; }
.howto ol { text-align: left; padding-left: 22px; margin: 0 0 10px; line-height: 1.55; font-size: 16px; }
.howto ol b { font-weight: 400; color: var(--orange-d); }
.howto-tip { font-size: 14px; color: #8a6a4f; background: #f3e4c8; border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; text-align: left; }
.pause { display: flex; flex-direction: column; gap: 10px; }

.result { text-align: center; display: flex; flex-direction: column; gap: 12px; }
.result-title { font-size: 24px; }
.result-score { font-size: 64px; line-height: 1; color: var(--orange-d); }
.result-score small { font-size: 24px; margin-left: 4px; }
.badge-best { align-self: center; background: var(--gold); color: #5a3b00; padding: 4px 12px; border-radius: 20px; animation: beat 1s infinite; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.stat { background: #f3e4c8; border-radius: 10px; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; }
.stat b { font-weight: 400; font-size: 20px; }
.stat small { font-size: 11px; color: #8a6a4f; }
.save-area { background: #fff; border-radius: 14px; padding: 12px; min-height: 52px; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.muted { color: #8a6a4f; font-size: 15px; }
.qualify { color: var(--orange-d); }
.save-form { display: flex; gap: 8px; }
.nick { flex: 1; min-width: 0; font-family: inherit; font-size: 18px; padding: 10px 12px; border: 2px solid #ecd8b4; border-radius: 12px; outline: none; color: var(--ink); user-select: text; -webkit-user-select: text; }
.nick:focus { border-color: var(--orange); }
.saved b { font-weight: 400; font-size: 22px; color: var(--orange-d); }
.saved small { color: #8a6a4f; }
.result-actions { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; }
.row .btn { flex: 1; padding: 11px 6px; font-size: 16px; }

.ranking { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.rk-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.rk-tab { flex: 1; border: 0; border-radius: 12px; padding: 9px 4px; font-size: 15px; background: #f1e3cb; color: var(--ink); }
.rk-tab.active { background: var(--orange); color: #fff; }
.rk-body { flex: 1; overflow-y: auto; min-height: 0; }
.rk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.rk-row { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 8px 12px; font-size: 17px; }
.rk-row.top1 { background: linear-gradient(90deg, #fff1bf, #fff); }
.rk-row.me { outline: 3px solid var(--orange); }
.rk-pos { width: 30px; text-align: center; color: #8a6a4f; }
.rk-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-score { color: var(--orange-d); }
.rk-empty, .rk-loading { text-align: center; padding: 40px 0; color: #8a6a4f; }
.rk-empty div { font-size: 50px; }
.rk-foot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 10px; font-size: 14px; color: #8a6a4f; }
.rk-local { font-size: 12px; color: var(--red); }

.modal-ad { text-align: center; display: flex; flex-direction: column; gap: 12px; }
.ad-label { align-self: flex-start; font-size: 12px; background: #0002; padding: 1px 8px; border-radius: 6px; }
.ad-box { background: linear-gradient(135deg, #2a2350, #151a36); color: var(--cream); border-radius: 16px; padding: 30px 16px; }
.ad-emoji { font-size: 48px; }
.ad-box strong { font-weight: 400; font-size: 24px; color: var(--gold); }
.ad-box p { margin: 6px 0 0; color: #fffc; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); z-index: 200; background: #000d; color: #fff; padding: 10px 16px; border-radius: 12px; opacity: 0; transition: .25s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 700px) {
  .customers { min-height: 112px; }
  .cu-face { font-size: 30px; }
  .tool-icon { font-size: 20px; }
  .mold-grid { gap: 7px; }
}


/* ===== 화면 높이에 맞추기 (모바일 브라우저 바가 큰 경우 대비) ===== */
.toolbar { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
.station { justify-content: flex-start; overflow: hidden; }
.cart { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mold-grid { flex: 1; min-height: 0; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.mold { aspect-ratio: auto; width: 100%; height: 100%; min-height: 0; }
.cart-hot .griddle { flex: 1; min-height: 0; grid-template-rows: repeat(2, minmax(0, 1fr)); }
.cell { container-type: size; min-height: 0; display: grid; place-items: center; }
.slot { aspect-ratio: auto; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); }
.prep { flex-shrink: 0; }
.board { min-height: 58px; }
.ball { width: 42px; height: 42px; }
.g-art { display: inline-block; width: 1.5em; vertical-align: -0.25em; }
.g-art svg { display: block; width: 100%; height: auto; }
.gc-emoji .g-art, .howto-emoji .g-art { width: 1.25em; vertical-align: middle; }
.rk-empty .g-art { width: 1.4em; }
@media (max-height: 760px) {
  .cart-sign { display: none; }
  .customers { min-height: 104px; }
  .cu-face { font-size: 28px; }
  .cu-item { font-size: 14px; }
  .hud { padding-top: 6px; padding-bottom: 4px; }
  .hud-btn { width: 36px; height: 36px; }
  .hud-timer, .hud-score { font-size: 18px; padding: 5px 10px; }
  .tool { padding: 4px 2px; }
  .tool-icon { font-size: 20px; }
  .tool-icon svg { width: 26px; height: 22px; }
  .tool-label { font-size: 12px; }
  .cart { padding: 8px; }
  .mold-grid, .griddle { gap: 6px; }
}

/* 결과 화면 배너 */
.ad-banner { position: relative; width: 100%; min-height: 64px; border-radius: 12px; background: #f3e4c8; overflow: hidden; border: 0; padding: 0; }
.ad-banner-label { position: absolute; top: 4px; left: 6px; z-index: 1; font-size: 10px; padding: 0 5px; border-radius: 4px; background: #0002; color: #6b5440; }
.ad-banner.house { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 14px; background: linear-gradient(120deg, #2a2350, #151a36); color: var(--cream); text-align: left; }
.ad-banner.house .ad-banner-label { background: #fff2; color: #fffa; }
.house-emoji { font-size: 30px; }
.house-text { display: flex; flex-direction: column; }
.house-text b { font-weight: 400; font-size: 18px; color: var(--gold); }
.house-text small { font-size: 13px; color: #fffc; }

/* 기름 붓질 */
.brush { position: absolute; left: 0; top: 50%; width: 34%; max-width: 70px; pointer-events: none; z-index: 5; opacity: 0; filter: drop-shadow(0 3px 2px #0007); }
.brush svg { display: block; width: 100%; height: auto; }
.brush.go { animation: brushSweep .75s ease-in-out; }
@keyframes brushSweep {
  0% { opacity: 0; transform: translate(10%, -90%) rotate(-12deg); }
  12% { opacity: 1; }
  30% { transform: translate(90%, -40%) rotate(8deg); }
  55% { transform: translate(40%, -60%) rotate(-8deg); }
  80% { opacity: 1; transform: translate(150%, -50%) rotate(6deg); }
  100% { opacity: 0; transform: translate(190%, -70%) rotate(0); }
}
.cavity { transition: fill .6s ease; }
.s-oiled .shine { stroke-dasharray: 60; animation: shineDraw .7s ease-out; }
@keyframes shineDraw { from { stroke-dashoffset: 60; stroke-opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .brush.go, .s-oiled .shine { animation-duration: .01s; } }

/* 상점 */
.hud-shop { border: 0; border-radius: 12px; padding: 7px 10px; font-size: 15px; background: rgba(255,255,255,.14); color: #fff; white-space: nowrap; }
.hud-shop.can-buy { background: linear-gradient(#ffe08a, #f5b72e); color: #5a3b00; animation: beat 1.2s infinite; }
.hud-score { white-space: nowrap; }
.shop { display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 0; }
.shop h2 { margin-bottom: 0; }
.shop-money { text-align: center; font-size: 18px; }
.shop-money b { font-weight: 400; color: var(--orange-d); }
.shop-money small { display: block; font-size: 12px; color: #8a6a4f; }
.shop-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.shop-item { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 10px 12px; }
.shop-item.owned { opacity: .6; }
.shop-icon { font-size: 30px; text-align: center; }
.shop-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-info strong { font-weight: 400; font-size: 17px; }
.shop-info small { font-size: 13px; color: #8a6a4f; }
.shop-lv { font-size: 12px; color: var(--orange-d); }
.shop-buy { padding: 9px 12px; font-size: 15px; min-width: 84px; font-variant-numeric: tabular-nums; }
.shop-buy:disabled { background: #e8dcc7; color: #a08a70; text-shadow: none; }
.shop-tip { background: #ffe9b8; color: #7a4a10; }
.result-label { font-size: 15px; color: #8a6a4f; margin-bottom: -8px; }
.result-money { font-size: 14px; color: #8a6a4f; margin-top: -6px; }
.result-score { font-size: 52px; }
.float.bell { background: #fff3c4; color: #7a4a10; }
/* 업그레이드로 칸/손님 수가 바뀔 때 */
.customers { grid-template-columns: repeat(var(--cu-cols, 3), minmax(0, 1fr)); }
.mold-grid { grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 3), minmax(0, 1fr)); }
.cart-hot .griddle { grid-template-rows: repeat(var(--rows, 2), minmax(0, 1fr)); }
@media (max-width: 400px) {
  .hud { gap: 6px; }
  .hud-timer { min-width: 0; }
  .hud-shop { padding: 6px 8px; font-size: 14px; }
  .hud-score, .hud-timer { font-size: 17px; padding: 6px 9px; }
}

.shop-icon svg { width: 38px; height: auto; display: block; margin: 0 auto; }
.house-emoji, .ad-emoji { display: flex; gap: 6px; justify-content: center; align-items: center; }
.house-emoji .g-art { width: 34px; }
.ad-emoji .g-art { width: 56px; }

/* 진열대 버리기 */
.tray-item { border: 0; padding: 0; cursor: pointer; }
.tray-trash { position: absolute; inset: 0; display: none; place-items: center; font-size: 15px; border-radius: 6px; background: rgba(226, 70, 60, .85); }
.tray-item.arm .tray-trash { display: grid; animation: pop .2s; }

/* 홈 하단 다른 게임 링크 */
.other-game { margin-top: 16px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; text-decoration: none; color: var(--cream); background: rgba(255,255,255,.1); border: 1.5px solid rgba(255,255,255,.18); }
.other-game:active { transform: translateY(2px); }
.other-game:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.other-emoji { font-size: 30px; }
.other-text { flex: 1; display: flex; flex-direction: column; }
.other-text b { font-weight: 400; font-size: 18px; }
.other-text small { font-size: 13px; color: #fffb; }
.other-arrow { font-size: 18px; color: var(--gold); }
.other-emoji { width: 46px; flex-shrink: 0; }
.other-emoji svg { display: block; width: 100%; height: auto; }

/* 애드핏 320x100 배너: 좁은 폰에서도 잘리지 않게 모달 여백까지 사용 */
.ad-banner.adfit { background: transparent; min-height: 100px; margin-inline: -18px; width: calc(100% + 36px); display: flex; justify-content: center; overflow: visible; }

/* 칭호 */
.title-badge { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; background: linear-gradient(120deg, #2a2350, #151a36); color: var(--cream); border-radius: 14px; padding: 10px 14px; }
.title-icon { font-size: 30px; }
.title-badge span:nth-child(2) { display: flex; flex-direction: column; text-align: left; }
.title-badge small { font-size: 12px; color: #fffb; }
.title-badge b { font-weight: 400; font-size: 22px; color: var(--gold); }
.title-badge em { font-style: normal; font-size: 12px; color: #fffb; flex-basis: 100%; }

/* 손님 영역 높이 고정: 주문이 길어지거나 손님이 늘어도 아래(틀·철판)가 움직이지 않게 */
.customers { height: 132px; min-height: 0; flex-shrink: 0; align-items: end; overflow: visible; }
.customer { min-width: 0; height: 100%; justify-content: flex-end; }
.cu-bubble { max-width: 100%; min-width: 0; padding: 4px 6px; }
.cu-item { font-size: 14px; line-height: 1.25; gap: 2px; }
.cu-item small { font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.customers.four .cu-item small { display: none; }  /* 손님 4명일 땐 이모지+개수만 */
.customers.four .cu-face { font-size: 30px; }
.tray, .hud, .toolbar { flex-shrink: 0; }
@media (max-height: 760px) {
  .customers { height: 112px; min-height: 0; }
  .cu-item { font-size: 13px; line-height: 1.2; }
  .cu-face { font-size: 26px; }
}
.result-score.minus { color: var(--red); }

/* 쿠팡파트너스 배너 */
.coupang { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.coupang iframe { display: block; width: 320px; max-width: none; height: 100px; border: 0; border-radius: 8px; background: #fff; }
.coupang-note { margin: 0; font-size: 10px; line-height: 1.4; color: #fff9; text-align: center; max-width: 320px; }
.modal .coupang { margin: 0 -18px; }
.modal .coupang-note { color: #8a6a4f; }
