:root {
  --bg-deep: #0b090d;
  --bg-panel: #15111a;
  --bg-panel-2: #1f1927;
  --border-gold: #c9973e;
  --border-subtle: #332a3e;
  --text-main: #f4efe6;
  --text-dim: #b4a9be;
  --accent-gold: #f5b942;
  --accent-crimson: #e03c3c;
  --accent-jade: #3cd08b;
  --accent-cyan: #5bc8f5;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

/* Fluid root size: exactly 16px at the 1280px-wide reference viewport (e.g. a 4K TV at 300% scaling) and below,
   scaling every rem-based size up proportionally on larger viewports (bound by width or height, so the whole
   layout keeps the reference proportions). */
html {
  font-size: max(16px, min(1.25vw, 2.6vh));
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(168, 42, 42, 0.16), transparent 55%),
    radial-gradient(circle at 80% 100%, rgba(201, 151, 62, 0.1), transparent 45%),
    var(--bg-deep);
  color: var(--text-main);
  font-family: var(--sans);
  -webkit-user-select: none;
  user-select: none;
}

.hidden {
  display: none !important;
}

body.hide-cursor,
body.hide-cursor *,
.app-shell.hide-cursor,
.app-shell.hide-cursor * {
  cursor: none !important;
}

.app-shell {
  height: 100dvh;
  width: 100vw;
  max-width: 70rem;
  margin: 0 auto;
  padding: 0.625rem 1rem 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.brand-seal {
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 0.375rem;
  background: linear-gradient(145deg, #c92b2b, #871616);
  border: 0.125rem solid var(--accent-gold);
  display: grid;
  place-items: center;
  font-size: 1.1875rem;
  font-weight: 800;
  color: #fff3d6;
  box-shadow: 0 0.125rem 0.625rem rgba(224, 60, 60, 0.35);
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-titles h1 {
  font-size: 1.08rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--accent-gold);
  line-height: 1.1;
}

.version-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.125rem 0.4375rem;
  border-radius: 0.3125rem;
  background: rgba(245, 185, 66, 0.14);
  color: var(--accent-gold);
  border: 0.0625rem solid rgba(201, 151, 62, 0.45);
  text-decoration: none;
  line-height: 1.3;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.version-badge:hover {
  border-color: var(--accent-gold);
  background: rgba(245, 185, 66, 0.24);
}

.brand-sub {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--text-dim);
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.625rem;
  border-radius: 62.4375rem;
  border: 0.0625rem solid var(--border-subtle);
  background: var(--bg-panel);
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--text-dim);
}

.pill-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #635870;
}

.status-pill.connected {
  border-color: rgba(60, 208, 139, 0.45);
  color: var(--accent-jade);
}

.status-pill.connected .pill-dot {
  background: var(--accent-jade);
  box-shadow: 0 0 0.5rem var(--accent-jade);
}

.ui-btn {
  padding: 0.375rem 0.6875rem;
  border-radius: 0.375rem;
  border: 0.0625rem solid var(--border-subtle);
  background: var(--bg-panel-2);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}

.ui-btn:hover {
  border-color: var(--border-gold);
  background: #2b2236;
}

.ui-btn:active {
  transform: translateY(0.0625rem);
}

.ui-btn:disabled {
  opacity: 0.36;
  cursor: default;
  pointer-events: none;
}

.ui-btn.is-muted {
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(20, 16, 26, 0.72);
}

.top-privacy-link,
.top-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  text-decoration: none;
  opacity: 0.58;
  padding: 0.125rem 0.25rem;
  border-radius: 0.3125rem;
  transition: opacity 0.14s ease, color 0.14s ease;
}

.top-home-link {
  font-size: 0.66rem;
  white-space: nowrap;
}

.top-privacy-link:hover,
.top-home-link:hover {
  opacity: 1;
  color: var(--accent-gold);
}

.app-shell[data-phase="title"] .arcade-hud,
.app-shell[data-phase="intro_cutscene"] .arcade-hud,
.app-shell[data-phase="descendant_cutscene"] .arcade-hud,
.app-shell[data-phase="descendant_select"] .arcade-hud {
  opacity: 0.7;
  filter: saturate(0.4);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

/* Main Cabinet Container */
.cabinet-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: linear-gradient(180deg, #191420 0%, #110d16 100%);
  border: 0.125rem solid #3c2f47;
  border-radius: 0.75rem;
  padding: 0.625rem 0.75rem;
  box-shadow: 0 1.125rem 2.8125rem rgba(0, 0, 0, 0.6), inset 0 0.0625rem 0 rgba(255, 224, 150, 0.08);
}

/* Arcade HUD */
.arcade-hud {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4375rem;
  background: #0d0a11;
  border: 0.0625rem solid #2e2438;
  border-radius: 0.5rem;
  padding: 0.4375rem 0.75rem;
}

.hud-row {
  display: grid;
  gap: 0.75rem;
  align-items: center;
}

.hud-scores {
  grid-template-columns: 0.95fr 0.95fr 0.95fr 1.35fr 1.05fr 0.75fr;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
}

.hud-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.hud-value {
  font-family: var(--mono);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-main);
}

.accent-gold {
  color: var(--accent-gold);
}

.accent-jade {
  color: var(--accent-jade);
}

.floor-badge-row,
.lives-loop-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.hud-floor-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1875rem;
  line-height: 1;
  padding: 0.0625rem 0.4375rem;
  border-radius: 0.3125rem;
  background: rgba(14, 42, 64, 0.92);
  border: 0.0625rem solid rgba(91, 200, 245, 0.72);
  box-shadow: 0 0 0.625rem rgba(91, 200, 245, 0.16);
}

.hud-floor-badge .floor-word {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #7dd3fc;
}

.hud-floor-badge .floor-num {
  font-size: 1.24rem;
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0.01em;
  color: #ffffff;
  text-shadow: 0 0 0.5rem rgba(91, 200, 245, 0.45);
}

.hud-floor-badge .floor-total {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(186, 230, 253, 0.74);
}

.dir-tag,
.loop-tag {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 0.0625rem 0.3125rem;
  border-radius: 0.25rem;
  background: #1a1423;
  border: 0.0625rem solid #352b44;
  color: #84c7e8;
}

.loop-tag {
  color: var(--accent-gold);
}

.hud-time-stat {
  align-items: flex-end;
}

.time-val {
  font-size: 1.15rem;
  color: #ffe28a;
}

.time-val.urgent {
  color: #ff4f4f;
}

/* Energy Bars */
.hud-bars {
  grid-template-columns: 1.25fr 1fr 1.25fr;
}

.energy-block,
.progress-block {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
  min-width: 0;
}

.bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.375rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.bar-name {
  color: #eae0d0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-role {
  font-size: 0.84em;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.bar-pct {
  font-family: var(--mono);
  color: var(--text-dim);
  flex-shrink: 0;
}

.energy-track {
  height: 0.75rem;
  background: #1e1726;
  border: 0.0625rem solid #493b59;
  border-radius: 0.25rem;
  overflow: hidden;
  padding: 0.0625rem;
}

.energy-fill {
  height: 100%;
  border-radius: 0.125rem;
  transition: width 0.08s linear;
}

.player-fill {
  background: linear-gradient(90deg, #d63333 0%, #f5b942 100%);
}

.boss-fill {
  background: linear-gradient(90deg, #9d28b8 0%, #ef4444 100%);
}

/* Pagoda Melee 10/11-Fighter HUD Grid */
.app-shell[data-melee="true"] .arcade-hud .hud-scores,
.app-shell[data-melee="true"] .arcade-hud .hud-bars {
  display: none;
}

.app-shell[data-melee="true"] .arcade-hud {
  padding: 0.3125rem 0.625rem;
}

.melee-hud-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.3125rem 0.5rem;
  width: 100%;
}

.melee-hud-grid.has-player {
  grid-template-columns: 1.18fr repeat(5, minmax(0, 1fr));
}

.melee-hud-card.player-card {
  grid-row: 1 / 3;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.5rem;
  border-color: rgba(56, 189, 248, 0.72);
  background: linear-gradient(180deg, #161d2e 0%, #10131f 100%);
}

.melee-hud-card.player-card .melee-hud-head {
  font-size: 0.74rem;
}

.melee-hud-card.player-card .melee-hud-name {
  color: #e0f2fe;
}

.melee-hud-card.player-card .melee-hud-track {
  height: 0.5rem;
}

.melee-hud-card.player-card .melee-hud-fill {
  background: linear-gradient(90deg, #d63333 0%, #f5b942 62%, #38bdf8 100%);
}

.melee-hud-card.player-card.winner {
  border-color: #3cd08b;
}

.melee-hud-card.player-card.ko {
  border-color: #4c1d24;
  background: #140b0f;
}

.melee-hud-card {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
  padding: 0.1875rem 0.375rem;
  border-radius: 0.3125rem;
  background: #14101c;
  border: 0.0625rem solid #352b44;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.melee-hud-card.waiting {
  opacity: 0.52;
  border-style: dashed;
}

.melee-hud-card.active {
  border-color: rgba(245, 185, 66, 0.55);
}

.melee-hud-card.ko {
  opacity: 0.36;
  border-color: #2c1e24;
  background: #120c10;
}

.melee-hud-card.winner {
  border-color: #3cd08b;
  box-shadow: 0 0 0.5rem rgba(60, 208, 139, 0.35);
}

.melee-hud-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  font-family: var(--mono);
  font-size: 0.67rem;
  font-weight: 800;
  line-height: 1.1;
}

.melee-hud-name {
  color: #f4efe6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.melee-hud-card.ko .melee-hud-name {
  text-decoration: line-through;
  color: #9e8a95;
}

.melee-hud-pct {
  flex-shrink: 0;
  color: #ffd57a;
}

.melee-hud-card.waiting .melee-hud-pct {
  color: #94a3b8;
}

.melee-hud-card.ko .melee-hud-pct {
  color: #f87171;
}

.melee-hud-card.winner .melee-hud-pct {
  color: #3cd08b;
}

.melee-hud-track {
  height: 0.375rem;
  background: #17121e;
  border: 0.0625rem solid #3a2f47;
  border-radius: 0.1875rem;
  overflow: hidden;
}

.melee-hud-fill {
  height: 100%;
  border-radius: 0.125rem;
  background: linear-gradient(90deg, #ef4444 0%, #f5b942 55%, #3cd08b 100%);
  transition: width 0.08s linear;
}

.progress-track {
  position: relative;
  height: 0.75rem;
  background: #17121e;
  border: 0.0625rem solid #3a2f47;
  border-radius: 0.25rem;
  overflow: hidden;
}

.trap-zone-half {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 50%;
  background: repeating-linear-gradient(
    -45deg,
    rgba(245, 185, 66, 0.16),
    rgba(245, 185, 66, 0.16) 0.3125rem,
    rgba(224, 60, 60, 0.16) 0.3125rem,
    rgba(224, 60, 60, 0.16) 0.625rem
  );
  border-right: 0.0625rem dashed rgba(245, 185, 66, 0.55);
}

.progress-marker {
  position: absolute;
  top: 0.0625rem;
  bottom: 0.0625rem;
  width: 0.5rem;
  margin-left: -0.25rem;
  border-radius: 0.125rem;
  background: var(--accent-jade);
  box-shadow: 0 0 0.375rem var(--accent-jade);
}

.boss-marker {
  position: absolute;
  top: 0.0625rem;
  bottom: 0.0625rem;
  width: 0.5rem;
  margin-left: -0.25rem;
  border-radius: 0.125rem;
  background: var(--accent-crimson);
}

/* Canvas Stage */
.canvas-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #08060a;
  border: 0.125rem solid #2d2338;
  border-radius: 0.5rem;
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Stage Overlays */
.stage-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 7, 14, 0.86);
  backdrop-filter: blur(0.25rem);
  display: flex;
  overflow-y: auto;
  padding: 0.625rem 1rem;
  z-index: 10;
}

.title-card,
.modal-card {
  margin: auto;
  width: min(47.5rem, 100%);
  background: linear-gradient(180deg, #1b1523 0%, #130e19 100%);
  border: 0.125rem solid var(--border-gold);
  border-radius: 0.75rem;
  padding: 1rem 1.375rem;
  box-shadow: 0 1.375rem 3.125rem rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Full-bleed Imperial Pagoda backdrop for Main Menu (clearly distinct from Pause modal) */
#title-overlay.title-screen-overlay {
  padding: 0;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(168, 28, 42, 0.42) 0%, rgba(20, 11, 24, 0.96) 68%),
    linear-gradient(180deg, #1d0c16 0%, #0b0710 100%);
  backdrop-filter: none;
}

#title-overlay.title-screen-overlay .title-card {
  width: 100%;
  min-height: 100%;
  border: none;
  border-top: 0.1875rem solid var(--border-gold);
  border-bottom: 0.1875rem solid var(--border-gold);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  justify-content: center;
  padding: 0.5rem min(2.25rem, 3vw);
}

#title-overlay.title-screen-overlay .title-card > * {
  width: min(62rem, 100%);
  margin-left: auto;
  margin-right: auto;
}

#title-overlay.title-screen-overlay .title-actions {
  width: min(64rem, 100%);
}

.modal-card.compact {
  width: min(27.5rem, 100%);
  text-align: center;
}

/* Distinct Cool Slate/Cyan Pause Overlay */
.modal-card.pause-card {
  background: linear-gradient(180deg, #112236 0%, #09131f 100%);
  border: 0.125rem solid var(--accent-cyan);
  box-shadow: 0 1.375rem 3.375rem rgba(0, 0, 0, 0.85), 0 0 1.75rem rgba(91, 200, 245, 0.18);
}

.pause-badge {
  align-self: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--accent-cyan);
  background: rgba(91, 200, 245, 0.14);
  border: 0.0625rem solid rgba(91, 200, 245, 0.45);
  border-radius: 62.4375rem;
  padding: 0.1875rem 0.75rem;
}

.pause-card h2 {
  color: #e6f6ff;
  letter-spacing: 0.1em;
}

.primary-btn.pause-resume-btn {
  border-color: #93e2ff;
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  box-shadow: 0 0.375rem 1.125rem rgba(14, 165, 233, 0.35);
}

.title-hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.title-hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
  min-width: 0;
}

.title-crest {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--accent-gold);
  text-align: right;
}

