/* =========================================================
 * 수리력 셰프 - 스타일시트
 *
 * 구성
 *  1. 디자인 토큰        색 · 서체 · 간격 · 반경 · 그림자
 *  2. 기본 요소 · 공용 컴포넌트   버튼 · 칩 · 카드 · 입력
 *  3. 화면별 스타일      시작 → 셰프 선택 → 게임(HUD·장면·조리대·문제) → 랭킹 → 분석
 *  4. 오버레이          시트 · 모달 · 토스트 · 효과 · 엔딩
 *  5. 문제 그림 자료     영수증 · 그래프 · 계량컵 · 시계 · 레시피 · 돈 · 가격표
 *  6. 반응형 · 접근성
 *
 * 원칙
 *  - 테두리는 1px, 깊이는 그림자로. 두꺼운 외곽선·오프셋 그림자·기울임은 쓰지 않는다.
 *  - 제목 서체(Jua)는 브랜드 타이틀과 큰 숫자에만. UI 텍스트는 Noto Sans KR.
 *  - 색은 역할로만 쓴다: brand(행동·강조), accent(성과·순위), ok(정답), 그 외는 중립.
 * ========================================================= */

/* ---------- 1. 디자인 토큰 ---------- */
:root {
  /* 표면 · 잉크 (모든 잉크는 --paper/--bg/--bg-2 위에서 4.5:1 이상) */
  --bg: #F7F2EA;
  --bg-2: #F1EAE0;
  --paper: #FFFFFF;
  --paper-2: #FBF8F3;
  --ink: #241A14;
  --ink-2: #665749;      /* on paper 7.9 · on bg-2 6.6 */
  --ink-3: #766656;      /* on paper 5.5 · on bg 4.95 · on bg-2 4.6 — 보조 텍스트 최소 색 */
  --ink-4: #9A8B7D;      /* 장식 전용(점선·구분 기호). 텍스트에 쓰지 않는다 */
  --line: #E8E0D5;
  --line-2: #D8CDBF;

  /* 역할색: brand(행동·오답·시간 경고) · accent(성과·순위·조리 진행) · ok(정답·완료) · info(중립 정보) */
  --brand: #D64A2E;
  --brand-2: #B93C24;    /* 흰 글자 5.6:1 — 글자가 얹히는 브랜드 면(primary 버튼·확인 키) */
  --brand-3: #A33520;    /* primary hover · 물리 버튼 밑면 */
  --brand-tint: #FBEAE5;
  --accent: #F0B32E;
  --accent-2: #8F6309;   /* 밝은 면 위 앰버 텍스트/선 (paper 5.5:1) */
  --accent-hover: #E6A825;
  --accent-tint: #FCF1D4;
  --accent-ink: #5C4406; /* accent-tint 위 글자 */
  --ok: #2F9B6E;
  --ok-2: #227A55;       /* 흰 글자 5.3:1 */
  --ok-tint: #E3F4EC;
  --ok-ink: #1B5A3F;     /* ok-tint 위 글자 */
  --info: #3A5A8C;
  --info-tint: #EDF1F8;
  --info-ink: #2C3A55;   /* info-tint 위 글자 */

  --on-brand: #FFFFFF;
  --on-dark: #F7F2EA;

  /* 엔딩 밤 팔레트 · 메달 */
  --night: #43356B;
  --night-2: #221A36;
  --gold: #FFE08A;
  --medal-1: var(--accent);
  --medal-2: #D7D3CC;
  --medal-3: #E3B48C;
  --medal-1-edge: #D9940F;   /* 메달 테두리: 흰 행 위 3:1 이상 */
  --medal-2-edge: #8F8A82;
  --medal-3-edge: #9C5F2E;

  /* 장면 전용(식당 일러스트 목재) */
  --wood: #C58B5C;
  --wood-d: #8E5F38;

  --f-ui: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --f-display: 'Jua', var(--f-ui);
  --f-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* 타입 스케일 (0.5px 단위 금지). 9~10px은 장면 일러스트(간판·MENU 보드) 전용 예외 */
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-md-2: 16px;
  --fs-lg: 17px;
  --fs-lg-2: 18px;
  --fs-xl: 20px;
  --fs-xl-2: 22px;
  --fs-2xl: 24px;
  --fs-3xl: 28px;
  --fs-display: 40px;
  --ls-code: .04em;

  /* 간격 스케일 (4px 기반) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --sh-1: 0 1px 2px rgba(36, 26, 20, .06), 0 1px 1px rgba(36, 26, 20, .03);
  --sh-2: 0 2px 6px rgba(36, 26, 20, .06), 0 8px 20px rgba(36, 26, 20, .07);
  --sh-3: 0 12px 36px rgba(36, 26, 20, .16), 0 2px 6px rgba(36, 26, 20, .08);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-1: .15s;
  --dur-2: .25s;
  --dur-3: .4s;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

/* ---------- 2. 기본 요소 ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  word-break: keep-all;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: var(--fs-md);
  line-height: 1.55;
  letter-spacing: -.01em;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { display: block; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin: 0; }
p { margin: 0; }
small { font-size: .85em; }
.mono { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 포커스 표시: outline 채널만 사용(box-shadow는 컴포넌트 그림자와 경합하므로 금지).
 * 링 색은 상태색이 아닌 중립 정보색(info) — 빨강은 오답·경고 전용이라 닫기 버튼에 얹히면 오류처럼 읽힌다. info는 모든 밝은 표면에서 3:1 이상 */
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; box-shadow: none; }
.btn:focus-visible, .chef-opt:focus-visible, .link-btn:focus-visible, .icon-btn:focus-visible, .hud-music:focus-visible { outline-offset: 3px; }
.choice:focus-visible, .key:focus-visible, .hint-btn:focus-visible, .bnav-btn:focus-visible { outline-offset: 1px; }
.q-row summary:focus-visible { outline-offset: -4px; } /* 부모 .q-row overflow:hidden에 잘리지 않게 안쪽으로 */
.chef-opt.is-on:focus-visible { outline-offset: 5px; }
.rk-hero :focus-visible, .res-hero :focus-visible, .ending :focus-visible, .btn.on-dark:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.modal-card :focus-visible { outline: 3px solid var(--info); outline-offset: 3px; } /* 흰 카드 안에서는 흰 링이 보이지 않으므로 info */
/* 포인터 사용 중(JS가 pointerdown에 html.using-pointer, Tab/화살표에 제거)에는 프로그램적 focus()의 링을 숨긴다 */
html.using-pointer :focus-visible { outline: none; }
.ending:focus, #rankBody:focus, #resultBody:focus, .rk-hero h1:focus, .rk-hero .rk-msg:focus, .q-text:focus, .q-card:focus, .modal-card:focus, .sheet-panel:focus { outline: none; }

#app { position: relative; height: 100%; width: 100%; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.is-active { display: flex; z-index: 1; }
/* 화면 전환(showScreen): 이전 화면 .is-leaving 180ms → 제거, 새 화면 .is-active.screen-in */
.screen.is-leaving { display: flex; z-index: 0; pointer-events: none; animation: screenOut .18s ease both; }
.screen.is-active.screen-in { animation: screenIn .28s var(--ease) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes screenOut { to { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes popOut { to { transform: scale(.96); opacity: 0; } }

/* 버튼
 * primary: 화면의 단 하나뿐인 다음 행동 · (기본): 보조 행동 · ghost: 이탈/취소 · butter: 엔딩/축하 CTA 전용
 * danger: 파괴적 확인(테두리형) · on-dark: 어두운 배경 위 닫기/돌아가기 · sm: 보조 소형(힌트 등) */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 10px 18px;
  font-weight: 600; font-size: var(--fs-md); line-height: 1.2;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  box-shadow: var(--sh-1);
  transition: background var(--dur-1), border-color var(--dur-1), box-shadow var(--dur-1), transform .08s var(--ease), opacity var(--dur-1), color var(--dur-1);
}
.btn.primary { background: var(--brand-2); color: var(--on-brand); border-color: var(--brand-3); }
.btn.butter { background: var(--accent); color: var(--ink); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.danger { background: var(--paper); color: var(--brand-2); border-color: var(--brand); }
.btn.on-dark { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .22); color: #fff; box-shadow: none; }
.btn.big { min-height: 54px; padding: 14px 22px; font-size: var(--fs-lg); border-radius: var(--r-md); width: 100%; }
.btn.sm { min-height: 32px; padding: 5px 12px; font-size: var(--fs-xs); border-radius: 999px; gap: var(--sp-1); }
.btn.sm::before { content: ''; position: absolute; inset: -6px; border-radius: inherit; }
/* 눌림 */
.btn:not(:disabled):active { transform: translateY(1px) scale(.985); box-shadow: none; }
.btn.big:not(:disabled):active { transform: scale(.97); }
.btn.primary:not(:disabled):active { background: var(--brand-3); }
.btn.butter:not(:disabled):active { background: var(--accent-2); color: var(--on-brand); }
.btn.ghost:not(:disabled):active, .link-btn:not(:disabled):active { background: rgba(36, 26, 20, .08); }
.btn.danger:not(:disabled):active { background: var(--brand-tint); }
.btn.on-dark:not(:disabled):active { background: rgba(255, 255, 255, .2); }
/* 비활성: 역할색 기반 중립(바랜 빨강 금지) */
.btn:disabled { opacity: 1; cursor: not-allowed; transform: none; box-shadow: none; background: var(--paper-2); color: var(--ink-3); border-color: var(--line); }
.btn.primary:disabled, .btn.butter:disabled, .btn.danger:disabled { background: var(--bg-2); color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:disabled, .btn.on-dark:disabled { background: transparent; border-color: transparent; }
.btn.sm:disabled { background: var(--bg-2); border-color: transparent; color: var(--ink-3); }
/* 시작 화면 주 CTA에만 물리 버튼(밑면 4px). 다른 버튼에는 쓰지 않는다 */
#btnEnter:not(:disabled) { box-shadow: 0 4px 0 var(--brand-3), var(--sh-1); }
#btnEnter:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-3); }

/* 아이콘 버튼 40px(.hud-music과 동일) + ::before로 48px 히트 영역 */
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); font-size: var(--fs-md); transition: background var(--dur-1), color var(--dur-1), transform .1s; }
.icon-btn::before { content: ''; position: absolute; inset: -4px; border-radius: inherit; }
.icon-btn:not(:disabled):active { transform: scale(.94); background: rgba(36, 26, 20, .1); }
/* 텍스트형 링크 버튼은 밑줄로 누를 수 있음을 드러낸다 */
.link-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 12px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); border-radius: var(--r-sm); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); transition: background var(--dur-1), color var(--dur-1), text-decoration-color var(--dur-1); }
.btn.ghost { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-2); }

@media (hover: hover) {
  .btn:not(:disabled):hover { background: var(--paper-2); }
  .btn.primary:not(:disabled):hover { background: var(--brand-3); }
  .btn.butter:not(:disabled):hover { background: var(--accent-hover); }
  .btn.ghost:not(:disabled):hover { background: rgba(36, 26, 20, .05); color: var(--ink); }
  .btn.danger:not(:disabled):hover { background: var(--brand-tint); }
  .btn.on-dark:not(:disabled):hover { background: rgba(255, 255, 255, .16); }
  .icon-btn:not(:disabled):hover { background: rgba(36, 26, 20, .06); color: var(--ink); }
  .link-btn:not(:disabled):hover { background: rgba(36, 26, 20, .05); color: var(--ink); text-decoration-color: currentColor; }
  .btn.ghost:not(:disabled):hover { text-decoration-color: currentColor; }
}

