/* ───── 게임 전용 폰트: Dongle (OFL, fonts/OFL-Dongle.txt) ─────
   한글 11,172자 + 영문·숫자·기본 기호만 남긴 서브셋 (원본 4.4MB → 약 180KB).
   쓰는 굵기는 두 가지뿐: 본문 400, 제목·강조·버튼·숫자 700.
   Dongle은 글자가 작게 그려지고(한글 높이 0.61em, 기존 시스템 글꼴은 약 0.89em)
   위아래 여백이 커서(줄 높이 1.45em) 두 가지를 맞췄다.
   - size-adjust 145%: 기존 글꼴과 같은 글자 높이가 되게 키운다 (CSS의 font-size 값은 그대로 둔다)
   - ascent/descent-override: 최종 줄 높이 1.2em, 글자가 줄 가운데에 오게 한다.
     이 값도 size-adjust만큼 함께 커지므로 145%로 나눠서 넣었다.
     (게임 속 한글 315자의 위·아래 끝 중앙값 기준: 글자 중심 0.128em) */
@font-face {
  font-family: 'Dongle';
  src: url('fonts/Dongle-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
  size-adjust: 145%;
  ascent-override: 54.2%; descent-override: 28.6%; line-gap-override: 0%;
}
@font-face {
  font-family: 'Dongle';
  src: url('fonts/Dongle-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
  size-adjust: 145%;
  ascent-override: 54.2%; descent-override: 28.6%; line-gap-override: 0%;
}
/* ───── 긴 글 전용 폰트: IBM Plex Sans KR 400 (OFL, fonts/OFL-IBMPlexSansKR.txt) ─────
   굽는 법·업데이트 기록처럼 읽어야 하는 긴 글에만 쓴다 (Dongle은 짧은 글에 귀엽지만 긴 글은 읽기 힘들다).
   서브셋 2.8MB → 517KB. 굵기는 400 하나만 쓰고, 강조는 굵기 대신 색으로 한다.
   로딩 화면을 늘리지 않도록 로딩이 끝난 뒤 뒤에서 받는다 (game.js). */
@font-face {
  font-family: 'IBM Plex Sans KR';
  src: url('fonts/IBMPlexSansKR-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
/* ───── 중국어(简体) 글꼴 (OFL, fonts/OFL-ZCOOLKuaiLe.txt · OFL-NotoSansSC.txt) ─────
   게임에 나오는 중국어 글자만 남긴 서브셋 (tools/zh-font.py로 다시 만든다).
   Dongle·Plex 뒤에 이어 두고 unicode-range로 한자만 맡긴다 (한국어·영어 화면에서는 받지 않는다).
   - BB ZH: 게임 글자 (ZCOOL KuaiLe, Dongle 한글과 비슷한 크기로 95%)
   - BB ZH Text: 긴 글 (Noto Sans SC, Plex 한글과 비슷한 크기로 95%)
   - BB ZH Mark: 언어 스위치의 "中" 한 글자만 (한국어·영어 화면에서 큰 글꼴을 받지 않게) */
@font-face {
  font-family: 'BB ZH';
  src: url('fonts/ZCOOLKuaiLe-zh.woff2') format('woff2');
  unicode-range: U+3000-303F, U+4E00-9FFF, U+FF00-FFEF;   /* 한자만: 이모지 등은 이 글꼴을 받지 않는다 */
  font-weight: 400; font-style: normal; font-display: swap;
  size-adjust: 95%;
}
@font-face {
  font-family: 'BB ZH Text';
  src: url('fonts/NotoSansSC-zh.woff2') format('woff2');
  unicode-range: U+3000-303F, U+4E00-9FFF, U+FF00-FFEF;   /* 한자만: 이모지 등은 이 글꼴을 받지 않는다 */
  font-weight: 400; font-style: normal; font-display: swap;
  size-adjust: 95%;
}
@font-face {
  font-family: 'BB ZH Mark';
  src: url('fonts/ZCOOLKuaiLe-mark.woff2') format('woff2');
  unicode-range: U+4E2D;   /* 한자만: 이모지 등은 이 글꼴을 받지 않는다 */
  font-weight: 400; font-style: normal; font-display: swap;
}
:root {
  --font-text: 'IBM Plex Sans KR', 'BB ZH Text', -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1c140e;
  touch-action: manipulation;
}

body {
  font-family: 'Dongle', 'BB ZH', -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-weight: 400;
  color: #3b230f;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

img { -webkit-user-drag: none; }

/* 360x640 좌표로 그리고, game.js가 화면에 맞게 통째로 확대한다 */
#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 360px;
  height: 640px;
  margin: -320px 0 0 -180px;
  overflow: hidden;
  background: #2a1b12;
  transform-origin: 50% 50%;
}

/* ───── 하늘 ───── */
#sky {
  position: absolute;
  left: 0; top: 0;
  width: 360px; height: 270px;
  background: #9fd3f2;
}
.sky-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 70%;
  opacity: 0;
}
#sky-morning { background-image: url(assets/sprites/bg-morning.webp); opacity: 1; }
#sky-sunset  { background-image: url(assets/sprites/bg-sunset.webp); }
#sky-night   { background-image: url(assets/sprites/bg-night.webp); }

#curtain {
  position: absolute;
  left: -6px; top: 0;
  width: 372px; height: 64px;
  z-index: 6;
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .3));
}