.title-logo {
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-align: left;
  white-space: nowrap;
  background: linear-gradient(180deg, #fff5d6 0%, #f5b942 52%, #d96426 100%);
  background-clip: text;
  color: transparent;
  line-height: 1.02;
}

.title-hero-meta .title-sub {
  text-align: right;
  font-size: 0.88rem;
  line-height: 1.3;
}

@media (max-width: 720px) {
  .title-hero-row {
    flex-direction: column;
    gap: 0.25rem;
  }
  .title-hero-meta {
    align-items: center;
  }
  .title-crest,
  .title-logo,
  .title-hero-meta .title-sub {
    text-align: center;
  }
}

.title-sub,
.modal-sub {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.score-showcase {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.625rem;
}

.showcase-box {
  background: #100c15;
  border: 0.0625rem solid #352a42;
  border-radius: 0.5rem;
  padding: 0.375rem 0.625rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}

.showcase-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.showcase-num {
  font-family: var(--mono);
  font-size: 1.08rem;
  font-weight: 800;
}

.showcase-num.gold {
  color: var(--accent-gold);
}

.showcase-num.jade {
  color: var(--accent-jade);
}

.showcase-num.muted {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.control-col {
  background: rgba(13, 10, 17, 0.72);
  border: 0.0625rem solid #2e243a;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.control-col h3 {
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  margin-bottom: 0.375rem;
}

.control-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.86rem;
  color: #dfd7cb;
}

kbd {
  display: inline-block;
  padding: 0.0625rem 0.3125rem;
  border-radius: 0.25rem;
  background: #271f31;
  border: 0.0625rem solid #4c3e5e;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: #fff3d6;
}

.hero-select-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 0.125rem;
}

.hero-select-wrap.hidden {
  display: none;
}

.hero-select-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.4375rem;
  border: 0.0625rem solid rgba(245, 185, 66, 0.34);
  background: rgba(11, 15, 28, 0.78);
  box-shadow: inset 0 0.0625rem 0 rgba(255, 255, 255, 0.06);
}

.hero-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.125rem 0.625rem 0.125rem 0.3125rem;
  border-radius: 0.3125rem;
  border: 0.09375rem solid rgba(255, 255, 255, 0.16);
  background: rgba(24, 30, 50, 0.72);
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.025rem;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, color 0.14s ease;
}

.hero-option:hover {
  border-color: rgba(245, 185, 66, 0.58);
  background: rgba(34, 42, 68, 0.88);
  color: #f8fafc;
}

#btn-hero-chenhao.active {
  background: linear-gradient(135deg, rgba(165, 29, 36, 0.86), rgba(180, 92, 18, 0.84));
  border-color: #f5b942;
  box-shadow: 0 0 0.6875rem rgba(245, 185, 66, 0.42);
  color: #fff8e7;
}

#btn-hero-xiaolian.active {
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.86), rgba(14, 116, 144, 0.86));
  border-color: #38bdf8;
  box-shadow: 0 0 0.6875rem rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
}

#btn-hero-slot3.active {
  background: linear-gradient(135deg, rgba(153, 27, 27, 0.90), rgba(180, 83, 9, 0.86));
  border-color: #f87171;
  box-shadow: 0 0 0.75rem rgba(248, 113, 113, 0.50);
  color: #fef2f2;
}

#btn-hero-slot4.active {
  background: linear-gradient(135deg, rgba(143, 29, 69, 0.92), rgba(161, 98, 7, 0.84));
  border-color: #f3c64d;
  box-shadow: 0 0 0.75rem rgba(243, 198, 77, 0.48);
  color: #fef3c7;
}

.hero-option.hidden {
  display: none;
}

.hero-portrait-canvas {
  display: block;
  width: 3rem;
  height: 3.125rem;
  border-radius: 0.25rem;
  background: rgba(8, 11, 20, 0.65);
  pointer-events: none;
}

.hero-option-name {
  white-space: nowrap;
}

.hero-select-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.3125rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01875rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 4;
  background: rgba(15, 23, 42, 0.94);
  border: 0.09375rem solid #f5b942;
  color: #fef3c7;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.55);
}

.hero-select-hint.side-chenhao {
  right: calc(100% + 0.625rem);
}

.hero-select-hint.side-xiaolian {
  left: calc(100% + 0.625rem);
  border-color: #38bdf8;
  color: #e0f2fe;
}

.hero-select-hint.side-slot3 {
  left: calc(100% + 0.625rem);
  border-color: #f87171;
  color: #fee2e2;
}

.hero-select-hint.side-slot4 {
  left: calc(100% + 0.625rem);
  border-color: #f3c64d;
  color: #fef3c7;
}

.hero-select-hint.hidden {
  display: none;
}

.title-actions,
.modal-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.125rem;
}

.melee-actions-row {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-basis: 100%;
}

.melee-actions-row.hidden {
  display: none;
}

.title-secondary-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-basis: 100%;
}

.descendant-card {
  width: min(40rem, 100%);
  text-align: center;
  background: linear-gradient(180deg, #1d1527 0%, #110c19 100%);
  border: 0.125rem solid var(--border-gold);
}

.descendant-card.three-up {
  width: min(48.75rem, 100%);
}

.descendant-card.four-up {
  width: min(55rem, 100%);
}

.descendant-card .title-crest {
  text-align: center;
}

.descendant-card h2 {
  font-size: 1.45rem;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
}

.descendant-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem;
  margin: 0.25rem 0;
}

.descendant-choices.one-up {
  grid-template-columns: minmax(0, 18rem);
  justify-content: center;
}

.descendant-choices.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.descendant-choices.four-up {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.625rem;
}

.descendant-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.75rem 0.875rem;
  border-radius: 0.625rem;
  border: 0.125rem solid rgba(255, 255, 255, 0.18);
  background: rgba(16, 13, 24, 0.88);
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.descendant-option:hover,
.descendant-option.active {
  transform: translateY(-0.125rem);
}

.descendant-option.hero-chenhao:hover,
.descendant-option.hero-chenhao.active {
  border-color: #f5b942;
  background: linear-gradient(160deg, rgba(165, 29, 36, 0.42), rgba(120, 53, 15, 0.56));
  box-shadow: 0 0 1.125rem rgba(245, 185, 66, 0.38);
}

.descendant-option.hero-xiaolian:hover,
.descendant-option.hero-xiaolian.active {
  border-color: #38bdf8;
  background: linear-gradient(160deg, rgba(29, 78, 216, 0.42), rgba(14, 116, 144, 0.54));
  box-shadow: 0 0 1.125rem rgba(56, 189, 248, 0.42);
}

.descendant-option.hero-slot3:hover,
.descendant-option.hero-slot3.active {
  border-color: #f87171;
  background: linear-gradient(160deg, rgba(153, 27, 27, 0.46), rgba(180, 83, 9, 0.52));
  box-shadow: 0 0 1.125rem rgba(248, 113, 113, 0.46);
}

.descendant-option.hero-slot4:hover,
.descendant-option.hero-slot4.active {
  border-color: #f3c64d;
  background: linear-gradient(160deg, rgba(143, 29, 69, 0.54), rgba(146, 64, 14, 0.44));
  box-shadow: 0 0 1.125rem rgba(243, 198, 77, 0.44);
}

.descendant-portrait {
  display: block;
  width: 4.5rem;
  height: 4.6875rem;
  border-radius: 0.4375rem;
  background: rgba(8, 11, 20, 0.72);
  border: 0.0625rem solid rgba(255, 255, 255, 0.12);
}

.descendant-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff6dc;
}

.descendant-traits {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.35;
}

.descendant-hint {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--accent-gold);
  letter-spacing: 0.06em;
  opacity: 0.92;
}

.continue-loop-pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #dbeafe;
  background: rgba(30, 58, 138, 0.72);
  border: 0.0625rem solid #60a5fa;
  border-radius: 0.3125rem;
  padding: 0.125rem 0.5rem;
}

#continue-overlay .descendant-card,
#melee-hero-overlay .descendant-card {
  padding: 0.625rem 1.25rem;
  gap: 0.3125rem;
}

#continue-overlay .descendant-card h2,
#melee-hero-overlay .descendant-card h2 {
  font-size: 1.2rem;
  margin: 0;
}

