@import url("https://fonts.googleapis.com/css2?family=Gowun+Batang:wght@700&family=Noto+Sans+KR:wght@400;600;700;900&family=Orbitron:wght@700;900&display=swap");

:root {
  color-scheme: dark;
  --bg: #0c0918;
  --panel: rgba(16, 22, 44, 0.82);
  --line: rgba(120, 170, 255, 0.22);
  --cyan: #67e8f9;
  --blue: #3b82f6;
  --gold: #ffd166;
  --violet: #b06cff;
  --mint: #5eead4;
  --danger: #fb7185;
  font-family: "Noto Sans KR", sans-serif;
}
.gem-balance {
  margin: -4px 0 12px; padding: 10px 12px;
  border: 1px solid rgba(255, 209, 102, 0.3); border-radius: 11px;
  color: #dbe7ff; background: rgba(255, 209, 102, 0.07);
}
.gem-balance strong { color: var(--gold); font-family: "Orbitron", sans-serif; font-size: 1.1rem; }
.shop-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shop-item {
  padding: 11px; border: 1px solid var(--rarity); border-radius: 12px;
  color: white; text-align: left; background: rgba(59, 130, 246, 0.07);
}
.shop-item b { display: block; color: var(--rarity); }
.shop-item small { display: block; margin: 3px 0 9px; color: #9fb0d4; }
.shop-item button {
  width: 100%; min-height: 31px; border: 0; border-radius: 8px;
  color: #07111d; background: var(--rarity); cursor: pointer; font-weight: 900;
}
.lobby-nav {
  position: absolute; z-index: 9; left: 18px; right: 18px; bottom: 14px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px;
  padding: 8px; border: 1px solid var(--line); border-radius: 16px;
  background: rgba(9, 14, 32, 0.96); backdrop-filter: blur(9px);
}
.lobby-nav button {
  min-height: 44px; border: 1px solid rgba(120, 170, 255, 0.2); border-radius: 10px;
  color: #b8c8e8; background: #111a34; cursor: pointer; font-weight: 800; font-size: 0.72rem;
}
.lobby-nav button.active { color: #07111d; border-color: transparent; background: var(--cyan); }

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: #eaf2ff;
  background:
    radial-gradient(circle at 12% 6%, rgba(59, 130, 246, 0.22), transparent 30rem),
    radial-gradient(circle at 88% 20%, rgba(176, 108, 255, 0.16), transparent 26rem),
    radial-gradient(circle at 70% 95%, rgba(255, 209, 102, 0.1), transparent 26rem),
    var(--bg);
}

button { font: inherit; }
h1, h2, p { margin: 0; }

.game-shell {
  width: min(1180px, calc(100% - 26px));
  margin: 0 auto;
  padding: 26px 0 46px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1 { font-family: "Gowun Batang", serif; font-size: clamp(1.4rem, 3vw, 2.3rem); letter-spacing: 0.01em; }
h1 span { color: var(--gold); font-size: 0.62em; margin-left: 6px; }
.eyebrow { color: var(--cyan); font-size: 0.66rem; font-weight: 900; letter-spacing: 0.2em; }

.ghost-button,
.result-panel button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  color: white;
  background: rgba(103, 232, 249, 0.08);
  cursor: pointer;
  transition: 0.15s;
}
.ghost-button:hover { background: rgba(103, 232, 249, 0.18); }

/* ---------- 스테이지 ---------- */
.stage {
  position: relative;
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid rgba(103, 232, 249, 0.3);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 0 60px rgba(59, 130, 246, 0.06);
  background: #0d0a1a;
}
canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 14px 14px auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  pointer-events: none;
}

.sys-window {
  width: min(320px, 46%);
  padding: 11px 13px 13px;
  border: 1px solid rgba(103, 232, 249, 0.45);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(12, 20, 44, 0.92), rgba(9, 14, 32, 0.88));
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.12), 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 22px rgba(59, 130, 246, 0.14);
  backdrop-filter: blur(8px);
}
.sys-title {
  display: flex; align-items: center; gap: 7px;
  color: var(--cyan);
  font-family: "Orbitron", sans-serif;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-bottom: 7px; margin-bottom: 8px;
  border-bottom: 1px solid rgba(103, 232, 249, 0.22);
}
.sys-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

