:root {
  --bg-sea: #06101d;
  --glass: rgba(8, 16, 30, 0.78);
  --glass-strong: rgba(7, 13, 25, 0.92);
  --border-brass: rgba(245, 188, 94, 0.36);
  --border-soft: rgba(148, 197, 255, 0.2);
  --ink: #f8fafc;
  --ink-soft: #d8e3f2;
  --gold: #fbbf24;
  --cyan: #38bdf8;
  --crimson: #fb7185;
  --emerald: #34d399;
  --font-sans: 'Noto Sans KR', 'Space Grotesk', 'Malgun Gothic', system-ui, sans-serif;
  --font-serif: 'Noto Sans KR', 'Newsreader', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Noto Sans KR', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-sea);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
}

#viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#world-overlays {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}

.hp-float {
  position: absolute;
  transform: translate(-50%, -100%);
  width: 44px;
}
.hp-float.boss { width: 88px; }
.hp-name {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: #fde047;
  text-align: center;
  text-shadow: 0 1px 3px #000;
  background: rgba(6, 11, 22, 0.78);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  margin-bottom: 2px;
}
.hp-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(5, 10, 18, 0.85);
  border: 1px solid rgba(255,255,255,0.22);
  overflow: hidden;
}
.hp-fill { height: 100%; transition: width 0.1s linear; }

.dmg-float {
  position: absolute;
  transform: translate(-50%, -100%);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.9);
}

.speech-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: 190px;
  padding: 0.24rem 0.52rem;
  border-radius: 8px;
  background: rgba(8, 15, 28, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.55);
  color: #fef3c7;
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
}
.speech-bubble.north { border-color: rgba(56, 189, 248, 0.65); color: #e0f2fe; }
.speech-bubble.south { border-color: rgba(251, 113, 133, 0.7); color: #ffe4e6; }
.speech-bubble.boss { border-color: #facc15; background: rgba(38, 10, 18, 0.94); color: #fef08a; font-weight: 700; }
.speech-bubble.ai {
  border-color: rgba(192, 132, 252, 0.95);
  background: rgba(28, 12, 54, 0.94);
  color: #f3e8ff;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.45);
}

.byok-card {
  background: rgba(12, 20, 38, 0.92);
  border: 1px solid rgba(192, 132, 252, 0.42);
  border-radius: 10px;
  padding: 0.78rem 0.88rem;
  margin-bottom: 0.85rem;
}
.byok-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.byok-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
}
.byok-status-pill {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
  white-space: nowrap;
}
.byok-status-pill.live {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.7);
  color: #6ee7b7;
}
.byok-status-pill.err {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(251, 113, 133, 0.7);
  color: #fda4af;
}
.byok-security-note {
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.45;
  margin: 0 0 0.65rem;
}
.byok-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.byok-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.byok-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
  margin-top: 0.4rem;
}
.byok-log {
  margin-top: 0.55rem;
  background: rgba(4, 9, 19, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 7px;
  padding: 0.42rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: #cbd5e1;
  max-height: 92px;
  overflow-y: auto;
  display: none;
}
.byok-log.has-items { display: block; }
.byok-log-line { padding: 0.12rem 0; border-bottom: 1px dashed rgba(255,255,255,0.06); }
.byok-log-line.ok { color: #6ee7b7; }
.byok-log-line.err { color: #fda4af; }
.season-banner {
  background: linear-gradient(135deg, rgba(15, 29, 54, 0.95), rgba(34, 18, 56, 0.92));
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-radius: 10px;
  padding: 0.78rem 0.9rem;
  margin-bottom: 0.8rem;
}
.season-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}
.season-title {
  font-weight: 700;
  font-size: 0.94rem;
  color: #fef3c7;
}
.season-pool-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(5, 11, 22, 0.78);
  border: 1px solid rgba(52, 211, 153, 0.45);
  border-radius: 8px;
  padding: 0.28rem 0.62rem;
}
.season-pool-label {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: #6ee7b7;
  letter-spacing: 0.06em;
}
.season-pool-val {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: #fbbf24;
}
.season-vs-row {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #e2e8f0;
  background: rgba(6, 12, 24, 0.72);
  border-radius: 7px;
  padding: 0.36rem 0.6rem;
  margin-bottom: 0.55rem;
}
.season-pass-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}
.season-pass-row input {
  flex: 1 1 210px;
  background: rgba(5, 11, 22, 0.92);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.78rem;
  padding: 0.42rem 0.58rem;
}
.rank-badge.verified {
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.65);
  color: #fde68a;
}
@media (max-width: 720px) {
  .byok-grid { grid-template-columns: 1fr; }
}
.speech-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border-width: 5px 5px 0 5px;
  border-style: solid;
  border-color: rgba(251, 191, 36, 0.6) transparent transparent transparent;
}