#continue-overlay .modal-sub,
#melee-hero-overlay .modal-sub {
  font-size: 0.8rem;
  margin: 0;
}

#continue-overlay .descendant-choices,
#melee-hero-overlay .descendant-choices {
  margin: 0.125rem 0;
}

#continue-overlay .descendant-option,
#melee-hero-overlay .descendant-option {
  padding: 0.4375rem 0.625rem;
  gap: 0.2rem;
}

#continue-overlay .descendant-portrait,
#melee-hero-overlay .descendant-portrait {
  width: 3.12rem;
  height: 3.25rem;
}

#continue-overlay .descendant-name,
#melee-hero-overlay .descendant-name {
  font-size: 0.96rem;
}

#continue-overlay .descendant-traits,
#melee-hero-overlay .descendant-traits {
  font-size: 0.7rem;
  line-height: 1.2;
}

#continue-overlay .descendant-hint,
#melee-hero-overlay .descendant-hint {
  font-size: 0.68rem;
  margin: 0;
}

#continue-overlay .secondary-btn,
#melee-hero-overlay .secondary-btn {
  padding: 0.375rem 0.875rem;
}

.primary-btn {
  padding: 0.625rem 1.125rem;
  border-radius: 0.5rem;
  border: 0.0625rem solid #ffd57a;
  background: linear-gradient(180deg, #d8432e 0%, #9b2217 100%);
  color: #fff7e6;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 0.375rem 1.125rem rgba(216, 67, 46, 0.4);
}

.primary-btn:hover {
  filter: brightness(1.08);
}

.primary-btn.continue-btn {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
  box-shadow: 0 0.375rem 1.125rem rgba(29, 78, 216, 0.42);
}

#title-overlay.title-screen-overlay .title-actions .primary-btn {
  padding: 0.5rem 0.875rem;
  font-size: 0.82rem;
}

#title-overlay.title-screen-overlay .title-actions .melee-mode-btn {
  padding: 0.25rem 0.875rem;
}

.primary-btn.rush-btn {
  border-color: #fde68a;
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  box-shadow: 0 0.375rem 1.125rem rgba(180, 83, 9, 0.38);
}

.primary-btn.super-rush-btn {
  border-color: #e9d5ff;
  background: linear-gradient(180deg, #7e22ce 0%, #4c1d95 100%);
  box-shadow: 0 0.375rem 1.125rem rgba(126, 34, 206, 0.42);
}

.primary-btn.melee-btn {
  border-color: #99f6e4;
  background: linear-gradient(180deg, #0f766e 0%, #134e4a 100%);
  box-shadow: 0 0.375rem 1.125rem rgba(15, 118, 110, 0.42);
}

.primary-btn.melee-player-btn {
  border-color: #6ee7b7;
  background: linear-gradient(180deg, #059669 0%, #065f46 100%);
  box-shadow: 0 0.375rem 1.125rem rgba(5, 150, 105, 0.42);
}

.primary-btn.melee-hated-btn {
  border-color: #67e8f9;
  background: linear-gradient(180deg, #0e7490 0%, #164e63 100%);
  box-shadow: 0 0.375rem 1.125rem rgba(14, 116, 144, 0.44);
}

.melee-mode-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.0625rem;
  padding: 0.3125rem 1.05rem;
  line-height: 1.08;
}

.melee-mode-btn.hidden {
  display: none;
}

.melee-btn-sub {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ccfbf1;
  opacity: 0.92;
}

.melee-player-btn .melee-btn-sub {
  color: #d1fae5;
}

.melee-hated-btn .melee-btn-sub {
  color: #fde68a;
}

.melee-results-actions {
  position: absolute;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 1.5rem);
  padding: 0.375rem 0.75rem;
  border-radius: 0.625rem;
  background: rgba(10, 8, 16, 0.92);
  border: 0.0625rem solid rgba(45, 212, 191, 0.42);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.65);
  z-index: 8;
}

.melee-results-actions.hidden {
  display: none;
}

.melee-results-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0.4375rem;
}

.melee-results-btn-row.hidden {
  display: none;
}

.melee-confirm-prompt {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 800;
  color: #fde68a;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 0 0.2rem;
}

.secondary-btn.melee-sort-btn {
  border-color: #38bdf8;
  color: #e0f2fe;
}

.secondary-btn.melee-sort-btn.by-kos {
  border-color: #f5b942;
  background: #2b2116;
  color: #fef3c7;
}

.melee-results-actions .primary-btn,
.melee-results-actions .secondary-btn {
  padding: 0.375rem 0.6875rem;
  font-size: 0.72rem;
  white-space: nowrap;
}

.secondary-btn {
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  border: 0.0625rem solid #4a3c5c;
  background: #231b2d;
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.secondary-btn:hover {
  border-color: var(--border-gold);
}

.record-banner {
  text-align: center;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--accent-jade);
  letter-spacing: 0.12em;
}

.wait-tip {
  margin-top: 0.25rem;
  padding-top: 0.625rem;
  border-top: 0.0625rem solid rgba(245, 185, 66, 0.24);
  text-align: center;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 0.94rem;
  line-height: 1.45;
  color: #f2e5c6;
}

.wait-tip::before {
  content: "TIP: ";
  font-family: var(--mono);
  font-style: normal;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
}

/* Dossier Modal */
.dossier-card {
  width: min(65rem, 100%);
  max-height: 96%;
  min-height: 0;
  overflow: hidden;
  padding: 0.875rem 1.125rem;
}

.dossier-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.dossier-head h2 {
  font-size: 1.1rem;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
}

.dossier-head .modal-sub {
  text-align: left;
  font-size: 0.8rem;
  margin-top: 0.125rem;
}

.dossier-body {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 0.625rem;
  padding-right: 0.375rem;
}

.dossier-item {
  background: #100c16;
  border: 0.0625rem solid #30253c;
  border-radius: 0.4375rem;
  padding: 0.625rem 0.75rem;
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  min-height: 8.5rem;
  box-sizing: border-box;
}

.dossier-preview-box {
  width: 9rem;
  height: 5.75rem;
  border-radius: 0.375rem;
  border: 0.0625rem solid #352944;
  background: radial-gradient(circle at 50% 72%, #241a30 0%, #0b0811 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
}

.dossier-boss-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.dossier-preview-locked {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 800;
  color: #3b3147;
  user-select: none;
  -webkit-user-select: none;
}

.dossier-item-info {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
}

.dossier-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.dossier-floor {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent-gold);
  font-weight: 800;
}

.dossier-weapon {
  font-size: 0.72rem;
  padding: 0.0625rem 0.375rem;
  border-radius: 62.4375rem;
  background: #231b2e;
  border: 0.0625rem solid #413352;
  color: var(--accent-cyan);
}

.dossier-name {
  font-size: 0.88rem;
  line-height: 1.2;
  font-weight: 800;
  color: #fff3df;
}

.dossier-tip {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.32;
}

.dossier-item.is-unmet .dossier-name,
.dossier-item.is-unmet .dossier-weapon,
.dossier-item.is-undefeated .dossier-tip {
  color: #6e6479;
  font-style: italic;
  user-select: none;
  -webkit-user-select: none;
}

.dossier-item.is-unmet .dossier-weapon {
  border-color: #2f2739;
  background: #181320;
}

.dossier-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 0.0625rem solid rgba(255, 255, 255, 0.07);
}

.dossier-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: #bfb5cc;
}

.dossier-flawless-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.0625rem 0.375rem;
  border-radius: 62.4375rem;
  background: rgba(245, 185, 66, 0.16);
  border: 0.0625rem solid rgba(245, 185, 66, 0.65);
  color: #fde68a;
  font-weight: 800;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
}