.hero-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.hero-line strong { font-size: 0.82rem; color: #eaf2ff; }
.hero-line em { font-style: normal; font-family: "Orbitron", sans-serif; font-weight: 900; color: var(--gold); font-size: 0.9rem; }

.bar-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; margin: 5px 0; }
.bar-name { font-size: 0.6rem; font-weight: 700; color: #9fb2d8; letter-spacing: 0.06em; }
.bar-val { font-size: 0.6rem; color: #c3d2f0; font-variant-numeric: tabular-nums; }
.bar { height: 8px; overflow: hidden; border-radius: 6px; background: rgba(3, 8, 20, 0.85); border: 1px solid rgba(120, 170, 255, 0.18); }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 0.18s; }
.bar.hp i { background: linear-gradient(90deg, #fb7185, #f43f5e); box-shadow: 0 0 8px rgba(244, 63, 94, 0.6); }
.bar.mp i { background: linear-gradient(90deg, #38bdf8, #3b82f6); box-shadow: 0 0 8px rgba(59, 130, 246, 0.6); }
.bar.exp i { background: linear-gradient(90deg, var(--gold), #fbbf24); box-shadow: 0 0 8px rgba(255, 209, 102, 0.6); }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px;
}
.stat-grid div {
  text-align: center; padding: 5px 2px; border-radius: 9px;
  background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(120, 170, 255, 0.16);
}
.stat-grid span { display: block; font-size: 0.56rem; color: #93a7cf; }
.stat-grid b { font-size: 0.85rem; color: #eaf2ff; font-family: "Orbitron", sans-serif; }

.scenario-card {
  width: min(210px, 40%);
  text-align: right;
  padding: 10px 13px;
  border: 1px solid rgba(255, 209, 102, 0.32);
  border-radius: 14px;
  background: rgba(14, 11, 22, 0.82);
  backdrop-filter: blur(8px);
}
.scenario-card strong { display: block; font-family: "Gowun Batang", serif; font-size: 0.98rem; color: var(--gold); margin: 2px 0 3px; }
.scenario-card span { color: #cdd6ea; font-size: 0.68rem; }

.constellation {
  position: absolute;
  top: 44%; right: 16px;
  max-width: 300px;
  padding: 10px 14px;
  color: #fff3d6;
  font-size: 0.78rem; font-weight: 600; line-height: 1.5; text-align: right;
  border-right: 3px solid var(--gold);
  background: linear-gradient(90deg, transparent, rgba(255, 209, 102, 0.16));
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.6);
  opacity: 0; transform: translateX(20px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.constellation.show { opacity: 1; transform: translateX(0); }

.message {
  position: absolute;
  bottom: 16px; left: 50%; translate: -50% 0;
  width: max-content; max-width: calc(100% - 30px);
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem; text-align: center;
  background: rgba(9, 14, 32, 0.86);
  transition: opacity 0.25s;
}
.raid-boss-hud {
  position: absolute; z-index: 5; top: 10px; left: 50%; translate: -50% 0;
  width: min(560px, calc(100% - 220px)); padding: 8px 12px 10px;
  border: 1px solid #f97316; border-radius: 8px;
  color: #fff; background: rgba(24, 9, 16, 0.92);
  box-shadow: 0 5px 0 #17070a, 0 0 24px rgba(249, 115, 22, 0.28);
}
.raid-boss-copy { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.raid-boss-copy span { color: #fdba74; font: 700 0.58rem "Orbitron", sans-serif; }
.raid-boss-copy strong { overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; }
.raid-boss-copy b { color: #fecaca; font: 700 0.6rem "Orbitron", sans-serif; }
.raid-boss-track { height: 10px; margin-top: 6px; overflow: hidden; border: 1px solid #7f1d1d; border-radius: 3px; background: #24080d; }
.raid-boss-track i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #dc2626, #fb923c); transition: width 0.2s; }

.result-panel {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-content: center;
  padding: 24px; text-align: center;
  background: rgba(6, 9, 20, 0.9);
  backdrop-filter: blur(7px);
}
.result-panel.hidden { display: none; }
.result-panel p.eyebrow { font-family: "Orbitron", sans-serif; }
.result-panel h2 { margin: 8px 0 12px; font-family: "Gowun Batang", serif; font-size: clamp(1.6rem, 4.5vw, 2.8rem); }
.result-panel p:not(.eyebrow) { color: #c8d3ec; max-width: 460px; }
.result-panel button { justify-self: center; margin-top: 22px; color: #0a1020; font-weight: 900; background: var(--gold); border-color: transparent; }

/* ---------- 온라인 방 ---------- */
.room-lobby {
  position: absolute; inset: 0; z-index: 7;
  display: block;
  padding: 18px 18px 82px;
  overflow: hidden;
  background: rgba(6, 9, 20, 0.96);
  backdrop-filter: blur(10px);
}
.room-lobby > .lobby-panel {
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.room-lobby.hidden, .room-box.hidden { display: none !important; }
.room-box {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid rgba(103, 232, 249, 0.38);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(18, 28, 55, 0.96), rgba(8, 14, 32, 0.96));
  box-shadow: 0 20px 60px #000, inset 0 0 28px rgba(59, 130, 246, 0.1);
}
.room-box h2 { margin: 7px 0 5px; font-family: "Gowun Batang", serif; }
.room-box h2 strong { color: var(--gold); font-family: "Orbitron", sans-serif; letter-spacing: 0.08em; }
.room-help { margin: 0 0 15px; color: #9fb0d4; font-size: 0.76rem; line-height: 1.5; }
.room-label { display: block; margin: 10px 0 5px; color: #c9d6ef; font-size: 0.72rem; font-weight: 700; }
.room-box input {
  width: 100%; height: 43px;
  border: 1px solid #34466f; border-radius: 11px;
  padding: 0 13px; outline: none;
  color: white; background: #090f24;
}
.room-box input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.1); }
.room-primary, .room-join-row button, .copy-code {
  border: 1px solid rgba(103, 232, 249, 0.4); border-radius: 11px;
  min-height: 42px; padding: 0 15px; cursor: pointer;
  color: #07111d; font-weight: 900; background: var(--cyan);
}
.room-primary { width: 100%; margin-top: 12px; }
.room-primary:disabled { cursor: not-allowed; opacity: 0.4; }
.room-divider { display: flex; align-items: center; gap: 10px; margin: 15px 0 5px; color: #7285ad; font-size: 0.7rem; }
.room-divider::before, .room-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.room-join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.room-join-row input { font-family: "Orbitron", sans-serif; font-size: 1rem; letter-spacing: 0.18em; }
.room-status { min-height: 1.3em; margin-top: 11px; color: #93c5fd; font-size: 0.72rem; text-align: center; }
.room-status.error { color: var(--danger); }
.copy-code { min-height: 30px; margin: 3px 0 14px; color: var(--cyan); background: rgba(103, 232, 249, 0.08); font-size: 0.7rem; }
.member-head { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); color: #dce7fb; font-size: 0.78rem; }
.member-head span { color: var(--gold); }
.member-list { display: grid; gap: 6px; max-height: 160px; overflow: auto; }
.member {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 8px 10px; border: 1px solid rgba(120, 170, 255, 0.15); border-radius: 10px;
  background: rgba(59, 130, 246, 0.07); font-size: 0.74rem;
}
.member small { color: #8ea2c8; }
.member .ready { color: #5eead4; }
.lobby-panel.tab-hidden { display: none !important; }
.lobby-panel.active { display: block; }
.lobby-box {
  width: min(620px, 100%);
  min-height: 390px;
  margin: 0 auto;
  padding: 18px;
  border: 1px solid rgba(103, 232, 249, 0.24);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(18, 28, 55, 0.94), rgba(8, 14, 32, 0.94));
}
.lobby-box h2 { margin: 6px 0 12px; font-family: "Gowun Batang", serif; }
.profile-summary { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 12px; }
.profile-summary b { color: var(--gold); font-family: "Orbitron", sans-serif; font-size: 1.15rem; }
.profile-summary span { color: #9fb0d4; font-size: 0.68rem; text-align: right; }
.play-button {
  width: 100%; min-height: 52px; margin-bottom: 8px;
  border: 0; border-radius: 14px; cursor: pointer;
  color: #09101e; font-weight: 900; font-size: 1rem;
  background: linear-gradient(90deg, var(--gold), #fb923c);
  box-shadow: 0 9px 24px rgba(251, 146, 60, 0.2);
}
.solo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.solo-actions .play-button { min-height: 46px; margin-bottom: 0; font-size: 0.82rem; }
.progress-button {
  min-height: 46px; border: 1px solid var(--line); border-radius: 11px;
  color: white; background: rgba(103, 232, 249, 0.12); cursor: pointer; font-weight: 900;
}
.raid-play-button {
  width: 100%; min-height: 43px; margin-top: 9px;
  border: 1px solid #fb923c; border-radius: 11px;
  color: #fff7ed; background: linear-gradient(180deg, #9a3412, #7c2d12);
  cursor: pointer; font-weight: 900;
}
.progress-select {
  margin-top: 12px; padding: 11px;
  border: 1px solid rgba(103, 232, 249, 0.24); border-radius: 12px;
  background: rgba(7, 13, 30, 0.46);
}
.progress-select-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.progress-select-head b { color: var(--gold); font-size: 0.76rem; }
.progress-select-head span { color: #9fb0d4; font-size: 0.6rem; }
.progress-select-head button {
  border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px;
  color: white; background: #17213e; cursor: pointer; font-size: 0.64rem;
}
.stage-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.stage-choice {
  min-width: 0; min-height: 43px; padding: 5px;
  border: 1px solid rgba(120, 170, 255, 0.24); border-radius: 8px;
  color: #dce7fb; background: rgba(59, 130, 246, 0.09); cursor: pointer;
}
.stage-choice b, .stage-choice small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-choice b { font: 0.68rem "Orbitron", sans-serif; }
.stage-choice small { margin-top: 2px; color: #9fb0d4; font-size: 0.56rem; }
.stage-choice.active { border-color: var(--gold); color: var(--gold); background: rgba(251, 191, 36, 0.14); }
.stage-choice:disabled, .scenario-choice:disabled { opacity: 0.3; cursor: not-allowed; }
.scenario-select-head { margin-top: 12px; }
.scenario-choices {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px;
  max-height: 105px; margin-top: 7px; overflow-y: auto;
}
.scenario-choice {
  min-width: 0; height: 30px; padding: 0;
  border: 1px solid rgba(120, 170, 255, 0.24); border-radius: 6px;
  color: #dce7fb; background: rgba(59, 130, 246, 0.09); cursor: pointer;
  font: 0.62rem "Orbitron", sans-serif;
}
.scenario-choice.latest { border-color: var(--gold); color: var(--gold); }
.stat-header, .inventory-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 10px 0 7px; padding-top: 9px;
  border-top: 1px solid var(--line); font-size: 0.72rem;
}
.stat-header span, .inventory-head span { color: #9fb0d4; }
.stat-header strong { color: var(--gold); }
.lobby-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.lobby-stats div {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px; border: 1px solid rgba(120, 170, 255, 0.16); border-radius: 10px;
  background: rgba(59, 130, 246, 0.07); font-size: 0.72rem;
}
.lobby-stats button {
  width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 8px;
  color: #07111d; background: var(--cyan); cursor: pointer; font-weight: 900;
}
.lobby-stats button:disabled { opacity: 0.3; cursor: not-allowed; }
.equip-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.equip-slot, .item-card {
  min-width: 0; padding: 7px;
  border: 1px solid rgba(120, 170, 255, 0.18); border-radius: 10px;
  color: #dce7fb; background: rgba(59, 130, 246, 0.07);
  font-size: 0.64rem;
}
.equip-slot b, .item-card b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equip-slot small, .item-card small { color: #8ea2c8; }
.inventory-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  min-height: 80px; max-height: 150px; overflow: auto;
}
.item-card { cursor: pointer; text-align: left; }
.item-card:hover { border-color: var(--rarity, var(--cyan)); }
.synth-button {
  width: 100%; min-height: 36px; margin-top: 9px;
  border: 1px solid rgba(176, 108, 255, 0.45); border-radius: 10px;
  color: white; background: rgba(176, 108, 255, 0.18); cursor: pointer; font-weight: 800;
}
.game-menu-button {
  position: absolute; z-index: 4; top: 14px; right: 230px;
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px;
  color: white; background: rgba(9, 14, 32, 0.86); cursor: pointer;
}
.game-menu-button.hidden, .pause-panel.hidden { display: none; }
.pause-panel {
  position: absolute; inset: 0; z-index: 8;
  display: grid; place-content: center; justify-items: stretch; gap: 9px;
  padding: 24px; text-align: center;
  background: rgba(6, 9, 20, 0.9); backdrop-filter: blur(8px);
}
.pause-panel h2 { margin: 4px 0 12px; font-family: "Gowun Batang", serif; }
.pause-panel button {
  min-width: 240px; min-height: 43px; border: 1px solid var(--line); border-radius: 11px;
  color: white; background: #17213e; cursor: pointer; font-weight: 800;
}
.pause-panel .danger-button { color: #fecdd3; border-color: rgba(251, 113, 133, 0.5); background: rgba(159, 18, 57, 0.25); }

/* ---------- 캐릭터 선택 ---------- */
.char-select {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-content: center; justify-items: center;
  padding: 24px; text-align: center;
  background: rgba(6, 9, 20, 0.94);
  backdrop-filter: blur(8px);
}
.char-select.hidden { display: none; }
.char-select .eyebrow { font-family: "Orbitron", sans-serif; }
.char-select > h2 { margin: 8px 0 20px; font-family: "Gowun Batang", serif; font-size: clamp(1.5rem, 4vw, 2.4rem); color: #eaf1ff; }
.char-cards { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 16px; max-width: 720px; width: 100%; }
.char-card {
  --c: var(--cyan);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 12px 16px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 16px;
  background: rgba(14, 20, 40, 0.85); color: #eaf1ff;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.char-card:hover, .char-card:focus-visible {
  border-color: var(--c); transform: translateY(-4px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4), 0 0 16px -4px var(--c);
  outline: none;
}
.char-portrait { width: 100%; height: 130px; }
.char-name { font-family: "Gowun Batang", serif; font-size: 1.1rem; color: var(--c); }
.char-world { font-size: 0.64rem; letter-spacing: 0.08em; color: #9fb0d4; text-transform: uppercase; }
.char-desc { font-size: 0.72rem; color: #c8d3ec; line-height: 1.45; margin: 4px 0 2px; min-height: 2.9em; }
.mini-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; margin: 4px 0 6px; }
.mini-stats i { font-style: normal; font-size: 0.64rem; font-weight: 700; color: #dbe6ff; padding: 2px 6px; border: 1px solid var(--line); border-radius: 999px; background: rgba(103, 232, 249, 0.06); }
.char-tag { font-style: normal; font-size: 0.72rem; font-weight: 700; color: var(--c); }
.cs-hint { margin-top: 18px; font-size: 0.72rem; color: #9fb0d4; }

/* ---------- 스킬바 ---------- */
.skillbar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  margin-top: 14px;
}
.skill {
  position: relative;
  overflow: hidden;
  padding: 12px 10px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #dbe5fb;
  text-align: left;
  background: linear-gradient(180deg, rgba(19, 27, 52, 0.9), rgba(12, 16, 34, 0.9));
  cursor: pointer;
  transition: 0.15s;
}
.skill:hover { border-color: var(--cyan); translate: 0 -2px; }
.skill.basic { border-color: rgba(255, 209, 102, 0.5); }
.skill.dash { border-color: rgba(103, 232, 249, 0.4); }
.skill .motion-icon {
  display: grid; place-items: center; width: 40px; height: 34px; margin-bottom: 7px;
  border: 1px solid rgba(231, 235, 246, 0.55); border-radius: 8px;
  color: var(--cyan); background: rgba(9, 15, 36, 0.52);
}
.skill .motion-icon svg {
  width: 27px; height: 27px; overflow: visible;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.skill.basic .motion-icon { color: var(--gold); border-color: rgba(255, 209, 102, 0.65); }
.skill .key-hint {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  min-width: 20px; padding: 2px 5px; border-radius: 5px;
  color: #0a1020; background: var(--cyan);
  font: 700 0.5rem "Orbitron", sans-serif; text-align: center;
}
.skill.basic .key-hint { background: var(--gold); }
.skill .sk-name { display: block; font-size: 0.8rem; font-weight: 700; color: #fff; }
.skill .sk-desc { display: block; margin-top: 2px; color: #8ea2c8; font-size: 0.6rem; line-height: 1.25; }
.skill .cd {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: block; width: 100%; height: 0;
  background: rgba(6, 10, 24, 0.72);
  border-top: 1px solid rgba(103, 232, 249, 0.4);
  transition: height 0.1s linear;
  pointer-events: none;
}

/* ---------- 조작 안내 ---------- */
.controls {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 12px; padding: 11px 16px;
  border-radius: 16px; background: rgba(120, 170, 255, 0.05);
}
.control-copy { display: flex; flex-wrap: wrap; gap: 14px; color: #97a8cd; font-size: 0.76rem; }
kbd { padding: 2px 6px; border: 1px solid #3a4a72; border-radius: 5px; color: white; background: #182140; box-shadow: 0 2px 0 #060a18; font-size: 0.72rem; }
.touch-controls { display: none; }

/* ---------- 다이얼로그 ---------- */
dialog {
  width: min(500px, calc(100% - 28px));
  border: 1px solid rgba(103, 232, 249, 0.4);
  border-radius: 20px; padding: 28px;
  color: white; background: #0e1330;
  box-shadow: 0 24px 80px #000;
}
dialog::backdrop { background: rgba(3, 5, 14, 0.78); backdrop-filter: blur(4px); }
dialog h2 { margin: 5px 0 14px; font-family: "Gowun Batang", serif; }
dialog p { margin-top: 12px; color: #c6d2ec; line-height: 1.75; font-size: 0.9rem; }
dialog p b { color: var(--cyan); }
.dialog-close { position: absolute; top: 12px; right: 14px; border: 0; color: #9fb0d4; font-size: 1.7rem; background: none; cursor: pointer; }

/* ---------- 반응형 ---------- */
@media (max-width: 860px) {
  .room-box, .lobby-box { min-height: auto; }
  .game-menu-button { right: 12px; top: 90px; }
  .scenario-card { display: none; }
  .sys-window { width: 62%; }
  .skillbar { grid-template-columns: repeat(3, 1fr); }
  .control-copy { display: none; }
  .touch-controls {
    display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px;
  }
  .move-joystick {
    position: relative; flex: 0 0 128px; width: 128px; height: 128px;
    border: 2px solid rgba(231, 235, 246, 0.55); border-radius: 50%;
    background: rgba(231, 235, 246, 0.34);
    box-shadow: inset 0 0 22px rgba(255,255,255,0.12), 0 4px 14px rgba(0,0,0,0.28);
    touch-action: none; user-select: none;
  }
  .joystick-knob {
    position: absolute; left: 50%; top: 50%; width: 58px; height: 58px;
    border-radius: 50%; background: #f4f4f1;
    box-shadow: 0 3px 9px rgba(0,0,0,0.24);
    translate: -50% -50%;
  }
  .touch-controls button {
    border: 1px solid var(--line); border-radius: 12px; color: white; background: #1a2444; touch-action: none;
    min-width: 46px; min-height: 46px; font-weight: 700;
  }
  .touch-skills-wrap { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
  .touch-skills { display: grid; grid-template-columns: repeat(4, 52px); gap: 6px; }
  .touch-basic { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; width: 100%; }
  .touch-basic .t-attack { background: var(--gold); color: #1a1422; }
  .touch-basic .t-dash { background: rgba(103, 232, 249, 0.25); }
  .char-cards { grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 96%; }
  .char-portrait { height: 108px; }
  .char-desc { display: none; }
}

@media (max-width: 560px) {
  .room-lobby { padding: 10px 10px 76px; }
  .lobby-nav { left: 8px; right: 8px; bottom: 8px; gap: 3px; padding: 5px; }
  .lobby-nav button { min-height: 40px; padding: 3px; font-size: 0.58rem; }
  .shop-list { grid-template-columns: 1fr; }
  .game-shell { width: calc(100% - 14px); padding-top: 14px; }
  h1 span { display: none; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column-reverse; align-items: flex-end; }
  .account-panel > span { display: none; }
  .kakao-login { min-height: 36px; padding: 0 9px; font-size: 0.62rem; }
  .stage { border-radius: 16px; }
  .hud { inset: 8px 8px auto; }
  .sys-window { width: 74%; padding: 8px 9px 10px; }
  .sys-title { font-size: 0.56rem; }
  .stat-grid { gap: 4px; }
  .message { bottom: 8px; padding: 6px 12px; font-size: 0.66rem; }
  .constellation { font-size: 0.66rem; top: 40%; max-width: 62%; }
  .skillbar { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .skill { padding: 9px 8px; }
  .skill .motion-icon { width: 34px; height: 30px; }
  .skill .motion-icon svg { width: 23px; height: 23px; }
  .skill .key-hint { top: 6px; right: 6px; font-size: 0.44rem; }
  .skill .sk-desc { display: none; }
  .move-joystick { flex-basis: 108px; width: 108px; height: 108px; }
  .joystick-knob { width: 50px; height: 50px; }
  .touch-controls button { min-width: 40px; min-height: 40px; }
  .touch-skills { grid-template-columns: repeat(4, 46px); }
  .char-select { padding: 16px; }
  .room-box { padding: 18px; }
  .raid-boss-hud { top: 6px; width: calc(100% - 16px); padding: 6px 8px 8px; }
  .raid-boss-copy strong { font-size: 0.7rem; }
  .solo-actions { grid-template-columns: 1fr; }
  .stage-choices { grid-template-columns: repeat(2, 1fr); }
  .scenario-choices { grid-template-columns: repeat(5, 1fr); max-height: 112px; }
  .char-cards { grid-template-columns: 1fr; gap: 8px; max-width: 300px; }
  .char-card { flex-direction: row; flex-wrap: wrap; align-items: center; text-align: left; padding: 8px 10px; gap: 4px 10px; }
  .char-portrait { width: 62px; height: 78px; }
  .char-name { font-size: 0.98rem; }
  .mini-stats { justify-content: flex-start; }
  .char-tag, .char-world { width: 100%; }
}

/* Mobile landscape battle layout. Desktop and pre-game screens keep their existing layout. */
@media (orientation: landscape) and (hover: none) and (pointer: coarse) {
  body.mobile-game-active {
    min-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    background: #050711;
  }
  body.mobile-game-active .game-shell {
    width: 100vw;
    height: 100dvh;
    padding: 0;
  }
  body.mobile-game-active .topbar,
  body.mobile-game-active .skillbar {
    display: none;
  }
  body.mobile-game-active .stage {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #050711;
  }
  body.mobile-game-active .stage > canvas {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: contain;
  }
  body.mobile-game-active .scenario-card { display: none; }
  body.mobile-game-active .hud { inset: max(7px, env(safe-area-inset-top)) auto auto max(8px, env(safe-area-inset-left)); }
  body.mobile-game-active .sys-window {
    width: 218px;
    padding: 5px 7px 6px;
    border-radius: 7px;
    background: rgba(9, 14, 32, 0.76);
    backdrop-filter: blur(4px);
  }
  body.mobile-game-active .sys-title {
    padding-bottom: 3px;
    margin-bottom: 4px;
    font-size: 0.42rem;
  }
  body.mobile-game-active .sys-title .dot { width: 4px; height: 4px; }
  body.mobile-game-active .hero-line { margin-bottom: 3px; }
  body.mobile-game-active .hero-line strong { font-size: 0.58rem; }
  body.mobile-game-active .hero-line em { font-size: 0.6rem; }
  body.mobile-game-active .bar-row {
    grid-template-columns: 18px 1fr auto;
    gap: 4px;
    margin: 2px 0;
  }
  body.mobile-game-active .bar-name,
  body.mobile-game-active .bar-val { font-size: 0.42rem; }
  body.mobile-game-active .bar { height: 5px; }
  body.mobile-game-active .stat-grid { gap: 3px; margin-top: 4px; }
  body.mobile-game-active .stat-grid div { padding: 2px 1px; border-radius: 4px; }
  body.mobile-game-active .stat-grid span { font-size: 0.38rem; }
  body.mobile-game-active .stat-grid b { font-size: 0.54rem; }
  body.mobile-game-active .game-menu-button {
    top: max(7px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    padding: 5px 8px;
    font-size: 0.62rem;
  }
  body.mobile-game-active .controls {
    position: fixed;
    z-index: 7;
    inset: 0;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    pointer-events: none;
  }
  body.mobile-game-active .touch-controls {
    display: block;
    width: 100%;
    height: 100%;
  }
  body.mobile-game-active .move-joystick {
    position: absolute;
    left: max(16px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 118px;
    height: 118px;
    pointer-events: auto;
    opacity: 0.82;
  }
  body.mobile-game-active .joystick-knob { width: 52px; height: 52px; }
  body.mobile-game-active .touch-skills-wrap {
    position: absolute;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    display: grid;
    grid-template: repeat(3, 54px) / repeat(3, 54px);
    gap: 5px;
    width: auto;
    pointer-events: none;
  }
  body.mobile-game-active .touch-skills,
  body.mobile-game-active .touch-basic { display: contents; }
  body.mobile-game-active .touch-controls button {
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    width: 54px;
    height: 54px;
    padding: 4px;
    border: 2px solid rgba(231, 235, 246, 0.72);
    border-radius: 50%;
    color: #f4f6fb;
    background: rgba(20, 30, 58, 0.84);
    box-shadow: 0 3px 0 rgba(0,0,0,0.38), inset 0 1px rgba(255,255,255,0.14);
    pointer-events: auto;
  }
  body.mobile-game-active .touch-skills .tbtn:nth-child(1) { grid-area: 1 / 2; }
  body.mobile-game-active .touch-skills .tbtn:nth-child(2) { grid-area: 2 / 1; }
  body.mobile-game-active .touch-skills .tbtn:nth-child(3) { grid-area: 1 / 3; }
  body.mobile-game-active .touch-skills .tbtn:nth-child(4) { grid-area: 2 / 3; }
  body.mobile-game-active .touch-basic .t-attack {
    grid-area: 2 / 2;
    color: #21190a;
    border-color: #ffe092;
    background: rgba(255, 209, 102, 0.94);
  }
  body.mobile-game-active .touch-basic .t-dash {
    grid-area: 3 / 2;
    color: #e9fdff;
    border-color: rgba(103, 232, 249, 0.76);
    background: rgba(40, 108, 130, 0.82);
  }
  body.mobile-game-active .touch-icon { position: relative; z-index: 2; display: grid; place-items: center; }
  body.mobile-game-active .touch-icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  body.mobile-game-active .touch-cd {
    position: absolute;
    z-index: 1;
    inset: auto 0 0;
    height: 0;
    background: rgba(3, 6, 16, 0.72);
    pointer-events: none;
  }
  body.mobile-game-active .message {
    bottom: max(8px, env(safe-area-inset-bottom));
    max-width: 45%;
    padding: 5px 9px;
    font-size: 0.54rem;
  }
  body.mobile-game-active .raid-boss-hud {
    top: max(5px, env(safe-area-inset-top));
    width: min(420px, calc(100% - 480px));
  }
  body.mobile-game-active .pause-panel { z-index: 8; }
}

@media (hover: none) and (pointer: coarse) {
  .skill .sk-desc { display: none; }
}

@media (orientation: portrait) and (hover: none) and (pointer: coarse) {
  body.mobile-game-active::after {
    content: "게임을 계속하려면 휴대폰을 가로로 돌려주세요";
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 28px;
    color: #fff;
    background: #090e20;
    font-size: 1rem;
    font-weight: 900;
    text-align: center;
  }
}

/* ---------- Y2K console chrome (see design.md) ---------- */
:root {
  --bg: #151823;
  --panel: #3d4568;
  --line: rgba(179, 185, 214, 0.62);
  --cyan: #e7ebf6;
  --blue: #7a8aba;
  --gold: #ecab37;
  --violet: #8f9ac4;
  --mint: #c4ccec;
  --danger: #e60012;
  font-family: Arial, "Noto Sans KR", sans-serif;
}

body {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 18% 8%, rgba(122, 138, 186, 0.5), transparent 34rem),
    linear-gradient(135deg, #11131d 0%, #303751 52%, #171a27 100%);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
  background-image: radial-gradient(rgba(231, 235, 246, 0.24) 0.8px, transparent 0.9px);
  background-size: 7px 7px;
}

h1, h2, .lobby-box h2, .room-box h2, .char-name {
  font-family: "Arial Black", "Noto Sans KR", sans-serif;
  font-weight: 900;
}
h1 {
  color: #21242e;
  -webkit-text-stroke: 1px #e7ebf6;
  text-shadow: 2px 2px 0 #60619c, 4px 4px 0 rgba(0,0,0,0.28);
}
h1 span, .eyebrow { color: #ecab37; }

.topbar {
  padding: 12px 14px;
  border: 1px solid #b3b9d6;
  border-radius: 6px;
  background: linear-gradient(180deg, #8998c4 0%, #6f7fab 48%, #59678f 100%);
  box-shadow: inset 0 2px rgba(255,255,255,0.34), inset 0 -3px rgba(33,36,46,0.32), 0 8px 20px rgba(0,0,0,0.28);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.account-panel { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.account-panel > span { max-width: 220px; color: #eef1f8; font-size: 0.68rem; text-align: right; }
.kakao-login {
  display: inline-grid; place-items: center; min-height: 42px; padding: 0 14px;
  border: 1px solid #191600; border-radius: 3px;
  color: #191600; background: linear-gradient(180deg, #ffe866 0%, #fee500 58%, #d7bd00 100%);
  box-shadow: inset 0 2px rgba(255,255,255,0.45), 0 3px 0 #171922;
  font-size: 0.72rem; font-weight: 900; text-decoration: none;
}
.kakao-login:hover { filter: brightness(1.06); transform: translateY(-1px); }
.hidden { display: none !important; }

.stage {
  border: 2px solid #b3b9d6;
  border-radius: 7px;
  background: #151823;
  box-shadow: inset 0 2px rgba(255,255,255,0.18), inset 0 -4px rgba(0,0,0,0.45), 0 14px 32px rgba(0,0,0,0.4);
}
.room-lobby, .char-select, .pause-panel, .result-panel {
  background:
    radial-gradient(rgba(179,185,214,0.23) 0.9px, transparent 1px) 0 0 / 6px 6px,
    #20232e;
  backdrop-filter: none;
}

.room-box, .lobby-box, .sys-window, .scenario-card, dialog {
  border: 1px solid #b3b9d6;
  border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #7786b2 0%, #59678f 49%, #424b70 100%);
  box-shadow: inset 0 2px rgba(255,255,255,0.34), inset 0 -3px rgba(33,36,46,0.4), 0 8px 18px rgba(0,0,0,0.35);
}
.room-help, .profile-summary span, .stat-header span, .inventory-head span,
.equip-slot small, .item-card small, .shop-item small, .cs-hint {
  color: #e1e5f2;
}
.profile-summary b, .stat-header strong, .gem-balance strong { color: #ffd36a; }

.lobby-nav {
  border: 1px solid #b3b9d6;
  border-radius: 5px;
  background:
    radial-gradient(rgba(179,185,214,0.25) 0.9px, transparent 1px) 0 0 / 6px 6px,
    #21242e;
  box-shadow: inset 0 2px rgba(255,255,255,0.12), 0 6px 16px rgba(0,0,0,0.4);
}

.play-button, .progress-button, .raid-play-button, .progress-select-head button, .stage-choice, .scenario-choice,
.room-primary, .room-join-row button, .copy-code,
.synth-button, .shop-item button, .pause-panel button, .lobby-stats button,
.game-menu-button, .ghost-button, .result-panel button, .lobby-nav button {
  border: 1px solid #1d202a;
  border-radius: 3px;
  box-shadow: inset 0 2px rgba(255,255,255,0.35), inset 0 -2px rgba(33,36,46,0.25), 0 3px 0 #171922;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}
.play-button, .room-primary, .room-join-row button, .result-panel button {
  color: #21242e;
  background: linear-gradient(180deg, #f6c35f 0%, #ecab37 56%, #d88a22 100%);
}
.lobby-nav button, .ghost-button, .copy-code, .synth-button, .progress-button,
.progress-select-head button, .stage-choice, .scenario-choice,
.pause-panel button, .game-menu-button {
  color: #f4f6fb;
  background: linear-gradient(180deg, #6878a5 0%, #4a567e 100%);
}
.lobby-nav button.active {
  color: #21242e;
  border-color: #1d202a;
  background: linear-gradient(180deg, #f8ca69 0%, #ecab37 58%, #d88a22 100%);
}
button:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: inset 0 2px rgba(0,0,0,0.2);
}
button:focus-visible, input:focus-visible {
  outline: 3px solid #ffd36a;
  outline-offset: 2px;
}

.skill, .char-card, .equip-slot, .item-card, .shop-item, .lobby-stats div {
  border-radius: 4px;
  border-color: #9da8cc;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #414b70 0%, #2e3655 100%);
  box-shadow: inset 0 1px rgba(255,255,255,0.18), inset 0 -2px rgba(0,0,0,0.25);
}
.skill .motion-icon {
  color: #f4f6fb;
  border-radius: 3px;
  border-color: #9da8cc;
  background: linear-gradient(180deg, #343d5f 0%, #242b45 100%);
  box-shadow: inset 0 1px rgba(255,255,255,0.2), 0 2px 0 #171922;
}
.skill.basic .motion-icon { color: #ffd36a; border-color: #ecab37; }
.skill .key-hint {
  color: #21242e;
  border-radius: 2px;
  background: #e7ebf6;
  box-shadow: 0 2px 0 #60619c;
}
.skill.basic .key-hint { background: #ecab37; }
.controls {
  border: 1px solid #646f99;
  border-radius: 5px;
  background:
    radial-gradient(rgba(179,185,214,0.19) 0.8px, transparent 0.9px) 0 0 / 6px 6px,
    #21242e;
}
kbd {
  border-radius: 2px;
  border-color: #b3b9d6;
  color: #21242e;
  background: #e7ebf6;
  box-shadow: 0 2px 0 #60619c;
}
.room-box input {
  border-radius: 2px;
  border-color: #b3b9d6;
  color: #21242e;
  background: #e7ebf6;
  box-shadow: inset 0 2px 4px rgba(33,36,46,0.18);
}
.room-box input::placeholder { color: #60619c; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
