/* STUDY RPG — 등불 아래 공부방
   어두운 원목 패널 + 양피지 메모 + 놋쇠 강조. 둥근 모서리·네온 글로우 없이 2px 테두리와 단단한 그림자만 씁니다. */

:root {
  color-scheme: dark;
  --bg: #16120e;
  --panel: #2a2119;
  --panel-2: #362b20;
  --inset: #1f1914;
  --line: #54432f;
  --line-2: #77613f;
  --text: #f1e7d3;
  --muted: #b9a88c;
  --brass: #d9a441;
  --brass-2: #f0c76a;
  --brass-ink: #22180b;
  --brass-edge: #7a561b;
  --accent-text: #e3b45a;
  --sage: #93b98c;
  --brick: #c4604f;
  --selected: #2c2317;
  --drop: 0 3px 0 #0a0806;
  --font-body: "Gowun Dodum", system-ui, sans-serif;
  --font-head: "Gowun Batang", "Gowun Dodum", serif;
  --font-pixel: "Press Start 2P", monospace;
}

/* 양피지 표면: 같은 컴포넌트를 밝은 종이 위에서 다시 칠합니다. */
.paper {
  --panel: #eadcbf;
  --panel-2: #ddcaa3;
  --inset: #e2d1ae;
  --line: #a88f6a;
  --line-2: #8a7354;
  --text: #2b2016;
  --muted: #6b5a45;
  --accent-text: #8a5313;
  --selected: #d9c18f;
  color: var(--text);
  background: var(--panel);
  border-color: var(--line-2);
}

* { box-sizing: border-box; }
html { background: var(--bg); overflow-x: hidden; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: var(--bg); font: 16px/1.6 var(--font-body); word-break: keep-all; overflow-wrap: break-word; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
:focus-visible { outline: 2px solid var(--brass-2); outline-offset: 2px; }
.eyebrow { display: block; margin-bottom: 2px; color: var(--accent-text); font-size: .8rem; font-weight: 700; }
.muted { color: var(--muted); }
.tiny { font-size: .82rem; }
.accent { color: var(--accent-text); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; color: var(--accent-text); font-size: .72rem; vertical-align: 2px; border: 1px solid currentColor; }
svg.pixel-icon, .command-icon, .resource-icon { display: block; flex: 0 0 auto; }
button svg { pointer-events: none; }

/* 패널 */
.pixel-panel, .game-window {
  position: relative;
  color: var(--text);
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 236, 200, .05), var(--drop);
}
.card { padding: 20px; }
.card > h2:first-child, .card > .eyebrow + h2 { margin-top: 0; }
.card h2 { margin: 0 0 12px; }
.card h3 { margin: 16px 0 8px; }

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: .5rem 1rem;
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  background: var(--panel-2);
  border: 2px solid var(--line-2);
  box-shadow: var(--drop);
  cursor: pointer;
}
.btn:hover { border-color: var(--brass); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a0806; }
.btn-primary { color: var(--brass-ink); background: var(--brass); border-color: var(--brass-edge); }
.btn-primary:hover { background: var(--brass-2); border-color: var(--brass-edge); }
.btn-ghost { background: transparent; border-color: var(--line); box-shadow: none; }
.btn-danger { color: #ffe8e1; background: #6a2c22; border-color: var(--brick); }
.btn-small { min-height: 32px; padding: .25rem .7rem; font-size: .86rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.icon-control { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; padding: 0; color: var(--text); background: var(--panel-2); border: 2px solid var(--line-2); box-shadow: var(--drop); cursor: pointer; }
.icon-control svg { width: 12px; height: 12px; }
.icon-control:hover { border-color: var(--brass); }

/* 입력 */
.field { display: grid; gap: 6px; }
.field label { color: var(--muted); font-size: .86rem; }
.input, .select, .textarea { width: 100%; padding: .6rem .8rem; color: var(--text); background: var(--inset); border: 2px solid var(--line); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brass); outline: none; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .75; }
.textarea { min-height: 90px; resize: vertical; }
.inline-form { display: flex; gap: 8px; }
.inline-form .btn { flex-shrink: 0; white-space: nowrap; }

/* 레이아웃 */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.page { animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: 0; } }
.empty { padding: 22px; color: var(--muted); text-align: center; border: 2px dashed var(--line); }

/* 브랜드 */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; color: var(--brass-ink); background: var(--brass); border: 2px solid var(--brass-edge); }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-family: var(--font-pixel); font-size: .72rem; letter-spacing: .02em; }