.dossier-spar-btn {
  background: linear-gradient(180deg, #214e4a 0%, #153533 100%);
  border: 0.0625rem solid #2dd4bf;
  color: #ccfbf1;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 0.3125rem;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, border-color 0.15s ease;
}

.dossier-spar-btn:hover {
  filter: brightness(1.16);
  border-color: #99f6e4;
}

.dossier-spar-btn:active {
  transform: translateY(1px);
}

/* Custom Keyboard Remapping & Rumble Modal */
.keymap-card {
  width: min(35rem, 94%);
  gap: 0.625rem;
  padding: 0.875rem 1.125rem;
}

.keymap-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.keymap-head h2 {
  font-size: 1.05rem;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
}

.keymap-head .modal-sub {
  text-align: left;
  font-size: 0.78rem;
  margin-top: 0.125rem;
}

.keymap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.65rem;
}

.keymap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #100c16;
  border: 0.0625rem solid #30253c;
  border-radius: 0.375rem;
  padding: 0.375rem 0.55rem;
}

.keymap-action {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f4efe6;
}

.keymap-bind-btn {
  min-width: 5.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.3125rem;
  border: 0.0625rem solid #4b3b60;
  background: #1d1629;
  color: var(--accent-gold);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.keymap-bind-btn:hover {
  border-color: var(--accent-gold);
  background: #281f38;
}

.keymap-bind-btn.is-listening {
  border-color: var(--accent-cyan);
  background: rgba(91, 200, 245, 0.18);
  color: #e0f2fe;
}

.keymap-rumble-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #100c16;
  border: 0.0625rem solid #30253c;
  border-radius: 0.375rem;
  padding: 0.375rem 0.65rem;
}

.keymap-rumble-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f4efe6;
}

.sparring-card {
  width: min(32rem, 92%);
}

.sparring-note {
  font-size: 0.76rem;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

@media (max-width: 560px) {
  .keymap-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .dossier-body {
    grid-template-columns: 1fr;
  }
}

/* Footer */
.cabinet-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  padding-top: 0.125rem;
}

.footer-left,
.footer-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.footer-center {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4375rem;
  flex: 1 1 auto;
}

.reset-records-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.7rem;
  opacity: 0.45;
  cursor: pointer;
  padding: 0.125rem 0.3125rem;
  border-radius: 0.25rem;
  min-height: 24px;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.reset-records-btn:hover {
  opacity: 1;
  color: var(--accent-crimson);
}

/* QwertyDash-style Low-Profile Segmented Pill Toggle */
.dock-pill {
  display: inline-flex;
  align-items: center;
  background: #140f1c;
  border: 0.0625rem solid #352a45;
  border-radius: 0.4375rem;
  padding: 0.125rem;
  gap: 0.125rem;
}

.dock-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  padding: 0 0.3125rem;
}

.dock-btn {
  border: 0.0625rem solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.125rem 0.4375rem;
  border-radius: 0.3125rem;
  min-width: 24px;
  min-height: 24px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.dock-btn:hover {
  color: var(--text-main);
}

.dock-btn.active {
  background: rgba(245, 185, 66, 0.16);
  color: var(--accent-gold);
  border-color: rgba(201, 151, 62, 0.45);
}

@media (max-height: 820px), (min-width: 1281px) and (min-height: 616px) and (min-aspect-ratio: 1280/820) {
  .app-shell {
    padding: 0.375rem 0.75rem;
    gap: 0.3125rem;
  }
  .cabinet-wrap {
    padding: 0.4375rem 0.625rem;
    gap: 0.375rem;
  }
  .arcade-hud {
    padding: 0.3125rem 0.625rem;
    gap: 0.25rem;
  }
  .title-card,
  #title-overlay.title-screen-overlay .title-card {
    padding: 0.625rem 1.125rem;
    gap: 0.375rem;
  }
  .title-crest {
    font-size: 0.66rem;
  }
  .title-logo {
    font-size: 1.65rem;
  }
  .title-sub {
    font-size: 0.85rem;
    line-height: 1.25;
  }
  .showcase-box {
    padding: 0.3125rem 0.5rem;
  }
  .control-col {
    padding: 0.4375rem 0.625rem;
  }
  .control-col h3 {
    font-size: 0.76rem;
    margin-bottom: 0.1875rem;
  }
  .control-col ul {
    gap: 0.125rem;
    font-size: 0.8rem;
    line-height: 1.28;
  }
  .primary-btn,
  .secondary-btn {
    padding: 0.5rem 0.9375rem;
  }
  .cabinet-footer {
    font-size: 0.74rem;
  }
}

/* Desktop 1-line footer & compact 4K@300% window safety */
@media (min-width: 860px) {
  .cabinet-footer {
    flex-wrap: nowrap;
    gap: 0.375rem;
    font-size: 0.68rem;
  }
  .footer-left,
  .footer-right {
    gap: 0.3125rem;
    flex-wrap: nowrap;
  }
  .footer-center {
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 0.25rem;
    min-width: 0;
  }
  .reset-records-btn {
    font-size: 0.64rem;
    padding: 0.125rem 0.25rem;
    white-space: nowrap;
  }
  .dock-label {
    font-size: 0.61rem;
    padding: 0 0.25rem;
  }
  .dock-btn {
    font-size: 0.61rem;
    padding: 0.0625rem 0.3125rem;
  }
}

@media (pointer: fine) and (max-height: 660px), (pointer: fine) and (min-width: 1281px) and (min-height: 616px) and (min-aspect-ratio: 1280/660) {
  #title-overlay.title-screen-overlay .title-card {
    padding: 0.25rem 1rem;
    gap: 0.22rem;
  }
  #title-overlay.title-screen-overlay .title-logo {
    font-size: 1.95rem;
  }
  #title-overlay.title-screen-overlay .title-hero-meta .title-sub {
    font-size: 0.82rem;
    line-height: 1.2;
  }
  #title-overlay.title-screen-overlay .showcase-box {
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.1875rem 0.5rem;
  }
  #title-overlay.title-screen-overlay .showcase-label {
    font-size: 0.68rem;
  }
  #title-overlay.title-screen-overlay .showcase-num {
    font-size: 0.96rem;
  }
  #title-overlay.title-screen-overlay .showcase-num.muted {
    font-size: 0.78rem;
  }
  #title-overlay.title-screen-overlay .control-col {
    padding: 0.25rem 0.625rem;
  }
  #title-overlay.title-screen-overlay .control-col h3 {
    font-size: 0.76rem;
    margin-bottom: 0.1875rem;
  }
  #title-overlay.title-screen-overlay .control-col ul {
    font-size: 0.74rem;
    line-height: 1.18;
    gap: 0.09375rem;
  }
  #title-overlay.title-screen-overlay .hero-select-wrap {
    margin-top: 0;
  }
  #title-overlay.title-screen-overlay .hero-select-box {
    padding: 0.15rem 0.4375rem;
  }
  #title-overlay.title-screen-overlay .hero-portrait-canvas {
    width: 2.34rem;
    height: 2.4375rem;
  }
  #title-overlay.title-screen-overlay .title-actions {
    gap: 0.3125rem 0.5rem;
    margin-top: 0.0625rem;
  }
  #title-overlay.title-screen-overlay .melee-actions-row,
  #title-overlay.title-screen-overlay .title-secondary-actions {
    gap: 0.4375rem;
  }
  #title-overlay.title-screen-overlay .primary-btn,
  #title-overlay.title-screen-overlay .secondary-btn {
    padding: 0.3125rem 0.8125rem;
    font-size: 0.75rem;
  }
  #title-overlay.title-screen-overlay .title-actions .primary-btn {
    padding: 0.3125rem 0.6875rem;
    font-size: 0.76rem;
  }
  #title-overlay.title-screen-overlay .title-actions .melee-mode-btn {
    padding: 0.16rem 0.6875rem;
  }
  #continue-overlay .descendant-card,
  #melee-hero-overlay .descendant-card {
    padding: 0.4375rem 1rem;
    gap: 0.25rem;
  }
  #continue-overlay .title-crest,
  #melee-hero-overlay .title-crest {
    display: none;
  }
  #continue-overlay .descendant-card h2,
  #melee-hero-overlay .descendant-card h2 {
    font-size: 1.08rem;
  }
  #continue-overlay .descendant-portrait,
  #melee-hero-overlay .descendant-portrait {
    width: 2.76rem;
    height: 2.875rem;
  }
  #continue-overlay .descendant-option,
  #melee-hero-overlay .descendant-option {
    padding: 0.3125rem 0.5rem;
    gap: 0.15rem;
  }
}