.dps-mech-bar {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.24rem 0.6rem;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 20, 30, 0.92), rgba(7, 10, 18, 0.95));
  border: 1px solid rgba(245, 188, 94, 0.45);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 224, 150, 0.22);
}
.dps-digits {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.dps-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(180deg, #1d2433 0%, #111622 49%, #0a0e17 51%, #161d2b 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fde047;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.35);
}
.dps-sep {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #94a3b8;
  font-size: 0.75rem;
}
.dps-unit {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
}
.dps-peak {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.42);
  color: #fde68a;
}

.freecam-bar {
  position: fixed;
  left: 50%;
  bottom: 5.2rem;
  transform: translateX(-50%);
  z-index: 14;
  display: none;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  max-width: calc(100vw - 1.5rem);
  gap: 0.45rem;
  padding: 0.38rem 0.68rem;
  border-radius: 10px;
  background: rgba(7, 13, 24, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: #cbd5e1;
  backdrop-filter: blur(10px);
}
.freecam-bar.active { display: inline-flex; }
.freecam-badge {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #04101d;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
}
#freecam-hint {
  white-space: nowrap;
}
@media (max-width: 860px) {
  .freecam-bar {
    flex-wrap: wrap;
    white-space: normal;
    justify-content: center;
    bottom: 5.6rem;
  }
}

/* Top HUD */
.hud-top {
  position: fixed;
  top: 0.65rem;
  left: 0.75rem;
  right: 0.75rem;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(210px, 290px) minmax(240px, 1fr) auto;
  gap: 0.65rem;
  align-items: start;
  pointer-events: none;
}

.hud-card {
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.86), rgba(7, 13, 24, 0.88));
  border: 1px solid rgba(245, 188, 94, 0.48);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 224, 150, 0.22);
}

.brand-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.lang-switch, .intro-lang-bar {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.intro-lang-bar {
  margin-bottom: 0.65rem;
}

.lang-pill {
  border: 1px solid rgba(245, 188, 94, 0.34);
  background: rgba(12, 22, 38, 0.78);
  color: var(--ink-soft);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.lang-pill:hover {
  border-color: var(--gold);
  color: var(--ink);
}

.lang-pill.active {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  border-color: #fde68a;
  color: #0b1322;
}

.brand-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.ship-title {
  margin: 0.15rem 0 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.1;
}

.zone-sub {
  margin: 0.12rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--cyan);
}

.hud-left-stack {
  display: flex;
  flex-direction: column;
  gap: 0.36rem;
  pointer-events: none;
}

.mission-hud-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.42rem;
  text-align: left;
  background: rgba(9, 17, 32, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.36);
  border-radius: 8px;
  padding: 0.34rem 0.58rem;
  color: var(--ink);
  font-size: 0.68rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.38);
  transition: border-color 0.16s ease, transform 0.14s ease;
}
.mission-hud-pill:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}
.mission-hud-pill.ready {
  border-color: #34d399;
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.88), rgba(14, 24, 42, 0.9));
}
.mission-pill-tag {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.mission-pill-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e2e8f0;
}

.onboarding-slot {
  pointer-events: auto;
  max-width: 280px;
}

.event-banner {
  display: none;
  align-items: center;
  gap: 0.48rem;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.9), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(251, 191, 36, 0.65);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: #fef3c7;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.event-banner.active { display: inline-flex; }
