/* ══════════════ 아르카디아 연대기 — 어두운 판타지 UI ══════════════ */

:root {
  --gold: #d4af37;
  --gold-dim: #9a7f2a;
  --panel-bg: rgba(12, 10, 8, 0.90);
  --panel-border: #6b5a2a;
  --hp-red: #c0392b;
  --mana-blue: #2e6db4;
  --rage-red: #d35400;
  --focus-orange: #c8a227;
  --rarity-common: #e8e8e8;
  --rarity-uncommon: #4caf50;
  --rarity-rare: #42a5f5;
  --rarity-epic: #ab47bc;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #08080f;
  color: #e8e0cc;
  font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", sans-serif;
  user-select: none;
}

.hidden { display: none !important; }

/* ══════════════ 시작 화면 ══════════════ */

#start-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  /* Flow로 생성한 배경 아트 + 가독성용 어두운 덮개 */
  background:
    linear-gradient(180deg, rgba(8, 8, 15, 0.55) 0%, rgba(8, 8, 15, 0.75) 70%, rgba(8, 8, 15, 0.92) 100%),
    url('../imgs/bg_title.jpg') center / cover no-repeat,
    linear-gradient(180deg, #0d0d18 0%, #08080f 100%);
  z-index: 100;
  overflow-y: auto;
}
.class-card { backdrop-filter: blur(2px); }

.start-note {
  max-width: 640px;
  margin: 4px auto 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #cdb98a;
  background: rgba(0,0,0,0.4);
  border: 1px solid #3a3323;
  border-radius: 6px;
  padding: 8px 12px;
}
#chat-input {
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
  background: rgba(0,0,0,0.55);
  border: 1px solid #3a3323;
  border-radius: 4px;
  color: #f0e6d0;
  font-size: 13px;
  padding: 5px 8px;
  outline: none;
}
#chat-input:focus { border-color: var(--gold-dim); background: rgba(0,0,0,0.75); }

#cast-bar {
  position: fixed;
  left: 50%; bottom: 130px;
  transform: translateX(-50%);
  width: 280px; height: 22px;
  background: rgba(0,0,0,0.6);
  border: 1px solid #6a5a2a;
  border-radius: 4px;
  overflow: hidden;
  z-index: 30;
}
#cast-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #d8a52a, #ffe082);
  transition: width 0.05s linear;
}
#cast-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; text-shadow: 0 1px 2px #000;
}

