/* Interface refinement: scoped to the existing simulation and its components. */
:root { --ink-muted: #a29ab7; --radius: 12px; --wrap: 90rem; }
body { overflow-x: visible; }
.app-shell { overflow: clip; }
button, input { max-width: 100%; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
:is(.hud-inner, .sim-main, .view-panel, .regimen-grid, .sanctum-bottom-grid, .codex-grid, .combat-hud) > * { min-width: 0; }
:is(h1, h2, h3, p, .relic-name, .relic-bonus, .leader-row, .sim-toast, .vn-choice-btn, .cutin-caption) { overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 4px; }
:is(.icon-btn, .stance-toggle-btn, .voice-play-mini, .vn-ep-btn, .boss-pill) { min-height: 44px; }
.eyebrow { display: block; font: 600 0.65rem/1.6 var(--font-text); letter-spacing: 0.19em; color: var(--accent); text-transform: uppercase; }
.hud-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; padding: 1rem 1.5rem; gap: 1rem 2rem; }
.brand-emblem { flex-shrink: 0; width: 2.65rem; height: 2.65rem; box-shadow: 0 0 24px #f4c55220; }
.brand-title { font-size: 1.2rem; }
.brand-sub { font-size: 0.6rem; letter-spacing: 0.2em; margin-top: 3px; }
.cycle-tracker { border-radius: 8px; padding: 0.55rem 0.75rem; flex-wrap: wrap; }
.day-badge { white-space: nowrap; }
.phase-badge { max-width: 100%; }
.hud-actions { gap: 0.4rem; }
.icon-btn { width: 44px; height: 44px; background: #ffffff05; border-color: #ffffff16; border-radius: 8px; }
#btn-reset-sim:hover { color: #fda4af; border-color: #ff4d6d88; }
.hud-stats { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.65rem; }
.stat-pill { min-width: 0; padding: 0.6rem 0.85rem; gap: 0.65rem; border-color: #ffffff10; background: linear-gradient(110deg, #27213770, #15121f70); }
.stat-val { margin-left: auto; font-size: 1rem; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stat-ap { border-color: #f4c55244; }
.mode-nav-inner { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 1.5rem; overflow: visible; gap: 0; }
.nav-tab { min-width: 0; min-height: 60px; justify-content: center; padding: 0.8rem 0.65rem; font: 600 0.8rem/1.45 var(--font-text); letter-spacing: 0.01em; text-transform: none; white-space: normal; position: relative; }
.nav-tab > span:not(.icon):not(.nav-badge) { min-width: 0; }
.nav-tab.active { background: linear-gradient(0deg, #f4c55212, transparent); }
.nav-badge { flex-shrink: 0; background: #ff4d6d25; border: 1px solid #ff4d6d55; color: #ffa3b3; font: 600 0.58rem/1.5 var(--font-text); padding: 0.15rem 0.4rem; }
#bond-badge { background: #9d7bff20; border-color: #9d7bff44; color: #cebaff; }
.sim-main { grid-template-columns: 300px minmax(0, 1fr); padding: 1.5rem; gap: 1.5rem; align-items: start; }
.view-panel { gap: 1.35rem; }
.knight-column { gap: 1rem; }
.knight-stage-card { background: linear-gradient(160deg, #292037e8, #100d1be8); border-color: #f4c55230; }
.stage-top-meta { flex-wrap: wrap; gap: 0.5rem; padding: 1rem 1rem 0; }
.knight-rank-tag { font-size: 0.63rem; letter-spacing: 0.07em; padding: 0.3rem 0.5rem; border-color: #f4c55244; }
.stance-toggle-btn { padding: 0.5rem 0.7rem; line-height: 1.4; justify-content: center; border-radius: 7px; }
.knight-figure-wrap { border: 0; background: transparent; width: 100%; padding: 0.8rem 0 0; border-radius: 0; }
.knight-portrait { width: 100%; max-height: 340px; }
.portrait-prompt { position: absolute; bottom: 12px; background: #100c1ce8; border: 1px solid #ffffff25; border-radius: 99px; padding: 0.3rem 0.7rem; font-size: 0.62rem; color: var(--ink-soft); }
.portrait-prompt span { color: var(--accent); margin-left: 0.5rem; }
.knight-quote-bubble { margin: 0 1rem 1rem; padding: 0.8rem; font-size: 0.8rem; line-height: 1.75; }
.quote-speaker { flex-wrap: wrap; gap: 0.4rem; font-size: 0.7rem; }
.voice-play-mini { flex-shrink: 0; padding: 0 0.4rem; }
.condition-card { padding: 1.1rem; gap: 1rem; }
.bar-header { align-items: start; gap: 0.8rem; font-size: 0.72rem; }
.bar-header > :last-child { flex-shrink: 0; color: var(--ink); font-family: var(--font-mono); }
.bar-track { height: 6px; border: 0; margin-top: 3px; }
.bar-group:last-child { border-top: 1px solid #ffffff12; padding-top: 0.8rem; }
#power-rating-text { color: var(--accent-bright); }
.panel-banner { min-height: 230px; padding: clamp(1.25rem, 3vw, 2.25rem); border-color: #f4c55244; background-image: linear-gradient(90deg, #100d1cf5 0%, #100d1cdc 45%, #100d1c60 100%), url('../assets/hero-cutin.webp'); background-position: center, right 28%; }
.banner-copy { flex: 1 1 340px; min-width: 0; }
.banner-copy .eyebrow { margin-bottom: 0.8rem; }
.banner-copy h1 { font-size: clamp(1.5rem, 2.5vw, 2.25rem); line-height: 1.2; letter-spacing: 0.015em; margin-bottom: 0.8rem; }
.banner-copy p { font-size: 0.8rem; line-height: 1.8; max-width: 53ch; }
.cta-gold-btn { min-height: 46px; justify-content: center; line-height: 1.5; font-size: 0.75rem; box-shadow: 0 3px 16px #f4c55222, inset 0 1px 0 #ffffff80; border: 1px solid #ffecad77; }
.cycle-progress { border: 1px solid #ffffff10; background: #100d1cbf; border-radius: 10px; padding: 0.85rem 1rem; }
.cycle-progress-copy { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.3rem 1rem; }
#cycle-progress-label { font: 0.68rem var(--font-mono); color: var(--ink-soft); }
.cycle-steps { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 5px; margin-top: 0.65rem; }
.cycle-step { height: 4px; background: #ffffff12; border-radius: 2px; }
.cycle-step.reached { background: #b08a35; }
.cycle-step.current { background: #ffe184; box-shadow: 0 0 9px #f4c55260; }
.section-head { gap: 0.65rem 1rem; }
.section-head h2 { font-size: 0.88rem; line-height: 1.45; min-width: 0; letter-spacing: 0.025em; }
.section-head h2 .icon { color: var(--accent); }
.section-sub { font-size: 0.73rem; line-height: 1.6; }
.regimen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.regimen-card { --card-accent: var(--violet); padding: 1.15rem; text-align: left; cursor: pointer; gap: 0.85rem; border-color: #ffffff16; background: linear-gradient(145deg, #242034eb, #14111feF); box-shadow: inset 0 1px 0 #ffffff06; }
.card-str { --card-accent: #ff8198; }
.card-agi { --card-accent: var(--cyan); }
.card-rest { --card-accent: var(--emerald); }
.regimen-card::before { height: 2px; width: 100%; background: var(--card-accent) !important; opacity: 0.8; }
.regimen-icon { color: var(--card-accent); width: 2.5rem; height: 2.5rem; background: #ffffff06; border: 1px solid #ffffff0c; border-radius: 9px; flex-shrink: 0; }
.ap-cost-tag { font-size: 0.65rem; color: var(--ink-soft); background: #00000025; border-color: #ffffff14; text-align: right; }
.regimen-top { align-items: center; }
.regimen-title { margin: 0 0 0.5rem; font-size: 0.94rem; line-height: 1.45; letter-spacing: 0.015em; }
.regimen-desc { font-size: 0.76rem; line-height: 1.75; }
.regimen-gains { margin-top: auto; font-size: 0.65rem; gap: 0.3rem; }
.gain-chip { padding: 0.25rem 0.4rem; }
.regimen-action { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding-top: 0.8rem; border-top: 1px solid #ffffff12; font: 600 0.7rem/1.5 var(--font-text); color: var(--card-accent); }
.regimen-action > span { font-size: 1rem; }
.regimen-card:disabled { background: #161321df; border-color: #ffffff0c; cursor: not-allowed; }
.regimen-card:disabled::before { opacity: 0.25; }
.regimen-card:disabled .regimen-action { color: var(--ink-muted); }
.regimen-card:disabled:hover { transform: none; box-shadow: none; border-color: #ffffff0c; }
.sanctum-bottom-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.chronicle-box, .relics-box, .codex-card { padding: 1.1rem; gap: 1rem; background: linear-gradient(150deg, #201b2de8, #110e1de8); border-color: #ffffff12; }
.chronicle-list { max-height: 320px; scrollbar-width: thin; scrollbar-color: #77634d transparent; padding-right: 0.3rem; }
.chronicle-item { padding: 0.75rem; font-size: 0.73rem; line-height: 1.8; border-left-color: #9d7bff66; }
.needs-attention { border-color: var(--accent); color: var(--accent-bright); background: #f4c55215; }
.relic-item { display: block; padding: 0.8rem; }
.relic-name { font-size: 0.75rem; margin-bottom: 0.3rem; line-height: 1.5; }
.relic-bonus { display: block; font-size: 0.65rem; margin-top: 0.5rem; }
.relic-item.locked { border-style: dashed; }
.relic-item.locked .relic-bonus { color: var(--ink-muted); }
.view-heading { padding: 0.6rem 0 0.4rem; }
.view-heading h1 { font-size: clamp(1.3rem, 2.4vw, 1.9rem); line-height: 1.35; margin: 0.5rem 0; }
.view-heading p { font-size: 0.8rem; color: var(--ink-soft); margin: 0; }
.vn-episode-bar { padding: 1rem; gap: 0.75rem; }
.vn-episode-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 0.5rem; }
.vn-ep-btn { min-width: 0; border-radius: 8px; font: 600 0.7rem/1.6 var(--font-text); padding: 0.65rem; }
.vn-stage-center { padding-top: 1.5rem; }
.vn-character-sprite { height: 270px; max-width: 100%; }
.vn-dialogue-frame { padding: 1.5rem; border-color: #f4c55277; }
.vn-speaker-plate { max-width: 100%; font-size: 0.7rem; padding: 0.45rem 0.7rem; }
.vn-text { font-size: 0.92rem; line-height: 1.85; margin: 0.6rem 0 1.25rem; }
.vn-choice-btn { gap: 0.7rem 1rem; align-items: start; flex-wrap: wrap; padding: 0.9rem 1rem; font-size: 0.8rem; line-height: 1.7; }
.vn-choice-btn > :first-child { flex: 1 1 220px; }
.vn-choice-btn:hover { transform: none; box-shadow: inset 3px 0 0 var(--accent); }
.vn-choice-tag { font-size: 0.65rem; padding: 0.15rem 0.45rem; background: #00000030; border-radius: 4px; flex: 0 1 auto; }
.codex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.codex-card > img { width: 100%; }
.codex-card p, .codex-card li { line-height: 1.85; }
.field-label { width: 100%; font-size: 0.7rem; color: var(--ink-soft); }
.Commander-input { min-width: 0; width: 100%; flex: 1 1 100%; min-height: 46px; font-size: 1rem; }
.submit-score-form > button { width: 100%; }
.leader-row { align-items: start; gap: 0.75rem; padding: 0.8rem; flex-wrap: wrap; }
.leader-row > div { flex: 1 1 140px; min-width: 0; }
.leader-row > span { font-size: 0.78rem; max-width: 100%; }
.leader-row:first-child { border-color: #f4c55255; background: #f4c5520a; }
.toast-stack { right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); width: min(390px, calc(100% - 2rem)); }
.sim-toast { font-size: 0.77rem; line-height: 1.7; padding: 1rem; backdrop-filter: blur(16px); }
.cutin-overlay { overflow: hidden; }
.cutin-caption { max-width: min(850px, 84vw); padding: 1rem 1.25rem; }
.cutin-sub { font-size: clamp(0.55rem, 1.3vw, 0.75rem); letter-spacing: 0.15em; }
.cutin-title { font-size: clamp(1.2rem, 4vw, 2.5rem); line-height: 1.3; margin-top: 0.5rem; }
.sim-footer { padding: 1.25rem 1.5rem; font-size: 0.65rem; line-height: 1.8; }
.sim-footer-inner { align-items: start; }
.sim-footer-inner > :last-child { max-width: 76ch; }
/* The arena has independent, readable HTML status and menus, never scaled text. */
.arena-top-bar { padding: 1.2rem; gap: 1.2rem; }
.arena-top-bar > div:first-child { flex: 1 1 440px; min-width: 0; }
.arena-top-bar h2 { line-height: 1.5; margin-bottom: 0.4rem; }
.boss-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.boss-pill { justify-content: center; font: 600 0.75rem/1.5 var(--font-text); padding: 0.7rem; }
.boss-pill.defeated::after { content: '✓'; color: var(--emerald); }
.combat-toolbar { display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; }
.combat-toolbar .eyebrow { font-size: 0.6rem; }
.combat-toolbar kbd { color: var(--ink-muted); padding: 0.05rem 0.3rem; border: 1px solid #ffffff20; border-radius: 3px; }
.combat-toolbar button { flex-shrink: 0; }
.combat-hud { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.combatant-card { padding: 1rem 1.2rem; background: #151222ee; border: 1px solid #f4c55240; border-radius: 10px; }
.combatant-name { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 0.8rem; color: var(--accent-bright); font: 700 0.8rem/1.5 var(--font-display); overflow-wrap: anywhere; }
.combatant-role { font: 600 0.55rem/1.6 var(--font-text); color: var(--ink-muted); letter-spacing: 0.15em; }
.combat-meter { margin-top: 0.65rem; }
.meter-label { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--ink-soft); font-size: 0.65rem; flex-wrap: wrap; }
.meter-label > :last-child { font-family: var(--font-mono); color: var(--ink); }
.combat-hud .bar-fill { transition: width 0.1s linear; max-width: 100%; }
.opponent-card { border-color: #ff4d6d40; }
.opponent-card .combatant-name { color: #ffa5b6; }
.boss-hp-fill { background: linear-gradient(90deg, #be2951, #ff6b87); }
.posture-fill { background: linear-gradient(90deg, #2788ab, #5ce1e6); }
.arena-viewport { height: auto; aspect-ratio: 1024 / 540; background: #0d0a16 url('../assets/bg-arena.webp') center / cover; }
#duel-canvas { width: 100%; height: 100%; aspect-ratio: 1024 / 540; }
.duel-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 1.25rem; background: #080611a8; overflow-y: auto; }
.duel-dialog { width: min(100%, 480px); text-align: center; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid #f4c55270; border-radius: 14px; background: linear-gradient(145deg, #262035f5, #100c1bf5); box-shadow: 0 20px 80px #000a, inset 0 1px 0 #ffffff15; }
.duel-sigil { font-size: 1.8rem; color: var(--accent); margin-bottom: 0.65rem; }
.duel-dialog h2 { font-size: clamp(1.1rem, 2.2vw, 1.6rem); line-height: 1.35; margin: 0.6rem 0; }
.duel-dialog p { color: var(--ink-soft); font-size: 0.8rem; line-height: 1.75; }
.duel-reward { font: 0.7rem/1.7 var(--font-text); color: var(--emerald); background: #38d39908; border: 1px solid #38d39920; padding: 0.5rem; border-radius: 6px; margin: 0.8rem 0 1rem; overflow-wrap: anywhere; }
.duel-dialog .cta-gold-btn { width: 100%; }
.dialog-hint { display: block; font-size: 0.6rem; color: var(--ink-muted); margin-top: 0.65rem; }
.arena-tip { display: flex; gap: 0.6rem; align-items: center; font-size: 0.7rem; color: var(--ink-soft); padding: 0.1rem 0.3rem; }
.arena-tip .icon { color: var(--cyan); font-size: 1rem; }
.arena-controls-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0.85rem; gap: 1rem; }
.move-pad, .skill-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.ctrl-btn { flex-direction: column; min-width: 0; min-height: 78px; padding: 0.65rem 0.3rem; text-align: center; justify-content: center; font: 600 0.7rem/1.4 var(--font-text); touch-action: none; overflow-wrap: anywhere; }
.ctrl-btn .icon { font-size: 1.05rem; }
.ctrl-btn:disabled { opacity: 0.45; transform: none; box-shadow: none; }
.ctrl-btn.is-ready { box-shadow: inset 0 0 20px #f4c55225, 0 0 16px #f4c55225; }
.key-hint { display: block; font-size: 0.58rem; margin-top: auto; }
@media (min-width: 1200px) { .panel-banner > div:last-child { align-self: flex-end; } }
@media (max-width: 1100px) {
  .hud-inner { gap: 1rem; }
  .sim-main { grid-template-columns: 270px minmax(0, 1fr); gap: 1.1rem; }
  .sanctum-bottom-grid, .codex-grid { grid-template-columns: minmax(0, 1fr); }
  .regimen-card { padding: 1rem; }
  .regimen-top { flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .hud-inner { grid-template-columns: minmax(0, 1fr) auto; }
  .cycle-tracker { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  .hud-stats { grid-row: 3; }
  .hud-actions { grid-column: 2; grid-row: 1; }
  .sim-main { grid-template-columns: minmax(0, 1fr); }
  .view-column { grid-row: 1; }
  .knight-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .knight-stage-card { min-height: 0; }
  .knight-portrait { max-height: 260px; }
  .regimen-top { flex-wrap: nowrap; }
  .sanctum-bottom-grid, .codex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-tab { font-size: 0.7rem; }
  .arena-controls-bar { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
  .ctrl-btn { min-height: 66px; }
  .arena-viewport.has-overlay { min-height: 390px; aspect-ratio: auto; }
  .has-overlay #duel-canvas { position: absolute; top: 50%; height: auto; transform: translateY(-50%); }
}
@media (max-width: 600px) {
  .hud-inner { padding: 0.85rem; gap: 0.7rem; }
  .brand-cluster { gap: 0.5rem; }
  .brand-emblem { width: 2rem; height: 2rem; font-size: 0.9rem; }
  .brand-title { font-size: 0.88rem; letter-spacing: 0.035em; }
  .brand-sub { font-size: 0.48rem; letter-spacing: 0.04em; }
  .hud-actions { gap: 0.2rem; }
  .icon-btn { width: 40px; min-height: 44px; border: 0; }
  .cycle-tracker { padding: 0.5rem 0.65rem; gap: 0.4rem; }
  .day-badge { font-size: 0.75rem; }
  .phase-badge { font-size: 0.65rem; }
  .hud-stats { gap: 0.3rem; }
  .stat-pill { flex-direction: column; gap: 0.2rem; padding: 0.55rem 0.15rem; }
  .stat-pill .icon { font-size: 0.85rem; }
  .stat-label { display: block; font-size: 0.5rem; }
  .stat-val { margin: 0; font-size: 0.8rem; line-height: 1.3; }
  .mode-nav-inner { padding: 0 0.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-tab { min-height: 48px; padding: 0.6rem 0.35rem; font-size: 0.67rem; gap: 0.35rem; }
  .sim-main { padding: 1rem 0.85rem; gap: 1.5rem; }
  .view-panel { gap: 1rem; }
  .panel-banner { min-height: 0; padding: 1.4rem; }
  .banner-copy h1 { font-size: 1.65rem; }
  .banner-copy p { font-size: 0.76rem; }
  .panel-banner > div:last-child, #btn-quick-duel { width: 100%; }
  .regimen-grid { grid-template-columns: minmax(0, 1fr); gap: 0.8rem; }
  .regimen-card { padding: 1.2rem; }
  .regimen-desc { font-size: 0.8rem; }
  .regimen-title { font-size: 1rem; }
  .sanctum-bottom-grid, .codex-grid, .knight-column { grid-template-columns: minmax(0, 1fr); }
  .section-head h2 { font-size: 0.86rem; }
  .vn-episode-tabs { grid-template-columns: minmax(0, 1fr); }
  .vn-ep-btn { text-align: left; }
  #btn-vn-voice { width: 100%; }
  .vn-stage-center { padding-top: 0.8rem; }
  .vn-character-sprite { height: 210px; }
  .vn-dialogue-frame { margin: 0 0.65rem 0.65rem; padding: 1rem; }
  .vn-text { font-size: 0.85rem; }
  .vn-choice-btn { padding: 0.85rem; }
  .vn-choice-tag { font-size: 0.65rem; }
  .arena-top-bar { padding: 1rem; }
  .arena-top-bar h2 { font-size: 0.9rem !important; align-items: start !important; }
  .arena-top-bar h2 .icon { margin-top: 0.25rem; }
  .boss-selector { grid-template-columns: minmax(0, 1fr); }
  .boss-pill { justify-content: start; }
  .combat-hud { gap: 0.5rem; }
  .combatant-card { padding: 0.75rem; }
  .combatant-name { font-size: 0.62rem; min-height: 2.8em; }
  .combatant-role { display: none; }
  .meter-label { font-size: 0.58rem; gap: 0.2rem; }
  .combat-toolbar .eyebrow { font-size: 0.55rem; letter-spacing: 0.08em; }
  .combat-toolbar kbd { display: none; }
  .arena-viewport { height: auto; }
  .arena-viewport.has-overlay { min-height: 0; }
  .has-overlay #duel-canvas { visibility: hidden; }
  .duel-overlay { position: relative; padding: 1rem; }
  .duel-dialog { padding: 1.25rem; }
  .duel-dialog .eyebrow { font-size: 0.58rem; }
  .arena-controls-bar { padding: 0.6rem; }
  .ctrl-btn { font-size: 0.63rem; min-height: 68px; }
  .key-hint { font-size: 0.55rem; }
  .toast-stack { bottom: max(0.75rem, env(safe-area-inset-bottom)); right: 0.75rem; width: calc(100% - 1.5rem); }
  .mode-arena-bg .toast-stack { top: max(0.75rem, env(safe-area-inset-top)); bottom: auto; }
}
@media (max-width: 360px) {
  .hud-inner { padding: 0.65rem; }
  .brand-emblem { display: none; }
  .brand-title { font-size: 0.85rem; }
  .brand-sub { font-size: 0.45rem; }
  .icon-btn { width: 38px; }
  .regimen-top { flex-wrap: wrap; }
}
@media (hover: none) {
  .regimen-card:hover, .cta-gold-btn:hover, .icon-btn:hover { transform: none; }
}

/* --- Guided Campaign Compass & Interconnected Flow UI --- */
.campaign-compass {
  background: linear-gradient(135deg, rgba(22, 18, 38, 0.96) 0%, rgba(12, 10, 22, 0.96) 100%);
  border: 1px solid rgba(244, 197, 82, 0.45);
  border-radius: 14px;
  padding: 1.05rem 1.25rem;
  margin-bottom: 1.15rem;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), inset 0 0 24px rgba(244, 197, 82, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.compass-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.compass-title {
  margin: 0.2rem 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  color: #fff;
  letter-spacing: 0.03em;
}

.compass-desc {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  max-width: 68ch;
  line-height: 1.45;
}

.compass-cta {
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: 0 0 22px rgba(244, 197, 82, 0.35);
}

.compass-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.compass-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.compass-step:hover {
  border-color: rgba(244, 197, 82, 0.4);
  color: var(--text-primary);
}

.compass-step .step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.compass-step.is-done {
  border-color: rgba(62, 224, 161, 0.38);
  background: rgba(62, 224, 161, 0.08);
  color: #8bf3c8;
}

.compass-step.is-done .step-num {
  background: rgba(62, 224, 161, 0.22);
  color: #3ee0a1;
}

.compass-step.active {
  border-color: var(--gold);
  background: rgba(244, 197, 82, 0.14);
  color: #fff;
  box-shadow: 0 0 16px rgba(244, 197, 82, 0.2);
}

.compass-step.active .step-num {
  background: var(--gold);
  color: #120d1d;
}

.nav-badge.is-next-badge {
  background: var(--gold) !important;
  color: #130e1e !important;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(244, 197, 82, 0.55);
}

/* Sanctum Chapter Training Checklist Card */
.training-goals-card {
  background: rgba(18, 15, 32, 0.9);
  border: 1px solid rgba(157, 123, 255, 0.35);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.training-goals-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.training-goals-header h3 {
  margin: 0.2rem 0 0;
  font-size: 0.96rem;
  color: #fff;
}

.shards-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  background: rgba(244, 197, 82, 0.12);
  border: 1px solid rgba(244, 197, 82, 0.4);
  color: var(--gold);
  font-size: 0.78rem;
}

.goal-req-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.goal-req-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.48rem 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.goal-req-pill.is-met {
  border-color: rgba(62, 224, 161, 0.45);
  background: rgba(62, 224, 161, 0.11);
  color: #9ef7d2;
}

.goal-req-pill.is-pending {
  border-color: rgba(244, 197, 82, 0.45);
  background: rgba(244, 197, 82, 0.1);
  color: var(--gold-bright);
}

.goal-req-status {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.42rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
}

.training-goals-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.2rem;
}

/* Regimen Card Enhancements */
.regimen-card.is-recommended {
  border-color: rgba(244, 197, 82, 0.65);
  box-shadow: 0 8px 26px rgba(244, 197, 82, 0.14), inset 0 0 18px rgba(244, 197, 82, 0.06);
}

.regimen-rec-badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.48rem;
  border-radius: 999px;
  background: rgba(244, 197, 82, 0.2);
  border: 1px solid rgba(244, 197, 82, 0.55);
  color: var(--gold-bright);
}

.regimen-actions-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.55rem;
}

.regimen-train-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.52rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(244, 197, 82, 0.45);
  background: rgba(244, 197, 82, 0.14);
  color: var(--gold-bright);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.regimen-train-btn:hover:not(:disabled) {
  background: var(--gold);
  color: #140f21;
}

.regimen-train-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.regimen-upgrade-btn {
  padding: 0.52rem 0.62rem;
  border-radius: 8px;
  border: 1px solid rgba(157, 123, 255, 0.4);
  background: rgba(157, 123, 255, 0.12);
  color: #d3c2ff;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.regimen-upgrade-btn:hover:not(:disabled) {
  background: rgba(157, 123, 255, 0.28);
  color: #fff;
}

.regimen-upgrade-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.regimen-max-pill {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--emerald);
  padding: 0.35rem 0.5rem;
}

/* Story Episode Tabs & Boss Selector Grid for 6 Chapters */
.vn-episode-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 0.38rem;
  width: 100%;
}

.vn-ep-btn.is-next-ep {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(244, 197, 82, 0.3);
}

.boss-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.boss-pill.is-current-trial {
  border-color: var(--gold);
}

/* Duel Dialog Guided Action Buttons */
.duel-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
}

.duel-guide-btn.is-primary-guide {
  background: linear-gradient(135deg, #f4c552 0%, #d49b27 100%);
  color: #130e1e;
  border-color: #ffe08a;
  font-weight: 800;
  box-shadow: 0 0 20px rgba(244, 197, 82, 0.4);
}

@media (max-width: 760px) {
  .compass-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .boss-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- Checkup fixes: reset dialog, relic archive, leaderboard --- */
.reset-modal {
  position: fixed; inset: 0; z-index: 900;
  display: grid; place-items: center; padding: 1rem;
  background: rgba(4, 3, 10, 0.78); backdrop-filter: blur(6px);
}
.reset-modal[hidden] { display: none; }
.reset-dialog {
  width: min(420px, 100%);
  background: linear-gradient(160deg, rgba(28, 22, 44, 0.98), rgba(12, 10, 20, 0.98));
  border: 1px solid rgba(244, 197, 82, 0.4); border-radius: 12px;
  padding: 1.4rem 1.3rem; text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.reset-dialog h2 { margin: 0.4rem 0; font-family: 'Cinzel', serif; color: #f4c552; font-size: 1.2rem; }
.reset-dialog p { margin: 0 0 1rem; font-size: 0.86rem; color: rgba(230, 224, 245, 0.78); line-height: 1.5; }
.reset-dialog-icon { font-size: 1.8rem; color: #f4c552; }
.reset-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

.codex-relics-card { grid-column: 1 / -1; }
.codex-relics-grid {
  display: grid; gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
}
.codex-relic-card {
  padding: 0.7rem 0.8rem; border-radius: 8px;
  border: 1px solid rgba(244, 197, 82, 0.35);
  background: rgba(244, 197, 82, 0.06); min-width: 0;
}
.codex-relic-card.locked { opacity: 0.5; filter: grayscale(0.7); border-style: dashed; }
.codex-relic-card .relic-top { display: flex; align-items: center; gap: 0.45rem; }
.codex-relic-card h4 { margin: 0; font-size: 0.86rem; overflow-wrap: anywhere; }
.codex-relic-card .relic-bonus { display: block; margin: 0.3rem 0; font-size: 0.72rem; color: #f4c552; letter-spacing: 0.04em; }
.codex-relic-card p { margin: 0; font-size: 0.74rem; color: rgba(230, 224, 245, 0.7); }

.leaderboard-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.leaderboard-list li {
  display: flex; align-items: center; gap: 0.6rem; min-width: 0;
  padding: 0.45rem 0.65rem; border-radius: 6px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.06); font-size: 0.8rem;
}
.leaderboard-list .lb-rank { width: 1.6rem; color: #f4c552; font-weight: 700; flex: none; }
.leaderboard-list .lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-list .lb-meta { flex: none; color: rgba(230, 224, 245, 0.65); font-size: 0.72rem; }