.event-tag {
  background: #fbbf24;
  color: #0b1322;
  border-radius: 999px;
  padding: 1px 6px;
  font-weight: 700;
  font-size: 0.56rem;
}

.war-center {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
}

.war-panel {
  width: min(100%, 440px);
  text-align: center;
}

.war-status-text {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}

.war-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(251, 113, 133, 0.55);
  border: 1px solid rgba(255,255,255,0.2);
  overflow: hidden;
}

.war-bar-north {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  transition: width 0.3s ease;
}

.boss-banner {
  display: none;
  width: min(100%, 400px);
  background: rgba(36, 10, 18, 0.88);
  border: 1px solid rgba(251, 113, 133, 0.65);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
}
.boss-banner.active { display: block; }
.boss-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: #fde047;
  margin-bottom: 0.2rem;
}
.boss-track { height: 6px; border-radius: 999px; background: rgba(0,0,0,0.6); overflow: hidden; }
.boss-fill { height: 100%; background: linear-gradient(90deg, #e11d48, #fb7185); }

.hud-right-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.hud-stats {
  display: flex;
  gap: 0.4rem;
  pointer-events: auto;
}

.stat-chip {
  background: var(--glass);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.36rem 0.56rem;
  min-width: 68px;
  backdrop-filter: blur(8px);
}
.stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stat-val {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}
.gold { color: var(--gold); }
.cyan { color: var(--cyan); }
.emerald { color: var(--emerald); }
.crimson { color: var(--crimson); }

.minimap-card {
  pointer-events: auto;
  background: var(--glass);
  border: 1px solid var(--border-brass);
  border-radius: 10px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
}
#minimap-canvas {
  border-radius: 6px;
  border: 1px solid rgba(148, 197, 255, 0.25);
  display: block;
}
.minimap-caption {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: var(--ink-soft);
}

/* Toast */
.toast {
  display: none;
  position: static;
  width: 100%;
  max-width: 290px;
  padding: 0.48rem 0.78rem;
  border-radius: 8px;
  background: var(--glass-strong);
  border: 1px solid var(--border-brass);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { display: block; opacity: 1; transform: translateY(0); }
.toast.tone-danger { border-color: var(--crimson); color: #fecdd3; }
.toast.tone-good { border-color: var(--emerald); color: #a7f3d0; }
.toast.tone-gold { border-color: var(--gold); color: #fef08a; }

/* Dock Prompt */
.context-prompt {
  position: fixed;
  left: 50%;
  bottom: 5.7rem;
  transform: translateX(-50%) translateY(8px);
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.48rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: rgba(10, 18, 32, 0.92);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.context-prompt.visible { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }

/* Bottom HUD */
.hud-bottom {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.65rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
}

.synergy-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: center;
}
.syn-pill {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 0.16rem 0.48rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--glass);
}
.syn-pill.muted { color: var(--ink-soft); }

.bottom-deck-row {
  pointer-events: auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
  background: var(--glass);
  border: 1px solid var(--border-brass);
  border-radius: 12px;
  padding: 0.42rem 0.65rem;
  backdrop-filter: blur(8px);
}

.weapon-slots-bar {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.32rem;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.weapon-slots-bar::-webkit-scrollbar {
  display: none;
}

.weapon-slot {
  position: relative;
  flex: 1 1 0;
  min-width: 54px;
  max-width: 112px;
  padding: 0.22rem 0.34rem;
  border-radius: 7px;
  border: 1px solid var(--border-brass);
  background: rgba(9, 17, 32, 0.9);
  cursor: pointer;
}
.weapon-slot.empty { border-style: dashed; border-color: var(--border-soft); opacity: 0.72; }
.ws-tier { display: block; font-family: var(--font-mono); font-size: 0.54rem; color: var(--gold); }
.ws-name { display: block; font-size: 0.62rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ws-cd-bar { display: block; height: 3px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.ws-cd-fill { display: block; height: 100%; background: var(--cyan); width: 0%; }

.action-dock {
  display: flex;
  gap: 0.24rem;
  align-items: center;
  flex-shrink: 0;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  padding: 0.35rem 0.46rem;
  border-radius: 7px;
  border: 1px solid var(--border-soft);
  background: rgba(15, 25, 45, 0.92);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.hud-btn:hover:not(:disabled) { border-color: var(--gold); }
.hud-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hud-btn.primary { background: linear-gradient(135deg, #d97706, #f59e0b); color: #090d16; border-color: #fde68a; }
.hud-btn.cyan-btn { border-color: rgba(56, 189, 248, 0.55); color: #bae6fd; }
.hud-btn.active { border-color: var(--emerald); color: var(--emerald); }
.hud-btn.cooling { opacity: 0.62; }

/* Mobile Joystick */
.touch-pad {
  display: none;
  position: fixed;
  left: 0.85rem;
  bottom: 5.4rem;
  z-index: 11;
  grid-template-columns: repeat(3, 38px);
  grid-template-rows: repeat(3, 38px);
  gap: 4px;
}
.touch-btn {
  border-radius: 8px;
  border: 1px solid var(--border-brass);
  background: rgba(10, 18, 34, 0.82);
  color: var(--ink);
  font-size: 0.9rem;
}

/* Intro Splash */
.intro-card {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  background: rgba(4, 9, 18, 0.58);
  backdrop-filter: blur(4px);
  padding: 1rem;
}
.intro-card.hidden { display: none; }
.intro-inner {
  width: min(94vw, 660px);
  background: var(--glass-strong);
  border: 1px solid var(--border-brass);
  border-radius: 14px;
  padding: 1.5rem 1.45rem;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72);
}
.intro-inner h1 {
  margin: 0.35rem 0 0.5rem;
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 4.2vw, 2.75rem);
}
.intro-inner p {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}
.intro-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
}
.intro-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(16, 28, 48, 0.85);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  background: rgba(3, 8, 16, 0.78);
  backdrop-filter: blur(6px);
  padding: 1rem;
}
.modal-backdrop.open { display: grid; }
.modal-card {
  width: min(96vw, 900px);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--glass-strong);
  border: 1px solid var(--border-brass);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 188, 94, 0.38) rgba(6, 11, 22, 0.45);
}
.modal-card::-webkit-scrollbar { width: 7px; }
.modal-card::-webkit-scrollbar-track { background: rgba(6, 11, 22, 0.45); border-radius: 999px; }
.modal-card::-webkit-scrollbar-thumb { background: rgba(245, 188, 94, 0.38); border-radius: 999px; }
.modal-card::-webkit-scrollbar-thumb:hover { background: rgba(245, 188, 94, 0.62); }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.modal-title { margin: 0.2rem 0 0; font-family: var(--font-serif); font-size: 1.5rem; word-break: keep-all; }
.modal-close {
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.harbor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.harbor-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.harbor-tab.active { border-color: var(--gold); background: rgba(245, 188, 94, 0.16); color: var(--gold); }

.armory-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.26rem 0.56rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(11, 19, 34, 0.86);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}
.filter-pill:hover { border-color: var(--gold); color: var(--ink); }
.filter-pill.active {
  border-color: var(--gold);
  background: rgba(245, 188, 94, 0.2);
  color: #fde68a;
}

.upgrade-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(52, 211, 153, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.48);
  color: #6ee7b7;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  width: fit-content;
}

.slot-card {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.slot-card:hover {
  border-color: var(--gold);
}
.slot-card.selected-slot {
  border-color: var(--gold);
  background: rgba(245, 188, 94, 0.14);
  box-shadow: 0 0 0 1px rgba(245, 188, 94, 0.35);
}

.delta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.26rem;
  margin: 0.14rem 0;
}
.delta-chip {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.delta-chip.pos {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.42);
  color: #6ee7b7;
}
.delta-chip.neg {
  background: rgba(251, 113, 133, 0.13);
  border-color: rgba(251, 113, 133, 0.38);
  color: #fda4af;
}

.bazaar-banner {
  padding: 0.48rem 0.72rem;
  margin-bottom: 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(52, 211, 153, 0.52);
  background: rgba(16, 185, 129, 0.14);
  color: #a7f3d0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.relic-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin: 0.15rem 0;
}
.relic-tag-pill {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
  background: rgba(15, 23, 42, 0.9);
  color: var(--ink-soft);
  text-transform: uppercase;
}
.quest-progress-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(6, 11, 22, 0.9);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  margin: 0.25rem 0;
}
.quest-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #34d399);
  transition: width 0.2s ease;
}

.shop-section-title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--cyan);
  margin-bottom: 0.5rem;
}
.equipped-grid, .catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
}
.shop-card {
  background: rgba(14, 23, 40, 0.9);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.shop-card.active-card { border-color: var(--emerald); }
.sc-head { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.64rem; }
.sc-name { font-weight: 700; font-size: 0.84rem; }
.sc-meta { font-family: var(--font-mono); font-size: 0.66rem; color: var(--ink-soft); }
.sc-desc { font-size: 0.74rem; color: var(--ink-soft); line-height: 1.38; margin-bottom: 0.25rem; }
.sc-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: auto; }
.badge-owned { font-family: var(--font-mono); font-size: 0.68rem; color: var(--emerald); font-weight: 700; }