/* 칩 · 라벨 (알약 컴포넌트는 .chip 하나로 통합: sm / neutral / ok 변형) */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1; padding: 5px 9px; border-radius: 999px;
  background: var(--brand-tint); color: var(--brand-2);
  background: color-mix(in srgb, var(--c, var(--brand)) 13%, #fff);
  color: color-mix(in srgb, var(--c, var(--brand)) 50%, var(--ink));
  white-space: nowrap;
}
.chip.sm { font-size: var(--fs-2xs); padding: 3px 7px; }
.chip.neutral { --c: var(--ink-3); background: var(--bg-2); color: var(--ink-2); }
.chip.ok { --c: var(--ok); background: var(--ok-tint); color: var(--ok-2); }
.chip.official { --c: var(--brand); }
.chip.practice { --c: var(--ink-3); }
@supports not (color: color-mix(in srgb, #000 50%, #fff)) {
  .chip, .dom-dots span { background: var(--brand-tint); color: var(--brand-2); }
  .chip.neutral, .chip.practice { background: var(--bg-2); color: var(--ink-2); }
  .chip.ok { background: var(--ok-tint); color: var(--ok-2); }
}
.eyebrow { display: inline-block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; color: var(--brand-2); }
.eyebrow.gold { color: var(--accent-2); }

/* 카드 (.card와 .info-card는 같은 컴포넌트) */
.card, .info-card, .q-card, .rk-mine, .rcp, .start-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.card, .info-card { padding: var(--sp-4) var(--sp-5) var(--sp-5); min-width: 0; }
.card h2, .info-card h2 { font-size: var(--fs-lg); margin: 0 0 var(--sp-3); display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.card h2 small, .info-card h2 small { font-weight: 500; font-size: var(--fs-sm); color: var(--ink-3); }

/* ---------- 3-1. 시작 화면 ---------- */
#screen-start { align-items: center; justify-content: flex-start; overflow-y: auto; padding: calc(20px + var(--safe-t)) 16px calc(28px + var(--safe-b)); }
.start-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; background: radial-gradient(120% 70% at 50% -10%, #FFFFFF 0%, var(--bg) 60%); }
.start-bg .floaty { position: absolute; width: 72px; opacity: .3; filter: saturate(.85); animation: floaty 7s ease-in-out infinite; }
.start-bg .floaty .food-svg { width: 100%; height: auto; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.start-col { position: relative; width: 100%; max-width: 440px; margin: auto; display: grid; gap: var(--sp-3); }
.start-side { display: contents; }
.start-card { padding: var(--sp-7) var(--sp-6) var(--sp-6); text-align: center; }
.logo-pot { width: 112px; aspect-ratio: 120 / 90; margin: -4px auto 6px; animation: logoIn .32s var(--ease) both; }
@keyframes logoIn { from { transform: scale(.9); opacity: 0; } }
.logo-title { inline-size: fit-content; margin-inline: auto; font-family: var(--f-display); font-weight: 400; font-size: var(--fs-display); line-height: 1; letter-spacing: -.02em; color: var(--ink); animation: slideUp .32s .06s var(--ease) both; }
.logo-title span { color: var(--brand); }
.logo-sub { margin: var(--sp-2) 0 var(--sp-5); color: var(--ink-2); font-size: var(--fs-md); text-wrap: balance; word-break: keep-all; }
.start-chef { width: 120px; margin: 0 auto var(--sp-1); animation: bob 2.4s ease-in-out infinite; }
.start-chef .chef-svg { width: 100%; height: auto; }
.start-card .btn.big { margin-top: var(--sp-3); }
.start-code { margin: var(--sp-4) 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--ink-2); }
.start-code > span { display: block; margin-bottom: 6px; }
.start-code b { display: inline-block; min-width: 11ch; text-align: center; margin-top: 0; font-family: var(--f-mono); font-weight: 600; font-size: var(--fs-md-2); letter-spacing: .06em; color: var(--ink); background: var(--paper-2); border: 1px solid var(--line); padding: 4px 12px; border-radius: var(--r-sm); }
.start-code small { display: block; margin: 6px auto 0; max-width: 30ch; font-size: var(--fs-sm); color: var(--ink-3); text-wrap: balance; }
.start-code .link-btn { margin-top: var(--sp-1); }
.start-rules { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); padding: 0; margin: var(--sp-4) 0 0; }
.start-rules li { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-1); }
.start-rules b { display: block; font-weight: 700; font-size: var(--fs-xl); letter-spacing: -.02em; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.start-rules b i { font-style: normal; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-left: 1px; }
.start-rules span { font-size: var(--fs-sm); color: var(--ink-3); }

.period-date { font-size: var(--fs-md); color: var(--ink-2); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.period-date b { font-weight: 700; font-size: var(--fs-xl-2); letter-spacing: -.02em; color: var(--ink); margin: 0 2px; }
/* 마감 카운트다운은 중립 정보 → info 색. (.chip과 함께 써도, 단독으로 써도 같은 모양) */
.period-left { display: inline-flex; align-items: center; margin-top: 0; font-size: var(--fs-xs); font-weight: 600; line-height: 1; color: var(--info-ink); background: var(--info-tint); border-radius: 999px; padding: 5px 9px; white-space: nowrap; }
.period-left.closed { color: var(--ink-2); background: var(--bg-2); white-space: normal; }
.period-left:empty { visibility: hidden; min-height: 22px; }
.prize-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: step; }
.prize-steps li { position: relative; display: grid; gap: 2px; padding: 10px 0 10px 40px; counter-increment: step; border-top: 1px solid var(--line); }
.prize-steps li:first-child { border-top: 0; padding-top: 2px; }
.prize-steps li::before { content: counter(step); position: absolute; left: 0; top: 10px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--on-dark); font-size: var(--fs-sm); font-weight: 700; }
.prize-steps li:first-child::before { top: 2px; }
.prize-steps b { font-weight: 600; font-size: var(--fs-md); }
.prize-steps span { font-size: var(--fs-sm); color: var(--ink-2); }
.prize-steps em { font-style: normal; font-weight: 700; color: var(--brand-2); }

/* 랭킹 표 (시작 · 종료 화면 공용) */
.rank-box { min-height: 48px; }
.rank-rule { margin: calc(-1 * var(--sp-1)) 0 var(--sp-3); font-size: var(--fs-sm); line-height: 1.55; color: var(--ink-3); }
.rank-rule b { font-weight: 600; color: var(--ink-2); }
.rank-card .rank-rule { margin-top: 0; }
.rank-empty { padding: 18px 12px; text-align: center; color: var(--ink-3); font-size: var(--fs-sm); background: var(--paper-2); border: 1px dashed var(--line-2); border-radius: var(--r-md); }
.rank-empty.is-error, .rank-box .is-error { border-style: solid; border-color: var(--line-2); color: var(--ink-2); }
.rank-empty .btn, .rank-box .is-error .btn { display: inline-flex; margin-top: 10px; min-height: 44px; font-size: var(--fs-sm); }
.rank-skel, .rk-skel { display: grid; gap: 6px; }
.rank-skel i, .rk-skel i { display: block; height: 46px; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--bg-2) 25%, var(--paper-2) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.rank-me { display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: 10px; font-size: var(--fs-sm); color: var(--ink-2); background: var(--accent-tint); border-radius: var(--r-sm); padding: 8px 12px; }
.rank-me b { font-weight: 700; font-size: var(--fs-lg); color: var(--ink); }
.rank-me small { font-family: var(--f-mono); color: var(--ink-3); }
.rk-head, .rk-row { display: grid; grid-template-columns: 32px 32px minmax(0, 1fr) 64px 56px; gap: var(--sp-2); align-items: center; }
.rk-head { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); padding: 0 10px 6px; letter-spacing: .02em; }
.rk-head span:nth-child(4), .rk-head span:nth-child(5), .rk-score, .rk-time { text-align: right; }
.rk-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--paper); }
.rk-row { padding: 7px 10px; min-height: 50px; border-top: 1px solid var(--line); } /* 행 높이 고정: '시간 종료' 태그가 .rk-time 아래 small로 들어가도 50px 안에 */
.rk-row:first-child { border-top: 0; }
/* 내 순위 = 성과/순위 역할 → accent (brand는 오답·경고 전용) */
.rk-row.mine { background: var(--accent-tint); box-shadow: inset 3px 0 0 var(--accent-2); }
.rk-row.mine .rk-no { color: var(--ink); font-weight: 800; }
.rk-no { font-weight: 700; font-size: var(--fs-base); text-align: center; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rk-no.m1, .rk-no.m2, .rk-no.m3 { width: 26px; height: 26px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; font-size: var(--fs-sm); box-shadow: inset 0 0 0 1.5px var(--m-edge); }
.rk-no.m1 { --m-edge: var(--medal-1-edge); background: var(--medal-1); color: var(--accent-ink); }
.rk-no.m2 { --m-edge: var(--medal-2-edge); background: var(--medal-2); color: #4A463F; }
.rk-no.m3 { --m-edge: var(--medal-3-edge); background: var(--medal-3); color: #5A3A1E; }
.rk-ava { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-2); overflow: hidden; display: block; }
.rk-ava > span[aria-hidden] { display: contents; } /* sr-only 이름 + aria-hidden svg 래퍼 구조 */
.rk-ava .chef-svg, .rk-ava svg, .chef-face { display: block; width: 100%; height: 100%; margin: 0; }
.rk-code { font-family: var(--f-mono); font-weight: 600; font-size: var(--fs-sm); letter-spacing: var(--ls-code); min-width: 0; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
.rk-id { white-space: nowrap; letter-spacing: 0; } /* 코드는 절대 자르지 않는다. 상태('시간 종료')는 .rk-time small로 — 코드 열은 한 줄 */
.rk-code em { flex: none; font-style: normal; font-family: var(--f-ui); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0; background: var(--brand-2); color: #fff; border-radius: 999px; padding: 2px 7px; }
.rk-score { font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rk-score b { font-weight: 700; font-size: var(--fs-md); color: var(--ink); }
.rk-time { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.rk-time small { display: block; font-size: var(--fs-2xs); font-weight: 500; color: var(--ink-3); line-height: 1.2; margin-top: 1px; letter-spacing: 0; }
.rk-gap { text-align: center; color: var(--ink-4); letter-spacing: 4px; line-height: 1; padding: 6px 0; }
.rk-gap [role="cell"] { display: block; text-align: center; }

/* ---------- 3-2. 셰프 선택 ---------- */
#screen-chef { overflow-y: auto; align-items: center; padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b)); }
.chef-wrap { width: 100%; max-width: 560px; margin: auto; display: grid; gap: var(--sp-4); }
.chef-head { position: relative; text-align: center; display: grid; gap: 6px; }
.chef-head h1 { font-size: clamp(22px, 5.5vw, var(--fs-3xl)); }
.chef-head .hud-music { position: absolute; right: 0; top: 0; margin: 0; }
.chef-sub { font-size: var(--fs-sm); color: var(--ink-2); margin: 0; text-wrap: balance; }
.chef-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.chef-opt {
  position: relative; display: grid; align-content: start; justify-items: center; gap: 2px; text-align: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-3);
  box-shadow: var(--sh-1); transition: border-color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1) var(--ease);
  animation: cardIn .4s var(--ease) both;
}
.chef-grid .chef-opt:nth-child(2) { animation-delay: .05s; }
.chef-grid .chef-opt:nth-child(3) { animation-delay: .10s; }
.chef-grid .chef-opt:nth-child(4) { animation-delay: .15s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } }
.chef-opt:not(:disabled):active { transform: scale(.98); box-shadow: var(--sh-1); transition-duration: .06s; }
.chef-opt.is-on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--sh-2); transform: translateY(-2px); }
.chef-opt.is-on::after { content: ''; position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 7' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/18px no-repeat; animation: pop .25s var(--ease) both; }
/* 상반신 크롭 아트: 하단 페이드 + 발밑 그림자로 '잘린 스티커' 느낌 제거 */
.chef-art { position: relative; width: 100%; max-width: 124px; aspect-ratio: 120 / 154; display: block; }
.chef-art::before { content: ''; position: absolute; left: 22%; right: 22%; bottom: 4px; height: 10px; border-radius: 50%; background: rgba(61, 42, 30, .12); filter: blur(1px); }
.chef-art .chef-svg { width: 100%; height: 100%; animation: bob 2.6s ease-in-out infinite; transform-origin: 50% 100%; -webkit-mask-image: linear-gradient(#000 82%, transparent 100%); mask-image: linear-gradient(#000 82%, transparent 100%); }
.chef-opt:nth-child(2) .chef-svg { animation-delay: -.7s; }
.chef-opt:nth-child(3) .chef-svg { animation-delay: -1.4s; }
.chef-opt:nth-child(4) .chef-svg { animation-delay: -2.1s; }
.chef-opt.is-on .chef-svg { animation: cheer .5s ease 2, bob 2.6s ease-in-out 1s infinite; }
.chef-opt.is-on .chef-art { animation: chefHop .45s var(--ease); }
@keyframes chefHop { 35% { transform: translateY(-6px); } }
.chef-opt b { display: grid; place-items: center; min-height: 2.5em; font-weight: 700; font-size: var(--fs-md); line-height: 1.25; letter-spacing: -.02em; margin-top: var(--sp-2); text-wrap: balance; }
.chef-opt small { font-size: var(--fs-sm); line-height: 1.3; color: var(--ink-3); }
/* 선택 시에만 뜨는 한마디 말풍선 (CHEFS[].line) */
.chef-line { display: block; min-height: 1.4em; margin-top: 6px; font-size: var(--fs-xs); font-weight: 600; line-height: 1.4; color: var(--brand-2); opacity: 0; transition: opacity .22s ease; text-wrap: balance; }
.chef-opt.is-on .chef-line:not(:empty) { opacity: 1; }
.chef-note { text-align: center; font-size: var(--fs-sm); color: var(--ink-2); margin-top: calc(-1 * var(--sp-2)); text-wrap: balance; }
.chef-note b { color: var(--brand-2); font-weight: 700; }
.chef-wrap .btn.ghost { justify-self: center; }
/* 모바일(700px 미만): 셰프 선택 후 "영업 시작하기" 버튼까지 한 화면에 보이도록 카드 높이를 화면 높이에 맞춤.
   그래도 넘치는 아주 작은 화면에서는 버튼이 화면 아래에 붙어 있음 */
@media (max-width: 699px) {
  #screen-chef { padding-top: calc(12px + var(--safe-t)); padding-bottom: calc(12px + var(--safe-b)); }
  .chef-wrap { gap: 12px; margin: 0 auto; }
  .chef-grid { gap: 10px; }
  .chef-opt { padding: 10px 8px; }
  .chef-art { width: auto; max-width: none; height: clamp(72px, calc((100vh - 470px) / 2), 124px); height: clamp(72px, calc((100dvh - 470px) / 2), 124px); }
  .chef-opt b { min-height: 0; margin-top: 4px; }
  .chef-line { margin-top: 2px; }
  .chef-note { margin-top: -4px; }
  #btnChefGo { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -8px 16px 4px var(--bg, #f7f2ea); }
}
@media (hover: hover) {
  .chef-opt:not(:disabled):hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
  .chef-opt.is-on:hover { transform: translateY(-2px); }
  .chef-opt:hover .chef-svg { animation: hop .5s ease infinite; }
}

/* ---------- 3-3. 게임 화면: HUD ---------- */
.hud { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); row-gap: var(--sp-1); padding: calc(8px + var(--safe-t)) 12px 8px; background: var(--paper); border-bottom: 1px solid var(--line); z-index: 5; }
.hud-item, .hud-code, .hud-timer { height: 36px; align-items: center; }
.hud-item { display: flex; gap: var(--sp-1); background: var(--bg-2); border-radius: 999px; padding: 0 11px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.hud-item span { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-2); }
.hud-item b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.hud-ord b { min-width: 2.6em; text-align: center; }
.hud-score b { color: var(--ok-ink); } /* bg-2 위 6.8:1 (ok-2는 4.42로 미달) */
.hud-item.bump { animation: bump .45s var(--ease); }
@keyframes bump { 40% { transform: scale(1.14); background: var(--ok-tint); } }
.hud-timer.pop { animation: timerPop .3s var(--ease); }
@keyframes timerPop { 50% { transform: scale(1.15); } }
.hud-timer b.pop { display: inline-block; animation: numPop .18s ease-out; }
@keyframes numPop { from { transform: scale(1.25); } to { transform: scale(1); } }
/* 소리 토글 = .icon-btn 변형. 40px + ::before 48px 히트 영역(.icon-btn::before와 같은 의사요소라 중복 생성 없음), 꺼짐 상태는 테두리+사선 아이콘으로 */
.hud-music { position: relative; margin-left: auto; flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); background: var(--bg-2); transition: background var(--dur-1), color var(--dur-1), transform .1s; }
.hud-music::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; }
.hud-music .ic { width: 18px; height: 18px; }
.hud-music .mu-off { opacity: 0; transition: opacity var(--dur-1); stroke: var(--brand-2); }
.hud-music.is-off { color: var(--ink-2); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line-2); }
.hud-music.is-off .mu-off { opacity: 1; }
.hud-music:not(:disabled):active { transform: scale(.94); }
.hud-timer { position: relative; display: flex; gap: 6px; flex: none; background: var(--bg-2); color: var(--ink); border-radius: 999px; padding: 0 14px 2px 10px; font-weight: 700; font-size: var(--fs-lg-2); overflow: hidden; transition: background .3s; }
.hud-timer .ic { width: 17px; height: 17px; }
.hud-timer b { font-variant-numeric: tabular-nums; min-width: 52px; letter-spacing: 0; line-height: 1.1; }
.hud-timer .tbar { position: absolute; left: 10px; right: 10px; bottom: 3px; height: 3px; background: rgba(36, 26, 20, .1); border-radius: 2px; }
/* 진행 바는 JS가 transform: scaleX(ratio)로 갱신(레이아웃 없음). width는 100% 고정 */
.hud-timer .tbar i { display: block; height: 100%; width: 100%; transform-origin: left center; background: var(--ok-2); border-radius: 2px; transition: transform .3s linear, background .3s; will-change: transform; }
.hud-timer.warn { background: var(--accent-tint); }
.hud-timer.warn .tbar i { background: var(--accent-2); }
.hud-timer.danger { background: var(--brand-tint); color: var(--brand-2); animation: tick 1s ease-in-out infinite; }
.hud-timer.danger b { color: var(--brand-2); font-weight: 800; }
.hud-timer.danger .tbar i { background: var(--brand-2); } /* 트랙 위 3.9:1 */
@keyframes tick { 50% { transform: scale(1.06); } }
.hud-code { flex: 0 1 auto; min-width: 0; display: flex; gap: 6px; background: var(--bg-2); color: var(--ink-2); border-radius: 999px; padding: 0 12px; font-family: var(--f-mono); font-weight: 600; font-size: var(--fs-xs); letter-spacing: .03em; white-space: nowrap; }
.hud-code b { overflow: hidden; text-overflow: ellipsis; }
.hud-code span { font-family: var(--f-ui); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--ls-code); opacity: 1; color: var(--ink-3); }