/* 상단 HUD */
.game-frame { min-height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.player-hud { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px clamp(14px, 3vw, 32px); background: #120e0b; border-bottom: 2px solid var(--line); }
.hud-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hud-identity > div { min-width: 0; }
.hud-identity h1 { margin: 0; overflow: hidden; font-size: clamp(1.1rem, 2.2vw, 1.45rem); white-space: nowrap; text-overflow: ellipsis; }
.hud-place { display: block; color: var(--muted); font-size: .76rem; line-height: 1.2; }
.hud-brand-mark { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; padding: 0; color: var(--brass-ink); background: var(--brass); border: 2px solid var(--brass-edge); box-shadow: var(--drop); cursor: pointer; }
.hud-brand-mark svg { width: 20px; height: 20px; }
.resources { display: flex; gap: 8px; }
.resource-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--inset); border: 2px solid var(--line); }
.resource-icon { width: 14px; height: 14px; }
.hud-coin .resource-icon { color: var(--brass); }
.hud-streak .resource-icon { color: #e07a4f; }
.hud-level { display: grid; grid-template-columns: auto 72px; gap: 8px; }
.hud-level > span { display: grid; line-height: 1.15; }
.hud-level b { font-size: .86rem; }
.hud-level small { color: var(--muted); font-size: .68rem; font-weight: 400; }
.hud-exp-track { display: block; width: 72px; height: 8px; background: #120e0b; border: 1px solid var(--line); }
.hud-exp-track b { display: block; height: 100%; background: var(--brass); }
.game-main { width: 100%; max-width: 1320px; min-width: 0; margin: 0 auto; padding: 20px clamp(12px, 2.5vw, 32px) 112px; }

/* 하단 독 */
.command-dock { position: fixed; z-index: 40; left: 50%; bottom: 12px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(64px, 1fr); gap: 2px; width: min(680px, calc(100vw - 24px)); padding: 4px; transform: translateX(-50%); background: #120e0b; border: 2px solid var(--line-2); box-shadow: 0 4px 0 #0a0806; }
.command-dock-button { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 56px; padding: 6px 4px; color: var(--muted); font-size: .8rem; font-weight: 700; background: transparent; border: 2px solid transparent; cursor: pointer; }
.command-icon { width: 18px; height: 18px; }
.command-dock-button:hover, .command-dock-button:focus-visible { color: var(--text); background: var(--panel); }
.command-dock-button.active { color: var(--brass-2); background: var(--selected); border-color: var(--brass-edge); }

/* 전체 메뉴 */
.command-menu-backdrop { position: fixed; z-index: 44; inset: 0; background: rgba(8, 6, 4, .55); }
.command-menu { position: fixed; z-index: 45; right: max(12px, calc((100vw - 680px) / 2)); bottom: 86px; width: min(380px, calc(100vw - 24px)); padding: 16px; background: var(--panel); border: 2px solid var(--line-2); box-shadow: 0 4px 0 #0a0806; }
.command-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mini-profile { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mini-profile h2 { margin: 0; font-size: 1rem; }
.mini-avatar { display: grid; place-items: center; width: 46px; height: 46px; overflow: hidden; background: var(--inset); border: 2px solid var(--line); }
.mini-player { width: 44px; height: 42px; margin-top: 6px; }
.dev-badge { margin-left: 6px; padding: 1px 5px; color: var(--brass-ink); font-family: var(--font-body); font-size: .7rem; vertical-align: 2px; background: var(--brass); }
.command-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 14px 0; padding: 0; list-style: none; }
.command-menu-grid button { display: grid; gap: 2px; width: 100%; min-height: 62px; padding: 10px; text-align: left; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.command-menu-grid button:hover, .command-menu-grid button:focus-visible { border-color: var(--brass); }
.command-menu-grid button[aria-current="page"] { background: var(--selected); border-color: var(--brass-edge); }
.command-menu-grid small { color: var(--muted); font-size: .76rem; }
.command-menu-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 2px solid var(--line); }

/* 온보딩 · 계정 */
.onboarding-shell { min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.onboarding { width: min(1080px, 100%); padding: clamp(20px, 4vw, 36px); }
.onboarding-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.onboarding-head h1 { margin: 20px 0 8px; font-size: clamp(1.7rem, 4.5vw, 2.8rem); }
.onboarding-head p { max-width: 620px; margin: 0; color: var(--muted); }
.stepper { display: flex; gap: 6px; min-width: 160px; margin-top: 10px; }
.stepbar { flex: 1; height: 6px; background: var(--inset); border: 1px solid var(--line); }
.stepbar.on { background: var(--brass); border-color: var(--brass-edge); }
.learner-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.learner-card { position: relative; display: grid; align-content: start; gap: 4px; min-height: 260px; padding: 18px; text-align: left; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.learner-card:hover { border-color: var(--line-2); }
.learner-card.selected { background: var(--selected); border-color: var(--accent); }
.learner-card .eyebrow { color: var(--accent); }
.learner-card h3 { margin: 2px 0 4px; font-size: 1.25rem; }
.learner-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.card-pixel-art { width: 96px; height: 102px; margin-bottom: 8px; }
.selected-tick { position: absolute; top: 10px; right: 10px; padding: 1px 8px; color: #14100b; font-weight: 900; background: var(--accent); }
.onboard-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.onboard-actions-right { display: flex; gap: 8px; }
.onboard-body { display: grid; grid-template-columns: .8fr 1.2fr; gap: 20px; }
.story-card { padding: 20px; }
.story-card h2 { margin: 0 0 6px; }
.story-visual { display: grid; place-items: center; height: 150px; margin-bottom: 16px; background: radial-gradient(circle at 50% 70%, #3a2d20 0 38%, var(--inset) 39%); border: 2px solid var(--line); }
.story-guide { width: 104px; height: 114px; }
.route-list { display: grid; gap: 8px; margin-top: 14px; }
.route-step { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.route-step b { display: grid; place-items: center; width: 26px; height: 26px; color: var(--accent-text); font-size: .78rem; border: 2px solid var(--line); }
.form-panel { padding: 22px; }
.form-panel h2 { margin: 0 0 4px; }
.form-panel h3 { margin: 18px 0 4px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.choice { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 8px 10px; text-align: left; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.choice:hover { border-color: var(--line-2); }
.choice.checked { background: var(--selected); border-color: var(--brass-edge); }
.choice input { accent-color: var(--brass); }
.curriculum-summary { display: flex; justify-content: space-between; gap: 12px; margin: 12px 0 18px; padding: 10px 14px; background: var(--inset); border: 2px solid var(--line); }
.curriculum-summary span { color: var(--muted); font-size: .85rem; }
.school-results { display: grid; gap: 6px; max-height: 220px; margin: 12px 0; overflow: auto; }
.school-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; text-align: left; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.school-result.selected { background: var(--selected); border-color: var(--brass-edge); }
.avatar-choice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.avatar-choice { display: grid; place-items: center; gap: 2px; padding: 8px; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.avatar-choice.checked { background: var(--selected); border-color: var(--brass-edge); }
.avatar-choice-art { width: 62px; height: 59px; }
.account-gate { width: min(820px, 100%); padding: clamp(22px, 5vw, 44px); }
.account-gate-head { margin: 28px 0 20px; }
.account-gate-head h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 4vw, 2.2rem); }
.account-gate-head p { margin: 0; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.account-card { display: flex; align-items: center; gap: 16px; min-height: 130px; padding: 18px; text-align: left; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.account-card:hover { border-color: var(--brass); }
.account-card span:not(.player-art) { display: grid; gap: 3px; }
.account-card small { color: var(--accent-text); font-weight: 700; }
.account-card b { font-size: 1.15rem; }
.account-card em { color: var(--muted); font-size: .86rem; font-style: normal; }
.account-avatar { width: 76px; height: 72px; }
.auth-form { display: grid; gap: 14px; width: min(500px, 100%); margin: 8px auto 0; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.google-login { width: 100%; color: #1f1f1f; background: #fff; border-color: #c9c3b8; }

/* 공부방 페이지 */
.room-focus-layout { grid-template-columns: minmax(0, 1.5fr) minmax(290px, .5fr); align-items: start; }
.shared-room-panel { padding: 0; overflow: hidden; }
.room-exit { position: absolute; z-index: 15; left: 12px; bottom: 12px; }
.room-side-rail { display: grid; gap: 16px; }
.today-ledger { padding: 18px; }
.ledger-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ledger-head h2 { margin: 0; }
.ledger-date { color: var(--muted); font-family: var(--font-pixel); font-size: .6rem; }
.ledger-list { margin: 10px 0 14px; }
.ledger-list div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.ledger-list dt { flex: 0 0 auto; color: var(--muted); }
.ledger-list dd { margin: 0; font-weight: 700; text-align: right; }
.ledger-list strong { color: #9c3b2b; }
.ledger-list span { display: block; color: var(--muted); font-weight: 400; font-size: .85rem; }
.ledger-study-button { width: 100%; }
.room-focus-panel { display: grid; gap: 12px; }
.room-focus-panel h2 { margin: 0; }
.room-start-button { width: 100%; }
.efficiency-breakdown { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.efficiency-breakdown span { display: grid; gap: 2px; padding: 8px 4px; color: var(--muted); font-size: .8rem; text-align: center; background: var(--inset); border: 2px solid var(--line); }
.efficiency-breakdown b { color: var(--accent-text); font-size: 1rem; }
.room-collection { grid-column: 1 / -1; content-visibility: auto; contain-intrinsic-size: auto 420px; }

/* 공부방 장면: 16:10 비율 안에서 모든 물건을 %로 배치합니다. 벽 0–60%, 걸레받이 60–62%, 바닥 62–100%. */
.room-scene {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  container-type: inline-size;
  background:
    repeating-linear-gradient(90deg, transparent 0 6%, rgba(39, 28, 22, .22) 6% 6.15%),
    linear-gradient(to bottom, #7d6c59 0 60%, #33271d 60% 62%, #533b2d 62% 100%);
}
.room-scene::before { content: ""; position: absolute; z-index: 0; inset: 62% 0 0; background: repeating-linear-gradient(0deg, transparent 0 22%, rgba(30, 20, 16, .42) 22% 24%), repeating-linear-gradient(90deg, #5b4232 0 12.5%, #664a36 12.5% 25%); }
.room-scene::after { content: ""; position: absolute; z-index: 0; top: 0; left: 0; right: 0; height: 2.6%; background: #33261f; border-bottom: 3px solid #73563d; }
.room-scene-beams { position: absolute; z-index: 0; inset: 2.6% 0 auto; height: 3.5%; background: repeating-linear-gradient(90deg, #33261f 0 1.6%, transparent 1.6% 25%); opacity: .8; }
.room-scene-window { position: absolute; z-index: 1; left: 45%; top: 8%; width: 15%; height: 20%; transform: translateX(-50%); background: #263a42; border: 6px solid #33261f; outline: 3px solid #171c1b; outline-offset: -9px; }
.room-scene-window::before, .room-scene-window::after { content: ""; position: absolute; background: #33261f; }
.room-scene-window::before { left: 50%; top: 0; bottom: 0; width: 4px; transform: translateX(-50%); }
.room-scene-window::after { left: 0; right: 0; top: 50%; height: 4px; transform: translateY(-50%); }
.room-scene-window span { position: absolute; left: 22%; top: 20%; width: 4px; height: 4px; background: #f1df9c; }
.time-morning .room-scene-window { background: #b9a777; }
.time-day .room-scene-window { background: #8ca59b; }
.time-evening .room-scene-window { background: #a46449; }
.time-night .room-scene-window { background: #263442; }
.room-floor-rug { position: absolute; z-index: 1; left: 22%; bottom: 4%; width: 56%; height: 27%; background: #33433e; border: 6px solid #26312d; outline: 2px solid #b08a49; outline-offset: -11px; }
.room-hotspot, .room-static { position: absolute; z-index: 3; display: block; padding: 0; background: transparent; border: 0; }
.room-hotspot { cursor: pointer; }
.room-hotspot::after { content: ""; position: absolute; inset: -3px; border: 2px solid transparent; pointer-events: none; }
.room-hotspot:hover::after, .room-hotspot:focus-visible::after { border-color: var(--brass-2); }
.room-hotspot:hover, .room-hotspot:focus-visible { z-index: 12; outline: none; }
/* 책상 앞에 앉은 아바타가 가려지지 않도록 책상은 포커스·호버 때도 겹침 순서를 유지합니다. */
.hotspot-desk:hover, .hotspot-desk:focus-visible { z-index: 5; }
.generated-room-sprite { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; image-rendering: pixelated; user-select: none; }
.hotspot-label { position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 6px); display: grid; width: max-content; max-width: 170px; padding: 5px 9px; color: var(--text); font-size: .84rem; line-height: 1.35; text-align: center; background: #120e0b; border: 2px solid var(--brass); opacity: 0; transform: translate(-50%, 4px); transition: opacity .12s ease, transform .12s ease; pointer-events: none; }
.hotspot-label small { color: var(--muted); font-size: .74rem; }
.label-below .hotspot-label { top: calc(100% + 6px); bottom: auto; transform: translate(-50%, -4px); }
.room-hotspot:hover .hotspot-label, .room-hotspot:focus-visible .hotspot-label { opacity: 1; transform: translate(-50%, 0); }
/* 가장자리 물건은 이름표를 안쪽으로 붙여 잘리지 않게 합니다. */
.hotspot-wardrobe .hotspot-label { left: 0; transform: translateY(4px); text-align: left; }
.hotspot-bookshelf .hotspot-label, .hotspot-chest .hotspot-label { left: auto; right: 0; transform: translateY(4px); text-align: right; }
/* 키 큰 가구는 이름표를 가구 아래쪽에 겹쳐 작은 화면에서도 장면 안에 남깁니다. */
.hotspot-wardrobe .hotspot-label, .hotspot-bookshelf .hotspot-label { top: auto; bottom: 12%; }
.hotspot-wardrobe:hover .hotspot-label, .hotspot-wardrobe:focus-visible .hotspot-label,
.hotspot-bookshelf:hover .hotspot-label, .hotspot-bookshelf:focus-visible .hotspot-label,
.hotspot-chest:hover .hotspot-label, .hotspot-chest:focus-visible .hotspot-label { transform: none; }
/* 배치 */
.hotspot-wardrobe, .static-room-wardrobe { left: 1%; top: 18%; width: 20%; aspect-ratio: 270 / 470; }
.hotspot-quests, .static-room-quests { left: 22%; top: 9%; width: 11%; aspect-ratio: 1; }
.hotspot-calendar, .static-room-calendar { left: 54.5%; top: 14%; width: 5.5%; aspect-ratio: 1; }
.hotspot-map, .static-room-map { left: 61.5%; top: 8%; width: 17%; aspect-ratio: 224 / 128; }
.hotspot-bookshelf, .static-room-bookshelf { right: 1%; top: 18%; width: 25%; aspect-ratio: 336 / 470; }
.hotspot-desk, .static-room-desk { z-index: 5; left: 25%; bottom: 3%; width: 42%; aspect-ratio: 470 / 404; }
.hotspot-chest, .static-room-chest { z-index: 6; right: 1.5%; bottom: 1.5%; width: 19.5%; aspect-ratio: 336 / 202; }
.room-wall-lamp { position: absolute; z-index: 4; left: 7%; top: 19%; width: 8%; height: auto; aspect-ratio: 1; }
.grid-sprite-calendar { position: relative; display: block; width: 100%; height: 100%; color: #463423; background: #d9ceb1; border: 4px solid #33261f; }
.grid-sprite-calendar::before { content: ""; position: absolute; left: 12%; right: 12%; top: 16%; height: 10%; background: var(--brick); }
.grid-sprite-calendar i { position: absolute; inset: 34% 0 0; display: grid; place-items: center; font: normal clamp(.5rem, 1.2cqi, .9rem)/1 var(--font-pixel); }
/* 캐릭터: 책상 앞 의자에 앉아 공부하는 뒷모습. 책상 앞면을 가리도록 책상보다 위에 그립니다. */
.room-avatar { position: absolute; z-index: 7; left: 38.4%; bottom: 0; width: 17.6%; pointer-events: none; }
.room-avatar-figure { position: relative; display: block; width: 100%; aspect-ratio: 504 / 861; filter: drop-shadow(0 6px 3px rgba(0, 0, 0, .4)); }
.seated-avatar-art { position: relative; z-index: 2; display: block; width: 100%; height: 100%; image-rendering: pixelated; transform-origin: 50% 100%; animation: room-study 3.2s steps(2, end) infinite; }
.room-avatar-figure .wearable-pet { left: -46%; bottom: 0; width: 52%; height: auto; aspect-ratio: 1; }
@keyframes room-study { 50% { transform: scaleY(.99); } }

/* 집중 모드 */
.focus-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.focus-card { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); width: min(1100px, 100%); overflow: hidden; }
.focus-scene { border-right: 2px solid var(--line); }
.focus-content { display: grid; align-content: center; justify-items: center; gap: 8px; padding: 28px 24px; text-align: center; }
.focus-content h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.focus-content p { margin: 4px 0; }
.focus-time-label { color: var(--muted); font-size: .86rem; }
.timer { display: flex; align-items: flex-start; justify-content: center; gap: 6px; margin: 10px 0 6px; }
.timer > i { padding-top: 14px; color: var(--muted); font: normal 1.3rem/1 var(--font-pixel); }
.timer-unit { display: grid; gap: 6px; min-width: 76px; padding: 12px 8px 8px; background: var(--inset); border: 2px solid var(--line); }
.timer-unit b { font: clamp(1.35rem, 2.6vw, 2rem)/1 var(--font-pixel); }
.timer-unit small { color: var(--muted); font-size: .74rem; }
.focus-progress-track { width: 100%; height: 8px; margin-bottom: 4px; background: var(--inset); border: 1px solid var(--line); }
.focus-progress-track span { display: block; height: 100%; background: var(--brass); transition: width .4s linear; }
.focus-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }

/* 아이템 카드 공통 */
.inventory-grid, .shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.item-card { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 150px; padding: 12px 10px; text-align: center; background: var(--inset); border: 2px solid var(--line); }
.item-card b { font-size: .92rem; line-height: 1.35; }
.item-card p { margin: 2px 0 8px; }
.item-card > .btn { margin-top: auto; }
.item-card > .tiny + .btn { margin-top: 8px; }
.item-icon { display: block; width: 64px; height: 64px; margin: 2px auto 6px; }
.shop-grid .item-icon, .shop-grid .world-item-preview { width: 58px; height: 58px; }
.rarity-RARE { border-color: #5d8296; }
.rarity-EPIC { border-color: #8a6fae; }
.equipped-card { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.world-item-preview { display: block; width: 64px; height: 64px; margin: 2px auto 6px; background: radial-gradient(circle, #ffe69b 0 8%, #7c61b7 9% 18%, #17213a 19%); border: 2px solid var(--line); }
.world-preview-blossoms { background: radial-gradient(circle at 35% 32%, #ffd1df 0 8%, transparent 9%), radial-gradient(circle at 65% 58%, #ff9bc1 0 10%, transparent 11%), #2c3346; }
.world-preview-snowfall { background: radial-gradient(circle at 22% 20%, white 0 5%, transparent 6%), radial-gradient(circle at 68% 38%, #f5fbff 0 8%, transparent 9%), radial-gradient(circle at 42% 76%, white 0 6%, transparent 7%), #2c3346; }
.world-preview-aurora { background: linear-gradient(135deg, #5b6eff, #6affcf, #bd77ff, #18203a); }
.world-preview-fountain { background: radial-gradient(circle, #d6fbff 0 12%, #5dd9ff 13% 28%, #223650 29%); }
.shop-sector-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0; }
.effect-catalog-row, .enhancement-category { display: grid; grid-template-columns: minmax(110px, .16fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px 0; border-top: 2px solid var(--line); }
.effect-row-title h3 { margin: 0; }
.shop-bottom { margin-top: 14px; }
.shop-feature { padding: 16px; background: var(--inset); border: 2px solid var(--line); }
.shop-feature h3 { margin: 0 0 4px; }

/* 아바타 공방 */
.avatar-stage { min-height: 380px; overflow: hidden; background: radial-gradient(ellipse 22% 5% at 50% 66%, rgba(0, 0, 0, .5) 0 55%, transparent 100%), linear-gradient(to bottom, var(--panel) 0 64%, var(--inset) 64%); }
.avatar-stage-center { position: absolute; inset: 0 0 33%; display: grid; place-items: end center; }
.avatar-preview-composite { position: relative; display: block; width: 220px; aspect-ratio: 322 / 305; }
.avatar-plinth { position: absolute; left: 50%; bottom: 18px; width: max-content; max-width: calc(100% - 28px); padding: 6px 12px; color: var(--accent-text); font-weight: 700; text-align: center; background: #120e0b; border: 2px solid var(--line); transform: translateX(-50%); }
.avatar-color-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.avatar-color { display: grid; place-items: center; gap: 2px; padding: 8px 4px; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.avatar-color.active { background: var(--selected); border-color: var(--brass); }
.avatar-color-art { width: 58px; height: 55px; }
.avatar-note { margin: 0 0 8px; }
.avatar-seated-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: -4px 0 14px; }
.avatar-seated-card { display: grid; justify-items: center; gap: 2px; min-width: 0; margin: 0; padding: 5px 3px; background: var(--inset); border: 1px solid var(--line); }
.avatar-seated-card img { display: block; width: min(100%, 78px); height: 74px; object-fit: contain; image-rendering: pixelated; }
.avatar-seated-card figcaption { font-size: .75rem; color: var(--muted); }
.profile-avatar-preview { display: grid; place-items: center; min-height: 170px; margin: 0 0 16px; background: var(--inset); border: 2px solid var(--line); }
.profile-avatar-composite { position: relative; display: block; width: 140px; aspect-ratio: 322 / 305; }

/* 강화 센터 */
.enhancement-center-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.enhancement-center-hero h2 { margin: 2px 0 8px; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.enhancement-center-avatar { display: grid; place-items: center; gap: 4px; min-width: 140px; color: var(--accent-text); font-size: .84rem; font-weight: 700; }
.enhancement-preview-composite { position: relative; display: block; width: 96px; aspect-ratio: 322 / 305; }
.enhancement-guide { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.enhancement-guide > * { padding: 3px 8px; font-size: .82rem; background: var(--inset); border: 2px solid var(--line); }
.enhancement-category-list { display: grid; }
.enhancement-card strong { color: var(--brass-2); }
.enhancement-rate-table { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.enhancement-rate-table div { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 8px 10px; background: var(--inset); border: 2px solid var(--line); }
.enhancement-rate-table em { display: block; color: var(--muted); font-size: .72rem; font-style: normal; }
/* 강화 연출의 카드 색과 같은 색 */
.tier-chip { --tier-a: #8ea4c8; --tier-b: #2b3550; display: inline-block; flex: none; width: 16px; height: 22px; background: linear-gradient(160deg, var(--tier-a), var(--tier-b)); border: 1px solid rgba(255, 255, 255, .55); clip-path: polygon(50% 0, 100% 9%, 100% 88%, 50% 100%, 0 88%, 0 9%); }
.tier-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; padding: 0; list-style: none; font-size: .8rem; }
.tier-legend li { display: flex; align-items: center; gap: 6px; }
.tier-legend small { color: var(--muted); }
.enhancement-rate-table small { color: var(--accent-text); }
.enhancement-rate-table b { color: #3f6a39; }

/* 목록 · 기록 */
.quest-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.quest-row:last-child { border-bottom: 0; }
.quest-row.no-art { grid-template-columns: 1fr auto; }
.quest-art { width: 40px; height: 40px; background-color: var(--inset); border: 2px solid var(--line); }
.mini-track { height: 6px; margin-top: 6px; background: var(--inset); border: 1px solid var(--line); }
.mini-track span { display: block; height: 100%; background: var(--sage); }
.schedule-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.date-box { width: 56px; padding: 6px; font-weight: 700; font-size: .86rem; text-align: center; background: var(--inset); border: 2px solid var(--line); }
.subject-manage-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.subject-manage-row div { display: grid; gap: 2px; }
.subject-manage-row small { color: var(--muted); }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding: 26px 4px 28px; }
.bar { position: relative; flex: 1; min-width: 26px; min-height: 3px; background: #6f8f68; border-top: 3px solid var(--sage); }
.bar b { position: absolute; top: -24px; left: 50%; font-size: .76rem; transform: translateX(-50%); }
.bar span { position: absolute; bottom: -26px; left: 50%; color: var(--muted); font-size: .76rem; transform: translateX(-50%); }
.stat-value { margin-top: 10px; color: var(--accent-text); font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; }
.streak-art { display: grid; place-items: center; min-height: 130px; }
.streak-lamp { width: 104px; height: 104px; }
.cancelled-session { opacity: .7; }
.cancelled-session > span:last-child { color: var(--brick); }
.danger-zone { border-color: #7c3a2e; }
.danger-confirm { display: grid; gap: 10px; margin-top: 16px; }

/* 모달 · 토스트 */
.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(8, 6, 4, .78); }
.modal { width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: 22px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin: 2px 0; }
.reward-burst { padding: 12px 0; text-align: center; }
.reward-burst h2 { margin: 4px 0 8px; }
.reward-values { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
.reward-value { padding: 10px 14px; background: var(--inset); border: 2px solid var(--line); }
.reward-player { width: 110px; height: 104px; margin: 0 auto 10px; }
.reward-item { display: block; width: 130px; height: 130px; margin: 0 auto 10px; animation: reward-pop .4s ease-out; }
@keyframes reward-pop { from { transform: scale(.4); opacity: .2; } }
.level-track { width: min(360px, 100%); height: 10px; margin: 14px auto; background: var(--inset); border: 2px solid var(--line); }
.level-track span { display: block; height: 100%; background: var(--brass); }
.region-list { display: grid; gap: 6px; margin-top: 12px; }
.region-card { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; text-align: left; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.region-card span { color: var(--accent-text); font-weight: 700; font-size: .86rem; }
.region-card small { color: var(--muted); }
.region-card.locked { opacity: .55; }
.region-card.current { border-color: var(--brass-edge); background: var(--selected); }
.collection-groups { display: grid; gap: 14px; }
.collection-groups h3 { margin: 0 0 6px; }
.collection-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.collection-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--inset); border: 2px solid var(--line); }
.collection-item.locked { opacity: .55; }
.collection-item span { display: grid; line-height: 1.3; }
.collection-item small { color: var(--muted); }
.collection-item-art { width: 40px; height: 40px; }
#toast-root { position: fixed; z-index: 100; right: 16px; bottom: 92px; display: grid; gap: 8px; }
.toast { max-width: 340px; padding: 10px 14px; background: #120e0b; border: 2px solid var(--brass); box-shadow: var(--drop); animation: toast-in .18s ease-out; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* 도트 스프라이트 */
.atlas-sprite, .effect-item-sprite, .player-art { display: inline-block; flex: 0 0 auto; background-repeat: no-repeat; background-position: var(--x, 0%) var(--y, 0%); image-rendering: pixelated; }
.atlas-sprite { background-image: url("assets/study-atlas.webp"); background-size: 400% 300%; }
.effect-item-sprite { background-image: url("assets/effect-item-atlas.webp"); background-size: 300% 300%; }
/* 시트마다 다른 가로 치우침을 translate로 보정합니다(transform 애니메이션과 독립). */
.player-art { background-image: var(--avatar-sheet, url("assets/player-sprites.webp")); background-size: 400% 400%; }
.composite-player { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; }
.wearable-pet { position: absolute; z-index: 3; left: -14%; bottom: 0; width: 34%; height: 34%; filter: drop-shadow(0 4px 2px rgba(0, 0, 0, .5)); }
.panel-art, .place-art { width: 100%; height: 100%; }
.chip-art { width: 40px; height: 40px; }
.enhancement-tier-1 { filter: drop-shadow(0 0 4px rgba(240, 199, 106, .45)); }
.enhancement-tier-2 { filter: drop-shadow(0 0 6px rgba(240, 199, 106, .6)); }
.enhancement-tier-3 { filter: drop-shadow(0 0 8px rgba(240, 199, 106, .75)); }
.enhancement-tier-4 { filter: drop-shadow(0 0 10px rgba(255, 214, 120, .85)); }
.enhancement-tier-5 { filter: drop-shadow(0 0 13px #ffe9a8); }
.shared-room-panel[class*="enhancement-tier-"] { filter: none; }

/* 월드 */
.explore-page { display: grid; gap: 14px; }
.explore-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.explore-toolbar h2 { margin: 0; }
.explore-page > * { min-width: 0; }
.explore-frame { position: relative; }
.explore-viewport { position: relative; height: clamp(460px, 64vh, 720px); overflow: hidden; background: #0c0a08; border: 2px solid var(--line-2); box-shadow: var(--drop); scrollbar-width: none; }
.explore-viewport::-webkit-scrollbar { display: none; }
.explore-map { position: relative; width: 1800px; min-width: 1800px; height: 1200px; overflow: hidden; background-image: var(--stage-tint, linear-gradient(transparent, transparent)), var(--map-image, url("assets/explore-town.webp")); background-position: center; background-size: 100% 100%; background-repeat: no-repeat; background-blend-mode: multiply, normal; cursor: crosshair; isolation: isolate; }
.explore-map::after { content: ""; position: absolute; z-index: 8; inset: 0; pointer-events: none; box-shadow: inset 0 0 90px 12px rgba(10, 7, 4, .5); }
.world-stage-1 { --stage-tint: linear-gradient(rgba(63,59,52,.48), rgba(30,37,44,.58)); filter: saturate(.63) brightness(.74); }
.world-stage-2 { --stage-tint: linear-gradient(rgba(76,70,53,.3), rgba(30,39,50,.36)); filter: saturate(.76) brightness(.84); }
.world-stage-3 { --stage-tint: linear-gradient(rgba(70,70,62,.13), rgba(28,38,52,.2)); filter: saturate(.88) brightness(.93); }
.world-stage-4 { --stage-tint: linear-gradient(rgba(255,255,255,.01), rgba(25,34,49,.04)); }
.world-stage-5 { --stage-tint: radial-gradient(circle at 50% 48%, rgba(255,232,159,.1), transparent 58%); filter: saturate(1.08) brightness(1.03); }
.world-stage-6 { --stage-tint: radial-gradient(circle at 50% 48%, rgba(255,222,116,.16), transparent 62%); filter: saturate(1.16) brightness(1.06); }
.world-stage-7 { --stage-tint: radial-gradient(circle at 50% 46%, rgba(255,239,161,.23), transparent 66%); filter: saturate(1.23) brightness(1.08); }
.world-stage-8 { --stage-tint: radial-gradient(circle at 50% 45%, rgba(255,244,184,.28), rgba(98,71,158,.08) 62%, transparent); filter: saturate(1.3) brightness(1.11); }
.world-decoration { position: absolute; z-index: 9; inset: 0; pointer-events: none; }
.world-decoration-lanterns { background: radial-gradient(circle at var(--lantern-1-x, 18%) var(--lantern-1-y, 64%), #ffe581 0 3px, transparent 5px), radial-gradient(circle at var(--lantern-2-x, 44%) var(--lantern-2-y, 48%), #ffcf68 0 4px, transparent 6px), radial-gradient(circle at var(--lantern-3-x, 71%) var(--lantern-3-y, 39%), #ffe581 0 3px, transparent 5px), radial-gradient(circle at var(--lantern-4-x, 84%) var(--lantern-4-y, 72%), #ffcf68 0 4px, transparent 6px); filter: drop-shadow(0 0 8px #ffc653); animation: decor-glow 2.8s ease-in-out infinite alternate; }
.world-decoration-blossoms { overflow: hidden; container-type: size; }
.petal { position: absolute; top: 0; left: var(--x); animation: petal-fall var(--fall) linear var(--fall-delay) infinite; will-change: transform; }
.petal b { display: block; animation: petal-sway var(--sway) ease-in-out var(--sway-delay) infinite alternate; }
.petal i { display: block; width: var(--size); height: calc(var(--size) * .7); background: linear-gradient(135deg, var(--petal-a) 0 45%, var(--petal-b)); border-radius: 100% 0 100% 0; opacity: var(--alpha); animation: petal-spin var(--spin) linear var(--spin-delay) infinite; }
@keyframes petal-fall { from { transform: translate(0, -4cqh); } to { transform: translate(var(--wind), 104cqh); } }
@keyframes petal-sway { from { transform: translateX(calc(var(--drift) * -1)); } to { transform: translateX(var(--drift)); } }
@keyframes petal-spin { from { transform: rotate(0deg) rotateX(0deg); } to { transform: rotate(var(--turn)) rotateX(360deg); } }
.world-decoration-snowfall { background-image: radial-gradient(circle, rgba(255,255,255,.96) 0 4px, transparent 5px), radial-gradient(circle, rgba(240,249,255,.78) 0 7px, transparent 8px); background-size: 118px 104px, 183px 157px; opacity: .72; filter: drop-shadow(0 0 5px rgba(224,244,255,.72)); animation: snowfall 13s linear infinite; }
.world-decoration-aurora { background: linear-gradient(115deg, transparent 10%, rgba(73,255,198,.2) 34%, rgba(120,104,255,.22) 52%, transparent 75%); mix-blend-mode: screen; animation: aurora 6s ease-in-out infinite alternate; }
.world-decoration-fountain { background: radial-gradient(circle at var(--fountain-x, 50%) var(--fountain-y, 49%), rgba(226,253,255,.98) 0 2.5%, rgba(86,224,255,.78) 3.5% 8%, rgba(66,167,255,.36) 9% 15%, transparent 23%); mix-blend-mode: screen; filter: drop-shadow(0 0 28px #61ddff) brightness(1.25); animation: fountain-glow 1.45s ease-in-out infinite alternate; }
@keyframes decor-glow { to { opacity: .55; } }
@keyframes snowfall { to { background-position: 50px 230px, -75px 260px; } }
@keyframes fountain-glow { to { opacity: .68; filter: drop-shadow(0 0 42px #79e8ff) brightness(1.48); } }
@keyframes aurora { to { transform: translateX(6%); opacity: .55; } }
.explore-hint { position: absolute; z-index: 12; right: 12px; bottom: 12px; padding: 5px 10px; color: var(--muted); font-size: .76rem; background: rgba(18, 14, 11, .9); border: 2px solid var(--line); }
.explore-player { position: absolute; z-index: 20; width: 88px; height: 102px; transform: translate(-50%, -78%); will-change: left, top, transform; filter: drop-shadow(0 9px 4px rgba(0,0,0,.62)); pointer-events: none; }
.explore-avatar-composite { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.explore-avatar-composite .wearable-pet { left: -8%; bottom: 5%; width: 28%; height: 27%; }
.explore-player.moving { animation: walk-bob .16s alternate infinite; }
@keyframes walk-bob { to { margin-top: -3px; } }
.remote-player-layer { position: absolute; z-index: 14; inset: 0; pointer-events: none; }
.remote-player { pointer-events: none; }
.remote-player-art { width: 100%; height: 100%; }
.world-player-name { position: absolute; top: calc(100% + 3px); left: 50%; max-width: 110px; overflow: hidden; color: #fff; font-size: 11px; font-weight: 800; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; transform: translateX(-50%); text-shadow: -1px -1px 0 #1a120b, 1px -1px 0 #1a120b, -1px 1px 0 #1a120b, 1px 1px 0 #1a120b; }
.world-chat-bubble { position: absolute; z-index: 30; left: 50%; bottom: 108%; width: max-content; max-width: 220px; padding: 6px 10px; color: #2b2016; font-size: .76rem; line-height: 1.35; white-space: normal; background: #f4e9d1; border: 2px solid #3a2b1e; box-shadow: 3px 3px 0 rgba(0,0,0,.3); transform: translateX(-50%); }
.world-chat-bubble::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 10px; height: 10px; background: #f4e9d1; border-right: 2px solid #3a2b1e; border-bottom: 2px solid #3a2b1e; transform: translateX(-50%) rotate(45deg); }
.world-network-status { position: absolute; z-index: 30; right: 10px; top: 10px; padding: 3px 8px; color: var(--text); font-size: .72rem; font-weight: 800; background: rgba(18, 14, 11, .88); border: 2px solid var(--line); }
.world-network-status span { display: none; }
.world-network-status[data-status="connected"] .connected, .world-network-status[data-status="connecting"] .connecting, .world-network-status[data-status="reconnecting"] .reconnecting, .world-network-status[data-status="offline"] .offline { display: inline; }
.world-network-status[data-status="connected"] { color: var(--sage); }
.world-network-status[data-status="reconnecting"] { color: var(--brass-2); }
.world-network-status[data-status="offline"] { color: #ff9d8d; }
.place-marker { position: absolute; z-index: 10; width: 72px; height: 77px; padding: 0; background: transparent; border: 0; cursor: pointer; filter: grayscale(.55) brightness(.8); transform: translate(-50%, -90%); transition: filter .15s ease, transform .15s ease; }
.place-marker:hover, .place-marker:focus-visible, .place-marker.discovered { filter: none; transform: translate(-50%, -94%) scale(1.08); }
.place-art { filter: drop-shadow(0 5px 2px rgba(0,0,0,.52)); }
.place-marker[data-place="moon-pond"]::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: 165px; height: 165px; border-radius: 50%; background: radial-gradient(circle, rgba(255,244,181,.84) 0 9%, rgba(255,213,105,.5) 24%, rgba(204,151,57,.23) 46%, transparent 72%); filter: blur(6px) sepia(.35); transform: translate(-50%, -50%); animation: pond-lamp-glow 2.8s ease-in-out infinite alternate; }
.place-marker[data-place="moon-pond"] .place-art { filter: sepia(.35) drop-shadow(0 0 10px #ffe08a) drop-shadow(0 0 24px rgba(235,174,65,.78)); }
@keyframes pond-lamp-glow { to { opacity: .62; transform: translate(-50%, -50%) scale(1.13); } }
.place-marker::after { content: ""; position: absolute; left: 50%; bottom: -1px; width: 8px; height: 5px; border-radius: 50%; background: rgba(5,8,15,.55); transform: translateX(-50%); }
.place-label { position: absolute; left: 50%; bottom: -20px; width: max-content; max-width: 140px; padding: 1px 6px; color: #fff; font-size: .66rem; background: rgba(18, 14, 11, .9); border: 1px solid var(--line-2); opacity: 0; transform: translateX(-50%); pointer-events: none; }
.place-marker:hover .place-label, .place-marker:focus-visible .place-label, .place-marker.discovered .place-label { opacity: 1; }
.world-chat-fab { position: absolute; z-index: 20; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px; font-weight: 700; background: #120e0b; border: 2px solid var(--brass-edge); box-shadow: var(--drop); cursor: pointer; }
.world-chat-fab:hover, .world-chat-fab.active { border-color: var(--brass); background: var(--selected); }
.world-chat-fab b { min-width: 20px; padding: 0 6px; color: var(--brass-ink); font-size: .74rem; text-align: center; background: var(--brass); }
.world-chat-fab b[hidden] { display: none; }
.explore-controls { display: grid; gap: 14px; }
.place-panel { display: flex; align-items: center; gap: 16px; min-height: 104px; padding: 14px 18px; }
.place-panel h3 { margin: 2px 0; }
.place-panel p { margin: 2px 0 10px; color: var(--muted); }
.place-panel-art { flex: 0 0 80px; width: 80px; height: 80px; }
.world-chat-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; }
.world-chat-bar > span { display: grid; gap: 2px; }
.world-chat-bar small { color: var(--muted); }
.world-chat-compose { display: flex; align-items: stretch; gap: 8px; }
.world-chat-compose .input { min-width: min(320px, 40vw); }
.world-chat-compose .btn { white-space: nowrap; }
.world-chat-panel { position: absolute; z-index: 25; top: 12px; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100% - 24px)); padding: 16px; border-color: var(--line-2); }
.world-chat-panel h2 { margin: 0; }
.world-chat-panel > p { margin: 0; }
.world-chat-panel > .btn, .world-chat-panel > .chat-history-button { align-self: flex-start; }
.world-chat-panel .world-chat-compose { display: flex; flex: 0 0 auto; }
.world-chat-panel .world-chat-compose .input { flex: 1; min-width: 0; }
.world-chat-messages { display: grid; flex: 1 1 auto; align-content: start; gap: 8px; min-height: 120px; padding-right: 4px; overflow-y: auto; }
.chat-message { position: relative; padding: 8px 10px; background: var(--inset); border: 2px solid var(--line); }
.chat-message.player { margin-left: 28px; border-color: #7a6040; }
.chat-message.npc { margin-right: 28px; border-color: #4f6e63; }
.chat-message p { margin: 4px 0 0; }
.chat-message small { position: absolute; top: 8px; right: 10px; color: var(--muted); font-size: .72rem; }
.chat-safety-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.chat-safety-actions button { color: var(--muted); font-size: .72rem; text-decoration: underline; background: transparent; border: 0; cursor: pointer; }
.chat-history-button { justify-self: center; padding: 3px 10px; color: var(--muted); font-size: .76rem; background: transparent; border: 2px solid var(--line); cursor: pointer; }
.chat-history-button:disabled { cursor: wait; opacity: .6; }
.explore-strip { display: flex; gap: 8px; padding-bottom: 4px; overflow: auto; }
.discovery-chip { display: flex; align-items: center; gap: 8px; min-width: 180px; padding: 6px 10px; background: var(--inset); border: 2px solid var(--line); }
.discovery-chip span { display: grid; line-height: 1.3; }
.discovery-chip small { color: var(--muted); }

/* Full-screen enhancement: 재료 투입 → 충전 → 카드 회전 → 판정 */
.forge-overlay { --tier-a: #8ea4c8; --tier-b: #2b3550; --tier-glow: rgba(126,174,255,.55); position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; overflow: hidden; color: #fff; background: radial-gradient(circle at 50% 42%, #18203a 0, #070a14 55%, #020309 100%); }
.forge-overlay.tier-bronze, .forge-card.tier-bronze, .tier-chip.tier-bronze { --tier-a: #f0b071; --tier-b: #6b3a17; --tier-glow: rgba(240,150,80,.6); }
.forge-overlay.tier-silver, .forge-card.tier-silver, .tier-chip.tier-silver { --tier-a: #f4f8ff; --tier-b: #6c7a90; --tier-glow: rgba(210,228,255,.65); }
.forge-overlay.tier-gold, .forge-card.tier-gold, .tier-chip.tier-gold { --tier-a: #fff0a3; --tier-b: #a8700d; --tier-glow: rgba(255,214,90,.8); }
.forge-rays { position: absolute; left: 50%; top: 42%; width: 180vmax; height: 180vmax; margin: -90vmax 0 0 -90vmax; background: repeating-conic-gradient(from 0deg, rgba(120,170,255,.16) 0 6deg, transparent 6deg 18deg); opacity: .35; animation: forge-spin 18s linear infinite; pointer-events: none; }
.forge-flash { position: absolute; z-index: 9; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.forge-stage { position: relative; z-index: 4; display: grid; justify-items: center; gap: 12px; width: min(520px, calc(100vw - 32px)); text-align: center; }
.forge-title { color: #9fc2ff; letter-spacing: .14em; }
.forge-arena { position: relative; display: grid; place-items: center; width: 320px; height: 330px; perspective: 900px; }
@media (max-height: 640px) { .forge-stage { gap: 6px; } .forge-arena { height: 250px; transform: scale(.76); margin: -36px 0; } }
.forge-ring { position: absolute; width: 290px; height: 290px; border: 2px dashed rgba(150,190,255,.45); border-radius: 50%; box-shadow: 0 0 40px rgba(110,160,255,.25), inset 0 0 40px rgba(110,160,255,.18); animation: forge-spin 6s linear infinite; }
.forge-material { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; opacity: 0; filter: drop-shadow(0 0 10px #8fc0ff); animation: forge-feed .6s cubic-bezier(.55,0,.8,.4) calc(var(--m) * .17s + .1s) forwards; }
.forge-material-art { display: block; width: 100%; height: 100%; }
.forge-card-slot { position: relative; z-index: 2; transform-style: preserve-3d; }
.forge-card { position: relative; display: grid; justify-items: center; align-content: center; gap: 6px; width: 184px; height: 252px; padding: 34px 14px 18px; overflow: hidden; color: #1a1206; background: linear-gradient(160deg, var(--tier-a) 0%, var(--tier-b) 100%); border: 3px solid rgba(255,255,255,.65); clip-path: polygon(50% 0, 100% 9%, 100% 88%, 50% 100%, 0 88%, 0 9%); box-shadow: 0 0 34px var(--tier-glow); filter: drop-shadow(0 0 18px var(--tier-glow)); }
.forge-card.tier-base { color: #eaf1ff; }
.forge-card-grade { position: absolute; left: 16px; top: 26px; font-family: "Press Start 2P", monospace; font-size: 1.15rem; text-shadow: 0 2px 0 rgba(255,255,255,.35); }
.forge-card-art { display: block; width: 112px; height: 112px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.forge-card-name { max-width: 100%; overflow: hidden; font-size: .95rem; white-space: nowrap; text-overflow: ellipsis; }
.forge-card small { font-size: .7rem; opacity: .75; }
.forge-card-shine { position: absolute; inset: -40% -60%; background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.55) 50%, transparent 60%); animation: forge-shine 2.4s ease-in-out infinite; pointer-events: none; }
.forge-burst { position: absolute; inset: 0; pointer-events: none; }
.forge-burst i { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4px; background: var(--tier-a); box-shadow: 0 0 12px var(--tier-glow); transform: rotate(45deg); opacity: 0; }
.forge-gauge { position: relative; width: min(320px, 80vw); height: 12px; overflow: hidden; background: #0d1426; border: 1px solid #3a4a72; }
.forge-gauge span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #3d7bff, #8ef0ff, #fff6b0); box-shadow: 0 0 14px #7fd6ff; }
.forge-status { min-height: 1.4em; margin: 0; color: #b9c8ea; font-size: .9rem; }
.forge-result { display: grid; justify-items: center; gap: 10px; }
.forge-result[hidden] { display: none; }
.forge-result strong { font-size: clamp(1.9rem, 7vw, 3rem); font-weight: 900; letter-spacing: .02em; filter: drop-shadow(0 4px 18px var(--tier-glow)); }
.forge-result-grade { color: #cfd9f2; font-weight: 900; }
.forge-skip { position: fixed; right: 20px; bottom: 20px; z-index: 10; }

/* 1단계: 재료가 카드로 빨려 들어가며 카드가 맥동 */
.phase-feed .forge-card { animation: forge-pulse .34s ease-out .2s 5; }
/* 2단계: 충전 – 링·광선 가속, 카드 떨림, 확률 게이지 채움 */
.phase-charge .forge-rays { opacity: .6; animation-duration: 3s; }
.phase-charge .forge-ring { animation-duration: 1s; border-color: rgba(190,225,255,.85); }
.phase-charge .forge-card { animation: forge-shake .08s linear infinite; filter: drop-shadow(0 0 30px var(--tier-glow)) brightness(1.15); }
.phase-charge .forge-gauge span, .phase-flip .forge-gauge span, .phase-result .forge-gauge span { width: var(--rate); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
/* 3단계: 카드가 빠르게 회전하며 빛이 차오름 */
.phase-flip .forge-rays { opacity: .85; animation-duration: 1.2s; }
.phase-flip .forge-card-slot { animation: forge-flip .7s cubic-bezier(.6,0,.4,1) forwards; }
.phase-flip .forge-flash { animation: forge-flash-in .7s ease-in forwards; }
/* 판정 */
.phase-result .forge-flash { animation: forge-flash-out .6s ease-out forwards; }
.phase-result .forge-material, .phase-result .forge-ring { display: none; }
.is-success { background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--tier-a) 55%, #0b1020) 0, #0b1020 50%, #020309 100%); }
.is-success .forge-rays { opacity: .95; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--tier-a) 40%, transparent) 0 7deg, transparent 7deg 16deg); animation-duration: 10s; }
.is-success .forge-card-slot { animation: forge-pop .6s cubic-bezier(.2,1.6,.4,1) both; }
.is-success .forge-burst i { animation: forge-burst 1s cubic-bezier(.1,.7,.3,1) calc(var(--i) * 8ms) forwards; }
.is-success .forge-result strong { background: linear-gradient(90deg, #fff, var(--tier-a), #fff); -webkit-background-clip: text; background-clip: text; color: transparent; animation: forge-stamp .5s cubic-bezier(.2,1.6,.4,1) both; }
.is-failure { background: radial-gradient(circle at 50% 42%, #3a1420 0, #0d0710 55%, #020203 100%); }
.is-failure .forge-rays { opacity: .12; animation: none; }
.is-failure .forge-card-slot { animation: forge-fail .55s linear both; }
.is-failure .forge-card { filter: grayscale(.85) brightness(.7); }
.is-failure .forge-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(62deg, transparent 48%, rgba(0,0,0,.75) 49% 50.5%, transparent 51.5%), linear-gradient(-38deg, transparent 55%, rgba(0,0,0,.7) 56% 57%, transparent 58%); }
.is-failure .forge-result strong { color: #ff8d9e; animation: forge-stamp .4s ease-out both; }

@keyframes forge-spin { to { transform: rotate(360deg); } }
@keyframes forge-feed { 0% { opacity: 0; transform: rotate(calc(var(--m) * 60deg)) translateX(240px) rotate(calc(var(--m) * -60deg)) scale(1); } 20% { opacity: 1; } 100% { opacity: 0; transform: rotate(calc(var(--m) * 60deg + 120deg)) translateX(0) rotate(calc(var(--m) * -60deg)) scale(.25); } }
@keyframes forge-pulse { 50% { transform: scale(1.06); filter: drop-shadow(0 0 30px var(--tier-glow)) brightness(1.3); } }
@keyframes forge-shake { 25% { transform: translate(-3px, 1px) rotate(-.6deg); } 75% { transform: translate(3px, -1px) rotate(.6deg); } }
@keyframes forge-shine { 0% { transform: translateX(-60%); } 60%, 100% { transform: translateX(60%); } }
@keyframes forge-flip { to { transform: rotateY(1080deg) scale(1.12); filter: brightness(2.2); } }
@keyframes forge-flash-in { 0%, 60% { opacity: 0; } 100% { opacity: 1; } }
@keyframes forge-flash-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes forge-pop { 0% { transform: scale(1.45); } 100% { transform: scale(1); } }
@keyframes forge-burst { 0% { opacity: 1; transform: rotate(calc(var(--i) * 15deg)) translateY(0) rotate(45deg); } 100% { opacity: 0; transform: rotate(calc(var(--i) * 15deg)) translateY(-230px) rotate(45deg) scale(.4); } }
@keyframes forge-stamp { 0% { opacity: 0; transform: scale(2.4); } 100% { opacity: 1; transform: scale(1); } }
@keyframes forge-fail { 0% { transform: scale(1.1); } 20% { transform: translateX(-14px) rotate(-3deg); } 40% { transform: translateX(12px) rotate(2deg); } 60% { transform: translateX(-7px); } 100% { transform: translateY(14px) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) {
  .forge-overlay *, .forge-overlay *::after { animation: none !important; transition: none !important; }
}

/* 반응형 */
@media (max-width: 1000px) {
  .learner-grid { grid-template-columns: repeat(2, 1fr); }
  .onboard-body { grid-template-columns: 1fr; }
  .story-card { display: none; }
  .room-focus-layout { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .focus-card { grid-template-columns: 1fr; width: min(720px, 100%); }
  .focus-scene { border-right: 0; border-bottom: 2px solid var(--line); }
}

@media (max-width: 680px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-3.quick-starts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .onboarding-head { display: block; }
  .learner-card { min-height: 0; }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .account-grid { grid-template-columns: 1fr; }
  .onboard-actions { flex-direction: column; align-items: stretch; }
  .onboard-actions-right { display: grid; grid-template-columns: 1fr 1fr; }
  .curriculum-summary { display: grid; }
  .avatar-choice-grid, .avatar-color-row { grid-template-columns: repeat(2, 1fr); }
  .player-hud { padding: 8px 12px; gap: 10px; }
  .hud-place { display: none; }
  .hud-streak { display: none; }
  .hud-level { grid-template-columns: auto; }
  .hud-exp-track { width: 100%; }
  .game-main { padding: 14px 12px 96px; }
  .command-dock { bottom: 0; width: 100%; grid-auto-columns: minmax(0, 1fr); padding: 2px; border-width: 2px 0 0; box-shadow: none; }
  .room-exit { left: 6px; bottom: 6px; min-height: 30px; padding: .2rem .6rem; font-size: .76rem; }
  .command-dock-button { min-height: 58px; font-size: .72rem; }
  .command-menu { right: 8px; bottom: 74px; width: calc(100vw - 16px); }
  .command-menu-grid { max-height: 46vh; overflow-y: auto; }
  .world-chat-panel { position: fixed; z-index: 42; inset: auto 8px 74px; width: auto; height: min(480px, calc(100dvh - 140px)); }
  #toast-root { left: 8px; right: 8px; bottom: 76px; }
  .toast { max-width: none; }
  .shop-sector-tabs { grid-template-columns: 1fr 1fr; }
  .effect-catalog-row, .enhancement-category { grid-template-columns: 1fr; }
  .enhancement-rate-table { grid-template-columns: 1fr; }
  .enhancement-center-hero { display: grid; }
  .explore-toolbar { flex-direction: column; align-items: stretch; }
  .explore-viewport { height: 56vh; min-height: 400px; margin-inline: -12px; border-inline: 0; }
  .explore-map { width: 1500px; min-width: 1500px; height: 1000px; }
  .explore-hint { display: none; }
  .place-label { opacity: 1; }
  .place-panel { align-items: flex-start; padding: 12px; }
  .place-panel-art { flex-basis: 64px; width: 64px; height: 64px; }
  .world-chat-bar { flex-direction: column; align-items: stretch; }
  .world-chat-compose { display: grid; grid-template-columns: 1fr; }
  .world-chat-compose .input { min-width: 0; }
  .inline-form { flex-direction: column; }
  .subject-manage-row { grid-template-columns: 1fr auto; }
  .subject-manage-row .btn-danger { grid-column: 2; }
  .modal-backdrop { align-items: end; padding: 8px; }
  .modal { width: 100%; max-height: 92vh; padding: 18px 14px; }
  .profile-actions { display: grid; grid-template-columns: 1fr; }
  .efficiency-breakdown span { font-size: .74rem; }
  .hotspot-label { max-width: 130px; font-size: .74rem; }
  .timer-unit { min-width: 64px; }
}

@media (max-width: 420px) {
  .explore-map { width: 1320px; min-width: 1320px; height: 880px; }
  .resource-chip { padding: 3px 8px; font-size: .82rem; }
  .card { padding: 16px 14px; }
  .timer { gap: 3px; }
  .timer-unit { min-width: 56px; padding-inline: 4px; }
}

@media (pointer: coarse) {
  .btn, .place-marker, .avatar-color, .avatar-choice, .choice { min-height: 44px; }
  .explore-map { cursor: pointer; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .petal, .petal b, .petal i { animation: none !important; }
  .petal { transform: translateY(calc(var(--y) * 1cqh)); }
}

/* 집중 성장 업적 · 보상 */
.focus-achievements, .focus-reward-card { grid-column: 1 / -1; }
.focus-achievements > p { margin: -6px 0 6px; }
.quest-row.is-locked .quest-art { opacity: .55; }
.focus-reward-line { margin-top: 4px; color: var(--accent-text); }
.focus-reward-group h3 { margin: 14px 0 8px; }
.focus-reward-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.focus-reward { position: relative; display: grid; align-content: start; gap: 2px; min-height: 64px; padding: 10px 12px; text-align: left; background: var(--inset); border: 2px solid var(--line); cursor: pointer; }
.focus-reward:hover:not(:disabled) { border-color: var(--line-2); }
.focus-reward.active { background: var(--selected); border-color: var(--brass); }
.focus-reward small { color: var(--muted); font-size: .76rem; }
.focus-reward.locked { opacity: .6; cursor: not-allowed; }
.aura-swatch { display: block; width: 100%; height: 18px; margin-bottom: 4px; border: 1px solid var(--line); }
.aura-swatch.aura-lantern { background: radial-gradient(ellipse at 50% 100%, rgba(255, 196, 92, .9), transparent 70%), #1a1511; }
.aura-swatch.aura-ember { background: radial-gradient(circle at 20% 60%, #ffb347 0 2px, transparent 3px), radial-gradient(circle at 55% 30%, #ff7a3d 0 2px, transparent 3px), radial-gradient(circle at 80% 70%, #ffd27a 0 2px, transparent 3px), radial-gradient(ellipse at 50% 100%, rgba(255, 110, 60, .6), transparent 70%), #1a1511; }
.aura-swatch.aura-star { background: radial-gradient(circle at 25% 40%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 60% 25%, #cfe6ff 0 2px, transparent 3px), radial-gradient(circle at 82% 65%, #fff 0 1.5px, transparent 2.5px), radial-gradient(ellipse at 50% 100%, rgba(150, 190, 255, .55), transparent 70%), #141826; }

/* 칭호: 이름 위 작은 글씨 */
.world-player-name small { display: block; color: var(--brass-2); font-size: 10px; line-height: 1.2; }
.avatar-plinth small { display: block; color: var(--muted); font-size: .76rem; font-weight: 700; }

/* 오라: 아바타 뒤(::before)에 빛, 앞쪽(::after)에 도트 입자 */
.aura-lantern::before, .aura-ember::before, .aura-star::before { content: ""; position: absolute; z-index: 0; left: 50%; bottom: 0; width: 92%; height: 34%; transform: translateX(-50%); border-radius: 50%; pointer-events: none; animation: aura-pulse 2.6s ease-in-out infinite alternate; }
.aura-lantern::before { background: radial-gradient(ellipse, rgba(255, 196, 92, .6), transparent 70%); }
.aura-ember::before { background: radial-gradient(ellipse, rgba(255, 110, 60, .55), transparent 70%); }
.aura-star::before { height: 80%; bottom: 6%; background: radial-gradient(ellipse, rgba(150, 190, 255, .35), transparent 68%); }
.aura-ember::after, .aura-star::after { content: ""; position: absolute; z-index: 4; left: 50%; bottom: 18%; width: 3px; height: 3px; pointer-events: none; }
.aura-ember::after { background: #ffb347; box-shadow: -22px -6px #ff7a3d, 18px -14px #ffd27a, -10px -26px #ff9a4d, 26px -30px #ff7a3d, -28px -38px #ffd27a; animation: ember-rise 2.4s linear infinite; }
.aura-star::after { bottom: 70%; background: #fff; box-shadow: -30px 10px #cfe6ff, 28px -6px #fff, -18px -18px #e6f0ff, 24px 22px #cfe6ff, 0 -26px #fff; animation: star-twinkle 1.8s steps(2, end) infinite; }
@keyframes aura-pulse { to { opacity: .6; transform: translateX(-50%) scale(1.08); } }
@keyframes ember-rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-34px); } }
@keyframes star-twinkle { 50% { opacity: .35; } }