.ai-btn {
  border-color: rgba(192, 132, 252, 0.55);
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.7), rgba(14, 116, 144, 0.62));
  color: #f3e8ff;
}
.ai-btn:hover {
  border-color: #d8b4fe;
  box-shadow: 0 0 14px rgba(192, 132, 252, 0.4);
}
.ai-btn.active {
  background: linear-gradient(135deg, #a855f7, #06b6d4);
  border-color: #f5d0fe;
  color: #050a14;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.55);
}

.rank-submit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem;
  background: rgba(12, 21, 38, 0.85);
  border: 1px solid var(--border-brass);
  border-radius: 9px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.85rem;
}
.rank-field {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  flex: 1 1 160px;
}
.rank-flag-field {
  flex: 0 0 110px;
}
.rank-field span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--gold);
  text-transform: uppercase;
}
.rank-field input, .rank-field select {
  background: rgba(5, 11, 22, 0.92);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.42rem 0.55rem;
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.52rem 0.65rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.78rem;
}
.ledger-left {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: wrap;
}
.ledger-right {
  text-align: right;
  flex-shrink: 0;
}
.rank-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold);
  min-width: 24px;
}
.rank-badge {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.rank-badge.human {
  background: rgba(52, 211, 153, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.55);
  color: #6ee7b7;
}
.rank-badge.ai {
  background: rgba(168, 85, 247, 0.24);
  border: 1px solid rgba(192, 132, 252, 0.65);
  color: #e9d5ff;
}
.ledger-sub {
  color: var(--ink-soft);
  font-size: 0.72rem;
}
.ledger-score {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold);
  font-size: 0.8rem;
}
.ledger-note {
  display: block;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.ai-api-box {
  background: rgba(11, 19, 34, 0.9);
  border: 1px solid rgba(192, 132, 252, 0.42);
  border-radius: 10px;
  padding: 0.85rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.ai-api-box code {
  color: #67e8f9;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}
.ai-code-snippet {
  margin: 0.65rem 0 0;
  padding: 0.7rem 0.8rem;
  background: rgba(4, 9, 18, 0.95);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  overflow-x: auto;
  line-height: 1.48;
  user-select: text;
  -webkit-user-select: text;
}

.zb-ad-modal { margin-top: 26px; min-height: 40px; }

/* Summary Modal */
.summary-card { width: min(96vw, 820px); padding: 0.95rem 1.15rem; }
.summary-sub {
  margin: 0.18rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.4;
}
.summary-card.outcome-victory { border-color: rgba(251, 191, 36, 0.72); }
.summary-card.outcome-sunk { border-color: rgba(251, 113, 133, 0.72); }
.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 0.42rem;
  margin-bottom: 0.65rem;
}
.summary-stat-box {
  background: rgba(12, 21, 38, 0.9);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
}
.summary-stat-box .stat-label { margin-bottom: 0.1rem; }
.summary-stat-box .stat-val { font-size: 0.88rem; }
.summary-poster-wrap {
  background: rgba(6, 11, 22, 0.85);
  border: 1px solid var(--border-brass);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.72rem;
  text-align: center;
}
.summary-poster-wrap .shop-section-title { margin-bottom: 0.36rem; text-align: left; }
.summary-chronicle-img {
  display: block;
  max-width: 100%;
  max-height: 270px;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 7px;
  border: 1px solid rgba(245, 188, 94, 0.35);
}
.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

@media (max-width: 820px) {
  .modal-card {
    padding: 0.9rem 0.92rem;
    max-height: 91vh;
  }
  .modal-title {
    font-size: 1.18rem;
  }
  .harbor-toolbar {
    gap: 0.42rem;
    margin-bottom: 0.65rem;
  }
  .harbor-toolbar > div,
  .harbor-tabs {
    width: 100%;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .harbor-toolbar > div::-webkit-scrollbar,
  .harbor-tabs::-webkit-scrollbar {
    display: none;
  }
  #codex-mount .itx-tab {
    padding: 8px 10px 9px;
    font-size: 12.5px;
  }
  .hud-top {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.34rem;
    top: 0.45rem;
    left: 0.5rem;
    right: 0.5rem;
  }
  .hud-card {
    padding: 0.38rem 0.54rem;
  }
  .ship-title {
    font-size: 0.92rem;
  }
  .brand-row-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }
  .brand-eyebrow {
    white-space: nowrap;
  }
  .mission-hud-pill {
    display: none;
  }
  .war-center {
    grid-column: 1 / -1;
    order: 3;
    gap: 0.24rem;
  }
  .war-panel {
    padding: 0.3rem 0.5rem;
  }
  .war-status-text {
    font-size: 0.58rem;
    margin-bottom: 0.2rem;
  }
  .dps-mech-bar {
    padding: 0.18rem 0.48rem;
    gap: 0.32rem;
  }
  .dps-cell {
    width: 14px;
    height: 18px;
    font-size: 0.7rem;
  }
  .war-center:has(.boss-banner.active) .dps-mech-bar {
    display: none;
  }
  .hud-top:has(.boss-banner.active) .onboarding-slot,
  html.mbp0-on.mbp0-boss .mbp0-coach {
    display: none !important;
  }
  html:not(.mbp0-on) .toast {
    position: fixed;
    top: auto;
    left: 50%;
    bottom: 11.4rem;
    width: auto;
    max-width: min(92vw, 340px);
    transform: translate(-50%, 6px);
    z-index: 12;
    font-size: 0.68rem;
    padding: 0.38rem 0.68rem;
    text-align: center;
  }
  html:not(.mbp0-on) .toast.show {
    transform: translate(-50%, 0);
  }
  .hud-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(58px, 1fr));
    gap: 0.25rem;
  }
  .stat-chip {
    padding: 0.28rem 0.44rem;
    min-width: 0;
  }
  .stat-val {
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .minimap-card { display: none; }
  .bottom-deck-row {
    flex-direction: column;
    align-items: stretch;
    padding: 0.36rem 0.5rem;
    gap: 0.35rem;
  }
  .action-dock {
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0;
  }
  .action-dock::-webkit-scrollbar { display: none; }
  .touch-pad {
    display: grid;
    left: 0.65rem;
    bottom: 8.3rem;
    grid-template-columns: repeat(3, 34px);
    grid-template-rows: repeat(3, 34px);
    gap: 3px;
  }
  .context-prompt {
    left: auto;
    right: 0.65rem;
    bottom: 8.5rem;
    transform: translateY(8px);
    max-width: calc(100vw - 9.2rem);
    padding: 0.42rem 0.7rem;
    font-size: 0.66rem;
    text-align: left;
  }
  .context-prompt.visible { transform: translateY(0); }
}