/* ───── 상단 정보 ───── */
#hud {
  position: absolute;
  left: 8px; right: 8px; top: 14px;   /* 천막 위에 올려서 하늘 배경을 넓게 보이게 */
  height: 32px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 7;
}
.pill {
  height: 30px;
  display: flex;
  align-items: center;
  background-size: 100% 100%;
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.pill.timer {
  width: 72px;
  padding: 0 8px 0 7px;
  gap: 4px;
  background-image: url(assets/sprites/timer-pill.webp);
  color: #fff;
}
#clock-icon {
  width: 18px; height: 18px;
  background: url(assets/sprites/clock.webp) 0 0 / 144px 18px no-repeat;
  image-rendering: pixelated;
  flex: none;
}
.pill.money {
  width: 94px;
  padding: 0 9px 0 33px;
  justify-content: flex-end;
  background-image: url(assets/sprites/money-pill.webp);
}
.pill.sold {
  width: 76px;
  padding: 0 10px 0 34px;
  justify-content: flex-end;
  background-image: url(assets/sprites/bread-pill.webp);
}
.round-btn {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
  font-size: 14px;
  line-height: 28px;
}
#pause-btn { margin-left: auto; display: flex; align-items: center; justify-content: center; gap: 3px; }
#pause-btn i { width: 3.5px; height: 11px; border-radius: 1.5px; background: #6b330c; }
.pause-panel { width: 260px; text-align: center; }
.pause-time { font-size: 14px; font-weight: 700; color: #8a4a1d; margin-bottom: 4px; }

/* ───── 손님과 말풍선 ───── */
#customer {
  position: absolute;
  left: 4px; top: 102px;
  width: 168px; height: 166px;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
#customer-img {
  max-width: 168px;
  max-height: 166px;
  object-fit: contain;
  transform-origin: 50% 100%;
}
#customer-img:not([src]) { visibility: hidden; }

#bubble {
  position: absolute;
  left: 162px; top: 106px;
  width: 192px; height: 128px;
  /* 그림 속 흰 풍선은 가로 6~87%, 세로 5~65%뿐이다(아래는 꼬리). 글자와 바를 그 안쪽에 둔다 */
  padding: 14px 34px 50px 24px;
  background: url(assets/sprites/textbox.webp) 0 0 / 100% 100% no-repeat;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transform-origin: 10% 90%;
}
#bubble-text {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
#bubble-text .n { color: #e2541c; font-size: 1.2em; }
#patience {
  flex: none;   /* 대사가 길어도 바가 눌려 납작해지지 않게 */
  margin-top: 8px;
  height: 7px;
  border-radius: 4px;
  background: #eadfd2;
  overflow: hidden;
}
#patience-fill {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: #5dbb63;
}

#counter {
  position: absolute;
  left: 0; top: 262px;
  width: 360px; height: 18px;
  background: #8a5a35;
  box-shadow: inset 0 3px 0 #a87248, inset 0 -3px 0 #5e3a20;
  z-index: 5;
}