/* 스테이지 레이아웃
 * 모바일(<900): .scene-col은 래퍼 역할만(display:contents) → 장면 → 문제 카드 → 주문서/조리대 순서(order).
 *   revealCard()가 block:'start'로 카드 상단을 맞추면 장면이 카드 바로 위에 붙어 있어 손가락 한 번이면 손님 반응이 보인다.
 * 데스크톱(≥900 landscape): grid-template-areas "scene q" / "work q" — 아래 반응형 블록 */
.stage { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4) var(--sp-4); -webkit-overflow-scrolling: touch; scroll-padding-top: var(--sp-2); }
.scene-col { display: contents; }
.scene { order: 0; }
.qpanel { order: 1; min-width: 0; }
.work { order: 2; }

/* 식당 장면 (일러스트) */
/* 장면은 자식이 전부 절대 배치라 높이에 내용이 기여하지 않는다 → container-type:size 안전(말풍선 위치를 cq 단위로 손님 폭에 맞춤) */
.scene { position: relative; height: clamp(160px, 25vh, 240px); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: #FBE9CC; flex: none; isolation: isolate; box-shadow: var(--sh-1); container-type: size; }
/* 저녁 조명(.late, 마지막 30초): 벽·바닥·창만 덮고(z 0) 캐릭터·말풍선(z ≥ 1)은 그대로 */
.scene::after { content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity var(--dur-3) ease; background: linear-gradient(180deg, rgba(232, 160, 80, .32), rgba(120, 70, 40, .22)); mix-blend-mode: multiply; }
.scene.late::after { opacity: 1; }
.scene.late .sc-wall { background: linear-gradient(#F6D9B0, #EEC48E); }
.scene.late .glow, .scene.late .sc-lights svg { animation: glow 1.2s ease-in-out infinite; }
.sc-wall { position: absolute; inset: 0 0 34% 0; background: linear-gradient(#FCEBCF, #F8DFB8); transition: background var(--dur-3) ease; }
.sc-wall::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: var(--wood-d); }
/* 바닥: 가로 판자(원근) — 세로 줄무늬는 카운터 전면처럼 읽혀 손님이 떠 보였다 */
.sc-floor { position: absolute; inset: 66% 0 0 0; background: repeating-linear-gradient(180deg, #D9A06D 0 14px, #CD935F 14px 28px); }
.sc-window { position: absolute; left: 4%; top: 12%; width: 23%; aspect-ratio: 1.1; max-width: 120px; border: 5px solid #fff; border-radius: 10px 10px 4px 4px; background: linear-gradient(#9ED8F0, #D5F0FA); overflow: hidden; box-shadow: 0 0 0 3px var(--wood-d); }
.sc-window::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: #fff; }
.sc-window::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; background: #fff; }
.sc-window .cloud { position: absolute; width: 40px; height: 14px; background: #fff; border-radius: 10px; top: 24%; left: -44px; will-change: transform; animation: cloud 18s linear infinite; }
.sc-window .cloud.c2 { top: 60%; animation-duration: 26s; animation-delay: -10s; width: 28px; }
@keyframes cloud { to { transform: translateX(172px); } }
/* 간판: 어두운 목재(#6E4626) 위 크림 글자 7.5:1 · 금색 별 6.3:1 (wood-d 위에서는 4.1~4.2로 미달) */
.sc-sign { position: absolute; left: 50%; top: 7%; transform: translateX(-50%); background: #6E4626; border: 2px solid #553319; border-radius: 8px; padding: 3px 12px 4px; text-align: center; color: #FFF4E2; white-space: nowrap; z-index: 2; max-width: 58%; }
.sc-sign small { display: block; font-size: var(--fs-2xs); font-weight: 600; opacity: 1; line-height: 1.1; letter-spacing: .04em; }
.sc-sign b { font-weight: 700; font-size: clamp(12px, 3.4vw, 15px); display: block; overflow: hidden; text-overflow: ellipsis; }
.sc-sign i { font-style: normal; font-size: 10px; letter-spacing: 1px; color: var(--gold); } /* 장면 전용 */
.sc-lights { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; z-index: 1; }
.sc-lights .bulb { width: 46px; position: absolute; top: 0; }
.sc-lights .bulb:nth-child(1) { left: 30%; }
.sc-lights .bulb:nth-child(2) { right: 30%; }
.glow { animation: glow 2.6s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .6; } }
.twinkle { animation: twinkle 1.6s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .45; } }
.flame { animation: flame .8s ease-in-out infinite alternate; transform-origin: center bottom; }
@keyframes flame { to { transform: scaleY(1.2) translateY(-1px); } }
.steam { animation: steam 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes steam { 0% { opacity: 0; transform: translateY(2px) scale(.9); } 40% { opacity: .9; } 100% { opacity: 0; transform: translateY(-8px) scale(1.1); } }
.sc-deco { position: absolute; right: 4%; top: 14%; width: 15%; max-width: 74px; }
.sc-deco .deco-svg { width: 100%; height: auto; }
.sc-deco .swim { animation: swim 3.2s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; } /* 어항 물고기 */
@keyframes swim { to { transform: translateX(6px) translateY(-2px); } }
.sc-menu { overflow: hidden; white-space: nowrap; position: absolute; left: 30%; top: 30%; width: 19%; max-width: 100px; background: #2F3A35; border: 3px solid var(--wood); border-radius: 5px; color: #F4F1EC; font-size: 9px; font-weight: 500; line-height: 1.3; padding: 3px 5px; transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.sc-menu b { display: block; font-weight: 700; color: var(--accent); font-size: 9px; text-align: center; letter-spacing: .08em; }
/* 손님 말풍선이 떠 있는 동안 MENU 보드는 완전히 비운다 (setBubble → .scene.has-bubble + .sc-menu.dim). 반투명으로 남기면 로딩 실패처럼 보인다 */
.scene.has-bubble .sc-menu, .sc-menu.dim { opacity: 0; transform: translateY(-6px) scale(.96); pointer-events: none; }
/* 테이블(최대 2개): 바닥선에 앉히고 손님(좌)과 셰프(우) 사이 중앙 구역에만 — 벽에 뜬 선반처럼 보이지 않게 */
.sc-tables { position: absolute; left: 32%; right: 44%; top: auto; bottom: 28%; display: flex; justify-content: center; align-items: flex-end; gap: 4%; z-index: 1; }
.sc-tables .table-svg { width: 48%; max-width: 124px; }
.sc-queue { position: absolute; left: 1%; bottom: 3%; display: flex; gap: 2px; opacity: .55; z-index: 1; }
.sc-queue span { width: 14px; height: 30px; border-radius: 7px 7px 3px 3px; background: #9C8471; position: relative; }
.sc-queue span::before { content: ''; position: absolute; top: -12px; left: 1px; width: 12px; height: 12px; border-radius: 50%; background: #9C8471; }
.sc-camera { position: absolute; right: 3%; bottom: 36%; font-size: 9px; font-weight: 700; letter-spacing: .06em; color: #fff; background: var(--brand-2); border-radius: 4px; padding: 1px 6px; z-index: 3; animation: onair 1.2s steps(2) infinite; } /* 장면 전용 9px */
@keyframes onair { 50% { opacity: .55; } }
/* 손님 62% / 셰프 64%: 셰프가 손님보다 조금 크게. 손님은 살짝 기울여(−3°) 셰프 쪽을 향한다 */
.sc-cust { position: absolute; left: 7%; bottom: 0; height: 62%; aspect-ratio: 100 / 142; z-index: 4; }
.sc-cust .cust-svg { width: 100%; height: 100%; transform: rotate(-3deg); transform-origin: 50% 100%; }
.sc-cust::after { content: ''; position: absolute; left: 10%; right: 10%; bottom: -2px; height: 10px; border-radius: 50%; background: rgba(61, 42, 30, .18); z-index: -1; }
.sc-cust.enter { animation: custIn .55s var(--ease) both; }
.sc-cust.leave { animation: custOut .45s ease-in both; }
.sc-cust.bounce .cust-svg { animation: hop .5s ease 2; }
@keyframes custIn { from { transform: translateX(-140%); } }
@keyframes custOut { to { transform: translateX(-160%); opacity: 0; } }
@keyframes hop { 40% { transform: translateY(-10%); } }
.sc-name { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); white-space: nowrap; font-size: var(--fs-2xs); font-weight: 600; background: rgba(255, 255, 255, .92); border-radius: 6px; padding: 1px 7px; color: var(--ink-2); }
/* 말풍선은 손님의 실제 폭(높이 62% × 100/142 = 43.7cqh) 오른쪽에 붙는다. cq 미지원 브라우저는 left:30% 폴백 */
.sc-bubble { position: absolute; left: 30%; left: max(30%, calc(7cqw + 43.7cqh + 10px)); bottom: 38%; max-width: 44%; max-width: min(44%, calc(93cqw - 43.7cqh - 20px)); background: var(--paper); border-radius: 12px; padding: 7px 11px; font-size: clamp(12px, 3.3vw, 15px); font-weight: 600; line-height: 1.3; z-index: 5; box-shadow: var(--sh-2); animation: pop .3s var(--ease) both; }
.sc-bubble::before { content: ''; position: absolute; left: -8px; bottom: 12px; border: 6px solid transparent; border-right: 8px solid var(--paper); }
.sc-bubble small { display: block; font-weight: 400; font-size: var(--fs-xs); color: var(--ink-3); margin-top: 1px; }
.sc-bubble.happy { background: var(--accent-tint); }
.sc-bubble.happy::before { border-right-color: var(--accent-tint); }
.sc-desk { position: absolute; right: 0; bottom: 0; width: 52%; height: 24%; background: var(--wood); border-top: 6px solid var(--wood-d); z-index: 3; border-top-left-radius: 10px; }
/* 조리대 위 현재 음식(#scDish): renderStation이 같은 stage의 Art.food를 렌더 — 캐릭터와 음식이 한 프레임에 */
.sc-dish { position: absolute; left: 14%; bottom: 46%; width: 30%; max-width: 84px; z-index: 4; }
.sc-dish .food-svg { width: 100%; height: auto; display: block; transform-origin: 50% 100%; }
.sc-dish .food-svg.animate { animation: stagePop .26s cubic-bezier(.34, 1.56, .64, 1) both; }
.sc-dish.cooking .food-svg { animation: cookBob 1.4s ease-in-out infinite; }
.sc-dish.done .food-svg { animation: tada .6s ease both; }
.sc-chef { position: absolute; right: 10%; bottom: 14%; height: 64%; aspect-ratio: 120 / 154; z-index: 2; animation: bob 2.4s ease-in-out infinite; transform-origin: bottom center; }
.sc-chef .chef-svg { width: 100%; height: 100%; }
.sc-chef.cooking { animation: cookBob .35s ease-in-out infinite; }
.sc-chef.cheer { animation: cheer .5s ease 3; }
.sc-chef.oops { animation: oops .55s ease both; }
@keyframes oops { 20% { transform: translateX(-5px) rotate(-3deg); } 45% { transform: translateX(5px) rotate(3deg); } 70% { transform: translateX(-2px) rotate(-1deg); } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes cookBob { 50% { transform: translateY(-4px) rotate(-2deg); } }
@keyframes cheer { 40% { transform: translateY(-14%) scale(1.04); } }
.lv-5 .scene-gold { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 50% at 50% 0%, rgba(255, 214, 107, .4), transparent 70%); z-index: 1; }

/* 주문서 + 조리대 */
.work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); }
.slip { position: relative; display: flex; flex-direction: column; margin-bottom: 7px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md) var(--r-md) 0 0; padding: var(--sp-3) var(--sp-3) var(--sp-4); font-size: var(--fs-sm); box-shadow: var(--sh-1); min-width: 0; }
.slip::after { content: ''; position: absolute; left: 0; right: 0; bottom: -7px; height: 8px; background: linear-gradient(-45deg, transparent 4px, var(--paper) 4px) 0 0 / 8px 8px repeat-x, linear-gradient(45deg, transparent 4px, var(--paper) 4px) 0 0 / 8px 8px repeat-x; filter: drop-shadow(0 1px 0 var(--line)); }
.slip-head { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-2xs); font-weight: 600; color: var(--ink-3); border-bottom: 1px dashed var(--line-2); padding-bottom: 6px; margin-bottom: var(--sp-2); }
.slip-item { font-weight: 700; font-size: var(--fs-md); line-height: 1.3; display: flex; align-items: center; gap: var(--sp-2); white-space: nowrap; min-width: 0; }
.slip-item span { overflow: hidden; text-overflow: ellipsis; }
.slip-item .mini { width: 28px; flex: none; }
.slip-lines { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; gap: 6px; }
.slip-lines li { display: flex; gap: 6px; align-items: center; line-height: 24px; min-width: 0; color: var(--ink-2); }
.slip-lines .n { color: var(--ink-3); flex: none; font-size: var(--fs-sm); }
/* 미완료 단계의 값 자리: 점선 빈칸(.slip-blank). 모노 폰트 '???'·무한 점멸 금지 */
.slip-lines .code { margin-left: auto; flex: none; display: inline-flex; align-items: center; font-family: var(--f-ui); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0; color: var(--ink-3); white-space: nowrap; }
.slip-lines .val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.slip-lines li.now { color: var(--ink); font-weight: 600; }
.slip-lines li.now .code { color: var(--brand-2); }
.slip-lines li.now .slip-blank { border-color: var(--brand); animation: blink 1.2s 3; }
.slip-lines li.done.fresh .val { animation: ink .4s ease both; }
.slip-lines li.done .ok { color: var(--ok-2); font-weight: 700; flex: none; }
.slip-lines li.help .ok { color: var(--accent-2); }
/* 값이 아직 없는 자리: 회색 점선 빈칸 (정답 후 .val에 ink 애니메이션으로 채워짐) */
.slip-blank { display: inline-block; width: 44px; height: 1em; vertical-align: -2px; border-bottom: 1.5px dashed var(--line-2); }
@keyframes blink { 50% { opacity: .6; } }
@keyframes ink { from { opacity: 0; transform: translateX(-6px); } }
.slip-stamp { position: static; align-self: flex-end; margin-top: auto; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0; color: var(--ok-2); background: var(--ok-tint); border-radius: 999px; padding: 3px 10px; animation: pop .3s var(--ease) both; }

.station { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; overflow: hidden; box-shadow: var(--sh-1); }
.st-head { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.st-head .tool-svg { width: 26px; flex: none; }
.st-head b { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-badge { position: absolute; right: 0; top: 0; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0; background: var(--bg-2); border-radius: 999px; padding: 3px 9px; color: var(--ink-2); z-index: 2; }
.st-food.done .st-badge, .st-badge.done { background: var(--ok-tint); color: var(--ok-2); }
.st-food { position: relative; height: 70px; display: grid; place-items: center; }
.st-food .food-svg { height: 100%; width: auto; max-width: 100%; }
.st-food .food-svg.stage-0 { opacity: .92; }
.st-food.cooking .food-svg, .station.cooking .st-food .food-svg { animation: cookBob 1.4s ease-in-out infinite; transform-origin: 50% 100%; }
.st-food.cooking::after { content: ''; position: absolute; inset: 10% 20%; border-radius: 50%; background: radial-gradient(rgba(255, 179, 71, .4), transparent 70%); animation: glow 1s infinite; z-index: -1; }
/* 조리 중 김 2줄 */
.station.cooking .st-food::before { content: ''; position: absolute; left: 50%; top: 4%; width: 22px; height: 26px; transform: translateX(-50%); z-index: 1; pointer-events: none; background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, .75) 0 3px, transparent 4px), radial-gradient(circle at 70% 30%, rgba(255, 255, 255, .65) 0 3px, transparent 4px); animation: steam 1.6s ease-in-out infinite; }
.st-food.done .food-svg { animation: tada .6s ease both; }
.st-food .food-svg.animate { animation: stagePop .26s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes stagePop { 50% { transform: scale(1.12); } }
.st-food .sparkle { position: absolute; width: 14px; height: 14px; background: var(--accent); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: spark .9s ease-out both; }
@keyframes spark { from { transform: scale(0) rotate(0); } 60% { transform: scale(1.3) rotate(90deg); } to { transform: scale(0) rotate(180deg); } }
@keyframes tada { 30% { transform: scale(1.12) rotate(-3deg); } 60% { transform: scale(.97) rotate(2deg); } }
.lyr-new { animation: drop .4s var(--ease) both; transform-box: fill-box; transform-origin: center; }
@keyframes drop { from { transform: translateY(-24px); opacity: 0; } }
/* 조리 단계 = 스텝 인디케이터(버튼 아님). 점: 대기 line-2 · 진행 brand+pulse · 완료 ok */
.st-steps { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: var(--sp-1); }
.st-step { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; font-size: var(--fs-xs); font-weight: 600; line-height: 1.25; padding: var(--sp-1) 2px 2px; border: 0; background: transparent; border-radius: 0; color: var(--ink-3); word-break: keep-all; overflow-wrap: anywhere; overflow: hidden; min-width: 0; }
.st-step .dot { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--line-2); flex: none; transition: background .3s; }
.st-step .st-ic { display: grid; place-items: center; width: 22px; height: 22px; opacity: .5; transition: opacity .3s; }
.st-step .st-ic svg, .step-ico { display: block; width: 18px; height: 18px; margin: 0 auto; }
.st-step .st-name { display: block; min-width: 0; max-width: 100%; }
.st-step.done { color: var(--ok-2); }
.st-step.done .dot { background: var(--ok); animation: pop .35s ease both; }
.st-step.done .dot::after { content: ''; position: absolute; left: 3.5px; top: 2px; width: 3px; height: 6px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.st-step.done .st-ic { opacity: 1; }
.st-step.now { color: var(--ink); font-weight: 700; }
.st-step.now .dot { background: var(--brand); animation: dotPulse 1.2s ease-in-out infinite; }
.st-step.now .st-ic { opacity: 1; }
@keyframes dotPulse { 50% { transform: scale(1.2); } }
/* 조리 진행 바: 진행 중 accent(노랑) + accent-2 인셋 테두리(bg-2 위 1.57:1인 노랑에 3:1 경계 확보), 완료 ok-2(4.4:1). 빨강은 오답·시간 경고 전용 */
.st-prog { height: 6px; background: var(--bg-2); border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line-2); }
.st-prog i { display: block; height: 100%; background: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent-2); border-radius: 6px; transition: width .5s var(--ease), background .3s; }
.st-food.done ~ .st-prog i, .st-prog.done i { background: var(--ok-2); box-shadow: none; }

/* 문제 패널 */
.q-card { position: relative; padding: var(--sp-4); }
.q-card.enter { animation: slideUp .3s var(--ease) both; }
.q-card > .q-text:last-child { margin-bottom: 0; }
/* 오답 카드 플래시(onWrong → .flash-wrong): 외곽 3px + 틴트가 켜졌다 꺼진다 */
.q-card.flash-wrong { animation: cardFlash .32s ease both, nudge .38s ease; }
@keyframes cardFlash { 0%, 100% { box-shadow: var(--sh-1); } 35% { box-shadow: 0 0 0 3px var(--brand), var(--sh-1); background: var(--brand-tint); } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } }
/* 메타 줄: 모바일은 칩+힌트 버튼 1줄, '문제 n/12 · ① 단계명'은 둘째 줄 전체 폭 → 단계명이 절대 잘리지 않는다. ≥700px은 한 줄 */
.q-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; row-gap: 4px; margin-bottom: var(--sp-3); }
.q-count { flex: 1 1 100%; order: 9; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); white-space: normal; line-height: 1.3; min-width: 0; font-variant-numeric: tabular-nums; }
.q-count .q-idx { white-space: nowrap; }
.q-count .q-step { font-style: normal; color: var(--ink-2); font-weight: 700; } /* 수동 라벨에 brand(오답색) 금지 */
/* 모바일: '문제 n/12' 아래 단계명을 제 줄에 (.q-idx · .q-sep · .q-step 마크업) */
@media (max-width: 699px) {
  .q-count .q-sep { display: none; }
  .q-count .q-step { display: block; }
}
.hint-btn, #btnHint { position: relative; margin-left: auto; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink-2); border-radius: 999px; padding: 6px 12px; min-height: 32px; transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1); }
.hint-btn::before, #btnHint::before { content: ''; position: absolute; inset: -6px; border-radius: inherit; }
.hint-btn:disabled, #btnHint:disabled, .hint-btn.used, #btnHint.used { opacity: 1; cursor: default; color: var(--ink-3); background: var(--bg-2); border-color: transparent; box-shadow: none; }
.q-text { font-size: var(--fs-lg); font-weight: 500; letter-spacing: -.015em; line-height: 1.6; margin: 0 0 14px; word-break: keep-all; overflow-wrap: anywhere; text-wrap: pretty; color: var(--ink); }
.q-text b { font-weight: 700; color: var(--brand-2); }
.tbl-wrap { overflow-x: auto; margin: 0 0 var(--sp-3); }
.q-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-base); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.q-table th { background: var(--paper-2); font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); padding: 7px 10px; text-align: center; white-space: nowrap; }
.q-table td { padding: 7px 10px; text-align: center; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
#qAnswer { position: relative; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.choice { position: relative; font-weight: 600; font-size: var(--fs-md-2); line-height: 1.3; min-height: 54px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--paper); color: var(--ink-2); box-shadow: var(--sh-1); transition: transform .08s var(--ease), box-shadow var(--dur-1), background var(--dur-1), border-color var(--dur-1), color var(--dur-1); word-break: keep-all; font-variant-numeric: tabular-nums; }
.choice:focus-visible { color: var(--ink); }
.choice:not(:disabled):active { transform: scale(.96); box-shadow: none; }
.choice.right, .inp-display.right { background: var(--ok-tint); border-color: var(--ok); color: var(--ok-2); animation: rightPop .4s var(--ease); }
@keyframes rightPop { 35% { transform: scale(1.04); box-shadow: 0 0 0 4px var(--ok-tint); } }
.choice.right::after { content: ''; position: absolute; right: 8px; top: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 7' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/13px no-repeat; animation: badgeIn .22s var(--ease) both; }
@keyframes badgeIn { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
/* 오답은 입력창과 같은 색 언어(brand 틴트) — 회색 '꺼짐'으로 읽히지 않게 */
.choice.wrong { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-2); box-shadow: none; text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--brand); animation: nudge .38s ease; }
.choice.reveal, .inp-display.reveal { border-style: dashed; }
.choice:disabled { cursor: default; }
.choice:disabled:not(.right):not(.wrong) { background: var(--paper-2); border-color: var(--line); color: var(--ink-3); box-shadow: none; }
@keyframes nudge { 15% { transform: translateX(-6px); } 35% { transform: translateX(6px); } 55% { transform: translateX(-4px); } 75% { transform: translateX(3px); } }
.inp { display: grid; gap: var(--sp-2); }
.inp-display { display: flex; align-items: baseline; justify-content: flex-end; gap: 3px; min-height: 54px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--paper); padding: 6px 16px; font-weight: 700; font-size: 26px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; transition: border-color var(--dur-1), background var(--dur-1); }
.inp-display .ph { align-self: center; color: var(--ink-3); font-weight: 400; font-size: var(--fs-md); margin-right: auto; }
.inp-display .unit { font-size: var(--fs-md); font-weight: 600; color: var(--ink-2); }
.inp-display.wrong { border-color: var(--brand); background: var(--brand-tint); animation: nudge .38s ease; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.keypad.locked { opacity: .45; pointer-events: none; }
/* 풀이 공개 상태(.q-card.solved): 죽은 키패드/선택지는 접고 입력창(정답 표시)만 남긴다. 데스크톱은 반응형 블록에서 다시 펼침 */
.q-card.solved .keypad, .q-card.solved .choices { display: none; }
.q-card.solved .inp-display { pointer-events: none; }
/* 정답 후 잠긴 선택지(.choices.locked): 정답·오답 보기만 선명하게 */
.choices.locked .choice:not(.right):not(.wrong) { opacity: .45; }
.key { font-weight: 600; font-size: var(--fs-xl); min-height: 48px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--paper); box-shadow: var(--sh-1); transition: background .1s, transform .08s var(--ease), color var(--dur-1); font-variant-numeric: tabular-nums; }
.key:not(:disabled):active { transform: translateY(1px) scale(.97); box-shadow: none; }
.key.fn { font-size: var(--fs-base); background: var(--bg-2); border-color: transparent; color: var(--ink-2); }
.key.ok { grid-column: 4; grid-row: 2 / span 3; background: var(--brand-2); color: var(--on-brand); border-color: var(--brand-3); font-size: var(--fs-md-2); }
.key.ok:not(:disabled):active { background: var(--brand-3); }
.key:disabled { background: var(--paper-2); border-color: var(--line); color: var(--ink-3); box-shadow: none; transform: none; cursor: default; }
.key.fn:disabled { background: var(--bg-2); color: var(--ink-3); }
.key.ok:disabled { background: var(--brand-tint); border-color: transparent; color: var(--brand-2); }
/* 입력이 비어 있는 동안 확인 키는 대기 톤(.idle), 숫자가 들어오는 순간 켜진다 */
.key.ok.idle:not(:disabled) { background: var(--brand-tint); color: var(--brand-2); border-color: transparent; box-shadow: none; }
.key.ok:not(.idle):not(:disabled) { animation: keyArm .18s var(--ease); }
@keyframes keyArm { from { transform: scale(.96); } }
@media (hover: hover) {
  .hint-btn:not(:disabled):hover, #btnHint:not(:disabled):hover { background: var(--accent-tint); color: var(--accent-2); border-color: transparent; }
  .choice:not(:disabled):hover { border-color: var(--ink-3); color: var(--ink); }
  .key:not(:disabled):hover { background: var(--paper-2); }
  .key.ok:not(:disabled):hover { background: var(--brand-3); }
  .bnav-btn:hover { background: var(--paper-2); }
}
/* 피드백 박스: 제목 16 → 정답 24 → 본문 14 위계 */
.q-feedback { margin-top: var(--sp-3); border-radius: var(--r-md); padding: 12px 14px 14px; font-size: var(--fs-base); line-height: 1.6; font-variant-numeric: tabular-nums; animation: fbIn .22s var(--ease) both; }
@keyframes fbIn { from { transform: translateY(8px); opacity: 0; } }
.q-feedback .fb-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: var(--fs-md-2); line-height: 1.3; margin-bottom: 6px; letter-spacing: -.01em; }
/* 남은 기회 카운터: 제목 줄 우측 알약 (가장 중요한 상태값을 가장 작은 티어에 두지 않는다) */
.q-feedback .fb-left { font-style: normal; flex: none; margin-left: auto; font-size: var(--fs-xs); font-weight: 700; color: var(--accent-ink); background: rgba(255, 255, 255, .75); border-radius: 999px; padding: 2px 9px; }
/* 입력형 오답: '내가 쓴 답 <s>999조각</s>' — 선택지의 취소선과 같은 시각 언어 */
.q-feedback .fb-mine s { color: var(--brand-2); font-weight: 700; text-decoration-color: var(--brand); text-decoration-thickness: 2px; margin-left: 2px; }
.q-feedback .fb-ans { display: block; font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 2px 0 var(--sp-2); }
.q-feedback .fb-ans small { font-size: var(--fs-base); font-weight: 500; opacity: .75; margin-left: var(--sp-1); }
.q-feedback .fb-body { display: block; }
.q-feedback .fb-work { display: grid; gap: 4px; margin: var(--sp-2) 0 0; padding: var(--sp-2) var(--sp-3) var(--sp-2) 30px; border-left: 2px solid rgba(44, 58, 85, .18); font-size: var(--fs-base); line-height: 1.7; text-align: left; }
.q-feedback .fb-work li { animation: ink .35s ease both; animation-delay: calc(var(--i, 0) * 90ms); }
.q-feedback .fb-work li::marker { font-weight: 700; font-variant-numeric: tabular-nums; }
.q-feedback .fb-meta { display: block; margin-top: 6px; font-size: var(--fs-xs); opacity: .8; }
.q-feedback .fb-cust { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; }
.q-feedback .fb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; text-align: left; }
.q-feedback .fb-head .fb-title { margin-bottom: 0; }
.q-feedback .fb-ava { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--paper); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(44, 58, 85, .15); }
.q-feedback .fb-ava svg { display: block; width: 100%; height: 100%; }
.q-feedback.hint { background: var(--accent-tint); color: var(--accent-ink); }
.q-feedback.good { background: var(--ok-tint); color: var(--ok-ink); }
.q-feedback.sol { background: var(--info-tint); color: var(--info-ink); }
.q-feedback b { font-weight: 700; }
.q-feedback .btn { margin-top: var(--sp-3); width: 100%; }
.q-feedback small { font-size: var(--fs-xs); }
/* 모바일에서 장면이 스크롤 밖일 때 카드 안에 보여 주는 손님 반응 (B-03/D-16) */
.q-react { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--ok-tint); color: var(--ok-ink); font-weight: 700; font-size: var(--fs-base); animation: slideUp .3s var(--ease) both; }
.q-react svg, .q-react .cust-svg { width: 44px; height: 44px; flex: none; }
/* 정답 도장: 답안 영역 중앙에 찍혔다가 사라짐 */
.q-stamp { position: absolute; left: 50%; top: 50%; right: auto; transform: translate(-50%, -50%) rotate(-4deg); font-size: var(--fs-xl-2); font-weight: 700; letter-spacing: 0; color: var(--on-brand); background: var(--ok-2); border-radius: 999px; padding: 10px 24px; z-index: 3; pointer-events: none; box-shadow: 0 6px 14px rgba(47, 155, 110, .3); animation: stampIn .45s var(--ease) both, fadeOut .25s .95s ease both; }
@keyframes stampIn { 0% { transform: translate(-50%, -50%) rotate(-8deg) scale(1.6); opacity: 0; } 55% { transform: translate(-50%, -50%) rotate(-4deg) scale(.96); opacity: 1; } 100% { transform: translate(-50%, -50%) rotate(-4deg) scale(1); opacity: 1; } }
.combo-pop { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); background: var(--ink); color: var(--on-dark); border-radius: 999px; padding: 5px 14px; font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; animation: comboUp 1.4s ease both; z-index: 4; pointer-events: none; box-shadow: var(--sh-2); }
@keyframes comboUp { 0% { transform: translate(-50%, 8px) scale(.8); opacity: 0; } 20% { transform: translate(-50%, 0) scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -14px); opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
/* 레벨업 모달 뒤 조용한 대기 카드(.q-card.q-wait) */
.q-card.q-wait .q-text { color: var(--ink-3); text-align: center; margin: 0; }
/* 주문 완료 판정 카드 (G4): 음식 80px 팝인 → 별 3개 순차 */
.serve-card { text-align: center; display: grid; justify-items: center; gap: 6px; cursor: pointer; }
.serve-card .q-top { width: 100%; justify-self: stretch; margin-bottom: 0; }
.serve-card .q-count { flex: 0 1 auto; order: 0; }
.serve-card .serve-food { width: 80px; height: 80px; animation: pop .2s var(--ease) both; }
.serve-card .serve-food .food-svg, .serve-card .serve-food svg { width: 100%; height: 100%; }
.serve-card .serve-title { font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.01em; }
.serve-card .serve-title b { color: var(--brand-2); }
.serve-stars { display: inline-flex; gap: 6px; justify-content: center; vertical-align: -1px; }
/* 꺼진 별도 윤곽이 보여야 '3개 중 몇 개'가 읽힌다 (.3은 거의 안 보임) */
.serve-star { display: block; width: 28px; height: 28px; opacity: .55; filter: grayscale(1); transform: scale(.9); transition: opacity .2s, filter .2s; }
.serve-star svg { width: 100%; height: 100%; }
.serve-star.on { opacity: 1; filter: none; animation: starPop .32s var(--ease) both; }
@keyframes starPop { 0% { transform: scale(0); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
.serve-card .serve-line { font-size: var(--fs-md); color: var(--ink-2); text-wrap: balance; }
.serve-card .serve-who { font-weight: 700; color: var(--ink); }
.serve-card .serve-meta { font-size: var(--fs-sm); color: var(--ink-3); }
.q-skip { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--ink-3); }

/* 하단 메뉴 */
.bnav { flex: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--sp-1); background: var(--paper); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-b)); z-index: 5; }
.bnav-btn { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 44px; padding: 9px 6px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); transition: background var(--dur-1), color var(--dur-1); }
.bnav-btn .bi { width: 22px; height: 22px; }
.bnav-btn .nav-ico { width: 100%; height: 100%; }
.bnav-btn:not(:disabled):active { background: var(--bg-2); }
.bnav-btn.is-on { color: var(--brand-2); background: var(--brand-tint); }