/* Crisp Korean & CJK High-Contrast Typography & Readability Polish */
.sc-desc {
  font-size: 0.78rem !important;
  line-height: 1.54 !important;
  color: #dce6f5 !important;
  word-break: keep-all;
}
.sc-meta {
  font-size: 0.73rem !important;
  line-height: 1.45 !important;
  color: #cbd8ec !important;
}
.sc-name {
  font-size: 0.94rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em;
  color: #f8fafc !important;
}
.hud-btn {
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
}
.speech-bubble {
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  padding: 0.28rem 0.62rem !important;
}
.brand-eyebrow {
  font-size: 0.63rem !important;
  letter-spacing: 0.04em !important;
  white-space: nowrap;
}
.zone-sub, .mission-pill-text, .war-status-text {
  font-weight: 600 !important;
}
#codex-mount .itx {
  height: auto;
  min-height: 360px;
}
#codex-mount .itx-body {
  overflow: visible;
}
.sea-news-slot {
  display: none;
  width: min(560px, 100%);
  pointer-events: none;
}
.sea-news-slot.has-news {
  display: block;
}
.sea-news-slot .sn0-dock {
  position: static !important;
  padding: 0;
}
.sea-news-slot .sn0-bar {
  width: 100%;
  height: 30px;
}
.sea-news-slot .sn0-chip,
.sea-news-slot .sn0-view {
  height: 24px;
}
.sea-news-slot .sn0-btn {
  width: 24px;
  height: 24px;
}
@media (max-width: 820px) {
  .sea-news-slot {
    width: 100%;
  }
  .war-center:has(.boss-banner.active) .sea-news-slot {
    display: none;
  }
  .sea-news-slot .sn0-bar {
    height: 26px;
  }
  .sea-news-slot .sn0-line,
  .sea-news-slot .sn0-chunk {
    font-size: 11px;
  }
}
@media (max-width: 640px) {
  .equipped-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.42rem;
  }
  .equipped-grid .slot-card {
    padding: 0.46rem 0.52rem;
    gap: 0.16rem;
  }
  .equipped-grid .slot-card .sc-name {
    font-size: 0.78rem !important;
    line-height: 1.24;
  }
  .equipped-grid .slot-card .sc-meta {
    font-size: 0.65rem !important;
  }
}