/* =====================================================================
   Adaptive Touchscreen Controls (Zero impact on desktop keyboard/gamepad)
   ===================================================================== */
.touch-controls {
  display: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.touch-left,
.touch-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  touch-action: none;
}

.touch-dpad {
  position: relative;
  width: 8.25rem;
  height: 8.25rem;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #241b30 0%, #140f1b 70%, #0d0912 100%);
  border: 0.125rem solid rgba(201, 151, 62, 0.55);
  box-shadow: inset 0 0 1.125rem rgba(0, 0, 0, 0.75), 0 0.5rem 1.25rem rgba(0, 0, 0, 0.55);
  touch-action: none;
}

.touch-dpad::before,
.touch-dpad::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
}

.touch-dpad::before {
  width: 78%;
  height: 78%;
  border: 0.0625rem dashed rgba(201, 151, 62, 0.24);
}

.dpad-arrow {
  position: absolute;
  font-size: 0.85rem;
  line-height: 1;
  color: rgba(244, 239, 230, 0.35);
  pointer-events: none;
  transition: color 0.08s ease, transform 0.08s ease, text-shadow 0.08s ease;
}

.dpad-up { top: 0.5rem; left: 50%; transform: translateX(-50%); }
.dpad-down { bottom: 0.5rem; left: 50%; transform: translateX(-50%); }
.dpad-left { left: 0.625rem; top: 50%; transform: translateY(-50%); }
.dpad-right { right: 0.625rem; top: 50%; transform: translateY(-50%); }

.touch-dpad.dir-up .dpad-up,
.touch-dpad.dir-down .dpad-down,
.touch-dpad.dir-left .dpad-left,
.touch-dpad.dir-right .dpad-right {
  color: var(--accent-gold);
  text-shadow: 0 0 0.625rem rgba(245, 185, 66, 0.85);
}

.touch-dpad-puck {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3rem;
  height: 3rem;
  margin-left: -1.5rem;
  margin-top: -1.5rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd57a 0%, #c9973e 55%, #7d5318 100%);
  border: 0.125rem solid #fff3d6;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.65);
  pointer-events: none;
  transition: transform 0.04s linear;
}

.touch-right {
  gap: 0.5rem;
  align-items: center;
}

.touch-jump-row {
  display: flex;
  justify-content: center;
  width: 100%;
}

.touch-atk-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.touch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  color: #fff7e6;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.06s ease, filter 0.06s ease, box-shadow 0.06s ease;
}

.touch-btn-jump {
  width: 6rem;
  height: 2.25rem;
  border-radius: 62.4375rem;
  border: 0.125rem solid rgba(91, 200, 245, 0.72);
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.5) 0%, rgba(7, 89, 133, 0.82) 100%);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #e6f7ff;
  box-shadow: 0 0.25rem 0.875rem rgba(0, 0, 0, 0.45);
}

.touch-btn-atk {
  width: 4.625rem;
  height: 4.625rem;
  border-radius: 50%;
  box-shadow: 0 0.375rem 1.125rem rgba(0, 0, 0, 0.6);
}

/* Subtle arcade 2-button slant (slightly lower left, higher right) */
.touch-btn-left-atk {
  transform: translateY(0.4375rem);
}

.touch-btn-right-atk {
  transform: translateY(-0.4375rem);
}

