:root {
  color-scheme:dark;
  --bg:#091222;
  --panel:#111d31;
  --line:#26374d;
  --text:#edf5ff;
  --muted:#9aacbf;
  --accent:#55e5cd;
}
* {
  box-sizing:border-box;
}
body {
  margin:0;
  min-height:100vh;
  font-family:Inter,"Noto Sans KR",system-ui,sans-serif;
  color:var(--text);
  background:radial-gradient(ellipse at 80% 0,#163148 0,transparent 48%),var(--bg);
}
button,a {
  -webkit-tap-highlight-color:transparent;
}
button {
  font:inherit;
  cursor:pointer;
}
button:disabled {
  opacity:.4;
  cursor:default;
}
button:focus-visible,a:focus-visible,.viewport:focus-visible {
  outline:3px solid #55e5cd;
  outline-offset:4px;
}
.page {
  max-width:1520px;
  margin:auto;
  padding:32px;
}
.hero {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:32px;
  margin-bottom:28px;
}
.back-link {
  display:inline-block;
  color:var(--muted);
  text-decoration:none;
  font-size:13px;
  margin-bottom:25px;
}
.back-link:hover {
  color:var(--accent);
}
.eyebrow {
  font-size:10px;
  letter-spacing:.18em;
  font-weight:800;
  color:var(--accent);
  margin:0 0 12px;
}
h1 {
  font-size:clamp(29px,3.6vw,48px);
  letter-spacing:-.065em;
  line-height:1.15;
  margin:0;
}
h1 span {
  color:var(--accent);
}
.hero-text {
  color:var(--muted);
  line-height:1.75;
  max-width:760px;
  margin:15px 0 0;
  font-size:14px;
}
.hero-badge {
  flex-shrink:0;
  padding:22px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#112436;
}
.hero-badge span,.hero-badge strong,.hero-badge small {
  display:block;
}
.hero-badge span {
  font-size:9px;
  letter-spacing:.18em;
  color:var(--accent);
}
.hero-badge strong {
  margin:10px 0;
  font-size:18px;
}
.hero-badge small {
  color:var(--muted);
}
.layout {
  display:grid;
  grid-template-columns:260px minmax(0,1fr);
  gap:22px;
  align-items:start;
}
.panel,.stage-panel {
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:20px;
}
.panel {
  padding:23px;
}
h2 {
  font-size:20px;
  margin:0 0 18px;
  letter-spacing:-.03em;
}
h3 {
  font-size:14px;
  margin:0 0 10px;
}
.character-list {
  display:grid;
  gap:9px;
}
.character-button {
  color:var(--text);
  display:block;
  width:100%;
  padding:14px;
  border-radius:12px;
  background:#18273b;
  border:1px solid transparent;
  text-align:left;
  transition:background .15s,border-color .15s;
}
.character-button:hover {
  background:#223950;
}
.character-button.active {
  background:#173c40;
  border-color:var(--accent);
}
.character-name {
  font-weight:750;
  font-size:14px;
}
.character-role {
  display:block;
  font-size:11px;
  margin-top:5px;
  color:var(--muted);
}
.info-box {
  margin-top:22px;
  padding-top:19px;
  border-top:1px solid var(--line);
}
.selected-description,.mission-note,.controls-copy p {
  color:var(--muted);
  font-size:12px;
  line-height:1.8;
  margin:0;
}
.mission-list {
  padding-left:18px;
  margin:0 0 13px;
  font-size:12px;
  line-height:2;
  color:#cbd8e7;
}
.mission-note {
  font-size:11px;
}
kbd {
  display:inline-block;
  background:#26374d;
  border:1px solid #3e5168;
  border-bottom-width:2px;
  border-radius:5px;
  padding:1px 5px;
  font:10px system-ui;
  color:#dae6f3;
}
.controls-copy p+p {
  margin-top:8px;
}
.stage-panel {
  overflow:hidden;
  min-width:0;
}
.stage-toolbar {
  height:62px;
  padding:0 20px;
  display:flex;
  align-items:center;
  gap:9px;
  font-size:13px;
}
.live-dot {
  width:6px;
  height:6px;
  background:var(--accent);
  border-radius:50%;
}
.toolbar-actions {
  margin-left:auto;
  display:flex;
  gap:7px;
}
.toolbar-actions button {
  background:#22334a;
  border:1px solid #33465e;
  border-radius:8px;
  padding:8px 11px;
  color:var(--text);
  font-size:11px;
}
.toolbar-actions button:hover:enabled {
  border-color:var(--accent);
}
.stage-wrap {
  position:relative;
  overflow:hidden;
}
.viewport {
  width:100%;
  aspect-ratio:1.45;
  background:#8ed5f7;
  outline:none;
}
.viewport canvas {
  display:block;
  width:100%;
  height:100%;
}
.game-stats {
  position:absolute;
  top:18px;
  left:18px;
  right:18px;
  display:flex;
  gap:10px;
  pointer-events:none;
}
.game-stats>div {
  padding:10px 15px;
  background:#091222dc;
  backdrop-filter:blur(8px);
  border:1px solid #ffffff24;
  border-radius:10px;
  min-width:95px;
}
.game-stats span {
  display:block;
  font-size:8px;
  color:#a9c7d9;
  letter-spacing:.12em;
}
.game-stats strong {
  display:block;
  margin-top:5px;
  font-size:23px;
  letter-spacing:-.02em;
}
.game-stats .health-stat {
  margin-left:auto;
  min-width:125px;
}
.health-stat span {
  display:flex;
  justify-content:space-between;
}
.health-stat b {
  color:var(--text);
}
progress {
  width:100%;
  height:8px;
  display:block;
  margin-top:14px;
  appearance:none;
  border:0;
  border-radius:20px;
  overflow:hidden;
  background:#344057;
}
progress::-webkit-progress-bar {
  background:#344057;
}
progress::-webkit-progress-value {
  background:var(--accent);
}
progress::-moz-progress-bar {
  background:var(--accent);
}
.game-overlay {
  position:absolute;
  inset:0;
  z-index:3;
  display:grid;
  place-items:center;
  background:#07101a80;
  backdrop-filter:blur(3px);
  padding:22px;
}
.game-overlay[hidden] {
  display:none;
}
.overlay-card {
  background:#0c1a2fed;
  border:1px solid #4c718477;
  padding:34px;
  max-width:440px;
  border-radius:20px;
  text-align:center;
  box-shadow:0 20px 70px #0006;
}
.overlay-card h2 {
  font-size:25px;
  line-height:1.4;
  margin:0 0 13px;
}
.overlay-card>p:not(.eyebrow) {
  font-size:13px;
  color:var(--muted);
  line-height:1.8;
}
.primary-button {
  background:var(--accent);
  color:#052727;
  border:0;
  border-radius:10px;
  width:100%;
  padding:14px;
  margin-top:13px;
  font-size:14px;
  font-weight:800;
}
.primary-button:hover {
  background:#89f8e5;
}
.overlay-card .overlay-hint {
  font-size:10px!important;
  margin-bottom:0;
}
.hud {
  padding:15px 20px;
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-size:11px;
  color:var(--muted);
  flex-wrap:wrap;
}
.game-message {
  margin:0;
  padding:0 20px 18px;
  font-size:12px;
  color:var(--accent);
  min-height:34px;
}
.touch-controls {
  position:absolute;
  bottom:20px;
  left:20px;
  right:20px;
  display:flex;
  justify-content:space-between;
  align-items:end;
  pointer-events:none;
}
.touch-controls button {
  pointer-events:auto;
  touch-action:none;
  user-select:none;
  color:white;
  background:#091222a8;
  border:1px solid #ffffff50;
  box-shadow:0 4px 10px #0002;
}
.dpad {
  display:grid;
  grid-template-columns:repeat(3,42px);
  grid-template-rows:repeat(2,42px);
  gap:5px;
}
.dpad button {
  font-size:21px;
  border-radius:10px;
}
.dpad button:first-child {
  grid-column:2;
}
.dpad button:nth-child(2) {
  grid-row:2;
  grid-column:1;
}
.dpad button:nth-child(3) {
  grid-row:2;
  grid-column:2;
}
.dpad button:nth-child(4) {
  grid-row:2;
  grid-column:3;
}
.attack-button {
  width:70px;
  height:70px;
  border-radius:50%;
  font-size:14px;
  font-weight:700;
}
.attack-button small {
  font-size:8px;
  color:var(--accent);
}
.touch-controls button:active,.touch-controls button.pressed {
  background:#137b77b8;
}
.renderer-error {
  margin:20px;
  padding:25px;
  border:1px solid #c78b44;
  background:#332d29;
  color:#ffe3bc;
  line-height:1.8;
  white-space:pre-line;
}
@media(pointer:fine) {
  .touch-controls {
    opacity:.8;
  }
}
@media(max-width:1100px) {
  .layout {
    grid-template-columns:220px minmax(0,1fr);
  }
  .hero-badge {
    display:none;
  }
  .page {
    padding:22px;
  }
  .panel {
    padding:17px;
  }
  .viewport {
    aspect-ratio:1.15;
  }
}
@media(max-width:760px) {
  .page {
    padding:16px;
  }
  .hero {
    margin-bottom:22px;
  }
  .back-link {
    margin-bottom:20px;
  }
  .layout {
    display:flex;
    flex-direction:column;
  }
  .panel {
    width:100%;
  }
  .character-list {
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .character-button {
    padding:11px;
  }
  .character-role {
    font-size:10px;
  }
  .panel .info-box {
    margin-top:14px;
    padding-top:12px;
  }
  .panel .info-box:nth-of-type(2),.panel .controls-copy {
    display:none;
  }
  .selected-description {
    font-size:11px;
  }
  .stage-panel {
    width:100%;
  }
  .viewport {
    aspect-ratio:.95;
    min-height:430px;
  }
  .stage-toolbar {
    padding:0 12px;
  }
  .stage-toolbar strong {
    font-size:12px;
  }
  .toolbar-actions button {
    padding:8px;
  }
  .game-stats {
    top:12px;
    left:12px;
    right:12px;
    gap:6px;
  }
  .game-stats>div {
    min-width:75px;
    padding:9px;
  }
  .game-stats strong {
    font-size:20px;
  }
  .game-stats .health-stat {
    min-width:95px;
  }
  .overlay-card {
    padding:25px;
  }
  .overlay-card h2 {
    font-size:21px;
  }
  .hud {
    padding:13px;
    font-size:10px;
  }
  .game-message {
    padding:0 13px 15px;
  }
  .hero-text {
    font-size:12px;
  }
}

.mission-summary { margin: 0; padding: 0 20px 14px; font-size: 11px; color: var(--accent); line-height: 1.6; }
.game-stats .stage-stat { min-width: 65px; }
@media (max-width:760px) {
  .mission-summary { padding: 0 12px 12px; font-size: 10px; }
  .game-stats .stage-stat { min-width: 40px; }
  .game-stats .stage-stat strong { font-size: 20px; }
}