/* AI Admiral Arena Broadcast Coordination (Zero Overlap With Minimap / War Panel) */
body:has(.dbx0.is-on) .war-panel,
body:has(.dbx0.is-on) .dps-mech-bar {
  display: none;
}
body:has(.dbx0.is-on) .war-center {
  padding-top: 64px;
}
.dbx0.is-on .dbx0-side {
  top: 230px;
  right: 12px;
  bottom: auto;
}
.dbx0.is-on .dbx0-feed {
  bottom: 84px;
}
.dbx0.is-on .dbx0-feed h3 {
  display: inline-block;
  width: fit-content;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(7, 13, 25, 0.86);
  border: 1px solid rgba(148, 197, 255, 0.28);
  color: #e2e8f0;
  margin-bottom: 3px;
}
@media (max-width: 820px) {
  body:has(.dbx0.is-on) .hud-brand-card,
  body:has(.dbx0.is-on) .hud-stats,
  body:has(.dbx0.is-on) .onboarding-slot,
  body:has(.dbx0.is-on) .sea-news-slot {
    display: none !important;
  }
  body:has(.dbx0.is-on) .war-center {
    padding-top: 146px;
  }
  .dbx0.is-on .dbx0-side {
    top: 76px;
    right: 8px;
    left: 8px;
  }
  .dbx0.is-on .dbx0-feed {
    left: 8px;
    right: 162px;
    width: auto;
    bottom: 205px;
  }
  .dbx0.is-on .dbx0-feed h3 {
    display: none;
  }
  .dbx0.is-on .dbx0-feed .dbx0-line {
    font-size: 12px;
    padding: 5px 8px;
  }
  .dbx0.is-on .dbx0-feed .dbx0-line:nth-last-child(n+3) {
    display: none;
  }
}
