/* =====================================================================
   도트 숲속 마을 테마. 몽글몽글 구름 말풍선, 알약 이름표, 노란 고르기 창.
   창 테두리는 assets/pixel-ui.js 가 작은 격자에 찍은 도트 그림(border-image)이라
   한 점이 4~5px 로 또렷하게 보인다. 글자는 도트 글꼴 갈무리11 (assets/fonts, 인터넷 없이도 보인다).
   ===================================================================== */
@font-face { font-family: 'Galmuri11'; font-weight: 400; font-display: block; src: local('Galmuri11 Regular'), url('fonts/Galmuri11.woff2') format('woff2'); }
@font-face { font-family: 'Galmuri11'; font-weight: 700; font-display: block; src: local('Galmuri11 Bold'), url('fonts/Galmuri11-Bold.woff2') format('woff2'); }

:root {
  --ink: #3b3128;
  --ink-2: #7a6248;
  --cream: #fff8e2;
  --paper: #fff1cc;
  --line: #e4cf9e;
  --yellow: #fff59c;
  --yellow-d: #c9a22a;
  --leaf: #c4ec76;
  --leaf-d: #62a224;
  --red: #ff7088;
  --red-d: #c4405a;
  --sky: #3f86cc;
  --font: 'Galmuri11', 'Apple SD Gothic Neo', 'Malgun Gothic', monospace;
  --drop: drop-shadow(0 8px 0 rgba(24, 60, 36, .32));
  --drop-s: drop-shadow(0 5px 0 rgba(24, 60, 36, .3));
  --pop: cubic-bezier(.2, 1.5, .4, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* 도트 글자 테두리 (8방향 4px) */
  --px-outline: 4px 0 #fff, -4px 0 #fff, 0 4px #fff, 0 -4px #fff, 4px 4px #fff, -4px 4px #fff, 4px -4px #fff, -4px -4px #fff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #44a04c; color: var(--ink);
  font-family: var(--font); font-weight: 400; font-synthesis: none;
  -webkit-font-smoothing: none;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; -webkit-user-select: text; user-select: text; }
img { -webkit-user-drag: none; }
svg { flex: none; }

#bg, #stage { position: fixed; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: hidden; }
.bg-art, #snow { position: absolute; inset: 0; width: 100%; height: 100%; }
.bg-art, .lights-art, #treeCanvas { image-rendering: pixelated; }
.lights-art { position: absolute; left: 0; top: 0; width: 1920px; height: 136px; pointer-events: none; z-index: 10; }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
#actors { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.fox3d-layer { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; pointer-events: none; }
#screens { position: absolute; inset: 0; z-index: 20; }
#wipe { position: absolute; inset: 0; width: 1920px; height: 1080px; z-index: 50; pointer-events: none; opacity: 0; }

@keyframes blink { 50% { opacity: .25; } }
@keyframes popIn { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { 0% { opacity: 0; transform: translateY(-60px) scale(.96); } 60% { opacity: 1; transform: translateY(8px); } 100% { transform: none; } }
@keyframes wobble { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes stepBob { 0%, 49% { transform: translateY(0); } 50%, 100% { transform: translateY(8px); } }

/* ---------- 도트 테두리 공통: 색과 모양은 --pf 변수로 고른다 ---------- */
.pf, .qwin, .rwin, .panel, .btn, .pill, #hud button, .talk, .talk-name, .modal-actions, .band, #toast, .fox-bubble,
.eyebrow, .title-rule span, .press, .board-head h1, .board-sub, .progress, .progress .coin, .col-panel, .col-head, .level-tag,
.bauble, .used-star, .chip, .player, .player .play, .seek, .rwin-head, .stat, .row-btn, .hold-reset, .key, kbd, .media-missing {
  border: 0 solid transparent; border-radius: 0; box-shadow: none; background: none;
  border-image: var(--pf-box-cream) 8 fill / 32px stretch;
  image-rendering: pixelated;
}
.q-media img, .giver:not(.px), .zoom img { image-rendering: auto; }

/* 공통 창: 크림색 도트 판 */
.qwin, .rwin, .panel { color: var(--ink); filter: var(--drop); }

/* 단축키 표시 */
.key {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; flex: none;
  border-image: var(--pf-box-paper) 8 fill / 16px stretch; color: var(--ink);
  font-family: var(--font); font-size: 20px; line-height: 1;
}

/* ---------- 버튼: 도트 알약 ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 16px;
  height: 96px; padding: 0 44px;
  border-image-source: var(--pf-pill-cream); border-image-slice: 10 fill; border-image-width: 40px;
  color: var(--ink); filter: var(--drop-s);
  font-family: var(--font); font-size: 40px; font-weight: 700; white-space: nowrap;
  transition: transform .14s steps(2), filter .14s;
}
.btn svg { width: 36px; height: 36px; }
.btn:hover { transform: translateY(-8px); filter: drop-shadow(0 13px 0 rgba(24, 60, 36, .28)); }
.btn:active { transform: translateY(4px); filter: drop-shadow(0 1px 0 rgba(24, 60, 36, .3)); }
.btn-gold { border-image-source: var(--pf-pill-yellow); }
.btn-emerald { border-image-source: var(--pf-pill-green); color: #2c4a12; }
.btn-ruby { border-image-source: var(--pf-pill-pink); }
.btn-ghost { height: 72px; padding: 0 28px; font-size: 28px; border-image-width: 32px; }

/* 화면 오른쪽 위 작은 도트 버튼들 */
#hud { position: absolute; top: 26px; right: 30px; z-index: 55; display: flex; gap: 12px; }
#hud button {
  position: relative; width: 76px; height: 76px; display: grid; place-items: center;
  border-image-source: var(--pf-disc-cream); border-image-slice: 10 fill; border-image-width: 38px;
  color: var(--ink); filter: var(--drop-s);
  transition: transform .14s steps(2);
}
#hud button:hover { transform: translateY(-6px); }
#hud button.off svg { opacity: .35; }
#hud button.off::after { content: ''; position: absolute; width: 44px; height: 8px; background: var(--red); transform: rotate(-45deg); }
#hud svg { width: 34px; height: 34px; }

.screen { position: absolute; inset: 0; }
.enter { animation: screenIn .45s var(--ease) both; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 표지 ---------- */
.title-copy { position: absolute; left: 110px; top: 170px; width: 1080px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 14px; height: 68px; padding: 0 34px; font-size: 30px; color: #1f4a7a;
  border-image: var(--pf-pill-blue) 10 fill / 34px stretch; filter: var(--drop-s);
}
.eyebrow svg { width: 30px; height: 30px; color: #e8a020; }
.title-main { margin: 34px 0 30px; font-size: 124px; line-height: 1.18; font-weight: 700; letter-spacing: -.02em; }
.title-main .ln { display: block; white-space: nowrap; }
.title-main .ch {
  display: inline-block; color: var(--c, #ef6a7c);
  text-shadow: var(--px-outline), 8px 0 #fff, -8px 0 #fff, 0 8px #fff, 0 -8px #fff, 8px 4px #fff, -8px 4px #fff, 4px 8px #fff, -4px 8px #fff, 8px -4px #fff, -8px -4px #fff, 4px -8px #fff, -4px -8px #fff, 0 16px rgba(24, 60, 36, .35);
  animation: letterIn .7s var(--pop) both, letterBob 1.2s steps(1) infinite;
  animation-delay: var(--d, 0s), calc(var(--d, 0s) + .8s);
}
.title-main .sp { display: inline-block; width: .3em; }
@keyframes letterIn { from { opacity: 0; transform: translateY(-80px) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes letterBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.title-rule span {
  display: inline-flex; align-items: center; gap: 12px; height: 80px; padding: 0 38px;
  font-size: 44px; font-weight: 700; color: #2c4a12;
  border-image: var(--pf-pill-green) 10 fill / 40px stretch; filter: var(--drop-s);
}
.title-rule svg { width: 34px; height: 34px; }
.title-copy .btn { margin-top: 56px; height: 124px; padding: 0 66px; font-size: 56px; border-image-width: 48px; }
.title-copy .btn svg { width: 46px; height: 46px; }
.press { display: inline-block; margin-top: 30px; margin-left: 18px; padding: 12px 30px; font-size: 28px; color: var(--ink); border-image: var(--pf-pill-cloud) 10 fill / 28px stretch; animation: blink 1.6s steps(2) infinite; }
#treeCanvas { position: absolute; left: 1196px; top: 150px; width: 672px; height: 832px; filter: drop-shadow(0 8px 0 rgba(24, 60, 36, .25)); }
.title-fade > * { animation: riseIn .7s var(--ease) both; }
.title-fade > *:nth-child(2) { animation: none; }
.title-fade > *:nth-child(3) { animation-delay: .5s; }
.title-fade > *:nth-child(4) { animation-delay: .65s; }
.title-fade > *:nth-child(5) { animation-delay: .8s; }

/* ---------- 보드: 분야별 도트 판과 동그라미 쪽지 ---------- */
.board-head { position: absolute; left: 0; right: 0; top: 30px; text-align: center; }
.board-head .eyebrow { display: none; }
.board-head h1 {
  display: inline-block; position: relative; margin: 0; padding: 22px 76px 24px;
  font-size: 55px; line-height: 1.15; font-weight: 700; color: #fff8e2;
  text-shadow: 0 4px 0 #5e3a1c;
  border-image: var(--pf-box-wood) 8 fill / 32px stretch; filter: var(--drop);
}
/* 나무 팻말 못 */
.board-head h1::before, .board-head h1::after { content: ''; position: absolute; top: 50%; width: 16px; height: 16px; margin-top: -8px; background: #f0d080; box-shadow: 4px 4px 0 #8a5a2a; }
.board-head h1::before { left: 30px; } .board-head h1::after { right: 34px; }
.board-sub { display: flex; width: max-content; margin: 18px auto 0; padding: 10px 34px; justify-content: center; align-items: center; gap: 10px; font-size: 26px; color: var(--ink); border-image: var(--pf-pill-cloud) 10 fill / 30px stretch; filter: var(--drop-s); }
.board-sub svg { width: 28px; height: 28px; color: #e8a020; }
/* 진행 표시 */
.progress {
  position: absolute; left: 36px; top: 32px; z-index: 5;
  display: flex; align-items: center; gap: 12px; height: 90px; padding: 0 34px 0 16px;
  border-image: var(--pf-pill-cream) 10 fill / 40px stretch; filter: var(--drop);
  font-size: 24px; color: var(--ink-2);
}
.progress .coin { display: grid; place-items: center; width: 60px; height: 60px; color: #2c4a12; border-image: var(--pf-disc-cream) 10 fill / 30px stretch; border-image-source: var(--pf-pill-green); }
.progress .coin svg { width: 34px; height: 34px; }
.progress b { font-weight: 700; font-size: 46px; color: var(--ink); }

.board-grid {
  position: absolute; left: 76px; top: 236px; width: 1768px;
  display: grid; grid-template-columns: 124px repeat(4, 1fr); grid-template-rows: 92px repeat(3, 196px); column-gap: 18px;
}
/* 분야마다 도트 판 */
.col-panel {
  --cat: #3f8cff;
  grid-row: 1 / span 4; margin-top: 30px;
  border-image: var(--pf-cat-box, var(--pf-box-cream)) 8 fill / 32px stretch; filter: var(--drop);
}
/* 분야 이름표 */
.col-head {
  grid-row: 1; position: relative; z-index: 1; align-self: start; justify-self: center; margin-top: -6px;
  display: flex; align-items: center; justify-content: center; gap: 14px; height: 88px; padding: 0 44px;
  border-image: var(--pf-cat-tag, var(--pf-pill-blue)) 10 fill / 40px stretch; filter: var(--drop-s);
  color: #fff; font-size: 44px; font-weight: 700; letter-spacing: .04em;
  text-shadow: 0 4px 0 var(--cat-dark, rgba(0, 0, 0, .4));
}
.col-head svg { width: 40px; height: 40px; filter: drop-shadow(0 4px 0 var(--cat-dark, rgba(0, 0, 0, .4))); }
/* 난이도 팻말 */
.level-tag {
  display: flex; flex-direction: column; align-items: center; justify-content: center; align-self: center; justify-self: center;
  width: 112px; height: 136px; gap: 8px;
  border-image: var(--pf-box-wood) 8 fill / 32px stretch; filter: var(--drop);
}
.level-tag b { font-size: 52px; line-height: 1; font-weight: 700; color: #fff8e2; text-shadow: 0 4px 0 #5e3a1c; }
.level-tag i { font-style: normal; font-size: 18px; letter-spacing: -.08em; color: #ffe88a; }

.cell { position: relative; }
.garland, .thread { display: none; }
/* 문제 쪽지: 도트 동그라미 */
.bauble-wrap { position: absolute; width: 90px; height: 164px; transition: transform .14s steps(2); }
.bauble-wrap:nth-child(odd) { transform: translateY(10px); }
.bauble {
  position: absolute; left: 4px !important; top: 36px !important; width: 84px; height: 84px;
  border-image: var(--pf-cat-disc, var(--pf-disc-cream)) 10 fill / 42px stretch; filter: var(--drop-s);
  display: grid; place-items: center; animation: stepBob 1.6s steps(1) infinite; animation-delay: inherit;
}
.bauble span { font-size: 40px; font-weight: 700; line-height: 1; color: var(--ink); margin-top: -2px; }
.bauble-wrap::before { display: none; }
.bauble-wrap::after { content: attr(data-lv); position: absolute; left: 0; right: 0; top: 140px; text-align: center; font-size: 16px; letter-spacing: -.1em; color: var(--cat-dark, var(--yellow-d)); pointer-events: none; }
.bauble-wrap.live:hover { transform: translateY(-12px) scale(1.1); }
.bauble-wrap.live:hover .bauble { border-image-source: var(--pf-cat-disc-hot, var(--pf-disc-cream)); }
/* 푼 문제: 꽃 도장 */
.bauble-wrap.used .bauble { border-image-source: var(--pf-cat-disc-used, var(--pf-disc-cream)); filter: none; animation: none; }
.bauble-wrap.used .bauble span { opacity: .3; }
.bauble-wrap.used .used-star { display: grid; }
.used-star {
  display: none; place-items: center; position: absolute; left: 16px; top: 48px !important; width: 60px; height: 60px; pointer-events: none;
  border-image: var(--pf-pill-red) 10 fill / 30px stretch; color: #fff; transform: rotate(-12deg);
}
.used-star svg { width: 36px; height: 36px; }
/* 아직 내용을 넣지 않은 칸 */
.bauble-wrap.empty::after { display: none; }
.bauble-wrap.empty .bauble { border-image: none; filter: none; animation: none; border: 6px dashed color-mix(in srgb, var(--cat) 35%, #d9cbb0); border-radius: 50%; }
.bauble-wrap.picked .bauble { animation: pickOff .32s ease-in forwards; }
@keyframes pickOff { 30% { transform: translateY(-14px) scale(1.15); } 100% { transform: translateY(-90px) scale(.4); opacity: 0; } }
.bauble-wrap.just-used .used-star { animation: stampIn .55s var(--pop) both; }
@keyframes stampIn { from { transform: scale(2.6) rotate(-40deg); opacity: 0; } to { transform: rotate(-12deg); opacity: 1; } }

/* ---------- 문제 화면: 분야 색 도트 편지지 ---------- */
.q-card {
  position: absolute; left: 50px; top: 70px; width: 1222px; height: 930px; padding: 44px 60px 48px; display: flex; flex-direction: column;
  animation: dropIn .55s var(--ease) both;
  border-image: var(--pf-cat-box, var(--pf-box-cream)) 8 fill / 40px stretch;
}
.q-card::before { content: ''; position: absolute; inset: 22px; border: 4px dashed color-mix(in srgb, var(--cat, #c9a874) 30%, #e4cf9e); pointer-events: none; }
.q-meta { position: relative; display: flex; align-items: center; gap: 18px; flex: none; padding-bottom: 20px; }
.giver {
  width: 112px; height: 112px; flex: none; object-fit: cover; padding: 8px;
  border: 0 solid transparent; border-image: var(--pf-cat-disc, var(--pf-disc-cream)) 10 fill / 40px stretch;
  background: none; filter: var(--drop-s);
}
.giver.px { image-rendering: pixelated; object-fit: contain; padding: 10px; }
.giver-text { display: flex; flex-direction: column; gap: 10px; min-width: 0; white-space: nowrap; }
.giver-text b { font-weight: 700; font-size: 36px; color: var(--ink); }
.giver-text small { font-size: 20px; color: var(--ink-2); }
.bang, .dia { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 62px; padding: 0 24px; flex: none; white-space: nowrap;
  border-image: var(--pf-pill-paper) 10 fill / 30px stretch; font-size: 24px; color: var(--ink);
}
.chip-cat { border-image-source: var(--pf-cat-tag, var(--pf-pill-blue)); color: #fff; text-shadow: 0 3px 0 var(--cat-dark, rgba(0,0,0,.4)); }
.chip svg { width: 28px; height: 28px; }
.chip i { font-style: normal; font-size: 20px; color: var(--yellow-d); letter-spacing: -.08em; }
.q-meta .spacer { flex: 1; }
.quest-reward { position: absolute; right: 40px; bottom: 26px; font-size: 22px; color: var(--ink-2); }
.quest-reward i { font-style: normal; color: var(--yellow-d); letter-spacing: -.08em; }

.q-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 24px; margin-top: 10px; }
.q-text {
  flex: 0 1 auto; min-height: 0; overflow: hidden;
  font-size: 66px; line-height: 1.46; white-space: pre-line; text-align: center;
  color: var(--ink); word-break: keep-all;
}
.q-text.has-media { flex: 0 0 auto; max-height: 40%; line-height: 1.32; }
.q-text.has-audio { max-height: 46%; line-height: 1.32; }
.q-media { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.q-media img {
  object-fit: contain; background: #fff; padding: 8px; cursor: zoom-in;
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px #8a6a44, 8px 12px 0 8px rgba(24, 60, 36, .22);
  animation: popIn .45s .1s var(--pop) both;
}
.media-missing { padding: 40px 60px; border-image: var(--pf-box-red) 8 fill / 32px stretch; color: #7a1e30; font-size: 30px; text-align: center; line-height: 1.5; }

.player {
  flex: none; display: grid; grid-template-columns: 116px 1fr; grid-template-rows: auto auto; column-gap: 28px; row-gap: 14px;
  align-items: center; padding: 26px 44px; width: 960px; align-self: center;
  border-image: var(--pf-pill-paper) 10 fill / 40px stretch;
}
.player .play {
  grid-row: 1 / span 2; width: 116px; height: 116px; display: grid; place-items: center; color: var(--ink);
  border-image: var(--pf-pill-yellow) 10 fill / 58px stretch; filter: var(--drop-s); transition: transform .14s steps(2);
}
.player .play:hover { transform: translateY(-6px); }
.player .play svg { width: 48px; height: 48px; }
.eq { display: flex; align-items: flex-end; gap: 7px; height: 66px; }
.eq i { flex: 1; height: 12px; background: #8fd86a; box-shadow: inset -4px -4px 0 rgba(0, 0, 0, .14); }
.eq i:nth-child(3n) { background: #7cc0f5; } .eq i:nth-child(3n+1) { background: #ff9aba; }
.player.playing .eq i { animation: eq .7s ease-in-out infinite alternate; animation-delay: var(--d); }
@keyframes eq { from { height: 12px; } to { height: calc(var(--h) * 6px + 12px); } }
.seek-row { display: flex; align-items: center; gap: 18px; font-size: 28px; color: var(--ink-2); }
.seek { flex: 1; height: 28px; cursor: pointer; position: relative; border-image: var(--pf-box-white) 8 fill / 12px stretch; }
.seek b { position: absolute; left: 6px; top: 6px; bottom: 6px; max-width: calc(100% - 12px); background: #ffd84a; box-shadow: inset 0 -4px 0 #d8a42a; }

.note-float { position: absolute; font-size: 58px; color: #fff; text-shadow: 4px 4px 0 rgba(24, 60, 36, .35); pointer-events: none; animation: noteUp 2.6s ease-out forwards; z-index: 41; }
.note-float:nth-child(3n) { color: var(--yellow); } .note-float:nth-child(3n+1) { color: #ff9aa8; }
@keyframes noteUp { 0% { opacity: 0; transform: translate(0, 0) scale(.5); } 20% { opacity: 1; transform: translate(0, -30px) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), -230px) rotate(20deg); } }

/* 자명종 */
.q-side { position: absolute; left: 1302px; top: 56px; width: 580px; height: 800px; }
.clock-wrap { position: absolute; left: 66px; top: 24px; width: 448px; height: 480px; transform-origin: 50% 100%; }
.clock-px { position: absolute; inset: 0; width: 448px; height: 480px; filter: drop-shadow(0 12px 0 rgba(24, 60, 36, .3)); }
.clock-label { position: absolute; left: 0; right: 0; top: 168px; text-align: center; font-size: 26px; color: var(--ink-2); }
.digits { position: absolute; left: 0; right: 0; top: 196px; text-align: center; font-size: 121px; font-weight: 700; line-height: 1; color: var(--ink); }
.clock-wrap.long .digits { font-size: 92px; top: 214px; }
.clock-wrap.hidden, .q-buttons.hidden { visibility: hidden; }
.clock-wrap.drop { animation: clockDrop .7s var(--pop) both; }
@keyframes clockDrop { from { transform: translateY(-160px) scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }
.clock-wrap.running:not(.urgent) { animation: wobble 1s ease-in-out infinite; }
.clock-wrap.urgent { animation: clockShiver .18s linear infinite; }
@keyframes clockShiver { 0%, 100% { transform: translateX(-5px) rotate(-1.5deg); } 50% { transform: translateX(5px) rotate(1.5deg); } }
.clock-wrap.urgent .digits { color: var(--red-d); animation: digitsPulse 1s ease-out infinite; }
@keyframes digitsPulse { 0% { transform: scale(1.22); } 40%, 100% { transform: scale(1); } }
.clock-wrap.ringing { animation: clockRing .12s linear infinite; }
@keyframes clockRing { 0%, 100% { transform: rotate(-5deg) translateY(-6px); } 50% { transform: rotate(5deg); } }
.clock-wrap.ended .digits { color: var(--ink-2); }

.q-buttons { position: absolute; left: 0; right: 0; top: 600px; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.q-buttons .btn { width: 500px; height: 112px; font-size: 46px; }

/* 타이머 시간 버튼 */
.timer-row { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 84px; padding: 0 18px;
  border-image: var(--pf-pill-cream) 10 fill / 32px stretch; filter: var(--drop-s);
  font-size: 28px; white-space: nowrap; color: var(--ink);
  transition: transform .14s steps(2), opacity .2s;
}
.pill .key { min-width: 32px; height: 32px; font-size: 17px; }
.pill-stop .key { font-size: 13px; padding: 0 5px; }
.pill:hover { transform: translateY(-6px); }
.pill:active { transform: translateY(4px); }
.pill.on { border-image-source: var(--pf-pill-yellow); }
.pill-stop { border-image-source: var(--pf-pill-pink); }
.pill-stop:disabled { opacity: .45; pointer-events: none; }
.q-buttons.drop { animation: riseIn .5s var(--pop) both; }

.vignette { position: absolute; inset: 0; pointer-events: none; z-index: 25; opacity: 0; transition: opacity .5s; background: radial-gradient(ellipse at center, transparent 55%, rgba(255, 90, 120, .45)); }
.vignette.on { opacity: 1; animation: vig 1s ease-in-out infinite; }
@keyframes vig { 50% { opacity: .45; } }

/* ---------- 알림: 위에서 통통 떨어지는 구름 말풍선 ---------- */
.band {
  position: absolute; left: 50%; top: 22px; z-index: 46; pointer-events: none; transform: translateX(-50%);
  border-image: var(--pf-cloud) 12 fill / 48px round; filter: var(--drop);
  animation: signIn .55s var(--pop) both;
}
.band-in { display: flex; align-items: center; gap: 22px; padding: 30px 64px; font-size: 34px; color: var(--ink); white-space: nowrap; }
.band-in b { font-weight: 700; color: #2c4a12; padding: 8px 30px; border: 0 solid transparent; border-image: var(--pf-pill-green) 10 fill / 28px stretch; image-rendering: pixelated; }
.band.out { animation: signOut .4s ease-in forwards; }
@keyframes signIn { from { transform: translateX(-50%) translateY(-200px) scale(.6); } 70% { transform: translateX(-50%) translateY(10px) scale(1.04); } to { transform: translateX(-50%); } }
@keyframes signOut { to { transform: translateX(-50%) translateY(-220px) scale(.6); } }
/* 시간 종료: 가운데 큰 빨간 팻말 */
.band-alert { top: 300px; border-image: var(--pf-box-red) 8 fill / 40px stretch; animation: alertIn 2.6s var(--ease) both; }
.band-alert .band-in { flex-direction: column; gap: 8px; padding: 40px 120px 46px; }
.band-alert small { font-size: 33px; letter-spacing: .3em; color: #7a1e30; }
.band-alert b { font-size: 121px; font-weight: 700; line-height: 1.05; color: #fff; border-image: none; padding: 0; text-shadow: 0 8px 0 var(--red-d), 6px 0 var(--red-d), -6px 0 var(--red-d), 0 -6px var(--red-d); }
@keyframes alertIn { 0% { transform: translateX(-50%) scale(.3); opacity: 0; } 10% { transform: translateX(-50%) scale(1.08); opacity: 1; } 16% { transform: translateX(-50%) scale(1); } 84% { transform: translateX(-50%); opacity: 1; } 100% { transform: translateX(-50%) translateY(-60px) scale(.8); opacity: 0; } }

/* ---------- 정답 화면: 구름 말풍선 + 초록 이름표 ---------- */
.a-card {
  position: absolute; left: 300px; top: 130px; width: 1320px; height: 750px; padding: 90px 80px 60px; display: flex; flex-direction: column; overflow: visible;
  animation: popIn .55s var(--pop) both;
  border-image: var(--pf-cloud) 12 fill / 60px round;
}
.rwin-head {
  position: absolute; left: 50%; top: -60px; transform: translateX(-50%); padding: 0 70px; height: 112px;
  display: grid; place-items: center; white-space: nowrap;
  border-image: var(--pf-pill-green) 10 fill / 50px stretch; filter: var(--drop-s);
  font-size: 55px; font-weight: 700; color: #2c4a12;
}
.rwin-head span { animation: popIn .5s .15s var(--pop) both; }
.a-label { flex: none; display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 4px; font-size: 36px; color: var(--leaf-d); }
.a-label svg { width: 38px; height: 38px; }
.a-card .q-body { animation: popIn .5s .2s var(--pop) both; }
.a-actions { position: absolute; left: 0; right: 0; top: 920px; display: flex; justify-content: center; }
.a-actions .btn { width: 560px; }

/* ---------- 캐릭터 ---------- */
.fox { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.fox-scale { position: absolute; left: 0; top: 0; width: 0; height: 0; transform: scale(var(--s, .42)); }
.fox-flip { position: absolute; left: -230px; top: -471px; width: 560px; height: 500px; transform: scaleX(var(--dir, 1)); transform-origin: 230px 471px; }
.fox-px { position: absolute; left: -100px; top: -129px; width: 640px; height: 720px; image-rendering: pixelated; }
/* 머리 위 말풍선 */
.fox-bubble {
  position: absolute; left: 0; bottom: var(--lift, 200px); transform: translateX(-50%) scale(.4); transform-origin: 50% 120%;
  padding: 26px 46px 28px; white-space: nowrap;
  border-image: var(--pf-cloud) 12 fill / 36px round; filter: var(--drop-s);
  color: var(--ink); font-size: 30px;
  opacity: 0; transition: opacity .15s, transform .35s var(--pop);
}
/* 꼬리: 도트 계단 삼각형 */
.fox-bubble::after { content: ''; position: absolute; left: 50%; bottom: -20px; width: 24px; height: 24px; margin-left: -12px; background: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 6px, 75% 6px, 75% 12px, 50% 12px, 50% 18px, 25% 18px, 25% 24px, 0 24px); box-shadow: none; }
.fox-bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }
/* 3D 캐릭터 머리 위 표시: 쿨쿨, 깜짝 (땀방울은 얼굴 그림에 있다) */
.fox-fx { position: absolute; left: 0; top: 0; width: 0; height: 0; transform: scale(var(--s, .42)); }
.fox-fx::before, .fox-fx::after { position: absolute; opacity: 0; font-family: var(--font); font-weight: 700; pointer-events: none; }
.fox[data-pose="sleep"] .fox-fx::before, .fox[data-pose="sleepy"] .fox-fx::before { content: 'Z'; left: 110px; top: -420px; font-size: 90px; color: #7c9ae8; text-shadow: var(--px-outline); animation: zz 2s ease-out infinite; }
.fox[data-pose="sleep"] .fox-fx::after { content: 'z'; left: 190px; top: -470px; font-size: 64px; color: #7c9ae8; text-shadow: var(--px-outline); animation: zz 2s 1s ease-out infinite; }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 40px) scale(.5); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(50px, -60px) scale(1.1); } }
.fox[data-pose="surprised"] .fox-fx::before { content: '!'; opacity: 1; left: 150px; top: -560px; font-size: 140px; color: #ffd84a; text-shadow: var(--px-outline), 0 10px 0 #c9a22a; animation: popIn .3s var(--pop) both; }

.snowball { position: absolute; left: 0; top: 0; width: 42px; height: 42px; margin: -21px; }
.snowman { position: absolute; width: 156px; height: 192px; transform-origin: 50% 100%; transition: transform .6s var(--pop), opacity .5s; }
.snowman img, .sled img { display: block; width: 100%; height: 100%; }
.sled { position: absolute; width: 420px; height: 72px; }

/* ---------- 알림, 대화창, 확대 ---------- */
#toast {
  position: absolute; left: 50%; bottom: 40px; z-index: 70; transform: translateX(-50%) translateY(30px) scale(.8);
  display: flex; align-items: center; gap: 14px; padding: 0 50px; height: 96px; white-space: nowrap;
  border-image: var(--pf-cloud) 12 fill / 40px round; filter: var(--drop);
  font-size: 30px; color: var(--ink); opacity: 0; transition: opacity .25s, transform .4s var(--pop); pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast svg { width: 34px; height: 34px; color: var(--leaf-d); }

.modal-back { position: absolute; inset: 0; z-index: 80; background: rgba(20, 40, 60, .3); animation: fadeIn .2s both; }
@keyframes fadeIn { from { opacity: 0; } }
/* 대화창: 화면 아래 몽글몽글 구름 말풍선 + 알약 이름표 */
.talk {
  position: absolute; left: 220px; right: 220px; bottom: 40px; min-height: 330px; padding: 96px 150px 84px;
  border-image: var(--pf-cloud) 12 fill / 60px round; filter: drop-shadow(0 10px 0 rgba(20, 40, 60, .25));
  animation: talkIn .4s var(--pop) both;
}
@keyframes talkIn { from { opacity: 0; transform: translateY(60px) scale(.85); } to { opacity: 1; transform: none; } }
.talk-name {
  position: absolute; left: 120px; top: -30px; height: 92px; min-width: 330px; padding: 0 60px;
  display: grid; place-items: center; font-size: 40px; color: #4a2a3a;
  border-image: var(--pf-tag-pink) 10 fill / 46px stretch; filter: drop-shadow(0 5px 0 rgba(20, 40, 60, .2));
}
.talk-name.tag-green { border-image-source: var(--pf-tag-green); color: #2c4018; }
.talk-name.tag-blue { border-image-source: var(--pf-tag-blue); color: #1f3a5a; }
.talk-title { font-size: 44px; font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.talk-title:empty { display: none; }
.talk-text { font-size: 44px; line-height: 1.7; color: #2e2a2a; word-break: keep-all; white-space: pre-line; min-height: 75px; }
/* 다음 표시: 도트 역삼각형이 콩콩 */
.talk-next { position: absolute; right: 150px; bottom: 60px; width: 52px; height: 48px; background: var(--px-next) 0 0 / 100% 100%; image-rendering: pixelated; opacity: 0; animation: stepBob .6s steps(1) infinite; }
.talk.done .talk-next { opacity: 1; }
/* 고르기: 말풍선 오른쪽 위 노란 창. 밑줄 친 대답, 고른 줄 왼쪽에서 흰 장갑 손이 까딱까딱 */
.modal-actions {
  position: absolute; right: 250px; bottom: 344px; display: flex; flex-direction: column; gap: 4px; padding: 34px 54px 36px 120px;
  border-image: var(--pf-choice) 10 fill / 40px stretch; filter: drop-shadow(0 6px 0 rgba(20, 40, 60, .22));
  opacity: 0; transform: translateY(20px) scale(.9); transform-origin: 80% 100%; pointer-events: none;
  transition: opacity .2s, transform .3s var(--pop);
}
.modal-actions.show { opacity: 1; transform: none; pointer-events: auto; }
.modal-actions .btn {
  position: relative; justify-content: flex-start; height: 76px; padding: 0 8px;
  border-image: none; filter: none; font-size: 40px; font-weight: 400; color: #2e2a6e;
}
.modal-actions .btn span { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 12px; text-decoration-color: #2e2a6e; }
.modal-actions .btn .key { display: none; }
.modal-actions .btn:hover, .modal-actions .btn:focus-visible, .modal-actions .btn:active { transform: none; filter: none; outline: none; }
.modal-actions .btn.sel { color: #1a0f5a; }
.modal-actions .btn::before { content: ''; position: absolute; left: -100px; top: 50%; width: 72px; height: 48px; margin-top: -26px; background: var(--px-hand) 0 0 / 100% 100%; image-rendering: pixelated; opacity: 0; filter: drop-shadow(0 4px 0 rgba(20, 40, 60, .25)); }
.modal-actions .btn.sel::before { opacity: 1; animation: handTap .5s steps(1) infinite; }
@keyframes handTap { 0%, 49% { transform: translateX(0); } 50%, 100% { transform: translateX(-10px); } }

.zoom { position: absolute; inset: 0; z-index: 75; display: grid; place-items: center; background: rgba(40, 40, 70, .85); cursor: zoom-out; animation: fadeIn .2s both; }
.zoom img { width: 1800px; height: 1000px; object-fit: contain; animation: popIn .3s var(--pop) both; }

/* 운영 패널 */
.panel { position: absolute; right: 20px; top: 20px; bottom: 20px; z-index: 85; width: 1040px; padding: 40px 50px 34px; display: flex; flex-direction: column; gap: 18px; animation: panelIn .4s var(--pop) both; border-image-width: 40px; }
@keyframes panelIn { from { transform: translateX(110%); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel h2 { font-weight: 700; font-size: 44px; color: var(--ink); }
.panel-stats { display: flex; gap: 12px; }
.stat { flex: 1; padding: 18px 22px; font-size: 20px; color: var(--ink-2); border-image: var(--pf-box-paper) 8 fill / 24px stretch; }
.stat b { display: block; font-size: 44px; color: var(--ink); font-weight: 700; }
.stat.warn { color: var(--red-d); }
.panel-list { flex: 1; min-height: 0; overflow-y: auto; border-top: 4px dashed var(--line); }
.panel-row { display: grid; grid-template-columns: 196px 1fr 138px; gap: 14px; align-items: center; padding: 10px 6px; border-bottom: 2px dashed var(--line); font-size: 22px; }
.panel-row.is-empty { opacity: .42; }
.panel-row .preview { color: var(--ink-2); font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-row .bad { color: var(--red-d); }
.row-btn { height: 50px; font-size: 20px; color: var(--ink); border-image: var(--pf-pill-yellow) 10 fill / 24px stretch; }
.row-btn:hover { filter: brightness(1.05); }
.row-btn.state-free { color: var(--ink-2); border-image: none; cursor: default; }
.panel-foot { display: flex; align-items: center; gap: 18px; font-size: 20px; color: var(--ink-2); line-height: 1.8; }
.panel-foot .keys { flex: 1; }
kbd { display: inline-grid; place-items: center; min-width: 32px; padding: 0 8px; border-image: var(--pf-box-paper) 8 fill / 12px stretch; color: var(--ink); font-family: var(--font); font-size: 16px; }
.hold-reset { position: relative; overflow: hidden; flex: none; width: 330px; height: 80px; color: #7a1e30; font-size: 22px; border-image: var(--pf-box-red) 8 fill / 24px stretch; }
.hold-reset i { position: absolute; left: 8px; top: 8px; bottom: 8px; width: 0; background: rgba(255, 255, 255, .5); }
.hold-reset span { position: relative; }

.fatal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: #06101c; color: #fff; font-family: sans-serif; font-size: 24px; line-height: 1.6; text-align: center; padding: 40px; }
.fatal b { color: #ffd98a; }

/* ---------- 3D 마을 배경 ---------- */
.world3d { position: absolute; inset: 0; width: 1920px; height: 1080px; image-rendering: pixelated; }

/* ---------- 3D 마을 표지: 게임 시작 화면 ---------- */
.title-center { left: 0; right: 0; top: 96px; width: auto; display: flex; flex-direction: column; align-items: center; text-align: center; }
.title-kicker { display: flex; gap: 6px; font-size: 64px; font-weight: 700; color: #7fe0c8; transform: rotate(-4deg); margin-bottom: -6px;
  text-shadow: 0 0 0 transparent, 5px 0 #20506a, -5px 0 #20506a, 0 5px #20506a, 0 -5px #20506a, 5px 5px #20506a, -5px 5px #20506a, 5px -5px #20506a, -5px -5px #20506a, 0 12px rgba(0, 0, 30, .45); }
.title-kicker span { display: inline-block; animation: letterIn .6s var(--pop) both, kickBob 2.4s ease-in-out infinite; animation-delay: var(--d), calc(var(--d) * 2 + 1s); }
.title-kicker span:nth-child(odd) { transform: translateY(-14px); }
.title-kicker .sp { width: 24px; }
@keyframes kickBob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
/* 글자마다 크림색 타일 위에 굵은 색 글자 */
.title-center .title-main { margin: 24px 0 18px; font-size: 118px; line-height: 1; }
.title-center .title-main .ln { display: flex; justify-content: center; gap: 14px; margin-bottom: 18px; }
.title-center .title-main .ch {
  position: relative; display: grid; place-items: center; width: 168px; height: 168px;
  border: 0 solid transparent; border-image: var(--pf-box-paper) 8 fill / 32px stretch; image-rendering: pixelated;
  filter: drop-shadow(0 10px 0 rgba(0, 0, 40, .45));
  color: var(--c); padding-top: 8px;
  text-shadow: 5px 0 #3b2a24, -5px 0 #3b2a24, 0 5px #3b2a24, 0 -5px #3b2a24, 5px 5px #3b2a24, -5px 5px #3b2a24, 5px -5px #3b2a24, -5px -5px #3b2a24, 0 11px #3b2a24;
  animation: tileIn .7s var(--pop) both, tileBob 3s ease-in-out infinite;
  animation-delay: var(--d, 0s), calc(var(--d, 0s) * 3 + 1s);
}
.title-center .title-main .ch:nth-child(3n+1) { rotate: -5deg; }
.title-center .title-main .ch:nth-child(3n+2) { rotate: 4deg; translate: 0 10px; }
.title-center .title-main .ch:nth-child(3n) { rotate: -2deg; translate: 0 -6px; }
/* 한 글자에는 새싹 */
.title-center .title-main .ln:first-child .ch:nth-child(2)::after {
  content: ''; position: absolute; left: 62px; top: -34px; width: 44px; height: 40px;
  background: linear-gradient(#6cc24a, #6cc24a) 18px 12px / 8px 28px no-repeat,
    radial-gradient(circle at 70% 70%, #8fd85a 60%, transparent 62%) 0 0 / 22px 20px no-repeat,
    radial-gradient(circle at 30% 70%, #8fd85a 60%, transparent 62%) 22px 0 / 22px 20px no-repeat;
}
.title-center .title-main .sp { width: 40px; }
@keyframes tileIn { from { opacity: 0; transform: translateY(-260px) scale(.5); } 70% { opacity: 1; transform: translateY(14px) scale(1.04); } to { transform: none; } }
@keyframes tileBob { 0%, 100% { transform: none; } 50% { transform: translateY(-8px); } }
.title-year { display: flex; align-items: center; gap: 16px; font-size: 32px; color: #fff4c8; text-shadow: 0 4px 0 rgba(0, 0, 40, .5); animation: riseIn .7s 1.4s var(--ease) both; }
.title-year svg { width: 30px; height: 30px; color: #ffd24a; }
.press-start { margin-top: 120px; padding: 12px 40px; font-size: 48px; color: #fff; text-shadow: 4px 0 #2a3a7a, -4px 0 #2a3a7a, 0 4px #2a3a7a, 0 -4px #2a3a7a, 0 8px rgba(0, 0, 40, .5);
  animation: riseIn .6s 1.8s var(--ease) both; }
.press-start span { display: inline-block; animation: pressBlink 1.1s steps(1) 2.4s infinite; }
.press-start:hover span { color: #ffe680; }
@keyframes pressBlink { 0%, 64% { opacity: 1; } 65%, 100% { opacity: 0; } }
.title-foot { position: absolute; top: 900px; font-size: 22px; color: rgba(255, 255, 255, .75); letter-spacing: .1em; }

/* 진행 표시: 동전 지갑 */
.has-world .progress { height: 96px; padding: 0 44px 0 22px; border-image: var(--pf-choice) 10 fill / 46px stretch; color: #6a5aa0; }
.has-world .progress .coin { width: 66px; height: 66px; border-image: none; color: #e0a020; filter: drop-shadow(0 4px 0 rgba(120, 80, 0, .3)); }
.has-world .progress .coin svg { width: 58px; height: 58px; }
.has-world .progress b { color: #5a3fb0; font-size: 52px; }
.has-world .a-card { padding: 96px 120px 96px; }