.touch-btn-atk.is-kick {
  border: 0.125rem solid #f7c866;
  background: radial-gradient(circle at 35% 28%, #e44b36 0%, #9b1d26 70%, #5e1018 100%);
}

.touch-btn-atk.is-punch {
  border: 0.125rem solid #7ef2c4;
  background: radial-gradient(circle at 35% 28%, #229c76 0%, #15624b 70%, #0d3c2f 100%);
}

.touch-btn-title {
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.touch-btn-sub {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.touch-btn-jump.pressed {
  transform: scale(0.94);
  filter: brightness(1.3);
  box-shadow: 0 0 1.125rem rgba(91, 200, 245, 0.75);
}

.touch-btn-left-atk.pressed {
  transform: translateY(0.4375rem) scale(0.93);
  filter: brightness(1.28);
  box-shadow: 0 0 1.375rem rgba(245, 185, 66, 0.7);
}

.touch-btn-right-atk.pressed {
  transform: translateY(-0.4375rem) scale(0.93);
  filter: brightness(1.28);
  box-shadow: 0 0 1.375rem rgba(94, 234, 212, 0.7);
}

.touch-only-pill {
  display: none;
}

.app-shell[data-touch="true"] .touch-only-pill {
  display: inline-flex;
}

.touch-move-hint {
  display: none;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(245, 185, 66, 0.52);
  border: 0.0625rem dashed rgba(245, 185, 66, 0.28);
  border-radius: 0.625rem;
  padding: 0.5rem 0.75rem;
  text-align: center;
  transition: opacity 0.2s ease;
}

.app-shell[data-touch="true"][data-touch-float="true"] .touch-move-hint {
  display: inline-block;
}

.app-shell[data-touch="true"][data-touch-float="true"] .touch-move-hint.is-dismissed {
  opacity: 0;
}

.app-shell[data-touch="true"][data-touch-float="true"] .touch-dpad {
  position: fixed;
  left: 0;
  top: 0;
  margin: 0;
  z-index: 9;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease;
}

.app-shell[data-touch="true"][data-touch-float="true"] .touch-dpad.is-floating-active {
  opacity: 0.86;
}

.app-shell[data-touch="true"][data-touch-lefty="true"] .touch-controls {
  flex-direction: row-reverse;
}

/* Portrait Mode: Dedicated arcade deck BELOW the canvas (never covers gameplay) */
@media (orientation: portrait) {
  .app-shell[data-touch="true"] .touch-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem 0.875rem;
    background: linear-gradient(180deg, #161020 0%, #0d0914 100%);
    border: 0.0625rem solid #352a45;
    border-radius: 0.625rem;
    flex-shrink: 0;
  }

  .app-shell[data-touch="true"][data-touch-float="true"] .touch-left {
    flex: 1 1 auto;
    align-self: stretch;
    min-height: 7.5rem;
    justify-content: center;
    position: relative;
  }

  .app-shell[data-touch="true"][data-touch-float="true"] .touch-move-hint.is-dismissed {
    opacity: 0.24;
  }

  .app-shell[data-touch="true"][data-touch-float="true"] .touch-left.is-dragging .touch-move-hint {
    opacity: 0;
  }

  .app-shell[data-touch="true"] .footer-center {
    display: none;
  }

  .app-shell[data-touch="true"][data-phase="title"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="intro_cutscene"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="floor10_ending"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="descendant_cutscene"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="descendant_select"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="paused"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="gameover"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="rush_victory"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="melee_results"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="sparring_result"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="pagoda_cutaway"] .touch-controls,
  .app-shell[data-touch="true"][data-mode="pagoda_melee"] .touch-controls,
  .app-shell[data-touch="true"][data-melee-spectating="true"] .touch-controls,
  .app-shell[data-touch="true"][data-modal-open="true"] .touch-controls {
    display: none;
  }
}

/* Landscape Mode: Translucent corner overlays over bottom of stage */
@media (orientation: landscape) {
  .app-shell[data-touch="true"] .touch-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: absolute;
    left: 1.25rem;
    right: 1.25rem;
    bottom: 2.625rem;
    z-index: 6;
    pointer-events: none;
  }

  .app-shell[data-touch="true"][data-touch-float="true"] .touch-controls {
    top: 3.5rem;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 1.25rem 2.25rem;
    align-items: stretch;
  }

  .app-shell[data-touch="true"][data-touch-float="true"] .touch-left {
    flex: 0 0 50%;
    height: 100%;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 0 0 0.75rem 0.5rem;
    opacity: 1;
  }

  .app-shell[data-touch="true"][data-touch-float="true"][data-touch-lefty="true"] .touch-left {
    align-items: flex-end;
    padding: 0 0.5rem 0.75rem 0;
  }

  .app-shell[data-touch="true"][data-touch-float="true"] .touch-right {
    align-self: flex-end;
  }

  .app-shell[data-touch="true"] .touch-left,
  .app-shell[data-touch="true"] .touch-right {
    pointer-events: auto;
    opacity: 0.78;
  }

  .app-shell[data-touch="true"][data-phase="title"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="intro_cutscene"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="floor10_ending"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="descendant_cutscene"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="descendant_select"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="paused"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="gameover"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="rush_victory"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="melee_results"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="sparring_result"] .touch-controls,
  .app-shell[data-touch="true"][data-phase="pagoda_cutaway"] .touch-controls,
  .app-shell[data-touch="true"][data-mode="pagoda_melee"] .touch-controls,
  .app-shell[data-touch="true"][data-melee-spectating="true"] .touch-controls,
  .app-shell[data-touch="true"][data-modal-open="true"] .touch-controls {
    display: none;
  }

  .app-shell[data-touch="true"] .footer-center {
    display: none;
  }
}

/* Touch / Mobile Shared Title & Active Play Visibility (Zero effect on mouse+keyboard desktop) */
@media (pointer: coarse) {
  .kb-hint {
    display: none;
  }
  .app-shell[data-phase="title"] .arcade-hud,
  .app-shell[data-phase="intro_cutscene"] .arcade-hud,
  .app-shell[data-phase="descendant_cutscene"] .arcade-hud,
  .app-shell[data-phase="descendant_select"] .arcade-hud,
  .app-shell[data-phase="gameover"] .arcade-hud,
  .app-shell[data-phase="title"] .controls-grid {
    display: none;
  }
  .app-shell:not([data-phase="title"]) .cabinet-footer {
    display: none;
  }
  .app-shell[data-phase="title"] .footer-center {
    display: none;
  }
}

.app-shell[data-touch="true"] .kb-hint {
  display: none;
}
.app-shell[data-touch="true"][data-phase="title"] .arcade-hud,
.app-shell[data-touch="true"][data-phase="intro_cutscene"] .arcade-hud,
.app-shell[data-touch="true"][data-phase="descendant_cutscene"] .arcade-hud,
.app-shell[data-touch="true"][data-phase="descendant_select"] .arcade-hud,
.app-shell[data-touch="true"][data-phase="gameover"] .arcade-hud,
.app-shell[data-touch="true"][data-phase="title"] .controls-grid {
  display: none;
}
.app-shell[data-touch="true"]:not([data-phase="title"]) .cabinet-footer {
  display: none;
}

/* Mobile / Touch Landscape: Ultra-compact single-row top bar & HUD to maximize game stage */
@media (orientation: landscape) and (pointer: coarse), (orientation: landscape) and (max-height: 500px) {
  .app-shell {
    max-width: 100vw;
    padding: 0.125rem 0.375rem;
    gap: 0.125rem;
  }
  .top-bar {
    padding: 0 0.25rem;
    gap: 0.375rem;
    min-height: 0;
  }
  .brand-group {
    gap: 0.375rem;
  }
  .brand-seal {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    border-width: 0.0625rem;
  }
  .brand-titles h1 {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
  }
  .version-badge {
    font-size: 0.56rem;
    padding: 0.0625rem 0.3125rem;
  }
  .brand-sub,
  .status-pill,
  #btn-keymap {
    display: none !important;
  }
  .top-controls {
    gap: 0.25rem;
  }
  .ui-btn {
    padding: 0.125rem 0.4375rem;
    font-size: 0.64rem;
    border-radius: 0.25rem;
    white-space: nowrap;
  }
  .cabinet-wrap {
    padding: 0.1875rem 0.375rem;
    gap: 0.1875rem;
    border-width: 0.0625rem;
    border-radius: 0.375rem;
  }
  .arcade-hud {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.125rem 0.5rem;
    gap: 0.5rem;
    border-radius: 0.3125rem;
  }
  .app-shell[data-melee="true"] .arcade-hud {
    flex-direction: column;
    align-items: stretch;
    padding: 0.1875rem 0.375rem;
  }
  .app-shell[data-melee="true"] .melee-hud-grid {
    gap: 0.1875rem 0.3125rem;
  }
  .app-shell[data-melee="true"] .melee-hud-card {
    padding: 0.125rem 0.25rem;
    gap: 0.125rem;
  }
  .app-shell[data-melee="true"] .melee-hud-head {
    font-size: 0.54rem;
  }
  .app-shell[data-melee="true"] .melee-hud-track {
    height: 0.25rem;
  }
  .melee-results-actions {
    bottom: 0.375rem;
    padding: 0.25rem 0.5rem;
    gap: 0.375rem;
  }
  .melee-results-actions .primary-btn,
  .melee-results-actions .secondary-btn {
    padding: 0.25rem 0.625rem;
    font-size: 0.66rem;
  }
  .hud-scores {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
  }
  .hud-scores .hud-stat:nth-child(2),
  .hud-scores .hud-stat:nth-child(3) {
    display: none;
  }
  .hud-stat {
    flex-direction: row;
    align-items: baseline;
    gap: 0.25rem;
    white-space: nowrap;
  }
  .hud-label {
    font-size: 0.55rem;
  }
  .hud-scores .hud-stat:nth-child(4) .hud-label,
  .hud-scores .hud-stat:nth-child(5) .hud-label {
    display: none;
  }
  .hud-value {
    font-size: 0.76rem;
    white-space: nowrap;
  }
  .hud-floor-badge {
    padding: 0.0625rem 0.3125rem;
    gap: 0.125rem;
  }
  .hud-floor-badge .floor-word {
    font-size: 0.54rem;
  }
  .hud-floor-badge .floor-num {
    font-size: 0.94rem;
  }
  .hud-floor-badge .floor-total {
    font-size: 0.58rem;
  }
  .dir-tag,
  .loop-tag {
    font-size: 0.58rem;
    padding: 0 0.1875rem;
  }
  .hud-bars {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 0.85fr 1.3fr 0.85fr;
    gap: 0.5rem;
    align-items: center;
    min-width: 0;
  }
  .energy-block,
  .progress-block {
    gap: 0.125rem;
    min-width: 0;
  }
  .bar-header {
    font-size: 0.55rem;
    white-space: nowrap;
    overflow: hidden;
    gap: 0.25rem;
  }
  .bar-pct {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .energy-track,
  .progress-track {
    height: 0.375rem;
  }
  .app-shell:not([data-phase="title"]) .cabinet-footer {
    display: none !important;
  }
  .app-shell[data-phase="title"] .cabinet-footer {
    padding-top: 0;
    font-size: 0.62rem;
    gap: 0.25rem;
  }
  .app-shell[data-phase="title"] .footer-center {
    display: none;
  }
  .dock-pill {
    padding: 0.0625rem;
  }
  .dock-label {
    font-size: 0.58rem;
    padding: 0 0.25rem;
  }
  .dock-btn {
    font-size: 0.58rem;
    padding: 0.0625rem 0.3125rem;
  }
  #title-overlay.title-screen-overlay .title-card {
    padding: 0.5rem 1rem;
    gap: 0.375rem;
  }
  #title-overlay.title-screen-overlay .title-logo {
    font-size: 1.55rem;
  }
  #title-overlay.title-screen-overlay .title-sub {
    font-size: 0.8rem;
    line-height: 1.25;
  }
  #title-overlay.title-screen-overlay .score-showcase {
    gap: 0.5rem;
  }
  #title-overlay.title-screen-overlay .showcase-box {
    padding: 0.3125rem 0.5rem;
  }
  #title-overlay.title-screen-overlay .showcase-label {
    font-size: 0.62rem;
  }
  #title-overlay.title-screen-overlay .showcase-num {
    font-size: 0.92rem;
  }
  #title-overlay.title-screen-overlay .primary-btn,
  #title-overlay.title-screen-overlay .secondary-btn {
    padding: 0.4375rem 0.875rem;
    font-size: 0.8rem;
  }
  .app-shell[data-touch="true"] .touch-controls {
    left: 0.625rem;
    right: 0.625rem;
    bottom: 0.5rem;
  }
  .app-shell[data-touch="true"][data-touch-float="true"] .touch-controls {
    top: 2.35rem;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 0.625rem 0.5rem;
  }
  .app-shell[data-touch="true"] .touch-dpad {
    width: 7rem;
    height: 7rem;
  }
  .app-shell[data-touch="true"] .touch-dpad-puck {
    width: 2.5rem;
    height: 2.5rem;
    margin-left: -1.25rem;
    margin-top: -1.25rem;
  }
  .app-shell[data-touch="true"] .touch-btn-atk {
    width: 4rem;
    height: 4rem;
  }
  .app-shell[data-touch="true"] .touch-btn-jump {
    width: 5.5rem;
    height: 2.125rem;
    font-size: 0.68rem;
  }
}