/* ───── 철판 ───── */
#grill {
  position: absolute;
  left: 10px; top: 288px;
  width: 340px; height: 246px;
  padding: 6px;
  border-radius: 18px;
  background: #3a2a1f;
  box-shadow: inset 0 0 0 3px #4c372a, 0 4px 0 #1a120c;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
}
.mold {
  position: relative;
  border-radius: 12px;
  background: #2c1f17;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.mold img {
  width: 100px;
  height: 77px;
  pointer-events: none;
  transform-origin: 50% 50%;
}
/* 다 익은 붕어빵 반짝임 (투명도만 바꿔서 그래픽 칩이 처리한다) */
.mold::before {
  content: '';
  position: absolute; inset: 6px;
  border-radius: 10px;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 230, 160, .55), rgba(255, 230, 160, 0) 70%);
  opacity: 0;
  pointer-events: none;
}
.mold.ready::before { animation: bread-glow .8s ease-in-out infinite alternate; }
@keyframes bread-glow { from { opacity: 0; } to { opacity: 1; } }
.mold .bar {
  position: absolute;
  left: 14px; right: 14px; bottom: 4px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .18);
  overflow: hidden;
}
.mold .bar i {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: #ffb347;
}
.mold .tag {
  position: absolute;
  left: 50%; top: 4px;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 8px;
  background: #fff3d6;
  color: #9b4a12;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

/* ───── 작업대 ───── */
#bench {
  position: absolute;
  left: 0; top: 542px;
  width: 360px; height: 98px;
  padding: 6px 8px 10px;
  background: #f3e2c4;
  box-shadow: inset 0 4px 0 #d8bf96;
  display: flex;
  align-items: stretch;
  gap: 6px;
}
#bag, #bag-cream {
  position: relative;
  width: 84px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  touch-action: none;
}
#bag-img, #bag-cream-img { height: 80px; transform-origin: 50% 100%; }
#bag-count, #bag-cream-count {
  position: absolute;
  right: -4px; top: 0;
  min-width: 26px; height: 26px;
  padding: 0 7px;
  white-space: nowrap;
  border-radius: 13px;
  background: #e2541c;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 26px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
#bag-count small, #bag-cream-count small { font-size: 11px; opacity: .85; }   /* 담은 개수 / 최대 개수 */
#bag-count.full, #bag-cream-count.full { background: #b3261e; }
.leftover {
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255, 250, 238, .8);
  font-family: var(--font-text);
  font-size: 12px; line-height: 1.55; word-break: keep-all; color: #6b4a2e; text-align: center;
}
.leftover:empty { display: none; }
.tool {
  flex: 1;
  border-radius: 16px;
  background: #fffaf0;
  box-shadow: 0 3px 0 #d8bf96;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  touch-action: none;
}
.tool img { width: 58px; height: 58px; }
.tool span { font-size: 12px; font-weight: 700; }
.tool.on {
  background: #ffe2a8;
  box-shadow: 0 3px 0 #e0a640, inset 0 0 0 3px #ffb02e;
}

/* ───── 안내 화살표, 알림 ───── */
#toast {
  position: absolute;
  left: 50%; top: 240px;
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(40, 24, 12, .88);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 0);
}

/* ───── 화면(시작·도움말·정산) ───── */
.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.hidden { display: none; }
.screen.dim { background: rgba(28, 18, 10, .62); }

