* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* 난이도별 색은 data/difficulties.js 의 theme 값이 아래 변수에 들어갑니다 */
:root {
  --bg: #fdf3e0;
  --on-bg: #4a3b35;
  --on-bg-soft: #8a7a72;
  --stars: 0;
  --vignette: 0;
  --field-top: #bfe8f7;
  --field-bottom: #dcf3c8;
  --platform: #a9d99b;
  --ink: #4a3b35;        /* 글자·테두리 */
  --ink-soft: #8a7a72;
  --panel: #fffaf0;
  --btn: #ffffff;
  --pink: #ff9eb5;
  --yellow: #ffd166;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.3s;
}

#app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px env(safe-area-inset-bottom);
}

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
}

/* ---------- 공통 ---------- */
.title { font-size: 32px; letter-spacing: 1px; color: var(--on-bg); margin-top: 8px; }
.subtitle { font-size: 14px; color: var(--on-bg-soft); margin-top: 4px; }

.sprite {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.tag {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  background: var(--ink); color: #fff;
  margin: 0 6px 0 0; vertical-align: middle;
}
.tag.nemesis { background: #e2566b; }

.main-btn {
  width: 100%; min-height: 56px;
  font-size: 18px; font-weight: 700; font-family: inherit;
  color: var(--ink); background: var(--yellow);
  border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
}
.main-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.main-btn.ghost { background: var(--btn); }
.main-btn:disabled { opacity: 0.45; box-shadow: none; }

.link-btn {
  margin-top: auto; padding: 10px;
  background: none; border: 0; font-family: inherit;
  color: var(--on-bg-soft); font-size: 13px; text-decoration: underline;
}

/* ---------- 처음 화면 · 방 만들기 ---------- */
#screen-title, #screen-room { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.title.small { font-size: 26px; }
.start-btn { margin-top: 20px; }
.save-summary { font-size: 13px; color: var(--on-bg-soft); margin-top: 6px; }
.credits { font-size: 10px; line-height: 1.4; color: var(--on-bg-soft); margin-top: 10px; text-align: center; word-break: break-word; }
.pick-label { align-self: flex-start; font-size: 14px; font-weight: 700; color: var(--on-bg); margin: 14px 0 6px; }

.pick-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick-grid.two { grid-template-columns: 1fr 1fr; }
/* 맵 고르기: 한 줄로 늘어놓고 옆으로 넘김 */
.map-strip {
  width: 100%; display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 2px 2px 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.map-strip::-webkit-scrollbar { display: none; }
.map-strip .pick { flex: 0 0 42%; scroll-snap-align: center; justify-content: center; }   /* 자물쇠가 없는 맵도 글자가 칸 가운데에 오게 */
.pick-label-note { font-weight: 400; font-size: 12px; color: var(--on-bg-soft); }
.pick {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px;
  background: var(--btn); color: var(--ink); font-family: inherit;
  border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 3px 0 var(--ink);
  opacity: 0.55;
}
.pick.selected { opacity: 1; background: var(--yellow); }
.pick:disabled { opacity: 0.35; box-shadow: none; border-style: dashed; }
.pick.warn { border-color: #e2566b; }
.pick .p-warn { font-size: 11px; font-weight: 700; color: #e2566b; }
.pick canvas { width: 80px; height: 80px; }
.pick .p-name { font-size: 14px; font-weight: 700; }
.pick .p-desc { font-size: 11px; color: var(--ink-soft); }

.monster-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.monster-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 6px 12px;
  background: var(--btn); color: var(--ink); font-family: inherit; text-align: left;
  border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 3px 0 var(--ink);
}
.monster-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.monster-card canvas { width: 64px; height: 64px; flex: none; }
.monster-card .m-name { font-size: 16px; font-weight: 700; }
.monster-card .m-en { font-size: 12px; color: var(--ink-soft); }
.monster-card .m-stat { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- 전투 화면 ---------- */
#screen-battle { padding: 8px 0 10px; gap: 8px; }

.field {
  position: relative; flex: 1 1 0; min-height: 0; width: 100%;
  background: linear-gradient(var(--field-top), var(--field-bottom));
  border: 3px solid var(--ink); border-radius: 16px;
  overflow: hidden;
}

/* 별빛과 가장자리 어둠 (어려운 난이도일수록 진하게) */
.field::before, .field::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.field::before {
  opacity: var(--stars);
  background-image:
    radial-gradient(circle, #fff 1.5px, transparent 2px),
    radial-gradient(circle, #ffe9a8 1px, transparent 1.5px),
    radial-gradient(circle, #fff 1px, transparent 1.5px);
  background-size: 97px 83px, 61px 71px, 43px 53px;
  background-position: 12px 18px, 40px 6px, 5px 30px;
  -webkit-mask-image: linear-gradient(#000 35%, transparent 75%);
  mask-image: linear-gradient(#000 35%, transparent 75%);
}
.field::after { z-index: 1; box-shadow: inset 0 0 70px 10px rgba(10, 5, 30, var(--vignette)); border-radius: 12px; }

.info-box {
  position: absolute; z-index: 2;
  background: var(--panel);
  border: 3px solid var(--ink);
  padding: 6px 10px 8px;
  box-shadow: 0 3px 0 rgba(74, 59, 53, 0.25);
}
.enemy-info { top: 10px; left: 10px; width: 54%; border-radius: 12px 12px 12px 2px; }
.player-info { bottom: 12px; right: 10px; width: 50%; border-radius: 12px 2px 12px 12px; }
.unit-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; white-space: nowrap; }
.unit-name .tag { margin: 0 0 0 6px; }
.combo { color: #e2566b; font-size: 13px; margin-left: 6px; }

/* 적과 나: 발밑에 둥근 발판 */
.unit { position: absolute; z-index: 1; }
.unit::before {
  content: ""; position: absolute; z-index: -1;
  left: -8%; right: -8%; bottom: -7%; height: 30%;
  background: var(--platform); border-radius: 50%;
}
.enemy-unit { top: 62px; right: 5%; }
.enemy-unit .sprite { width: 128px; height: 128px; }
.player-unit { bottom: 8%; left: 3%; }
.player-unit .sprite { width: 192px; height: 192px; }

.bar {
  position: relative; width: 100%; height: 16px;
  background: #5c4d47; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden;
}
.bar .fill {
  height: 100%; width: 100%;
  transform-origin: left center;
  transition: transform 0.3s ease-out;
  background: #6fcf7c;
}
.bar .fill.mid { background: #f2c14e; }
.bar .fill.low { background: #ef6b5e; }
.bar span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.bar.time { height: 10px; margin: 6px 0 0; }
.bar.time .fill { background: var(--yellow); transition: none; }
.bar.time.low .fill { background: #ef6b5e; }

.float {
  position: absolute; left: 50%; top: 0; z-index: 3;
  transform: translateX(-50%);
  font-size: 26px; font-weight: 900; color: #fff;
  -webkit-text-stroke: 1px var(--ink);
  text-shadow: 0 2px 0 var(--ink);
  pointer-events: none; opacity: 0; white-space: nowrap;
}
.float.show { animation: float-up 0.8s ease-out; }
#player-float { font-size: 20px; color: #ffb3b3; }
.float .blocked {
  display: block; text-align: center;
  font-size: 13px; font-weight: 800; color: #d6dbe6;
  -webkit-text-stroke: 0; text-shadow: 0 1px 0 var(--ink), 0 0 3px var(--ink);
}
@keyframes float-up {
  0% { opacity: 1; transform: translate(-50%, 14px); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -26px); }
}

/* 공격·피격·쓰러짐 연출 */
.lunge-up { animation: lunge-up 0.35s ease-in-out; }
.lunge-down { animation: lunge-down 0.35s ease-in-out; }
.hit { animation: hit 0.45s steps(1) 0.15s, jolt 0.4s linear 0.15s; }
/* 맞은 쪽이 좌우로 덜컥 흔들림 */
@keyframes jolt {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-9px) rotate(-4deg); }
  35% { transform: translateX(8px) rotate(3deg); }
  55% { transform: translateX(-6px); }
  75% { transform: translateX(4px); }
}
/* 전투 화면 전체 흔들림·번쩍임 (내가 맞음 / 내가 때림 / 치명타) */
.quake-hurt { animation: quake-big 0.45s linear 0.15s, tint-red 0.5s ease-out 0.15s; }
.quake-hit { animation: quake-small 0.25s linear 0.15s; }
.quake-crit { animation: quake-big 0.4s linear 0.15s, tint-white 0.4s ease-out 0.15s; }
@keyframes quake-big {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-8px, 3px); }
  25% { transform: translate(7px, -4px); }
  40% { transform: translate(-6px, -2px); }
  55% { transform: translate(5px, 3px); }
  70% { transform: translate(-3px, 1px); }
  85% { transform: translate(2px, -1px); }
}
@keyframes quake-small {
  0%, 100% { transform: translate(0, 0); }
  30% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, 1px); }
}
@keyframes tint-red {
  0% { box-shadow: inset 0 0 0 999px rgba(226, 60, 70, 0.45); }
  100% { box-shadow: inset 0 0 0 999px rgba(226, 60, 70, 0); }
}
@keyframes tint-white {
  0% { box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.7); }
  100% { box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .quake-hurt, .quake-hit, .quake-crit { animation: none; }
  .hit { animation: hit 0.45s steps(1) 0.15s; }
}
.listen-btn {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 20px;
  padding: 10px 18px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink);
}
.faint { transition: transform 0.5s ease-in, opacity 0.5s ease-in; transform: translateY(40px); opacity: 0; }
@keyframes lunge-up {
  50% { transform: translate(36px, -28px); }
}
@keyframes lunge-down {
  50% { transform: translate(-36px, 28px); }
}
@keyframes hit {
  0%, 50% { opacity: 0.15; }
  25%, 75% { opacity: 1; }
}

.quiz-area {
  flex: none; width: 100%;
  background: var(--panel);
  border: 3px solid var(--ink); border-radius: 16px;
  padding: 10px 12px 14px;
}
.quiz-head { display: flex; align-items: center; min-height: 20px; }
.q-time { margin-left: auto; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* 일시정지 버튼 (문제 위 오른쪽) */
.pause-btn {
  display: inline-flex; align-items: center; gap: 2px; margin-left: 8px; padding: 2px 8px;
  font: inherit; font-size: 12px; color: var(--ink); background: #fffaf0;
  border: 2px solid var(--ink); border-radius: 8px;
}
.pause-btn.on { background: #ffd24a; }
.choices .pause-resume { grid-column: 1 / -1; align-self: center; height: 56px; }
.choices .pause-quit {
  grid-column: 1 / -1; justify-self: center; padding: 6px 12px; margin-top: 4px;
  font: inherit; font-size: 12px; color: var(--ink-soft); background: transparent;
  border: 1px dashed var(--ink-soft); border-radius: 8px;
}
.choices .pause-quit.sure { color: #b3261e; border-color: #b3261e; border-style: solid; }

.q-prompt {
  min-height: 80px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; font-weight: 800; font-size: 34px;
  padding: 6px 4px; word-break: keep-all;
}
.q-prompt.sentence { font-size: 20px; font-weight: 600; line-height: 1.4; flex-direction: column; }
/* 답을 고른 뒤 문제 단어 아래에 나오는 "품사 · 뜻(또는 영어 단어)" */
.q-prompt.reveal { flex-direction: column; line-height: 1.15; }
.prompt-sub { margin-top: 4px; font-size: 16px; font-weight: 600; color: #6b5a52; }
/* 빈칸 문제를 푼 뒤 문장 아래에 나오는 한국어 해석 */
.sentence-ko { margin-top: 4px; font-size: 14px; font-weight: 400; color: #6b5a52; line-height: 1.35; }
.q-prompt.message { font-size: 20px; font-weight: 700; }
.q-prompt .blank { color: #e2566b; border-bottom: 3px solid #e2566b; padding: 0 4px; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 146px; }
.choice {
  min-height: 64px; padding: 6px;
  font-size: 19px; font-weight: 700; font-family: inherit;
  color: var(--ink); background: var(--btn);
  border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
  word-break: keep-all;
}
.choice:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.choice.correct { background: #8fe09b; }
.choice.wrong { background: #ff9a9a; }
.choices.locked .choice { pointer-events: none; }
.choices.locked .choice:not(.correct):not(.wrong) { opacity: 0.7; }
/* 답을 고른 뒤 보기 아래에 붙는 풀이 */
.choice-gloss { display: block; margin-top: 2px; font-size: 11px; font-weight: 400; color: #8a7a72; line-height: 1.15; }
.prompt-gloss { margin-top: 4px; font-size: 13px; font-weight: 400; color: #8a7a72; }
.choice-note { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; color: #6b5a52; line-height: 1.2; }

/* ---------- 결과 화면 ---------- */
.reward { font-size: 18px; font-weight: 700; color: var(--on-bg); margin-top: 18px; text-align: center; }
.wrong-list {
  flex: 1 1 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  width: 100%; margin: 14px 0;
  background: var(--panel); border: 3px solid var(--ink); border-radius: 14px;
  padding: 12px 14px; font-size: 15px; line-height: 1.9;
}
.wrong-list h2 { font-size: 14px; color: #e2566b; margin-bottom: 4px; }
.wrong-list .ko { color: var(--ink-soft); margin-left: 8px; }
.result-buttons { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: auto; padding-top: 14px; }
.wrong-list h2.good { color: #3f9d52; }
.wrong-list h2.notice { color: #b5651d; }

/* ---------- 포션 퀵슬롯 ---------- */
.potion-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-height: 40px; }
.potion-btn {
  min-height: 40px; padding: 0 12px;
  font-size: 15px; font-weight: 700; font-family: inherit;
  color: var(--ink); background: #fff3c4;
  border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink);
}
.potion-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.potion-btn:disabled { opacity: 0.4; box-shadow: none; }
.potion-left, .potion-empty { margin-left: auto; font-size: 12px; color: var(--ink-soft); }
.potion-empty { margin-left: 0; }

/* ---------- 지도 화면 ---------- */
#screen-world { padding: 8px 0 6px; gap: 8px; }
.hud { width: 100%; display: flex; align-items: center; gap: 6px; }
.hud-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 800; color: var(--on-bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-chip {
  font-size: 13px; font-weight: 700; padding: 4px 8px;
  background: var(--panel); border: 2px solid var(--ink); border-radius: 99px; white-space: nowrap;
  color: var(--ink); font-family: inherit;
}
.hud-btn {
  font-size: 13px; font-weight: 700; font-family: inherit; padding: 5px 10px;
  color: var(--ink); background: var(--btn); border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: 0 2px 0 var(--ink); white-space: nowrap;
}
.world-wrap {
  position: relative; flex: 1 1 0; min-height: 0; width: 100%;
  border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; background: #2a2230;
}
.world-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 70px 10px rgba(10, 5, 30, var(--vignette));
}
#world-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.world-hint { font-size: 11px; color: var(--on-bg-soft); }
.world-hint.status { font-size: 14px; font-weight: 800; color: var(--on-bg); }

/* ---------- 대화창 · 팝업 ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) 0 calc(16px + env(safe-area-inset-bottom));
  background: rgba(40, 25, 35, 0.45);
}
.talk-overlay { justify-content: flex-end; background: rgba(40, 25, 35, 0.15); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.talk-box, .panel-box {
  background: var(--panel); border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink); padding: 14px 16px;
}
.talk-name { display: inline-block; font-size: 13px; font-weight: 800; color: #fff; background: var(--ink); padding: 2px 10px; border-radius: 99px; }
.talk-en { font-size: 18px; font-weight: 700; line-height: 1.45; margin: 10px 0 4px; white-space: pre-line; }
.talk-ko { font-size: 15px; color: var(--ink-soft); line-height: 1.45; }
.link-btn.small { margin: 0; padding: 4px 0; color: var(--ink-soft); }
.link-btn.small:disabled { opacity: 0.55; text-decoration: none; cursor: default; }
.talk-note { font-size: 13px; color: #c2463c; margin-top: 6px; }
.talk-options { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.talk-options .main-btn { min-height: 48px; font-size: 16px; }

.panel-box { max-height: 100%; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { flex: 1; font-size: 18px; }
.panel-body { overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 10px; }
.panel-gold { font-size: 15px; font-weight: 700; }
.panel-note { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.empty { font-size: 14px; color: var(--ink-soft); text-align: center; padding: 16px 0; }

.shop-row {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  background: var(--btn); border: 2px solid var(--ink); border-radius: 12px;
}
.shop-icon { font-size: 30px; }
.shop-info { flex: 1; }
.shop-info .sub { font-size: 12px; color: var(--ink-soft); }
.buy-btn {
  font-size: 14px; font-weight: 800; font-family: inherit; padding: 8px 10px;
  color: var(--ink); background: var(--yellow); border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: 0 2px 0 var(--ink);
}
.buy-btn:disabled { opacity: 0.4; box-shadow: none; }

.nemesis-list { display: flex; flex-direction: column; gap: 4px; }
.nemesis-row {
  display: flex; align-items: baseline; gap: 8px; font-size: 15px;
  padding: 6px 8px; background: var(--btn); border-radius: 8px;
}
.nemesis-row .ko { color: var(--ink-soft); font-size: 13px; }
.nemesis-row .dots { margin-left: auto; color: #e2566b; letter-spacing: 1px; }
.nemesis-row .when { font-size: 11px; color: var(--ink-soft); width: 48px; text-align: right; }
.nemesis-row.dim { opacity: 0.45; }

/* ---------- 전투: 치즈 게이지 + 액티브 스킬 ---------- */
.skill-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.cheese-gauge {
  position: relative; flex: 1; height: 22px;
  background: #5c4d47; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden;
}
.cheese-gauge .fill { height: 100%; background: #ffd24a; transition: width 0.3s; }
.cheese-gauge span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.skill-btn {
  min-height: 36px; padding: 0 10px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  color: var(--ink); background: #d6f0ff;
  border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink);
}
.skill-btn:disabled { opacity: 0.4; box-shadow: none; }
.loot-row { line-height: 1.4; margin-bottom: 6px; }
.loot-row .ko { margin-left: 0; font-size: 13px; }

/* ---------- 캐릭터 창 · 장비 카드 ---------- */
#screen-char { gap: 10px; }
.char-head { width: 100%; display: flex; align-items: center; gap: 10px; }
.char-head canvas { width: 96px; height: 96px; flex: none; }
.char-info { flex: 1; min-width: 0; }
.char-info .title { margin-top: 0; }
.char-info .subtitle { white-space: pre-line; }
.char-head .hud-btn { align-self: flex-start; }
#char-tabs .pick { padding: 8px 2px; font-size: 14px; font-weight: 700; }
.char-body {
  flex: 1 1 0; min-height: 0; width: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: 3px solid var(--ink); border-radius: 14px; padding: 12px;
}
.char-body h3, .panel-body h3 { font-size: 14px; margin-top: 4px; }
.char-body h4 { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.item-card, .stat-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--btn); border: 2px solid var(--ink); border-radius: 12px;
}
.item-card.empty-slot { color: var(--ink-soft); font-size: 13px; border-style: dashed; }
.item-info { flex: 1; min-width: 0; font-size: 14px; }
.item-info .sub { font-size: 12px; color: var(--ink-soft); }
.item-info .sub.broken { color: #c2463c; font-weight: 700; }
.item-info .tag { margin-left: 6px; }
.item-info .dots { color: #e2566b; }
.item-stats { font-size: 13px; font-weight: 700; margin: 2px 0; }
.item-flavor { font-size: 12px; font-style: italic; color: #a23fc9; }
.item-actions { display: flex; flex-direction: column; gap: 6px; }
.stat-row.dim { opacity: 0.45; }
.derived { font-size: 13px; line-height: 1.8; }
.panel-msg { font-size: 14px; font-weight: 700; color: #c2463c; }
.main-btn.small { min-height: 44px; font-size: 14px; }

/* ============================================================
   게임 스킨: 위의 기본 모양 위에 덮어씀
   (둥근 알약 모양 대신 굵은 테두리의 도트 게임풍 패널·버튼, 귀여운 글꼴, 무늬 바탕)
   ============================================================ */
:root {
  --ink: #3b2a2a;
  --wood: #6b4733;        /* 나무 패널 */
  --wood-dark: #4a3022;
  --wood-light: #8b6247;
  --paper: #fff4d6;       /* 종이 패널 */
}

html, body {
  font-family: "Jua", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background-color: var(--bg);
  /* 옅은 체크무늬 바탕 */
  background-image:
    linear-gradient(45deg, rgba(60, 40, 30, 0.05) 25%, transparent 25%, transparent 75%, rgba(60, 40, 30, 0.05) 75%),
    linear-gradient(45deg, rgba(60, 40, 30, 0.05) 25%, transparent 25%, transparent 75%, rgba(60, 40, 30, 0.05) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}
button { font-family: inherit; }
strong, h1, h2, h3, h4, .p-name, .m-name, .unit-name { font-weight: 400; }

.icon { image-rendering: pixelated; image-rendering: crisp-edges; flex: none; vertical-align: middle; }
.icon-label { display: inline-flex; align-items: center; gap: 5px; }

/* 제목: 테두리가 있는 로고 글자 */
.title {
  color: #ffd166; font-size: 36px; letter-spacing: 1px;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 0 5px 0 var(--ink);
}
.title.small { font-size: 28px; }
.pick-label { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.pick-label::before { content: ""; width: 8px; height: 8px; background: #e2566b; border: 2px solid var(--ink); }

/* ---------- 버튼 ---------- */
.main-btn, .choice, .pick, .stage, .monster-card, .buy-btn, .potion-btn, .skill-btn, .hud-btn, .dock-btn {
  border: 3px solid var(--ink); border-radius: 6px; font-weight: 400;
}
.main-btn {
  font-size: 20px;
  background: linear-gradient(#ffe08a 0 55%, #ffc94a 55%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 5px 0 var(--ink);
}
.main-btn.ghost { background: linear-gradient(#fffaf0 0 55%, #efe2c8 55%); }
.main-btn:active { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 1px 0 var(--ink); }
.choice {
  background: linear-gradient(#ffffff 0 55%, #f1e8d6 55%);
  box-shadow: inset 0 2px 0 #fff, 0 4px 0 var(--ink);
}
.buy-btn, .potion-btn, .skill-btn, .hud-btn { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 3px 0 var(--ink); }
.potion-btn { display: inline-flex; align-items: center; gap: 4px; }

.pick {
  opacity: 1;
  background: linear-gradient(#fffaf0 0 55%, #efe2c8 55%);
  box-shadow: inset 0 2px 0 #fff, 0 4px 0 var(--ink);
}
.pick.selected { background: linear-gradient(#ffe08a 0 55%, #ffc94a 55%); transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 2px 0 var(--ink); }
.pick:disabled { opacity: 0.5; box-shadow: none; }
.pick .p-name { font-size: 15px; }

/* ---------- 패널 ---------- */
.quiz-area, .wrong-list, .char-body, .talk-box, .panel-box, .info-box, .loot-list {
  background: var(--paper);
  border: 3px solid var(--ink); border-radius: 6px;
  box-shadow: inset 0 0 0 2px #fffdf3, inset 0 0 0 4px #ead9ad, 0 4px 0 rgba(40, 25, 20, 0.35);
}
.enemy-info, .player-info { border-radius: 6px; }
.item-card, .shop-row, .stat-row, .nemesis-row { border-radius: 6px; }
.field { border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 4px 0 rgba(40, 25, 20, 0.35); }
.bar { border-radius: 4px; }
.tag { border-radius: 4px; font-weight: 400; }
.shop-icon { display: flex; }

/* ---------- 지도 화면: 위(얼굴·체력·골드) / 지도 / 아래(버튼 3개) ---------- */
#screen-world { padding: 8px 0 10px; gap: 8px; }
.hud {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: var(--wood); color: #fff;
  border: 3px solid var(--ink); border-radius: 6px;
  box-shadow: inset 0 2px 0 var(--wood-light), inset 0 -3px 0 var(--wood-dark), 0 4px 0 rgba(40, 25, 20, 0.35);
}
.hud-face {
  width: 44px; height: 44px; flex: none; overflow: hidden;
  background: #ffe9b8; border: 3px solid var(--ink); border-radius: 6px;
}
.hud-face canvas { width: 84px; height: 84px; margin: -15px 0 0 -23px; }   /* 얼굴만 보이게 확대 */
.hud-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hud-who { font-size: 15px; color: #ffe9b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px;
  background: var(--wood-dark); color: #ffe08a; font-size: 16px; white-space: nowrap;
  border: 2px solid #2a1a12; border-radius: 5px;
}
.world-wrap { border-radius: 6px; box-shadow: 0 4px 0 rgba(40, 25, 20, 0.35); }
.place-banner, .steps-badge {
  position: absolute; top: 8px; display: flex; align-items: center; gap: 6px;
  padding: 4px 12px; background: var(--wood); color: #ffe9b8; font-size: 16px; white-space: nowrap;
  border: 3px solid var(--ink); border-radius: 6px;
  box-shadow: inset 0 2px 0 var(--wood-light), 0 3px 0 rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.place-banner { left: 8px; }
.steps-badge { right: 8px; background: var(--wood-dark); color: #ffe08a; }

.dock { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dock-btn {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 0 4px; font-size: 16px; color: var(--ink);
  background: linear-gradient(#fffaf0 0 55%, #efe2c8 55%);
  box-shadow: inset 0 2px 0 #fff, 0 4px 0 var(--ink);
}
.dock-btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 #fff, 0 1px 0 var(--ink); }
.dock-btn .badge {
  position: absolute; top: -7px; right: -5px; width: 16px; height: 16px;
  background: #e2566b; border: 3px solid var(--ink); border-radius: 50%;
}

/* ---------- 던전 고르기 ---------- */
.room-info { display: flex; gap: 8px; margin-top: 10px; }
.stage-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.stage {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  text-align: left; color: var(--ink);
  background: linear-gradient(#fffaf0 0 55%, #efe2c8 55%);
  box-shadow: inset 0 2px 0 #fff, 0 4px 0 var(--ink);
}
.stage.selected { background: linear-gradient(#ffe08a 0 55%, #ffc94a 55%); }
.stage:disabled { background: #d8ccb6; box-shadow: none; opacity: 0.7; }
.stage-num {
  width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--wood); color: #ffe9b8; font-size: 18px;
  border: 2px solid var(--ink); border-radius: 5px;
}
.stage-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stage .p-name { font-size: 17px; }
.stage .p-desc { font-size: 12px; color: var(--ink-soft); }

/* ---------- 결과 화면 ---------- */
.reward { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: var(--wood); color: #ffe9b8; font-size: 17px;
  border: 3px solid var(--ink); border-radius: 6px;
  box-shadow: inset 0 2px 0 var(--wood-light), 0 3px 0 rgba(40, 25, 20, 0.35);
}
.chip.bad { background: #7a2d3b; box-shadow: inset 0 2px 0 #9c4455, 0 3px 0 rgba(40, 25, 20, 0.35); }
.exp-line { width: 100%; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--on-bg); }
.exp-line .bar { flex: 1; height: 14px; }
.exp-line .fill { background: #7fb4f0; }

.loot-list { width: 100%; margin-top: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.loot-list h2 { font-size: 15px; text-align: center; color: #b8742a; letter-spacing: 2px; }
.loot-card { display: flex; align-items: center; gap: 10px; animation: loot-pop 0.35s ease-out both; }
.loot-card:nth-child(3) { animation-delay: 0.12s; }
.loot-card:nth-child(4) { animation-delay: 0.24s; }
.loot-card:nth-child(5) { animation-delay: 0.36s; }
.loot-icon {
  width: 54px; height: 54px; flex: none; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 3px solid var(--ink); border-radius: 6px;
  box-shadow: inset 0 0 0 2px #f1e8d6;
}
.loot-info { flex: 1; min-width: 0; font-size: 17px; line-height: 1.3; }
.loot-info .sub { font-size: 12px; color: var(--ink-soft); }
.loot-info .tag { margin-left: 6px; }
/* 크기만 통통 튀게 (투명하게 시작하지 않음: 애니메이션이 멈춘 화면에서도 전리품이 보이도록) */
@keyframes loot-pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.wrong-list { margin: 12px 0; }
@media (prefers-reduced-motion: reduce) { .loot-card { animation: none; } }

/* ---------- 캐릭터 창: 아이콘 칸 · 랭크 칸 · 머리 칩 ---------- */
.slot-icon {
  width: 52px; height: 52px; flex: none; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 3px solid var(--ink); border-radius: 6px;
  box-shadow: inset 0 0 0 2px #f1e8d6;
}
.slot-icon.dim .icon { opacity: 0.35; filter: grayscale(1); }
.item-card.empty-slot { gap: 10px; padding: 6px 10px; }
.skill-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.skill-head .tag { margin: 0; }
.pips { display: inline-flex; gap: 3px; }
.pip { width: 12px; height: 12px; background: #fff; border: 2px solid var(--ink); border-radius: 3px; }
.pip.on { background: #e2566b; }
.tab-btn { position: relative; flex-direction: row; justify-content: center; gap: 6px; font-size: 16px; }
.tab-btn .badge {
  position: absolute; top: -7px; right: -5px; width: 16px; height: 16px;
  background: #e2566b; border: 3px solid var(--ink); border-radius: 50%;
}
.char-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.char-chips .icon-label {
  padding: 3px 8px; background: var(--wood); color: #ffe9b8; font-size: 15px;
  border: 2px solid var(--ink); border-radius: 5px;
}
#char-summary .exp-line { margin-top: 6px; }
.char-info .title { font-size: 26px; }

/* ---------- 팝업 안 내용: 칸 사이 간격 (버튼 그림자가 아래 글자를 덮지 않게) ---------- */
.shop, .smith, .training { display: flex; flex-direction: column; gap: 10px; }
.panel-body > *, .shop > *, .smith > *, .training > *, .char-body > * { flex-shrink: 0; }
.smith .main-btn.small + .panel-note { margin-top: -2px; }

/* ---------- 재료 가방 ---------- */
.mats-box { display: flex; flex-direction: column; gap: 6px; }
.mats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mat-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-width: 0; }
.mat-pic {
  position: relative; width: 100%; aspect-ratio: 1; max-width: 56px; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 3px solid var(--ink); border-radius: 6px; box-shadow: inset 0 0 0 2px #f1e8d6;
}
.mat-count {
  position: absolute; right: -4px; bottom: -6px; padding: 0 4px;
  background: var(--ink); color: #ffe08a; font-size: 12px; border-radius: 4px;
}
.mat-name { font-size: 12px; margin-top: 4px; white-space: nowrap; }
.mat-use { font-size: 10px; color: var(--ink-soft); line-height: 1.2; }
.mat-cell.none .mat-pic .icon { opacity: 0.3; filter: grayscale(1); }
.mat-cell.none .mat-count { background: #9a8f88; }

/* ---------- 던전 고르기: 위아래로 스크롤하지 않고 한 화면에 들어가게 촘촘하게 ---------- */
#screen-room .title.small { font-size: 22px; }
#screen-room .room-info { margin-top: 4px; }
#screen-room .room-info .res { padding: 3px 10px; font-size: 14px; }
#screen-room .subtitle { margin-top: 2px; font-size: 12px; }
#screen-room .pick-label { margin: 8px 0 4px; }
/* 난이도: 아이콘 + 이름을 한 줄로 */
#room-diffs .pick { padding: 5px 4px; min-height: 0; gap: 0; }
#room-diffs .pick .icon { width: 18px !important; height: 18px !important; }
#room-diffs .pick .p-name { font-size: 14px; }
#room-diffs .pick .p-desc, #room-diffs .pick .p-warn { font-size: 10px; line-height: 1.2; }
/* 맵 카드 */
#room-maps .pick { padding: 6px 4px; min-height: 0; }
/* 던전: 2칸 × 2줄 */
#room-dungeons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#room-dungeons .stage { padding: 6px 6px; gap: 6px; }
#room-dungeons .stage-num { width: 26px; height: 26px; font-size: 15px; }
#room-dungeons .stage-num .icon { width: 18px !important; height: 18px !important; }
#room-dungeons .stage .p-name { font-size: 14px; line-height: 1.2; }
#room-dungeons .stage .p-desc { font-size: 10px; line-height: 1.2; }
#room-dungeons .stage > .icon { width: 18px !important; height: 18px !important; }
/* 입장 · 쉼터로 버튼을 한 줄로 */
#screen-room .result-buttons { flex-direction: row; gap: 8px; padding-top: 10px; }
#screen-room .result-buttons .main-btn { min-height: 50px; font-size: 16px; }
#screen-room #btn-enter { flex: 2; }
#screen-room #btn-room-back { flex: 1; }

/* 던전 전투 배경 그림이 있을 때 (js/battle-bg.js): 그림을 화면에 맞춰 깔고, 둥근 발판은 숨김 */
.field.has-bg { background-size: cover; background-position: center bottom; image-rendering: pixelated; }
.field.has-bg .unit::before { display: none; }

/* ---------- 이야기(만화) 화면: 오래된 책 한 장 (js/story-screen.js) ---------- */
.story { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: #2b1b10; overflow-y: auto; }
.story[hidden] { display: none; }
.story-page {
  position: relative; box-sizing: border-box; width: min(100vw - 20px, 420px); margin: 12px 0; padding: 18px 18px 14px 28px;
  font-family: "Gowun Batang", serif; color: #2a1a0c;
  background: radial-gradient(circle at 78% 12%, rgba(150,96,36,.22), transparent 22%), radial-gradient(circle at 12% 74%, rgba(150,96,36,.18), transparent 26%),
    radial-gradient(circle at 90% 88%, rgba(120,70,24,.2), transparent 20%), linear-gradient(#ecd9a0, #e0c585);
  box-shadow: inset 0 0 46px rgba(120,78,30,.5), inset 0 0 6px rgba(70,40,10,.7), 0 8px 24px rgba(0,0,0,.55); border-radius: 3px;
}
.story-page::before { content: ""; position: absolute; inset: 0; background: var(--tile); opacity: .9; pointer-events: none; mix-blend-mode: multiply; border-radius: 3px; }
.story-page::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 24px; background: linear-gradient(90deg, rgba(60,34,8,.4), rgba(60,34,8,.12) 60%, transparent); pointer-events: none; }
.story-top { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.story-chap { font: italic 13px "IM Fell English", serif; letter-spacing: .5px; color: #6a4a28; }
.story-chap b { display: block; font: 700 11px "Gowun Batang", serif; letter-spacing: 0; margin-top: 1px; }
.story-skip { font: 12px "Gowun Batang", serif; color: #6a4a28; background: none; border: 1px solid rgba(106,74,40,.6); border-radius: 2px; padding: 4px 9px; }
#story-pic { position: relative; z-index: 1; display: block; width: 100%; image-rendering: pixelated; filter: drop-shadow(1px 2px 0 rgba(60,34,8,.35)); }
.story-cap { position: relative; z-index: 1; margin: 14px 2px 8px; min-height: 120px; }
.story-en { margin: 0; font: italic 17px/1.42 "IM Fell English", Georgia, serif; color: #2a1a0c; }
.story-en::first-letter { float: left; font: normal 700 50px/.8 "IM Fell English", Georgia, serif; color: #8a2f1a; padding: 5px 7px 0 0; }
.story-ko { margin: 9px 0 0; font: 13px/1.55 "Gowun Batang", serif; color: #6a4a28; border-top: 1px solid rgba(106,74,40,.35); padding-top: 7px; clear: both; }
.story-foot { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.story-dots { display: flex; gap: 6px; }
.story-dots i { width: 7px; height: 7px; border: 1px solid #6a4a28; border-radius: 50%; box-sizing: border-box; }
.story-dots i.on { background: #2a1a0c; border-color: #2a1a0c; }
.story-next { display: flex; align-items: center; gap: 6px; font: 12px "Gowun Batang", serif; color: #6a4a28; animation: story-blink 1.6s infinite; }
.story-next::after { content: ""; border: 5px solid transparent; border-left: 7px solid #6a4a28; }
@keyframes story-blink { 50% { opacity: .35; } }

/* ---------- 첫 로딩 화면: 오래된 책 표지 (js/main.js splash) ---------- */
.screen.splash { position: fixed; inset: 0; z-index: 40; background: #2b1b10; justify-content: center; align-items: center; padding: 16px; max-width: none; }
.splash-cover {
  position: relative; width: 100%; max-width: 380px; padding: 26px 20px 22px; text-align: center;
  background: linear-gradient(#ecd9a0, #e0c585); border-radius: 3px;
  box-shadow: inset 0 0 40px rgba(120,78,30,.55), 0 6px 22px rgba(0,0,0,.55);
}
.splash-cover::before { content: ""; position: absolute; inset: 0; background: var(--tile); opacity: .9; pointer-events: none; mix-blend-mode: multiply; border-radius: 3px; }
.splash-cover::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(106,74,40,.55); outline: 1px solid rgba(106,74,40,.3); outline-offset: 3px; pointer-events: none; }
.splash-cover > * { position: relative; z-index: 1; }
.splash-top { margin: 0; font: italic 13px "IM Fell English", Georgia, serif; letter-spacing: 1px; color: #6a4a28; }
.splash-title { margin: 4px 0 2px; font: 400 44px/1.05 "IM Fell English", Georgia, serif; color: #2a1a0c; letter-spacing: .5px; text-shadow: none; }
.splash-title::first-letter { color: #8a2f1a; }
.splash-sub { margin: 0 0 14px; font: 700 14px "Gowun Batang", serif; color: #6a4a28; }
#splash-pic { display: block; width: 100%; image-rendering: pixelated; filter: drop-shadow(1px 2px 0 rgba(60,34,8,.35)); }
.splash-bar { height: 6px; margin: 18px 18px 0; border: 1px solid #6a4a28; border-radius: 1px; background: rgba(106,74,40,.15); overflow: hidden; }
#splash-fill { width: 0; height: 100%; background: #6a4a28; transition: width 1.1s ease-out; }
.splash-msg { margin: 10px 0 0; font: 13px "Gowun Batang", serif; color: #6a4a28; }
.splash-msg.ready { font-weight: 700; color: #2a1a0c; animation: story-blink 1.6s infinite; }

/* ---------- 캐릭터 고르기 · 만들기 ---------- */
.char-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.char-card {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 12px 6px 8px; text-align: left;
  background: var(--btn); color: var(--ink); font-family: inherit;
  border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
}
.char-card.selected { background: var(--yellow); }
.char-card.empty { border-style: dashed; box-shadow: none; background: rgba(255,255,255,.45); }
.char-card .sprite { width: 52px; height: 52px; flex: none; }
.char-card .c-plus { width: 52px; height: 52px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--ink-soft); }
.char-card .c-info { flex: 1; min-width: 0; }
.char-card .c-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-card .c-desc { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.char-card .c-mark { flex: none; font-size: 12px; padding: 3px 8px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; }
#screen-create { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.job-info { width: 100%; margin: 8px 0 0; padding: 8px 10px; font-size: 13px; line-height: 1.5; white-space: pre-line; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; }
.name-input {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 18px; color: var(--ink);   /* 16px 이상이어야 아이폰이 화면을 확대하지 않음 */
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; outline: none; -webkit-appearance: none;
}
.name-input:focus { background: #fffbe8; }
.name-error { min-height: 18px; margin: 4px 0 0; align-self: flex-start; font-size: 12px; color: #e2566b; }

/* 캐릭터 고르기 화면 아래의 작은 버튼들 (지우기 · 소리 설정 · 이야기) */
.tool-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.tool-btn {
  padding: 7px 4px; font-family: inherit; font-size: 13px; color: var(--ink); background: var(--btn);
  border: 2px solid var(--ink); border-radius: 10px; box-shadow: 0 2px 0 var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool-btn:active { transform: translateY(2px); box-shadow: none; }
.tool-btn[hidden] { display: none; }
/* 처음 화면의 구글 로그인 칸 (js/cloud.js) */
.cloud-box { width: 100%; display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.cloud-box[hidden] { display: none; }
.cloud-status { flex: 1; font-size: 12px; line-height: 1.4; color: var(--on-bg-soft); word-break: break-all; }
.cloud-box .tool-btn { flex: none; padding: 7px 10px; }

/* ---------- 수상한 상자 (js/lucky.js) ---------- */
.lucky-btns { display: flex; flex-direction: column; gap: 4px; flex: none; }
.lucky-btns .buy-btn { padding: 6px 8px; font-size: 13px; }
.buy-btn.ghost { background: var(--btn); }
.lucky { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lucky-stage { width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.lucky-stage .icon { width: 96px; height: 96px; }
.lucky-stage.shake .icon { animation: lucky-shake .18s infinite; }
.lucky-stage.burst { animation: lucky-pop .4s ease-out; background: radial-gradient(circle, rgba(255,210,74,.55), transparent 70%); }
.lucky-stage.burst.big { background: radial-gradient(circle, rgba(255,120,150,.6), rgba(255,210,74,.45) 45%, transparent 72%); }
@keyframes lucky-shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-9deg) translateY(-2px); } 75% { transform: rotate(9deg) translateY(-2px); } }
@keyframes lucky-pop { 0% { transform: scale(.7); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.lucky-list { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.lucky-line { margin: 0; padding: 6px 10px; font-size: 14px; background: var(--btn); border: 2px solid var(--ink); border-radius: 10px; }
.lucky-line.big { background: var(--yellow); font-weight: 800; }
.lucky-line.dud { color: var(--ink-soft); }
.lucky-again { width: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.lucky-list.ten { gap: 3px; }
.lucky-list.ten .lucky-line { padding: 3px 8px; font-size: 13px; border-width: 1.5px; }

/* 장비 착용 제한 표시: 아직 못 채운 조건은 빨갛게 */
.item-needs .unmet { color: #c2463c; font-weight: 700; }

/* ---------- 설정 화면 (js/settings.js) ---------- */
.settings { display: flex; flex-direction: column; gap: 8px; }
.settings h3 { margin: 6px 0 0; font-size: 15px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
.set-row > span { font-size: 15px; }
.seg { display: flex; gap: 4px; flex: none; }
.seg button {
  min-width: 46px; padding: 6px 8px; font-family: inherit; font-size: 14px; color: var(--ink); background: var(--btn);
  border: 2px solid var(--ink); border-radius: 10px;
}
.seg button.on { background: var(--yellow); box-shadow: inset 0 2px 0 rgba(255,255,255,.6); }
.settings .tool-grid { margin-top: 0; }
.settings .credits { margin-top: 2px; color: var(--ink-soft); }
/* 지도 화면 오른쪽 아래의 작은 설정 버튼 */
.hud-settings {
  position: absolute; right: 8px; bottom: 8px; padding: 4px 10px; font-family: inherit; font-size: 14px;
  color: #ffe9b8; background: var(--wood); border: 3px solid var(--ink); border-radius: 6px; opacity: .92;
}
/* 레벨테스트의 "모르겠어요": 보기 아래에 한 줄로 */
.choice.dunno { grid-column: 1 / -1; min-height: 44px; font-size: 16px; color: var(--ink-soft); }
.choice.dunno small { display: block; font-size: 11px; opacity: 0.8; }
/* 글자 크게 (설정) */

/* 설정 묶음 상자: 묶음마다 테두리 상자 + 진한 제목 띠 */
.settings { gap: 10px; }
.set-group { border: 2px solid var(--ink); border-radius: 12px; background: #fffdf6; overflow: hidden; }
.set-head {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 15px;
  color: #ffe9b8; background: var(--wood, #6b4733); border-bottom: 2px solid var(--ink);
}
.set-group .set-row { padding: 3px 8px; min-height: 39px; }
.set-group .set-row + .set-row { border-top: 1px dashed rgba(59, 42, 42, .2); }
.set-group .tool-grid { padding: 8px; }
.seg button { padding: 5px 8px; }