/* Portrait phone width tuning (clean non-overlapping header, HUD, title, & deck) */
@media (orientation: portrait) and (max-width: 650px) {
  .app-shell {
    max-width: 100vw;
    padding: 0.25rem 0.375rem;
    gap: 0.25rem;
  }
  .top-bar {
    gap: 0.25rem;
    flex-wrap: nowrap;
  }
  .brand-group {
    gap: 0.25rem;
    min-width: 0;
    flex: 1 1 auto;
  }
  .brand-seal {
    width: 1.375rem;
    height: 1.375rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    flex-shrink: 0;
  }
  .brand-titles {
    min-width: 0;
    overflow: hidden;
  }
  .brand-title-row {
    gap: 0.25rem;
  }
  .brand-titles h1 {
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
  }
  .version-badge {
    font-size: 0.52rem;
    padding: 0.0625rem 0.25rem;
    flex-shrink: 0;
  }
  .brand-sub,
  .status-pill,
  #btn-keymap {
    display: none !important;
  }
  .top-controls {
    gap: 0.1875rem;
    flex-shrink: 0;
  }
  .ui-btn {
    padding: 0.1875rem 0.3125rem;
    font-size: 0.58rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }
  .cabinet-wrap {
    padding: 0.375rem;
    gap: 0.375rem;
    border-width: 0.0625rem;
  }
  .arcade-hud {
    padding: 0.375rem 0.5rem;
    gap: 0.375rem;
  }
  .hud-scores {
    grid-template-columns: 1fr auto auto auto;
    gap: 0.5rem;
  }
  .hud-scores .hud-stat:nth-child(2),
  .hud-scores .hud-stat:nth-child(3) {
    display: none;
  }
  .hud-label {
    font-size: 0.58rem;
    white-space: nowrap;
  }
  .hud-value {
    font-size: 0.86rem;
    white-space: nowrap;
  }
  .hud-floor-badge {
    padding: 0.0625rem 0.3125rem;
    gap: 0.125rem;
  }
  .hud-floor-badge .floor-word {
    font-size: 0.58rem;
  }
  .hud-floor-badge .floor-num {
    font-size: 1.04rem;
  }
  .hud-floor-badge .floor-total {
    font-size: 0.64rem;
  }
  .dir-tag,
  .loop-tag {
    font-size: 0.62rem;
    padding: 0.0625rem 0.25rem;
    white-space: nowrap;
  }
  .hud-bars {
    grid-template-columns: 1fr 1fr;
    gap: 0.3125rem 0.625rem;
  }
  .progress-block {
    grid-column: 1 / -1;
    order: 3;
  }
  .bar-header {
    font-size: 0.64rem;
    white-space: nowrap;
    gap: 0.375rem;
  }
  .energy-track,
  .progress-track {
    height: 0.5rem;
  }
  #title-overlay.title-screen-overlay .title-card {
    padding: 1rem 0.875rem;
    gap: 0.625rem;
  }
  #title-overlay.title-screen-overlay .title-logo {
    font-size: 1.8rem;
  }
  .score-showcase {
    gap: 0.375rem;
  }
  .showcase-box {
    padding: 0.375rem 0.375rem;
  }
  .showcase-label {
    font-size: 0.64rem;
  }
  .showcase-num {
    font-size: 0.94rem;
  }
  .dossier-body {
    grid-template-columns: 1fr;
  }
  .cabinet-footer {
    justify-content: center;
    gap: 0.3125rem;
  }
  .footer-left,
  .footer-right {
    max-width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .dock-pill {
    max-width: 100%;
    padding: 0.0625rem;
  }
  .dock-label {
    font-size: 0.58rem;
    padding: 0 0.25rem;
  }
  .dock-btn {
    font-size: 0.58rem;
    padding: 0.0625rem 0.3125rem;
  }
  .app-shell[data-touch="true"] .touch-controls {
    padding: 0.5rem 0.75rem 0.625rem;
  }
  .app-shell[data-touch="true"] .touch-dpad {
    width: 7.25rem;
    height: 7.25rem;
  }
  .app-shell[data-touch="true"] .touch-dpad-puck {
    width: 2.625rem;
    height: 2.625rem;
    margin-left: -1.3125rem;
    margin-top: -1.3125rem;
  }
  .app-shell[data-touch="true"] .touch-btn-atk {
    width: 4.125rem;
    height: 4.125rem;
  }
  .app-shell[data-touch="true"] .touch-atk-row {
    gap: 0.625rem;
  }
}


/* Default HUD positions moved from inline styles for strict CSP */
#hud-player-bar,
#hud-boss-bar,
.melee-hud-fill {
  width: 100%;
}

#hud-progress-marker {
  left: 94%;
}

#hud-boss-marker {
  left: 8%;
}