#title {
  background: url(assets/sprites/start-scene.webp) center bottom / cover no-repeat;
  justify-content: space-between;
  padding: 70px 0 64px;
}
.title-top { text-align: center; }
.title-sound {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  font-size: 18px;
  line-height: 36px;
}
.title-lang {   /* 소리 버튼 왼쪽: [한 | EN | 中] 스위치, 지금 언어 쪽이 진하다 */
  position: absolute;
  top: 14px; right: 58px;
  display: flex;
  height: 36px;
  padding: 3px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.title-lang span {
  width: 34px; height: 30px;
  border-radius: 15px;
  font-size: 21px;
  font-weight: 700;
  line-height: 30px;
  text-align: center;
  color: rgba(107, 58, 18, .4);
  transition: background .15s, color .15s;
}
.title-lang span[data-lang="zh"] { font-family: 'BB ZH Mark', 'BB ZH', sans-serif; font-size: 17px; }
.title-lang span.on { background: #6b3a12; color: #fff; }
.title-bread {
  width: 150px;
  filter: drop-shadow(0 6px 0 rgba(120, 60, 20, .25));
  animation: none;
}
#title h1 {
  margin-top: 18px;   /* 두 줄이 되면서 로고와 붙어 보이지 않게 조금 내렸다 */
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1px;
  color: #fff8ea;
  -webkit-text-stroke: 7px #8a4a1d;
  paint-order: stroke fill;
  text-shadow: 0 5px 0 #5b2e10;
}
/* 게임 이름 "cnation 붕어빵 타이쿤": 두 줄, 위 줄 cnation은 같은 글자 꾸밈으로 작게 */
.game-title { line-height: 1.05; text-align: center; }
.game-title span { display: block; }
.game-title .title-brand {
  margin-bottom: 4px;
  font-size: 0.62em;
  letter-spacing: 0.5px;
  -webkit-text-stroke-width: 5px;
  text-shadow: 0 3px 0 #5b2e10;
}
.title-menu {
  width: 230px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.btn {
  height: 52px;
  border-radius: 26px;
  background: url(assets/sprites/button.webp) 0 0 / 100% 100% no-repeat;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 2px 0 rgba(140, 60, 0, .55);
  box-shadow: 0 4px 0 rgba(110, 50, 10, .45);
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(110, 50, 10, .45); }
.btn.ghost {
  background: #fff8ea;
  color: #8a4a1d;
  text-shadow: none;
  box-shadow: 0 4px 0 rgba(110, 50, 10, .25);
}
.best {
  min-height: 18px;
  font-size: 13px;
  font-weight: 700;
  color: #fff8ea;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

.panel {
  width: 316px;
  padding: 22px 20px 20px;
  border-radius: 26px;
  background: #ffc876;
  box-shadow: 0 8px 0 rgba(90, 40, 5, .4), inset 0 0 0 4px #e7a03f;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.panel h2 {
  text-align: center;
  font-size: 21px;
  font-weight: 700;
  color: #6b330c;
}
.help-scroll {
  max-height: 404px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.help-head {
  margin-top: 6px;
  font-size: 17px;
  font-weight: 700;
  color: #6b330c;
}
.help-head:first-child { margin-top: 0; }
.help-list {
  padding: 10px 12px 10px 28px;
  border-radius: 14px;
  background: rgba(255, 250, 238, .85);
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.2px;
  word-break: keep-all;
  color: #4a2a12;
}
.help-list li + li { margin-top: 4px; }
.help-list b { font-weight: 400; color: #c8560f; }   /* 400 한 굵기만 쓰므로 강조는 색으로 */
.steps { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 14px;
  background: rgba(255, 250, 238, .85);
  font-family: var(--font-text);
  font-size: 13.5px;   /* 13px는 빽빽하고 14px부터 3줄로 넘어가는 항목이 생긴다 */
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.2px;
  word-break: keep-all;
  color: #4a2a12;
}
.steps b { font-weight: 400; color: #c8560f; }   /* 400 한 굵기만 쓰므로 강조는 색으로 */
.steps img { width: 44px; height: 44px; object-fit: contain; flex: none; }

.version-line {
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 248, 234, .9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
}
.link-btn {
  font: inherit;
  color: inherit;
  text-shadow: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 10px 4px;  /* 손가락으로 누르기 쉽게 */
  margin: -10px -4px;
}
.credit {
  margin-top: -2px;
  text-align: center;
  font-family: var(--font-text);
  font-size: 10.5px;
  font-weight: 400;
  color: #9a6a3a;
}
.credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; -webkit-user-select: text; user-select: text; }
.history-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 250, 238, .85);
  color: #4a2a12;
}
.history-item h3 { font-size: 15px; font-weight: 700; color: #6b330c; }
.history-item h3 small { margin-left: 6px; font-size: 11px; font-weight: 700; color: #a0703f; }
.history-item ul { margin-top: 5px; padding-left: 16px; font-family: var(--font-text); font-size: 11.5px; font-weight: 400; line-height: 1.6; letter-spacing: -0.2px; word-break: keep-all; color: #4a2a12; }
.history-item li + li { margin-top: 2px; }
.receipt .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 700;
}
.receipt .row b { font-size: 15px; font-variant-numeric: tabular-nums; }
.receipt .plus b { color: #2e7d32; }
.receipt .minus b { color: #c0392b; }
.receipt hr { border: 0; border-top: 2px dashed rgba(107, 51, 12, .35); margin: 2px 0; }
.receipt .total { font-size: 17px; }
.receipt .total b { font-size: 22px; color: #6b330c; }
#loading {
  z-index: 40;
  gap: 14px;
  background: radial-gradient(circle at 50% 38%, #5a3519 0%, #2a1b12 70%);
  cursor: pointer;
}
.loading-bread { width: 120px; height: 92px; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .25)); }
#loading.ready .loading-bread { animation: bread-bob 1.4s ease-in-out infinite; }
@keyframes bread-bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
.loading-title {
  margin-top: 6px;
  font-size: 32px;
  font-weight: 700;
  color: #fff8ea;
  -webkit-text-stroke: 6px #8a4a1d;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #5b2e10;
}
.loading-bar {
  width: 220px; height: 10px;
  margin-top: 10px;
  border-radius: 5px;
  background: rgba(255, 248, 234, .18);
  overflow: hidden;
}
.loading-bar i { display: block; width: 0; height: 100%; border-radius: 5px; background: #ffb347; transition: width .2s; }
#loading.ready .loading-bar { visibility: hidden; }
.loading-text { min-height: 20px; font-size: 13px; font-weight: 700; color: #fff8ea; }
#loading.ready .loading-text { font-size: 15px; animation: tap-pulse 1.4s ease-in-out infinite; }
@keyframes tap-pulse { 50% { opacity: .45; } }
.receipt .best { color: #6b330c; text-shadow: none; text-align: center; }

/* ───────────────────────── 스토리 모드 ───────────────────────── */
/* HUD: 판매 수 대신 손님 만족도 (스토리 모드 · 3분 챌린지 모두) */
.pill.sold { display: none; }
.pill.sat {
  display: flex;
  flex: 1 1 auto;      /* 시간·돈 칸을 줄이고 남은 폭을 모두 써서 만족도 바를 길게 */
  min-width: 0;
  gap: 4px;
  padding: 0 7px;
  border-radius: 15px;
  background: #ffc876;
  box-shadow: inset 0 0 0 2px #e7a03f;
  font-size: 14px;
  color: #5b2e10;
}
.pill.sat i { flex: 1; height: 7px; border-radius: 4px; background: #eadfd2; overflow: hidden; }
.pill.sat i b { display: block; width: 80%; height: 100%; background: #5dbb63; transition: width .3s; }
#sat-face { font-size: 13px; }

/* 잠긴 틀과 새로 열리는 틀 */
.mold.locked img { opacity: .35; }
.mold.locked::after {
  content: '🔒';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  border-radius: 12px;
  background: rgba(20, 12, 8, .45);
}
.mold.unlocking { animation: mold-unlock 1.1s ease-out 2; }
@keyframes mold-unlock { 0% { box-shadow: 0 0 0 0 rgba(255, 200, 90, .9); } 100% { box-shadow: 0 0 0 10px rgba(255, 200, 90, 0); } }

/* 타이틀 버튼: 두 번째 큰 버튼 */
.btn.alt { filter: hue-rotate(-18deg) saturate(1.15); }
.btn small { display: block; margin-top: 1px; font-size: 12px; font-weight: 400; opacity: .9; }
#story-continue { height: auto; min-height: 52px; padding: 6px 0; }

/* 스토리 패널 공통 */
.story-panel { width: 300px; text-align: center; }
.story-desc {
  font-family: var(--font-text);
  font-size: 13px; line-height: 1.6; letter-spacing: -0.2px;
  word-break: keep-all; color: #4a2a12;
}
.go-info {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 250, 238, .85);
  font-family: var(--font-text);
  font-size: 12px; line-height: 1.6; word-break: keep-all; color: #4a2a12;
}
.go-info b { font-weight: 400; color: #c8560f; }
.quit-note { font-family: var(--font-text); font-size: 11px; line-height: 1.5; color: #7a4a22; text-align: center; }

/* 하루 시작 이야기 */
#story-intro { cursor: pointer; }
.intro-card {
  width: 300px;
  padding: 26px 22px 22px;
  border-radius: 26px;
  background: rgba(255, 248, 234, .96);
  box-shadow: 0 8px 0 rgba(90, 40, 5, .35);
  text-align: center;
}
.intro-day {
  font-size: 34px; font-weight: 700; color: #fff8ea;
  -webkit-text-stroke: 6px #8a4a1d; paint-order: stroke fill; text-shadow: 0 4px 0 #5b2e10;
}
.intro-text {
  margin-top: 12px;
  font-family: var(--font-text);
  font-size: 15px; line-height: 1.65; letter-spacing: -0.2px; word-break: keep-all; color: #4a2a12;
}
.intro-extra { margin-top: 10px; white-space: pre-line; font-size: 15px; font-weight: 700; color: #c8560f; line-height: 1.4; }
.intro-extra:empty { display: none; }
.intro-tap { margin-top: 18px; font-size: 14px; font-weight: 700; color: #8a4a1d; animation: tap-pulse 1.4s ease-in-out infinite; }

/* 상점 */
.shop-panel { width: 324px; padding: 18px 14px 16px; }
.shop-money { text-align: center; font-size: 15px; font-weight: 700; color: #6b330c; }
.shop-money b { font-size: 18px; color: #c8560f; }
.shop-list { max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.shop-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 6px;
  border-radius: 14px;
  background: rgba(255, 250, 238, .9);
}
.shop-item.closed { opacity: .55; filter: grayscale(.6); }
.shop-icon { flex: none; width: 36px; text-align: center; font-size: 24px; }
.shop-body { flex: 1; min-width: 0; }
.shop-name { font-size: 16px; font-weight: 700; color: #5b2e10; }
.shop-name em {
  margin-left: 4px; padding: 0 6px 1px; border-radius: 7px;
  font-style: normal; font-size: 11px; font-weight: 700; vertical-align: 2px;
}
.shop-name em.hard { background: #ffe0d0; color: #c0392b; }
.shop-name em.new { background: #e2541c; color: #fff; }
.shop-dots { display: flex; gap: 3px; margin: 2px 0 3px; }
.shop-dots i { width: 14px; height: 5px; border-radius: 3px; background: #e6d2b8; }
.shop-dots i.on { background: #e2541c; }
.shop-effect { font-family: var(--font-text); font-size: 11.5px; line-height: 1.45; letter-spacing: -0.2px; color: #6b4a2e; word-break: keep-all; }
.shop-effect b { font-weight: 400; color: #c8560f; }
.shop-action { flex: none; width: 74px; text-align: center; }
.shop-buy {
  width: 100%; padding: 6px 0 5px;
  border-radius: 12px;
  background: #e2541c; color: #fff;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 3px 0 rgba(110, 40, 10, .35);
}
.shop-buy:disabled { background: #cdb79c; box-shadow: none; }
.shop-buy small { display: block; font-size: 10px; font-weight: 400; }
.shop-wait, .shop-max { font-size: 12px; font-weight: 700; color: #8a6a4a; }
.shop-max { color: #5dbb63; }

/* 엔딩 · 랭킹 */
.end-rows { display: flex; flex-direction: column; gap: 6px; padding: 10px 6px; border-radius: 14px; background: rgba(255, 250, 238, .7); }
.end-label { font-size: 13px; font-weight: 700; color: #6b330c; }
.end-name {
  width: 100%; height: 40px; padding: 0 12px;
  border: 2px solid #e7a03f; border-radius: 12px;
  background: #fff8ea;
  font: 700 18px Dongle, sans-serif; color: #5b2e10; text-align: center;
  -webkit-user-select: text; user-select: text;
}
.rank-list { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.rank-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 12px;
  background: rgba(255, 250, 238, .85); text-align: left;
}
.rank-row.me { box-shadow: inset 0 0 0 2px #e2541c; }
.rank-no { flex: none; width: 22px; font-size: 17px; font-weight: 700; color: #c8560f; text-align: center; }
.rank-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; color: #5b2e10; }
.rank-name small { display: block; font-family: var(--font-text); font-size: 10.5px; font-weight: 400; color: #8a6a4a; }
.rank-row b { flex: none; font-size: 15px; color: #6b330c; }
.rank-empty { font-family: var(--font-text); font-size: 13px; color: #6b4a2e; padding: 20px 0; }

/* 화면이 아닌 요소(버튼, 안내 문구)도 상황에 따라 숨긴다 */
.hidden { display: none !important; }

/* ───────────────────────── 스토리 모드 2단계: 손님 줄 서기 ───────────────────────── */
/* 줄 서기를 쓰는 날은 손님 한 명용 그림 대신 #queue에 줄 선 손님들을 그린다 (시안 C2) */
body.queue-mode #customer { display: none; }
body.queue-mode #bubble { left: 190px; width: 186px; }
#queue { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.qc { position: absolute; width: 145px; height: 145px; transform-origin: 50% 100%; }
.qc img { width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; }
.qtag {
  position: absolute;
  padding: 2px 7px 4px;
  border-radius: 10px;
  background: #fff8ea;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
  font-size: 13px; font-weight: 700; color: #5b2e10;
  white-space: nowrap;
}
.qtag i { display: block; margin-top: 2px; height: 4px; border-radius: 2px; background: #eadfd2; overflow: hidden; }
.qtag i b { display: block; width: 100%; height: 100%; transform-origin: 0 50%; background: #5dbb63; }
.qmore {
  position: absolute; left: 4px; top: 73px; z-index: 0;
  padding: 1px 7px 2px; border-radius: 9px;
  background: rgba(42, 27, 18, .75); color: #fff8ea;
  font-size: 13px; font-weight: 700;
}
.qmore:empty { display: none; }

/* 말풍선 아래 줄: 남은 개수 + 인내심 바 (3분 챌린지는 바만) */
#bubble-row { flex: none; display: flex; align-items: center; gap: 6px; margin-top: 8px; }
#bubble-row #patience { flex: 1; margin-top: 0; }
#order-chip { flex: none; padding: 0 7px 1px; border-radius: 8px; background: #f3e6d3; font-size: 13px; font-weight: 700; line-height: 18px; color: #5b2e10; }

/* 슈크림: Day 4부터 슈크림 도구와 슈크림 봉투가 나온다 */
body:not(.has-cream) #bag-cream, body:not(.has-cream) .tool-cream { display: none; }

.bag-label { display: none; }
body.has-cream .bag-label {
  display: block; position: absolute; left: 0; right: 0; bottom: 0;
  font-style: normal; font-size: 12px; font-weight: 700; color: #5b2e10; text-align: center;
}
body.has-cream #bench { gap: 4px; padding-left: 6px; padding-right: 6px; }
body.has-cream #bag, body.has-cream #bag-cream { flex: 1 1 0; min-width: 0; padding-bottom: 14px; }
body.has-cream #bag-img, body.has-cream #bag-cream-img { height: 62px; }
body.has-cream .tool { flex: 1 1 0; min-width: 0; }
body.has-cream .tool img { width: 44px; height: 44px; }
body.has-cream .tool span { font-size: 12px; }
body.has-cream #bag-count, body.has-cream #bag-cream-count { font-size: 12px; min-width: 22px; height: 22px; line-height: 22px; padding: 0 5px; right: -2px; }

/* 뒤집은 틀 위 종류 표시 */
.mold .kind {
  position: absolute; left: 5px; top: 5px; z-index: 2;
  padding: 0 5px 1px; border-radius: 7px;
  font-size: 11px; font-weight: 700; color: #fff; line-height: 15px;
}
.mold .kind:empty { display: none; }
.mold .kind.bean { background: #8a3b2b; }
.mold .kind.cream { background: #d8a21d; }

/* 타이틀: 게임 방법 · 랭킹 나란히 */
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
#ch-bean, #ch-mix { height: auto; min-height: 60px; padding: 8px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; line-height: 1.25; }
#ch-bean small, #ch-mix small { display: block; font-size: 14px; font-weight: 400; opacity: .9; }
.rank-entry { display: flex; flex-direction: column; gap: 6px; }
/* 랭킹 탭 */
.rank-tabs { display: flex; gap: 4px; }
.rank-tabs button { flex: 1; padding: 6px 0; border-radius: 10px; background: rgba(255, 250, 238, .6); font-size: 13px; font-weight: 700; color: #8a5a35; }
.rank-tabs button.on { background: #e2541c; color: #fff; }

/* 특별 손님 이름표: 말풍선 위에 붙는다 */
#bubble-name { position: absolute; left: 16px; top: -17px; padding: 1px 8px; border-radius: 8px; background: #e2541c; color: #fff; font-size: 13px; font-weight: 700; line-height: 1.3; white-space: nowrap; }
#bubble-name:empty { display: none; }

/* 온라인 / 내 기기 랭킹 */
.rank-scope { display: flex; align-self: stretch; gap: 4px; margin: -2px 0 0; padding: 3px; border-radius: 12px; background: rgba(138, 90, 53, .15); }
.rank-scope button { flex: 1; white-space: nowrap; padding: 4px 0; border-radius: 9px; font-size: 13px; font-weight: 700; color: #8a5a35; }
.rank-scope button.on { background: #fff8ea; color: #6b330c; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.rank-note { font-family: var(--font-text); font-size: 12px; color: #c8560f; margin: 0; }

/* 게임 방법 > 손님 소개 */
.guest-sub { font-family: var(--font-text); font-size: 12.5px; color: #8a5a35; margin: 6px 0 6px; text-align: left; }
.guest-animals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.guest-animals figure { margin: 0; text-align: center; }
.guest-animals img { width: 100%; max-width: 62px; aspect-ratio: 1; object-fit: contain; }
.guest-animals figcaption { font-family: var(--font-text); font-size: 11px; color: #6b4a2e; margin-top: -2px; }
.guest-rules { margin-bottom: 8px; }
.guest-people { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.guest { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 14px; background: rgba(255, 250, 238, .75); }
.guest > img { flex: none; width: 64px; height: 64px; object-fit: contain; object-position: 50% 100%; }
.guest h4 { margin: 0 0 2px; font-size: 17px; font-weight: 700; color: #6b330c; }
.guest ul { margin: 0; padding-left: 14px; font-family: var(--font-text); font-size: 12.5px; line-height: 1.5; letter-spacing: -0.2px; color: #4a3220; }
.guest li + li { margin-top: 2px; }
.guest b { font-weight: 400; color: #c8560f; }

/* 3분 챌린지 단계 안내 */
#stage-banner {
  position: absolute; left: 50%; top: 58px; transform: translate(-50%, 0) scale(.6);
  padding: 8px 16px; border-radius: 16px; background: rgba(226, 84, 28, .95); color: #fff;
  font-size: 20px; font-weight: 700; white-space: nowrap; text-shadow: 0 2px 0 rgba(110, 40, 0, .5);
  box-shadow: 0 4px 0 rgba(110, 40, 0, .35); z-index: 10; pointer-events: none; opacity: 0;
}
#stage-banner.show { animation: stage-pop 2.2s ease-out forwards; }
@keyframes stage-pop {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.6); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  20% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -14px) scale(1); }
}

/* 만족도가 바뀔 때 잠깐 보이는 +2 / -12 */
.pill.sat { position: relative; }
#sat-delta { position: absolute; right: 6px; top: 100%; margin-top: 2px; font-style: normal; font-size: 15px; font-weight: 700; opacity: 0; pointer-events: none; text-shadow: 0 1px 0 #fff, 0 0 3px #fff; }
#sat-delta.up { color: #2f8f3a; }
#sat-delta.down { color: #d0342c; }
#sat-delta.show { animation: sat-pop 1.1s ease-out; }
@keyframes sat-pop { 0% { opacity: 0; transform: translateY(-4px); } 15% { opacity: 1; transform: translateY(0); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(6px); } }
.pill.sat.hit { animation: sat-hit .45s ease-out; }
@keyframes sat-hit { 0%, 100% { box-shadow: inset 0 0 0 2px #e7a03f; } 30% { box-shadow: inset 0 0 0 3px #e74c3c, 0 0 8px rgba(231, 76, 60, .7); } }

/* 엔딩: 보름 장사 기록 */
#ending .panel { max-height: calc(100% - 24px); overflow-y: auto; }
.end-story { display: flex; flex-direction: column; gap: 4px; }
.end-rec { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 10px; border-radius: 10px; background: rgba(255, 250, 238, .7); font-size: 15px; color: #5b2e10; opacity: 0; animation: end-rise .5s ease-out forwards; }
.end-rec b { font-weight: 700; color: #6b330c; white-space: nowrap; }
.end-chart { display: flex; align-items: flex-end; gap: 3px; height: 54px; padding: 4px 8px 0; margin-top: 4px; border-radius: 10px; background: rgba(255, 250, 238, .7); opacity: 0; animation: end-rise .5s ease-out forwards; }
.end-chart i { flex: 1; border-radius: 3px 3px 0 0; min-height: 3px; }
.end-chart-cap { margin: 2px 0 0; font-family: var(--font-text); font-size: 11px; color: #8a5a35; opacity: 0; animation: end-rise .5s ease-out forwards; }
@keyframes end-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 창이 화면보다 길면 잘리지 않고 창 안에서 스크롤 (정산·상점·랭킹·게임 오버 등 모든 창, v1.5.19) */
.screen > .panel { max-height: calc(100% - 24px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex-shrink: 0; }
.screen > .panel > * { flex-shrink: 0; }   /* 넘치면 줄이 눌려 겹치지 않고 스크롤되게 */