/* ---------- 3-4. 랭킹 화면 (게임 종료 후) ---------- */
#screen-rank { background: var(--bg); }
.rank-scroll { flex: 1; overflow-y: auto; padding: calc(20px + var(--safe-t)) 16px calc(28px + var(--safe-b)); position: relative; }
#screen-rank .confetti { z-index: 1; }
.rk-wrap { position: relative; z-index: 2; max-width: 560px; margin: 0 auto; display: grid; gap: var(--sp-3); }
/* 짧은 스태거(최대 .3s): 응답 뒤 1초 가까이 화면 아래가 비어 보이지 않게 */
.rk-wrap > * { animation: slideUp .4s var(--ease) both; }
.rk-wrap > :nth-child(2) { animation-delay: .08s; } .rk-wrap > :nth-child(3) { animation-delay: .14s; } .rk-wrap > :nth-child(4) { animation-delay: .2s; } .rk-wrap > :nth-child(5) { animation-delay: .26s; } .rk-wrap > :nth-child(6) { animation-delay: .3s; }
.rk-list .rk-row { animation: slideUp .35s var(--ease) both; animation-delay: calc(.25s + var(--i, 0) * 30ms); }
.rk-list .rk-row.mine { animation: slideUp .35s var(--ease) both, mineFlash 1.2s ease-out both; animation-delay: calc(.25s + var(--i, 0) * 30ms), calc(.6s + var(--i, 0) * 30ms); }
/* 서버 응답 후 재렌더(.rk-wrap.settled): 이미 보이던 블록은 다시 등장시키지 않는다 */
.rk-wrap.settled > .rk-mine, .rk-wrap.settled > .rk-actions, .rk-wrap.settled > .rk-note-center { animation: none; }
.rk-wrap.settled > .rk-hero { animation-delay: 0s; }
.rk-wrap.settled > .rk-prize { animation-delay: .15s; }
.rk-wrap.settled > .rank-card { animation-delay: .3s; }
@keyframes mineFlash { 0% { box-shadow: inset 3px 0 0 var(--accent-2), 0 0 0 3px var(--accent-tint); } }
.rk-hero { position: relative; text-align: center; background: var(--ink); color: var(--on-dark); border-radius: var(--r-xl); padding: var(--sp-6) var(--sp-5) var(--sp-7); overflow: hidden; box-shadow: var(--sh-2); }
.rk-hero .eyebrow { color: var(--gold); }
.rk-hero h1 { font-size: clamp(22px, 6vw, var(--fs-3xl)); margin: var(--sp-2) 0 6px; text-wrap: balance; }
.rk-hero.win { background: linear-gradient(160deg, #3A2A14 0%, #241A14 60%); }
.rk-hero.win::before { content: ''; position: absolute; inset: -40% -20% auto; height: 120%; background: radial-gradient(50% 60% at 50% 40%, rgba(240, 179, 46, .35), transparent 70%); pointer-events: none; }
.rk-hero.wait { background: var(--paper); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--sh-1); }
.rk-hero.wait .eyebrow { color: var(--brand-2); }
.rk-hero.wait .btn { width: auto; margin-top: 14px; }
/* 순위 계산 중: 어두운 히어로를 유지한 채 자리표시 (흰→검정 플래시 방지) */
.rk-hero.calc .rk-big b, .rk-big b.ph { color: rgba(255, 255, 255, .28); animation: phPulse 1s ease-in-out infinite; }
@keyframes phPulse { 50% { opacity: .5; } }
.spin { display: inline-block; width: 14px; height: 14px; margin-right: var(--sp-2); vertical-align: -2px; border: 2px solid rgba(255, 255, 255, .25); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.rk-hero.wait .spin { border-color: var(--line-2); border-top-color: var(--brand); }
.rk-skel { display: grid; gap: 1px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--line); }
.rk-skel i { height: 46px; border-radius: 0; }
.rk-big { position: relative; display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 2px 4px; font-weight: 700; font-size: var(--fs-xl); margin: var(--sp-2) 0 var(--sp-3); }
.rk-big small { flex-basis: 100%; align-self: auto; margin: 0 0 2px; font-size: var(--fs-sm); font-weight: 600; letter-spacing: .04em; opacity: .7; text-align: center; }
.rk-big b { font-family: var(--f-display); font-weight: 400; font-size: clamp(56px, 16vw, 80px); line-height: 1; letter-spacing: -.02em; color: var(--gold); font-variant-numeric: tabular-nums; animation: pop .45s .1s var(--ease) both; }
/* 순위 공개: 카운트업 없이(1→7→9위 오표시 방지) 최종 숫자에 펀치 1회 */
.rk-big b.pop { animation: lvPunch .42s cubic-bezier(.2, 1.4, .4, 1) both; }
/* 히어로 안 플레이어 코드: 히어로만 캡처해도 교사가 대조할 수 있게 */
.rk-who { margin: -4px 0 8px; font-size: var(--fs-sm); opacity: .8; }
.rk-who b { font-family: var(--f-mono); letter-spacing: var(--ls-code); color: #fff; font-weight: 600; }
.rk-hero.wait .rk-who b { color: var(--ink); }
.rk-msg { position: relative; font-size: var(--fs-md); line-height: 1.6; text-wrap: pretty; opacity: .92; word-break: keep-all; }
.rk-msg + .rk-msg { margin-top: var(--sp-1); }
.rk-msg b { font-weight: 700; color: var(--gold); }
.rk-hero.wait .rk-msg b { color: var(--brand-2); }
.rk-note { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--ink-3); }
.rk-note-center { text-align: center; }
small.rk-note-center { display: block; }
.rk-hero .rk-note { color: inherit; opacity: .75; }
.rk-hero.wait .rk-note { color: var(--ink-3); opacity: 1; }
.rk-mine { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: var(--sp-4); align-items: center; padding: var(--sp-4); }
.rk-mine-ava { width: 76px; height: 76px; border-radius: 50%; background: var(--bg-2); overflow: hidden; display: block; box-shadow: inset 0 0 0 1px var(--line); }
.rk-mine-ava .chef-svg { display: block; width: 100%; height: 100%; margin: 0; }
.rk-mine dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-4); }
.rk-mine dt { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); }
.rk-mine dd { margin: 0; font-weight: 700; font-size: var(--fs-lg); line-height: 1.25; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rk-mine dd small { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); }
.rk-mine dd.code { font-family: var(--f-mono); font-size: var(--fs-md); letter-spacing: var(--ls-code); }
.rk-prize { background: var(--accent-tint); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-md); text-align: center; line-height: 1.55; color: var(--accent-ink); }
.rk-prize.off { background: var(--bg-2); color: var(--ink-2); }
.rk-prize b { font-weight: 700; color: var(--brand-2); }
.rk-prize small { display: block; margin-top: var(--sp-1); font-size: var(--fs-sm); opacity: .85; }
.rk-actions { display: grid; gap: var(--sp-2); }
.rk-actions .btn { width: 100%; }