.stat-alloc { display: flex; gap: 6px; margin-top: 6px; }
.stat-btn {
  flex: 1; padding: 7px 4px; cursor: pointer;
  background: rgba(60,45,20,0.5); border: 1px solid var(--gold-dim);
  border-radius: 4px; color: #f0e6d0; font-size: 12px; font-family: inherit;
}
.stat-btn span { display: block; color: #9a8a5a; font-size: 10px; }
.stat-btn:hover:not(:disabled) { background: rgba(90,68,30,0.7); border-color: var(--gold); }
.stat-btn:disabled { opacity: 0.4; cursor: default; }

#menu-bar {
  position: fixed;
  right: 14px; bottom: 96px;
  display: flex; gap: 6px;
  z-index: 35;
}
.menu-btn {
  width: 52px; height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  background: rgba(20, 18, 12, 0.82);
  border: 1px solid var(--gold-dim, #6a5a2a);
  border-radius: 8px;
  color: #e8dcc0; cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, border-color 0.1s, background 0.1s;
}
.menu-btn:hover { transform: translateY(-3px); border-color: var(--gold, #d4af37); background: rgba(40, 32, 16, 0.92); }
.menu-btn:active { transform: translateY(-1px); }
.menu-btn .mb-ico { font-size: 20px; line-height: 1; }
.menu-btn .mb-lbl { font-size: 10px; color: #bcae88; }

@media (max-width: 720px) {
  #menu-bar { bottom: 8px; right: 8px; }
  .menu-btn { width: 46px; height: 46px; }
}

#notice-banner {
  position: fixed;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  max-width: 70vw;
  background: rgba(60, 30, 10, 0.85);
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  color: #ffe6b0;
  font-size: 13px;
  padding: 6px 16px;
  z-index: 40;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-inner {
  text-align: center;
  padding: 30px 20px;
  max-width: 980px;
  width: 100%;
}

.game-title {
  font-size: 52px;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(212, 175, 55, 0.45), 0 2px 2px #000;
  letter-spacing: 6px;
  margin-bottom: 6px;
}

.game-sub {
  color: #8a8070;
  font-size: 15px;
  letter-spacing: 3px;
  margin-bottom: 28px;
}

.name-row {
  margin-bottom: 24px;
}
.name-row label {
  margin-right: 10px;
  color: var(--gold);
  font-size: 15px;
}
#name-input, #pw-input {
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: #f0e8d0;
  font-size: 17px;
  padding: 8px 14px;
  width: 220px;
  text-align: center;
  outline: none;
  font-family: inherit;
}
#name-input:focus, #pw-input:focus { border-color: var(--gold); box-shadow: 0 0 8px rgba(212,175,55,0.35); }

#class-cards {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.class-card {
  width: 210px;
  background: var(--panel-bg);
  border: 2px solid #3a3323;
  border-radius: 8px;
  padding: 14px 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  text-align: left;
}
.class-card:hover { transform: translateY(-3px); border-color: var(--gold-dim); }
.class-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(212,175,55,0.4);
}
.class-card .cc-emoji { font-size: 40px; text-align: center; }
.class-card .cc-name { font-size: 19px; text-align: center; margin: 4px 0 2px; font-weight: bold; }
.class-card .cc-res { font-size: 12px; text-align: center; color: #9a9080; margin-bottom: 6px; }
.class-card .cc-tag { font-size: 12.5px; text-align: center; color: #d8cfb8; line-height: 1.4; min-height: 34px; margin-bottom: 6px; }
.class-card .cc-stats { font-size: 12.5px; text-align: center; color: #b6ad97; margin-bottom: 8px; letter-spacing: 0.3px; }
.class-card .cc-detail-btn {
  display: block; width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,0.06); border: 1px solid #4a4230; color: #cdbf95;
  font-size: 12px; padding: 5px 0; border-radius: 5px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.class-card .cc-detail-btn:hover { background: rgba(212,175,55,0.16); border-color: var(--gold-dim); }
.class-card .cc-skills { border-top: 1px solid #333; padding-top: 8px; margin-top: 8px; max-height: 230px; overflow-y: auto; }
.class-card .cc-skills.hidden { display: none; }
.class-card .cc-skill { font-size: 12px; color: #c9c0aa; margin-bottom: 4px; line-height: 1.35; }
.class-card .cc-skill b { color: var(--gold); font-weight: normal; }

.start-buttons { display: flex; gap: 14px; justify-content: center; }

.gold-btn {
  background: linear-gradient(180deg, #6b5518, #4a3a10);
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: #ffe9a8;
  font-size: 18px;
  font-family: inherit;
  padding: 12px 38px;
  cursor: pointer;
  letter-spacing: 2px;
  text-shadow: 0 1px 2px #000;
}
.gold-btn:hover { background: linear-gradient(180deg, #8a6f20, #5c4914); box-shadow: 0 0 12px rgba(212,175,55,0.4); }

.start-error { margin-top: 16px; color: #e57373; font-size: 14px; }

/* ══════════════ 게임 캔버스 ══════════════ */

#game-canvas {
  position: fixed; inset: 0;
  display: block;
  background: #000;
  cursor: crosshair;
}

/* ══════════════ 지역 배너 ══════════════ */

#zone-banner {
  position: fixed;
  top: 18%; left: 50%;
  transform: translateX(-50%);
  font-size: 40px;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212,175,55,0.6), 0 2px 3px #000;
  letter-spacing: 8px;
  pointer-events: none;
  z-index: 30;
  animation: bannerFade 3s forwards;
}
@keyframes bannerFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* ══════════════ 유닛 프레임 ══════════════ */

.unit-frame {
  position: fixed;
  display: flex;
  gap: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 8px 10px;
  width: 250px;
  z-index: 20;
}
#player-frame { top: 12px; left: 12px; }
#target-frame { top: 12px; left: 280px; border-color: #7a3030; }

.uf-portrait {
  font-size: 32px;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.4);
  border: 1px solid #4a4232;
  border-radius: 50%;
  flex-shrink: 0;
}
.uf-info { flex: 1; min-width: 0; }
.uf-name-row { display: flex; justify-content: space-between; margin-bottom: 3px; }
.uf-name { font-size: 13px; color: #f0e8d0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uf-level { font-size: 12px; color: var(--gold); flex-shrink: 0; margin-left: 6px; }

.bar {
  position: relative;
  height: 15px;
  background: rgba(0,0,0,0.6);
  border: 1px solid #333;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}
.bar-fill { height: 100%; width: 100%; transition: width 0.15s; }
.hp-bar .bar-fill { background: linear-gradient(180deg, #d65545, var(--hp-red)); }
.res-bar .bar-fill.res-mana { background: linear-gradient(180deg, #4a8fd6, var(--mana-blue)); }
.res-bar .bar-fill.res-rage { background: linear-gradient(180deg, #e67e40, var(--rage-red)); }
.res-bar .bar-fill.res-focus { background: linear-gradient(180deg, #e0bd45, var(--focus-orange)); }
.bar-text {
  position: absolute; inset: 0;
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 1px #000;
}
.uf-buffs { font-size: 11px; color: #9ad0ff; min-height: 13px; }

/* ══════════════ 미니맵 ══════════════ */

#minimap-wrap {
  position: fixed;
  top: 12px; right: 12px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 6px;
  z-index: 20;
}
#minimap-title { text-align: center; font-size: 12px; color: var(--gold); margin-bottom: 4px; }
#minimap { display: block; border: 1px solid #333; }

/* ══════════════ 퀘스트 추적기 ══════════════ */

#quest-tracker {
  position: fixed;
  top: 185px; right: 12px;
  width: 210px;
  z-index: 19;
  font-size: 12px;
}
.qt-title { color: var(--gold); font-size: 13px; margin-bottom: 6px; text-shadow: 0 1px 2px #000; }
.qt-quest { margin-bottom: 8px; background: rgba(0,0,0,0.45); border-left: 2px solid var(--gold-dim); padding: 5px 8px; border-radius: 0 4px 4px 0; }
.qt-name { color: #f0e8d0; }
.qt-prog { color: #b0a890; font-size: 11px; }
.qt-prog.done { color: #7ed67e; }

/* ══════════════ 채팅 ══════════════ */

#chat-box {
  position: fixed;
  left: 12px; bottom: 12px;
  width: 360px; height: 170px;
  background: rgba(5, 5, 8, 0.65);
  border: 1px solid #3a3323;
  border-radius: 6px;
  z-index: 20;
  display: flex;
  flex-direction: column;
}
#chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.45;
}
#chat-log::-webkit-scrollbar { width: 6px; }
#chat-log::-webkit-scrollbar-thumb { background: #4a4232; border-radius: 3px; }
.chat-line { margin-bottom: 2px; word-break: break-all; }
.chat-line.c-general { color: #d8d0ba; }
.chat-line.c-general .chat-who { color: #6fb5ff; }
.chat-line.c-system { color: #ffd54a; }
.chat-line .chat-ch { color: #888; }

/* ══════════════ 하단바: 스킬 + 경험치 ══════════════ */

#bottom-bar {
  position: fixed;
  left: 50%; bottom: 12px;
  transform: translateX(-50%);
  z-index: 20;
  text-align: center;
}

#skill-bar { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }

.skill-slot {
  position: relative;
  width: 56px; height: 56px;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  cursor: pointer;
  overflow: hidden;
}
.skill-slot:hover { border-color: var(--gold); }
.skill-slot.locked { filter: grayscale(1) brightness(0.55); cursor: default; }
.skill-slot.no-res { border-color: #6b2a2a; }
.skill-slot .ss-icon { font-size: 24px; line-height: 1; pointer-events: none; }
.skill-slot .ss-name { font-size: 9px; color: #c9c0aa; pointer-events: none; margin-top: 2px; white-space: nowrap; }
.skill-slot .ss-key {
  position: absolute; top: 1px; left: 4px;
  font-size: 11px; color: var(--gold); text-shadow: 0 1px 1px #000;
  pointer-events: none;
}
.skill-slot .ss-cd {
  position: absolute; left: 0; bottom: 0; width: 100%;
  background: rgba(0,0,0,0.75);
  pointer-events: none;
  height: 0;
}
.skill-slot .ss-cd-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
.skill-slot .ss-lock { position: absolute; bottom: 2px; right: 3px; font-size: 9px; color: #999; pointer-events: none; }

#xp-wrap {
  position: relative;
  width: 420px; max-width: 90vw;
  height: 12px;
  margin: 0 auto;
  background: rgba(0,0,0,0.65);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow: hidden;
}
#xp-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #7a5cd6, #a98ef0);
  transition: width 0.3s;
}
#xp-text {
  position: absolute; inset: 0;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 1px #000;
}
#key-hint { margin-top: 5px; font-size: 10px; color: #6a6455; text-shadow: 0 1px 1px #000; }

/* ══════════════ 중앙 알림 ══════════════ */

#notify-area {
  position: fixed;
  top: 24%; left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  pointer-events: none;
  text-align: center;
}
.notify-msg {
  font-size: 18px;
  color: #ffd54a;
  text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 1px 2px #000;
  margin-bottom: 6px;
  animation: notifyFade 2.2s forwards;
}
.notify-msg.n-warn { color: #ff8a65; }
.notify-msg.n-good { color: #9ccc65; }
@keyframes notifyFade {
  0% { opacity: 0; transform: translateY(8px); }
  12% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ══════════════ 패널 공통 ══════════════ */

.panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 460px;
  max-width: 94vw;
  max-height: 78vh;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 10px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
}
.panel-head {
  display: flex; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #3a3323;
  color: var(--gold);
  font-size: 16px;
  letter-spacing: 1px;
}
.panel-head > span:first-child { flex: 1; }
.panel-gold { color: #ffd54a; font-size: 13px; margin-right: 12px; }
.panel-close {
  background: none; border: 1px solid #4a4232; border-radius: 4px;
  color: #b0a890; cursor: pointer; font-size: 13px;
  width: 24px; height: 24px; line-height: 1;
}
.panel-close:hover { color: #fff; border-color: var(--gold); }
.panel-body { padding: 12px 14px; overflow-y: auto; font-size: 13px; }
.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb { background: #4a4232; border-radius: 4px; }
.panel-hint { margin-top: 10px; font-size: 11px; color: #7a7365; }

/* 등급 색 */
.r-common { color: var(--rarity-common); }
.r-uncommon { color: var(--rarity-uncommon); }
.r-rare { color: var(--rarity-rare); }
.r-epic { color: var(--rarity-epic); }

/* ── 인벤토리 ── */
#panel-inventory { left: auto; right: 20px; top: auto; bottom: 220px; transform: none; width: 340px; }
#inv-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.inv-slot {
  position: relative;
  aspect-ratio: 1;
  background: rgba(0,0,0,0.45);
  border: 1px solid #3a3323;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  cursor: pointer;
}
.inv-slot:hover { border-color: var(--gold); }
.inv-slot.empty { cursor: default; opacity: 0.5; }
.inv-slot .inv-qty {
  position: absolute; bottom: 1px; right: 3px;
  font-size: 10px; color: #fff; text-shadow: 0 1px 1px #000;
}
.inv-slot .inv-rim { position: absolute; inset: 0; border-radius: 5px; pointer-events: none; }
.inv-slot.rim-uncommon .inv-rim { box-shadow: inset 0 0 0 1px var(--rarity-uncommon); }
.inv-slot.rim-rare .inv-rim { box-shadow: inset 0 0 0 1px var(--rarity-rare); }
.inv-slot.rim-epic .inv-rim { box-shadow: inset 0 0 0 1px var(--rarity-epic); }

/* ── 캐릭터 ── */
.char-row { display: flex; justify-content: space-between; padding: 4px 2px; border-bottom: 1px dashed #2a2418; }
.char-row .cr-label { color: #9a9080; }
.char-equip { margin-top: 12px; }
.char-equip-title { color: var(--gold); margin-bottom: 6px; }
.equip-slot {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid #3a3323;
  border-radius: 6px;
  padding: 7px 10px;
  margin-bottom: 6px;
  cursor: pointer;
}
.equip-slot:hover { border-color: var(--gold); }
.equip-slot .eq-icon { font-size: 20px; }
.equip-slot .eq-empty { color: #6a6455; }
.equip-slot .eq-stats { margin-left: auto; font-size: 11px; color: #9ccc65; }

/* ── 스킬 목록 ── */
.skill-row {
  display: flex; gap: 10px;
  background: rgba(0,0,0,0.35);
  border: 1px solid #3a3323;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 7px;
}
.skill-row.locked { opacity: 0.45; }
.skill-row .sr-icon { font-size: 26px; }
.skill-row .sr-name { color: var(--gold); font-size: 14px; }
.skill-row .sr-meta { font-size: 11px; color: #8a8272; margin: 2px 0; }
.skill-row .sr-desc { font-size: 12px; color: #c9c0aa; line-height: 1.4; }

/* ── 퀘스트 일지 ── */
.ql-quest {
  background: rgba(0,0,0,0.35);
  border: 1px solid #3a3323;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 7px;
}
.ql-name { color: var(--gold); font-size: 14px; }
.ql-name .ql-done-tag { color: #7ed67e; font-size: 11px; }
.ql-text { font-size: 12px; color: #c9c0aa; margin: 4px 0; line-height: 1.4; }
.ql-prog { font-size: 12px; color: #9ad0ff; }
.ql-reward { font-size: 11px; color: #8a8272; margin-top: 3px; }
.ql-empty { color: #7a7365; text-align: center; padding: 20px 0; }

/* ── 대화 ── */
#panel-dialogue { width: 420px; top: auto; bottom: 200px; }
#dlg-text { line-height: 1.55; color: #e0d8c2; margin-bottom: 12px; min-height: 40px; white-space: pre-line; }
#dlg-options { display: flex; flex-direction: column; gap: 6px; }
.dlg-btn {
  background: rgba(0,0,0,0.45);
  border: 1px solid #4a4232;
  border-radius: 6px;
  color: #e8e0cc;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
}
.dlg-btn:hover { border-color: var(--gold); background: rgba(50,40,15,0.5); }
.dlg-btn .dlg-mark { color: var(--gold); margin-right: 6px; }
.dlg-btn.dlg-complete .dlg-mark { color: #7ed67e; }

/* ── 상점 ── */
#panel-shop { left: 20px; top: 50%; transform: translateY(-50%); width: 380px; }
.shop-section-title { color: var(--gold); font-size: 13px; margin-bottom: 6px; }
.shop-item {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid #3a3323;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 5px;
  cursor: pointer;
}
.shop-item:hover { border-color: var(--gold); }
.shop-item .si-icon { font-size: 20px; }
.shop-item .si-info { flex: 1; min-width: 0; }
.shop-item .si-name { font-size: 13px; }
.shop-item .si-desc { font-size: 10px; color: #8a8272; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-item .si-price { color: #ffd54a; font-size: 12px; flex-shrink: 0; }
.shop-item.cant-afford .si-price { color: #e57373; }

/* ══════════════ 사망 오버레이 ══════════════ */

#death-overlay {
  position: fixed; inset: 0;
  background: rgba(40, 0, 0, 0.55);
  z-index: 80;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.death-text { font-size: 48px; color: #ff6b5a; text-shadow: 0 0 30px #000; letter-spacing: 6px; }
.death-sub { margin-top: 14px; font-size: 17px; color: #e0c8c0; }

/* ══════════════ 페이드 ══════════════ */

#fade-overlay {
  position: fixed; inset: 0;
  background: #000;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s;
}
#fade-overlay.on { opacity: 1; }

/* ══════════════ 서사(스토리) 오버레이 ══════════════ */
#story-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(6,8,14,0.86) 0%, rgba(2,3,6,0.97) 100%);
  animation: story-fade 0.6s ease;
}
#story-overlay.hidden { display: none; }
@keyframes story-fade { from { opacity: 0; } to { opacity: 1; } }
#story-panel {
  max-width: 620px; width: 86%;
  padding: 38px 40px 30px;
  text-align: center;
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(24,22,30,0.72), rgba(12,11,16,0.82));
  box-shadow: 0 0 60px rgba(0,0,0,0.6), inset 0 0 40px rgba(0,0,0,0.4);
}
#story-label {
  color: var(--gold); letter-spacing: 6px; font-size: 13px;
  text-transform: uppercase; margin-bottom: 10px; opacity: 0.9;
  animation: story-fade 0.8s ease;
}
#story-title {
  font-size: 34px; font-weight: bold; color: #f4ead0;
  margin-bottom: 24px; letter-spacing: 2px;
  text-shadow: 0 2px 18px rgba(212,175,55,0.35);
  animation: story-fade 1s ease;
}
#story-lines { margin-bottom: 28px; min-height: 120px; }
.story-line {
  color: #d6cdb8; font-size: 16px; line-height: 1.9; margin: 0 0 2px;
  opacity: 0; animation: line-rise 0.9s ease forwards;
}
@keyframes line-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
#story-continue { margin-top: 6px; animation: story-fade 1.4s ease; }