/* ---------- 3-5. 수리력 분석(결과) 화면 ---------- */
#screen-result { background: var(--bg); }
.result-scroll { flex: 1; overflow-y: auto; padding: calc(20px + var(--safe-t)) 16px calc(28px + var(--safe-b)); }
.res-wrap { max-width: 860px; margin: 0 auto; display: grid; gap: var(--sp-3); }
.res-head { position: relative; text-align: center; display: grid; gap: 6px; justify-items: center; padding-top: 36px; }
.res-back { position: absolute; left: 0; top: 0; width: auto; min-height: 44px; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.res-back-arrow { display: inline-block; margin-right: 2px; font-weight: 700; }
.res-ava { width: 64px; height: 64px; border-radius: 50%; background: var(--bg-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 2px; }
.res-ava .chef-svg, .res-ava svg { display: block; width: 100%; height: 100%; }
.res-head h1 { font-size: clamp(22px, 6vw, var(--fs-3xl)); text-wrap: balance; }
.res-badge { display: inline-block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; color: var(--ink-2); }
.res-badge.gold { color: var(--accent-2); }
.res-who { color: var(--ink-3); font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; align-items: center; }
.res-code { display: inline-block; font-family: var(--f-mono); font-weight: 600; font-size: var(--fs-sm); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-xs); padding: 2px 10px; color: var(--ink); letter-spacing: var(--ls-code); }
.res-head, .res-hero, .tiles .tile, .res-wrap > .card, .res-actions { animation: slideUp .4s var(--ease) both; }
.tile b .num, .hero-cell b .num, .bar-num b .num { font-variant-numeric: tabular-nums; }
/* 세 지표 등간격 · 라벨 줄 기준선 정렬(값 크기가 달라도 라벨은 한 줄에) */
.res-hero { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: var(--sp-2); background: var(--ink); color: var(--on-dark); border-radius: var(--r-xl); padding: var(--sp-5) var(--sp-3); overflow: hidden; box-shadow: var(--sh-2); animation-delay: .08s; }
.res-hero.perfect { background: linear-gradient(160deg, #3A2A14 0%, #241A14 60%); padding-top: 44px; }
.res-hero .ribbon { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--ink); font-size: var(--fs-xs); font-weight: 700; border-radius: 999px; padding: 4px 14px; white-space: nowrap; }
.hero-cell { display: grid; grid-template-rows: auto 1fr; text-align: center; min-width: 0; }
.hero-cell > span { display: block; font-size: var(--fs-xs); opacity: .65; margin-bottom: 4px; }
.hero-cell b { display: block; align-self: end; font-weight: 700; font-size: clamp(20px, 5.5vw, var(--fs-3xl)); letter-spacing: -.02em; color: #fff; font-variant-numeric: tabular-nums; }
.hero-cell b small { font-size: .5em; font-weight: 500; opacity: .7; }
/* 핵심 지표(첫 시도 정답)만 Jua 큰 숫자 — '큰 숫자 = Jua' 원칙 */
.hero-cell:first-child b { font-family: var(--f-display); font-weight: 400; font-size: clamp(40px, 11vw, 56px); line-height: 1; color: var(--gold); }
.hero-cell:first-child b small { font-family: var(--f-ui); font-weight: 500; font-size: .36em; color: var(--on-dark); opacity: .7; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.tiles .tile { animation-delay: calc(.2s + var(--i, 0) * 45ms); }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-2) 10px; text-align: center; }
.tile > span { display: block; font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: 2px; white-space: nowrap; }
.tile b { font-weight: 700; font-size: var(--fs-xl); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile b small { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); margin-left: 1px; }
.res-wrap > .card { animation-delay: .35s; }
.card.weak { background: var(--accent-tint); border-color: transparent; }
.card.weak p { line-height: 1.7; color: var(--accent-ink); }
.card.weak .tip { display: block; margin-top: 10px; font-size: var(--fs-sm); background: rgba(255, 255, 255, .7); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); color: var(--ink-2); }
.chart-grid { display: grid; gap: var(--sp-3); align-items: center; }
.radar-box { max-width: 340px; width: 100%; margin: 0 auto; }
.radar { width: 100%; height: auto; }
/* viewBox '-45 0 390 290' → 중심 (150,140)은 view-box 기준 (195,140) */
.radar .rd-data { transform-box: view-box; transform-origin: 195px 140px; }
.rd-lbl { font-family: var(--f-ui); font-weight: 600; font-size: var(--fs-sm); fill: var(--ink); }
.rd-val { font-family: var(--f-ui); font-weight: 600; font-size: var(--fs-xs); fill: var(--ink-2); }
.rd-val.none { fill: var(--ink-3); font-weight: 500; }
.rd-tick { font-size: var(--fs-2xs); fill: var(--ink-3); opacity: .7; }
.legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-xs); color: var(--ink-3); margin-top: var(--sp-1); }
.legend .lg { display: inline-block; width: 14px; height: 6px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.lg.first { background: var(--brand-2); }
.lg.final { height: 4px; border: 0; background: repeating-linear-gradient(90deg, var(--ok-2) 0 5px, transparent 5px 9px); }
.bars-legend { justify-content: flex-start; margin: calc(-1 * var(--sp-1)) 0 2px; }
.bars { display: grid; gap: var(--sp-3); }
.bar-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) 96px; gap: 10px; align-items: center; }
.bar-row.none .bar-track { opacity: .5; }
.bar-name { font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.bar-name .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.bar-tracks { display: grid; gap: 3px; }
.bar-track { height: 10px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); border-radius: 5px; overflow: hidden; }
.bar-track.thin { height: 4px; }
.bar-fill { height: 100%; border-radius: 5px; }
.bar-fill.first { background: var(--brand-2); }
.bar-fill.final { background: var(--ok-2); }
.bar-num { text-align: right; line-height: 1.2; }
.bar-num b { font-weight: 700; font-size: var(--fs-md); display: block; font-variant-numeric: tabular-nums; }
.bar-num small { font-size: var(--fs-xs); color: var(--ink-3); }
.q-list { display: grid; gap: 6px; }
.q-row { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); overflow: hidden; transition: border-color var(--dur-1); }
.q-row[open] { border-color: var(--line-2); }
.q-row summary { list-style: none; display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 10px 12px; cursor: pointer; flex-wrap: wrap; border-radius: inherit; transition: background var(--dur-1); }
.q-row summary::-webkit-details-marker { display: none; }
.q-row summary:active { background: var(--bg-2); }
.q-row[open] > summary { background: var(--paper-2); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.q-row summary::after { content: ''; flex: none; width: 7px; height: 7px; margin-left: 6px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: translateY(-2px) rotate(45deg); transition: transform .2s var(--ease); }
.q-row[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.q-row[open] .q-body { animation: slideUp .25s var(--ease) both; }
.q-row summary .chip.sm { min-width: 60px; justify-content: center; }
.q-no { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }
.q-diff { font-size: var(--fs-xs); color: var(--ink-3); min-width: 36px; }
.q-diff.d-hard { color: var(--ink-2); font-weight: 600; }
.mk { display: inline-flex; align-items: center; gap: var(--sp-1); width: auto; min-width: 22px; font-weight: 700; font-size: var(--fs-md-2); text-align: center; }
.mk-word { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.mk.ok { color: var(--ok-2); }
.mk.no { color: var(--brand-2); } /* 흰 바탕 5.6:1 (brand는 4.3) */
.mk.fix { color: var(--accent-2); } /* 첫 시도 오답 → 다시 풀어 맞힘: 성과·진행 역할색 */
.mk.none { color: var(--ink-3); }
.mk.none .mk-word { color: var(--ink-3); }
.q-meta { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.q-body { padding: 2px 12px 12px; font-size: var(--fs-base); border-top: 1px solid var(--line); }
.q-body p { margin: 10px 0; }
.q-ans b { font-weight: 700; color: var(--ok-2); }
.q-exp { background: var(--paper-2); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); color: var(--ink-2); }
.q-id { display: none; } /* 개발용 식별자는 학생 화면에서 숨김 */
.res-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.res-actions .btn { font-size: var(--fs-md); }
@media (hover: hover) {
  .q-row summary:hover { background: var(--paper-2); }
}

/* ---------- 4. 오버레이 ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(36, 26, 20, .45); animation: fade .2s ease both; }
.sheet-panel { position: relative; width: 100%; max-width: 760px; max-height: 86%; display: flex; flex-direction: column; background: var(--bg); border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sheetUp .3s var(--ease) both; padding-bottom: var(--safe-b); box-shadow: var(--sh-3); }
/* 시트 퇴장(closeSheet → .sheet.is-leaving 200ms 뒤 hidden) */
.sheet.is-leaving { pointer-events: none; }
.sheet.is-leaving .sheet-backdrop { animation: fadeOut .2s ease both; }
.sheet.is-leaving .sheet-panel { animation: sheetUp .2s ease reverse both; }
.sheet-panel::before { content: ''; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line-2); }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-5) var(--sp-4) 10px var(--sp-5); }
.sheet-head h2 { font-size: var(--fs-xl); letter-spacing: -.02em; }
.sheet-head .icon-btn { flex: none; }
.sheet-note { margin: 0 var(--sp-4) var(--sp-2); font-size: var(--fs-sm); color: var(--accent-ink); background: var(--accent-tint); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); }
.sheet-body { overflow-y: auto; padding: var(--sp-1) var(--sp-4) var(--sp-5); -webkit-overflow-scrolling: touch; }
.sheet-body > p, .sheet-intro { margin: 0 0 10px; color: var(--ink-2); font-size: var(--fs-sm); }
.help-list { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; gap: 14px; font-size: var(--fs-base); line-height: 1.55; color: var(--ink-2); }
.help-list b { display: block; color: var(--ink); font-weight: 700; font-size: var(--fs-md); margin-bottom: 4px; }
/* 시트 하단 나가기: 테두리 있는 보조 버튼(.btn) + 아래 작은 안내문 — 본문처럼 보이는 ghost 금지 */
.help-exit { width: auto; margin: var(--sp-2) auto 0; display: flex; }
.help-exit-note { display: block; text-align: center; font-size: var(--fs-xs); color: var(--ink-3); margin-top: 4px; }

.ord-list { display: grid; gap: var(--sp-2); }
.ord-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px 10px 10px; }
.ord-row .food-svg { width: 48px; height: 48px; }
.ord-row h3 { font-size: var(--fs-md); font-weight: 600; }
.ord-row h3 .who { font-weight: 500; color: var(--ink-2); }
.ord-row p { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 2px; }
.ord-row .st { font-size: var(--fs-sm); font-weight: 600; text-align: right; white-space: nowrap; color: var(--ink-2); }
.ord-row .st.st-now { color: var(--brand-2); }
.ord-row .st.st-done { color: var(--ok-2); }
.ord-row .st small { display: block; font-size: var(--fs-2xs); color: var(--ink-3); font-weight: 500; }
.ord-row.now { border-color: var(--brand); background: var(--brand-tint); box-shadow: var(--sh-1); }
.ord-row.lock { opacity: 1; background: var(--paper-2); box-shadow: none; }
.ord-row.lock h3, .ord-row.lock .st { color: var(--ink-3); }
/* 잠긴 행의 영역·난이도 칩은 정보(다음 손님의 영역)라 투명도를 낮추지 않는다 — paper-2 배경 + ink-3 제목이 이미 '대기'를 표현 */
.ord-row .q-mark { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-size: var(--fs-lg-2); font-weight: 700; color: var(--ink-3); }
/* 대기 손님 실루엣: 얼굴 크롭(Art.customerFace)을 원 안에 꽉 채우고 우하단 '?' 배지 */
.ord-row .q-mark.sil { position: relative; overflow: visible; place-items: center; }
.ord-row .q-mark.sil .cust-svg, .ord-row .q-mark.sil svg { width: 100%; height: 100%; margin: 0; border-radius: 50%; filter: brightness(0) opacity(.3); }
.ord-row .q-mark.sil::after { content: '?'; position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 700; color: var(--ink-3); display: grid; place-items: center; }
.dom-dots { display: flex; gap: var(--sp-1); margin-top: 5px; flex-wrap: wrap; }
.dom-dots span { font-size: var(--fs-2xs); font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-2); background: color-mix(in srgb, var(--c, var(--brand)) 13%, #fff); color: color-mix(in srgb, var(--c, var(--brand)) 50%, var(--ink)); }

.rcp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.rcp { padding: var(--sp-3) 14px 14px; display: grid; gap: var(--sp-2); position: relative; }
.rcp.lock { background: var(--paper-2); box-shadow: none; }
/* 잠긴 메뉴: 회색 실루엣 대신 색을 남기고 자물쇠 배지로 '잠김'을 표현(다음 레벨 보상 기대감) */
.rcp.lock .food-svg { filter: saturate(.35) brightness(1.05); opacity: .7; }
.rcp.lock .rcp-top { position: relative; }
.rcp.lock .rcp-top::after { content: ''; position: absolute; left: 36px; top: 36px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='10' width='12' height='10' rx='2' fill='%23fff'/%3E%3Cpath d='M8.5 10V7.5a3.5 3.5 0 0 1 7 0V10' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") center/14px no-repeat; box-shadow: 0 0 0 2px var(--paper); }
.rcp-top { display: flex; align-items: center; gap: var(--sp-3); }
.rcp-top .food-svg { width: 60px; height: 60px; flex: none; }
.rcp h3 { font-size: var(--fs-md-2); }
.rcp .price { font-weight: 600; color: var(--brand-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.rcp ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.rcp li { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); line-height: 1.4; background: var(--bg-2); border-radius: 999px; padding: 2px 8px; color: var(--ink-2); }
.ing-dot { display: inline-block; width: 10px; height: 10px; vertical-align: -1px; flex: none; }
.ing-dot svg { width: 100%; height: 100%; display: block; }
.rcp .meta { font-size: var(--fs-xs); color: var(--ink-3); }
.rcp .lock-tag { position: absolute; right: 12px; top: 12px; font-size: var(--fs-2xs); font-weight: 600; background: var(--bg-2); border-radius: 999px; padding: 2px 8px; color: var(--ink-3); }
.rcp .steps { font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.6; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: rgba(36, 26, 20, .5); animation: fade .2s ease both; overflow: hidden; }
.modal .confetti { z-index: 0; }
.modal.is-closing { pointer-events: none; animation: fadeOut .16s ease both; }
.modal.is-closing .modal-card { animation: popOut .16s ease both; }
.modal-card { position: relative; z-index: 1; width: 100%; max-width: 400px; max-height: 92%; overflow-y: auto; background: var(--paper); border-radius: var(--r-xl); padding: var(--sp-6) var(--sp-5) var(--sp-5); text-align: center; animation: pop .3s var(--ease) both; box-shadow: var(--sh-3); }
.modal-card h2 { font-size: var(--fs-2xl); margin: 0 0 6px; letter-spacing: -.02em; text-wrap: balance; }
.modal-card .eyebrow + h2 { margin-top: var(--sp-1); }
.modal-card p { margin: 0 0 10px; color: var(--ink-2); font-size: var(--fs-md); line-height: 1.6; text-wrap: pretty; }
.modal-card p b.mono { font-family: var(--f-mono); letter-spacing: var(--ls-code); color: var(--ink); }
.modal-card .btn { width: 100%; margin-top: var(--sp-2); }
.modal-card .btn:first-of-type { margin-top: var(--sp-3); }
.lvup-art { position: relative; height: 150px; margin: var(--sp-1) 0 var(--sp-2); display: grid; place-items: center; }
.lvup-art .burst { position: absolute; width: 170px; height: 170px; border-radius: 50%; background: repeating-conic-gradient(var(--accent-tint) 0 12deg, transparent 12deg 24deg); mask: radial-gradient(circle, #000 30%, transparent 70%); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); animation: burstIn .5s var(--ease) both, spin 14s .5s linear infinite; }
.lvup-art .burst i { position: absolute; inset: 0; border-radius: 50%; }
@keyframes burstIn { from { transform: scale(.4); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.lvup-art .lv-num { position: relative; display: flex; align-items: baseline; gap: 2px; font-family: var(--f-display); font-size: 60px; color: var(--brand); line-height: 1; animation: lvPunch .42s .12s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes lvPunch { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); } to { transform: scale(1); opacity: 1; } }
.lvup-art .lv-num small { font-size: var(--fs-lg-2); color: var(--ink-2); font-family: var(--f-ui); font-weight: 600; margin-right: 0; position: relative; top: -2px; }
.unlock-label { display: block; margin: 14px 0 2px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; color: var(--ink-3); }
.unlock-row { display: flex; justify-content: center; gap: var(--sp-4); margin: var(--sp-1) 0 var(--sp-2); }
.unlock-row div { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 96px; font-size: var(--fs-base); font-weight: 600; color: var(--ink-2); }
.unlock-row .food-svg, .unlock-row svg { width: 64px; height: 64px; display: block; margin: 0 auto; }
/* JS가 120ms 스태거로 .in 부여 (해금 아이템 팝인) */
.unlock-item { opacity: 0; transform: translateY(12px); transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.unlock-item.in { opacity: 1; transform: none; }
.unlock-item .sparkle { position: absolute; width: 12px; height: 12px; background: var(--accent); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: spark .9s ease-out both; }
.auto-note { display: block; margin: 10px 0 0; font-size: var(--fs-xs); color: var(--ink-3); }
.auto-bar { height: 2px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: var(--sp-2); }
.auto-bar i { display: block; height: 100%; background: var(--brand); animation: autobar var(--dur, 5s) linear both; }
@keyframes autobar { from { width: 100%; } to { width: 0; } }

.fx { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.fx-coin { position: absolute; width: 30px; height: 30px; left: 0; top: 0; will-change: transform; }
.fx-coin svg { width: 100%; height: 100%; }
.fx-heart { position: absolute; width: 24px; height: 24px; animation: heartUp 1.4s ease-out both; }
@keyframes heartUp { 0% { transform: translate(0, 0) scale(.4); opacity: 0; } 20% { opacity: 1; transform: translate(var(--dx, 0), -20px) scale(1); } 100% { transform: translate(calc(var(--dx, 0) * 2), -90px) scale(.8); opacity: 0; } }
.confetti { position: absolute; top: -20px; width: 8px; height: 13px; border-radius: 1.5px; animation: fall ease-in both; will-change: transform; }
@keyframes fall {
  0% { transform: translate(0, 0) rotateZ(var(--rot, 0deg)) rotateX(0); opacity: 1; }
  25% { transform: translate(var(--sx, 30px), 28vh) rotateZ(calc(var(--rot, 0deg) + 180deg)) rotateX(180deg); }
  50% { transform: translate(calc(var(--sx, 30px) * -.6), 56vh) rotateZ(calc(var(--rot, 0deg) + 360deg)) rotateX(360deg); }
  75% { transform: translate(var(--sx, 30px), 84vh) rotateZ(calc(var(--rot, 0deg) + 540deg)) rotateX(540deg); opacity: 1; }
  100% { transform: translate(0, 112vh) rotateZ(calc(var(--rot, 0deg) + 720deg)) rotateX(720deg); opacity: 0; }
}
/* 전체 화면 도장(영업 시간 종료 등). Jua는 '큰 숫자/브랜드' 원칙의 의도된 예외(브랜드 모멘트) */
.fx-stamp { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: var(--f-display); font-size: clamp(34px, 9vw, 56px); color: #fff; background: var(--ink); padding: 14px 32px 18px; border-radius: var(--r-xl); box-shadow: var(--sh-3); white-space: nowrap; animation: fxStamp 1.05s var(--ease) both; }
.fx-stamp.late { background: var(--brand-2); }
@keyframes fxStamp { 0% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(.96); opacity: 1; } 28% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -56%); opacity: 0; } }
/* 토스트: role=status 라이브 리전. 비어 있으면 숨기되 접근성 트리에는 남긴다(display:none 금지) */
.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: var(--on-dark); font-size: var(--fs-sm); font-weight: 600; line-height: 1.45; padding: 11px 18px; border-radius: 999px; z-index: 80; animation: pop .2s var(--ease) both; max-width: calc(100% - 32px); text-align: center; box-shadow: var(--sh-3); }
.toast:empty { opacity: 0; pointer-events: none; animation: none; }
.toast.is-leaving { animation: fadeOut .15s ease both; } /* toast()가 150ms 동안 부여 */
/* 영업 시작 스플래시 (A-13) */
/* 글자가 얹히는 브랜드 면은 brand-2(흰 글자 5.6:1). 가장자리 brand-3로 살짝 깊이. 크기는 vmin으로 데스크톱에서도 화면을 채운다 */
.splash { position: fixed; inset: 0; z-index: 65; display: grid; place-content: center; justify-items: center; gap: clamp(4px, 1vmin, 12px); text-align: center; background: var(--brand-2); background: radial-gradient(70% 60% at 50% 42%, var(--brand-2), var(--brand-3) 80%); color: var(--on-brand); animation: splashIn .35s var(--ease) both; }
.splash.out { animation: fade .3s ease reverse both; pointer-events: none; }
.splash-art { width: clamp(132px, 24vmin, 220px); animation: splashHop .5s .15s var(--ease) both; }
.splash-art .chef-svg { width: 100%; height: auto; }
.splash b { font-family: var(--f-display); font-weight: 400; font-size: clamp(44px, 8vmin, 76px); line-height: 1; letter-spacing: -.02em; animation: slideUp .35s .2s var(--ease) both; }
.splash small { font-size: clamp(14px, 2.2vmin, 20px); opacity: 1; color: rgba(255, 255, 255, .96); animation: slideUp .35s .3s var(--ease) both; }
@keyframes splashIn { from { clip-path: circle(0 at 50% 50%); } to { clip-path: circle(120% at 50% 50%); } }
@keyframes splashHop { from { transform: translateY(24px) scale(.9); opacity: 0; } 60% { transform: translateY(-8px) scale(1.04); opacity: 1; } }

/* 엔딩 장면 */
.ending { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: var(--sp-4); padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: radial-gradient(90% 70% at 50% 20%, var(--night) 0%, var(--night-2) 100%); color: var(--on-dark); overflow-y: auto; overflow-x: hidden; animation: fade .4s ease both; }
.ending > .en-head { margin-top: auto; }
.ending > .en-foot { margin-bottom: auto; }
.ending.is-leaving { animation: fadeOut .25s ease both; pointer-events: none; }
.en-head { text-align: center; max-width: 640px; animation: slideUp .5s .15s var(--ease) both; display: grid; gap: var(--sp-2); justify-items: center; }
.ending .eyebrow, .en-eyebrow { display: inline-block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; color: var(--gold); }
.en-head h1 { font-size: clamp(26px, 6vw, 36px); color: #FFFFFF; text-wrap: balance; }
.en-head p { font-size: var(--fs-base); color: rgba(255, 255, 255, .74); text-wrap: balance; max-width: 34em; }
.en-stage { width: 100%; max-width: min(920px, calc(52vh * 4 / 3)); border-radius: var(--r-lg); overflow: hidden; flex: none; animation: pop .5s .1s var(--ease) both; position: relative; z-index: 2; box-shadow: 0 20px 48px rgba(0, 0, 0, .35); outline: 1px solid rgba(255, 255, 255, .12); outline-offset: -1px; contain: layout paint; }
.en-svg { width: 100%; height: auto; display: block; }
.en-foot { width: 100%; max-width: 520px; text-align: center; display: grid; gap: var(--sp-3); position: relative; z-index: 2; animation: slideUp .5s .6s var(--ease) both; }
/* 결과 수치 2단: 라벨 위(12px) · 값 아래(20px 골드). 결과 화면의 결과 숫자가 가장 약한 위계에 있지 않게 */
.en-mini { display: flex; flex-wrap: wrap; justify-content: center; align-items: start; gap: 6px 24px; font-size: var(--fs-xs); opacity: 1; color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }
.en-mini span { display: inline-grid; justify-items: center; gap: 2px; white-space: nowrap; }
.en-mini b { font-weight: 700; font-size: var(--fs-xl); line-height: 1.1; color: var(--gold); }
.en-mini b.code { font-family: var(--f-mono); font-weight: 600; font-size: var(--fs-md-2); letter-spacing: var(--ls-code); }
.ending .confetti { z-index: 1; }
.en-sign { font-family: var(--f-display); font-size: 40px; fill: var(--gold); letter-spacing: 2px; }
.en-sign-sub { font-family: var(--f-ui); font-weight: 700; font-size: var(--fs-lg); fill: #8E3B2E; }
.en-board { font-family: var(--f-ui); font-weight: 700; font-size: var(--fs-md); fill: var(--gold); }
.en-board.big { font-family: var(--f-display); font-weight: 400; font-size: var(--fs-2xl); fill: #fff; letter-spacing: 0; }
.en-talk { font-family: var(--f-ui); font-weight: 700; font-size: var(--fs-lg); fill: #3D2A1E; letter-spacing: -.01em; }
.en-bdg-t { font-family: var(--f-display); font-size: var(--fs-lg); letter-spacing: 1px; }
.en-bdg-s { font-family: var(--f-ui); font-weight: 700; font-size: var(--fs-xs); }
.en-mini-b { font-family: var(--f-ui); font-weight: 700; font-size: 9px; fill: #1A47A0; }
.en-svg .en-qp { animation: enBob 1.7s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.en-svg .en-qp.fast { animation-duration: .5s; }
@keyframes enBob { 50% { transform: translateY(-2px) scale(1.015, 1.03); } }
.en-svg .en-walker { animation: enWalk 9s ease-out infinite; }
@keyframes enWalk { 0% { transform: translateX(-150px); opacity: 0; } 6% { opacity: 1; } 32% { transform: translateX(0); } 92% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(0); opacity: 0; } }
.en-svg .en-wave { animation: enWave .55s ease-in-out infinite alternate; transform-origin: 90px 112px; }
@keyframes enWave { from { transform: rotate(-16deg); } to { transform: rotate(18deg); } }
.en-svg .en-bow { animation: enBowK 4.5s ease-in-out infinite; transform-origin: 60px 152px; }
@keyframes enBowK { 0%, 58%, 100% { transform: rotate(0); } 66%, 80% { transform: rotate(9deg) translateY(4px); } }
.en-svg .en-bulb { animation: enBulb 1s steps(2) infinite; }
@keyframes enBulb { 50% { opacity: .45; } }
.en-svg .en-badge-drop { animation: enDrop 1.1s .7s var(--ease) both; }
.en-svg.portrait .en-badge-drop { animation-name: enDropTall; }
@keyframes enDrop { from { transform: translateY(-260px) rotate(-30deg) scale(.6); opacity: 0; } }
@keyframes enDropTall { from { transform: translateY(-400px) rotate(-30deg) scale(.6); opacity: 0; } }
.en-svg .en-badge-swing { animation: enSwing 3.2s 1.9s ease-in-out infinite; transform-origin: 0 -40px; }
@keyframes enSwing { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(6deg); } 70% { transform: rotate(-5deg); } }
.en-svg .en-shine { animation: enShine 2.8s 2s ease-in-out infinite; }
@keyframes enShine { 0% { transform: translateX(-70px) skewX(-20deg); } 45%, 100% { transform: translateX(80px) skewX(-20deg); } }
.en-svg .en-cloud { animation: enDrift 26s linear infinite alternate; }
.en-svg .en-cloud.slow { animation-duration: 40s; }
@keyframes enDrift { to { transform: translateX(90px); } }
.en-svg .en-heart { animation: enHeart 3s ease-out infinite; opacity: 0; transform-box: fill-box; }
@keyframes enHeart { 0% { opacity: 0; translate: 0 0; } 15% { opacity: 1; } 100% { opacity: 0; translate: 10px -110px; } }
.en-svg .en-flash { opacity: 0; animation: enFlash 3.4s infinite; }
.en-svg .en-flash.d2 { animation-delay: 1.7s; }
@keyframes enFlash { 0%, 86%, 100% { opacity: 0; } 89% { opacity: 1; } 94% { opacity: .15; } }
.en-svg .en-twk { animation: twinkle 1.6s ease-in-out infinite; }
.en-svg .en-lampglow { animation: glow 3s ease-in-out infinite; }
.en-svg .en-swap-a { animation: enSwapA 4s infinite; }
.en-svg .en-swap-b { animation: enSwapB 4s infinite; opacity: 0; }
@keyframes enSwapA { 0%, 45% { opacity: 1; } 50%, 95% { opacity: 0; } 100% { opacity: 1; } }
@keyframes enSwapB { 0%, 45% { opacity: 0; } 50%, 95% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- 5. 문제 그림 자료 ---------- */
.q-visual { margin: 0 0 12px; display: flex; justify-content: center; }
.q-body .q-visual { justify-content: flex-start; margin: 10px 0; }
.v-hid { display: inline-block; min-width: 26px; padding: 0 6px; border-radius: var(--r-xs); background: var(--brand-tint); color: var(--brand-2); font-weight: 700; text-align: center; border: 1px dashed var(--brand); }
.v-receipt { position: relative; width: 100%; max-width: 330px; margin-bottom: var(--sp-2); background: #fff; padding: 12px 14px 18px; font-size: var(--fs-base); border: 1px solid var(--line); border-bottom: 0; font-variant-numeric: tabular-nums; }
.v-receipt::after { content: ''; position: absolute; left: 0; right: 0; bottom: -8px; height: 10px; background: linear-gradient(-45deg, transparent 5px, #fff 5px) 0 0 / 10px 10px repeat-x, linear-gradient(45deg, transparent 5px, #fff 5px) 0 0 / 10px 10px repeat-x; filter: drop-shadow(0 1px 0 var(--line)); }
.rc-shop { text-align: center; font-weight: 700; font-size: var(--fs-md-2); }
.rc-sub { text-align: center; font-size: var(--fs-2xs); color: var(--ink-3); letter-spacing: 0; font-variant-numeric: tabular-nums; border-bottom: 1px dashed var(--line-2); padding-bottom: 6px; margin-bottom: 6px; }
.rc-sp { letter-spacing: .5em; margin-right: -.5em; }
.v-receipt table { width: 100%; border-collapse: collapse; }
.v-receipt th { font-weight: 500; font-size: var(--fs-xs); color: var(--ink-3); text-align: right; padding: 2px 2px 4px; }
.v-receipt td { text-align: right; padding: 3px 2px; white-space: nowrap; }
.v-receipt .l { text-align: left; }
.rc-line { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--line-2); margin-top: 6px; padding-top: 6px; font-weight: 700; font-size: var(--fs-md-2); }
.rc-line.sm { border-top: none; margin-top: 0; padding-top: 2px; font-size: var(--fs-sm); font-weight: 400; color: var(--ink-2); }
.rc-bar { height: 22px; margin-top: 8px; background: repeating-linear-gradient(90deg, #241A14 0 2px, transparent 2px 4px, #241A14 4px 5px, transparent 5px 8px); opacity: .7; }
.v-bars { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 10px 4px; }
.vb-title { font-weight: 700; font-size: var(--fs-sm); text-align: center; }
.v-bars svg { width: 100%; height: auto; }
.vb-grid { stroke: #EFE8DD; stroke-width: 1; }
.vb-grid.major { stroke: #DDD3C5; }
.vb-axis { stroke: #241A14; stroke-width: 1.5; }
.vb-tick { font-size: var(--fs-2xs); fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.vb-unit { font-size: 10px; fill: var(--ink-3); }
.vb-val { font-size: var(--fs-xs); fill: var(--ink); font-weight: 700; }
.vb-lbl { font-size: var(--fs-xs); fill: var(--ink-2); font-weight: 600; }
.v-cups { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.v-cup { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px 6px; text-align: center; }
.v-cup svg { width: 120px; height: auto; }
.v-cup figcaption { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.vc-tick { font-size: var(--fs-2xs); fill: var(--ink); font-variant-numeric: tabular-nums; }
.v-clock { position: relative; display: grid; justify-items: center; gap: 6px; }
.v-clock svg { width: 150px; height: 150px; }
.vk-num { font-size: var(--fs-md); font-weight: 700; fill: var(--ink); }
.vk-ap { font-size: var(--fs-xs); font-weight: 700; background: var(--ink); color: var(--on-dark); border-radius: 999px; padding: 2px 12px; }
.v-recipe { width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--sh-1); }
.vr-title { font-weight: 700; font-size: var(--fs-md); text-align: center; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 6px; }
.v-recipe table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.v-recipe th { font-weight: 600; font-size: var(--fs-sm); color: var(--ink-3); padding: 3px 4px; text-align: right; }
.v-recipe td { padding: 5px 4px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.v-recipe .l { text-align: left; }
.v-pizza svg { width: 150px; height: 150px; }
.v-tray svg { width: 100%; height: auto; }
.v-tray { width: 100%; display: flex; justify-content: center; }
.v-money { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; align-items: center; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; max-width: 420px; }
.vm-grp { display: flex; }
.vm-grp > svg + svg { margin-left: -46px; }
.vm-grp > .vm-coin + .vm-coin { margin-left: -14px; }
.vm-bill { width: 92px; height: 46px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .18)); }
.vm-coin { width: 40px; height: 40px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .18)); }
.vm-t { font-weight: 700; font-size: var(--fs-md); fill: #2B2B33; }
.vm-c { font-weight: 700; font-size: var(--fs-xs); fill: #2B2B33; }
.v-tags { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.vt-tag { position: relative; display: grid; justify-items: center; gap: 2px; min-width: 120px; max-width: 160px; flex: 1 1 120px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 18px 10px 12px; text-align: center; box-shadow: var(--sh-1); }
.vt-hole { position: absolute; top: 6px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line-2); }
.vt-shop { font-size: var(--fs-2xs); font-weight: 600; color: var(--ink-3); letter-spacing: .02em; }
.vt-name { font-weight: 700; font-size: var(--fs-md); }
.vt-price { font-weight: 700; font-size: var(--fs-xl-2); letter-spacing: -.02em; color: var(--brand-2); line-height: 1.1; font-variant-numeric: tabular-nums; }
.vt-price small { font-size: var(--fs-xs); font-weight: 600; }
.vt-unit { font-size: var(--fs-xs); color: var(--ink-3); }
.vt-badge { position: absolute; top: -9px; right: -6px; background: var(--brand-2); color: #fff; font-size: var(--fs-xs); font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.vt-sub { font-size: var(--fs-xs); color: var(--ink-3); }

/* ---------- 6. 반응형 · 접근성 ---------- */
@media (min-width: 700px) {
  body { font-size: var(--fs-md-2); }
  .stage { padding: var(--sp-4) var(--sp-5) var(--sp-5); gap: var(--sp-4); }
  .work { gap: var(--sp-4); }
  .scene { height: clamp(220px, 32vh, 300px); }
  .st-food { height: 100px; }
  .st-step { font-size: var(--fs-sm); }
  .q-count { flex: 0 1 auto; order: 0; } /* 메타 줄 한 줄 */
  .q-text { font-size: var(--fs-lg-2); }
  .choice { font-size: var(--fs-lg); min-height: 60px; }
  .chart-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
  .tiles { grid-template-columns: repeat(6, 1fr); }
  .rk-actions { grid-template-columns: 1fr 1fr; }
  .rk-actions .btn.ghost { grid-column: 1 / -1; justify-self: center; width: auto; min-width: 160px; }
  /* 셰프 4열: 카드 171px → 8자 이름 1줄, 아트 148px(모바일 124px보다 크게) */
  .chef-wrap { max-width: 720px; gap: var(--sp-5); }
  .chef-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
  .chef-opt { padding: 18px 12px 16px; }
  .chef-art { max-width: 148px; }
  .hud { padding-left: var(--sp-5); padding-right: var(--sp-5); gap: var(--sp-2); }
  .hud-item { font-size: var(--fs-base); }
  .hud-timer { font-size: var(--fs-xl); }
  .hud-timer b { min-width: 58px; }
  .q-row summary { display: grid; grid-template-columns: 22px 84px 48px auto minmax(0, 1fr) 14px; gap: var(--sp-2); align-items: center; }
  .q-row summary .chip { justify-self: start; }
  .q-meta { margin-left: 0; justify-self: end; }
}
@media (min-width: 600px) {
  .en-foot { max-width: 640px; }
  .en-next { width: auto; min-width: 280px; padding-inline: 48px; justify-self: center; }
}
/* 데스크톱 게임 스테이지: 왼쪽 열 = 장면 + 주문서/조리대, 오른쪽 열 = 문제 카드(두 행 span).
 * 장면 높이는 뷰포트에서 HUD·하단 메뉴·조리대(≈420px)를 뺀 값 → 800px 화면에서 왼쪽 열이 폴드에 꽉 차고, 오른쪽은 키패드 문제도 폴드 안 */
@media (min-width: 900px) and (orientation: landscape) {
  .stage { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "scene q" "work q"; align-items: start; gap: var(--sp-4); width: 100%; max-width: 1280px; margin: 0 auto; }
  .scene, .qpanel, .work { order: 0; }
  .scene { grid-area: scene; height: clamp(300px, calc(100vh - 420px), 480px); align-self: start; }
  .qpanel { grid-area: q; position: static; }
  .work { grid-area: work; align-self: start; }
  /* 데스크톱은 공간 여유가 있어 풀이 상태에서도 키패드/선택지를 유지 */
  .q-card.solved .keypad { display: grid; }
  .q-card.solved .choices { display: grid; }
  /* 하단 메뉴 = 가운데 떠 있는 세그먼트 컨트롤 (max 480px) */
  .bnav { width: 100%; max-width: 480px; margin: 0 auto 12px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-1); padding: 4px; border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--sh-2); }
  .bnav-btn { border-radius: 999px; min-height: 40px; }
  /* 시트 → 가운데 다이얼로그 */
  .sheet { align-items: center; padding: var(--sp-6); }
  .sheet-panel { border-radius: var(--r-xl); max-height: min(88vh, 760px); padding-bottom: 0; animation: pop .25s var(--ease) both; }
  .sheet.is-leaving .sheet-panel { animation: popOut .2s ease both; }
  .sheet-panel::before { display: none; }
  .sheet-head { padding-top: var(--sp-4); }
  .sheet-body { padding-bottom: var(--sp-6); }
  /* 2열에서는 장면 말풍선이 손님 한마디를 보여 주므로 카드 안 복제본은 숨김(명시도 0,2,0으로 기본 규칙을 이긴다) */
  .q-react, .q-feedback .fb-cust { display: none; }
  /* 시작 화면 2열: 히어로 카드(sticky) 왼쪽 · 안내 카드 오른쪽 */
  .start-col { max-width: 920px; grid-template-columns: 420px minmax(0, 1fr); align-items: start; gap: var(--sp-6); }
  .start-card { position: sticky; top: 0; }
  .start-side { display: grid; gap: var(--sp-4); align-content: start; }
  .start-bg .floaty { width: 88px; }
}
@media (orientation: portrait) and (max-width: 599px) { .en-stage { max-width: min(920px, calc(58vh * 800 / 840)); } }
@media (max-width: 599px) {
  /* 모바일 배경 음식은 숨기지 않고 4개만 작게 — 시작 화면에 '주인공(셰프)' 외의 장식은 옅게 */
  .start-bg .floaty { width: 56px; opacity: .18; }
  .start-bg .floaty:nth-child(n+5) { display: none; }
  .en-sign-sub, .en-bdg-s, .en-mini-b { display: none; }
  .en-talk { font-size: var(--fs-lg-2); }
  .q-meta { font-size: var(--fs-2xs); }
}
@media (max-width: 480px) {
  /* HUD 한 줄(nowrap): Lv 알약만 숨기고(간판에 보임) 라벨은 유지 → '주문 0/5 · 정답 0/12 · ♫ · 09:56 · CHEF-XXXXX'.
   * 390px 예산 ≈ 61 + 69 + 36 + 89 + 82 + 간격 16 + 패딩 16 = 369. 코드는 전체 표시, ellipsis는 안전장치 */
  .hud { flex-wrap: nowrap; gap: 4px; padding-left: 8px; padding-right: 8px; }
  .hud-lv { display: none; }
  .hud-item { padding: 0 7px; gap: 3px; }
  .hud-item span { font-size: var(--fs-2xs); letter-spacing: -.01em; }
  .hud-ord b { min-width: 0; }
  .hud-music { width: 36px; height: 36px; }
  .hud-timer { padding: 0 10px 2px 8px; }
  .hud-timer b { min-width: 48px; }
  .hud-code span { display: none; }
  .hud-code { padding: 0 8px; font-size: var(--fs-2xs); letter-spacing: 0; }
}
@media (max-width: 420px) {
  .st-steps { gap: 3px; }
  .st-step { font-size: var(--fs-2xs); }
}
@media (max-width: 374px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .rk-code em { display: none; }
  .mk.ok .mk-word, .mk.no .mk-word, .mk.fix .mk-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (max-width: 370px) {
  /* 아주 좁은 폭에서만 라벨을 시각적으로 숨기되 접근성 트리에는 남긴다(display:none 금지) */
  .hud-item span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .q-text { font-size: var(--fs-md); }
  .choice { font-size: var(--fs-md); }
  .slip-item { font-size: var(--fs-base); }
  .bar-row { grid-template-columns: 66px minmax(0, 1fr) 84px; }
  .rk-head, .rk-row { grid-template-columns: 26px 28px minmax(0, 1fr) 52px 52px; gap: 6px; }
  .rk-ava { width: 28px; height: 28px; }
  .rk-mine { grid-template-columns: 60px minmax(0, 1fr); }
  .rk-mine-ava { width: 60px; height: 60px; }
}
@media (max-height: 640px) { .en-head p { display: none; } .en-head h1 { font-size: var(--fs-xl-2); } .ending { gap: 10px; } .en-stage { max-width: min(920px, calc(46vh * 4 / 3)); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .auto-bar { display: none; }
  .screen.is-leaving { display: none; }
  .unlock-item { opacity: 1; transform: none; transition: none; }
  .rk-wrap > *, .rk-list .rk-row, .screen-in, .splash, .splash-art, .splash b, .splash small { animation: none; }
  .station.cooking .st-food .food-svg, .station.cooking .st-food::before, .st-step.now .dot, .q-feedback .fb-work li, .serve-food, .serve-star.on, .lv-num.lv-punch, .rk-big b.pop, .sc-dish .food-svg, .sc-dish.cooking .food-svg, .start-chef, .q-card.flash-wrong, .key.ok { animation: none; }
}

/* ---------- 시작 화면(모바일·태블릿 세로): 스크롤 없이 한 화면. 세로 공간은 vh 기준으로 줄인다 ---------- */
@media (max-width: 899px) {
  #screen-start { padding: calc(10px + var(--safe-t)) 12px calc(10px + var(--safe-b)); justify-content: center; }
  .start-col { gap: var(--sp-2); }
  .start-card { padding: clamp(10px, 1.6vh, 16px) var(--sp-4) clamp(10px, 1.6vh, 14px); }
  .logo-pot { display: none; }
  .start-chef { width: clamp(64px, 11vh, 104px); margin-bottom: 0; }
  .logo-title { font-size: clamp(26px, 4.4vh, 38px); }
  .logo-sub { margin: 4px 0 clamp(8px, 1.4vh, 14px); font-size: var(--fs-sm); }
  .start-card .btn.big { margin-top: 0; min-height: clamp(44px, 6vh, 54px); font-size: var(--fs-md-2); }
  .start-rules { margin-top: clamp(8px, 1.2vh, 12px); gap: var(--sp-1); }
  .start-rules li { padding: clamp(4px, .8vh, 8px) 4px; }
  .start-rules b { font-size: var(--fs-lg-2); }
  .start-rules span { font-size: var(--fs-2xs); }
  .start-code { margin-top: clamp(8px, 1.2vh, 12px); padding-top: clamp(8px, 1.2vh, 12px); display: flex; align-items: center; justify-content: center; gap: 8px; font-size: var(--fs-xs); }
  .start-code > span { display: inline; margin-bottom: 0; }
  .start-code b { margin-top: 0; min-width: 0; font-size: var(--fs-md); padding: 3px 10px; }
  .start-code small { display: none; }
  .start-col .info-card { padding: clamp(8px, 1.3vh, 12px) var(--sp-4) clamp(8px, 1.3vh, 12px); }
  .start-col .info-card h2 { font-size: var(--fs-base); margin-bottom: 4px; }
  .period-date { font-size: var(--fs-sm); }
  .period-date b { font-size: var(--fs-lg-2); }
  .prize-steps li { padding: clamp(4px, .8vh, 8px) 0 clamp(4px, .8vh, 8px) 32px; gap: 0; }
  .prize-steps li:first-child { padding-top: 0; }
  .prize-steps li::before { width: 22px; height: 22px; font-size: var(--fs-2xs); top: clamp(4px, .8vh, 8px); }
  .prize-steps li:first-child::before { top: 0; }
  .prize-steps b { font-size: var(--fs-sm); }
  .prize-steps span { font-size: var(--fs-xs); line-height: 1.4; }
}
