:root {
  color-scheme: dark;
  --bg-top: #192035;
  --bg-bottom: #06070d;
  --panel: rgba(11, 16, 26, 0.96);
  --panel-border: rgba(171, 197, 255, 0.14);
  --text: #f5efd9;
  --muted: #b1b8c9;
  --accent: #ff7a3d;
  --accent-soft: #ffbd8f;
  --enemy: #5cd4ff;
  --gold: #e3bc62;
  --glow: rgba(255, 122, 61, 0.18);
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Courier New", Monaco, monospace;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 122, 61, 0.08), transparent 14%),
    linear-gradient(90deg, rgba(92, 212, 255, 0.05), transparent 26%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.masthead,
.scoreboard,
.stage-card,
.message-panel,
.ladder-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(3, 5, 10, 0.85), 0 18px 40px var(--shadow);
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-end;
  padding: 24px 28px;
  margin-bottom: 18px;
}

.label {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-soft);
  font-size: 0.75rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.95;
}

.subtitle {
  margin: 14px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 1rem;
}

.career-strip,
.fight-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mini-stat {
  min-width: 108px;
  padding: 14px 16px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.mini-stat span,
.metric-row span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.mini-stat strong,
.metric-row strong {
  font-size: 1.4rem;
}

.scoreboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  margin-bottom: 18px;
}

.corner-card,
.fight-card {
  padding: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
}

.player-corner {
  box-shadow: inset 0 0 0 1px rgba(255, 111, 60, 0.1);
}

.enemy-corner {
  box-shadow: inset 0 0 0 1px rgba(92, 212, 255, 0.14);
}

.corner-label {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
}

.corner-card h2,
.fight-card h2 {
  margin: 0;
  font-size: 1.65rem;
}

.corner-card p,
.fight-card p {
  margin-top: 10px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-row span {
  margin-bottom: 0;
}

.stage-card {
  padding: 18px;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  background: #121a28;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.legend {
  display: flex;
  gap: 10px 18px;
  flex-wrap: wrap;
  padding: 14px 6px 4px;
  color: var(--muted);
}

.legend p,
.message-panel p,
.ladder-panel p {
  margin: 0;
}

kbd {
  font: inherit;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 18px;
  margin-top: 18px;
}

.message-panel,
.ladder-panel {
  padding: 18px 22px;
}

.message-panel {
  border-color: rgba(255, 111, 60, 0.18);
  box-shadow: 0 0 0 1px var(--glow), 0 24px 60px var(--shadow);
}

#message {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

#objective {
  color: var(--muted);
}

.ladder-panel {
  border-color: rgba(227, 188, 98, 0.18);
}

#ladder {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

#ladder li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

#ladder li.active {
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 111, 60, 0.2);
}

#ladder li.cleared {
  color: #f8e3a7;
  box-shadow: inset 0 0 0 1px rgba(227, 188, 98, 0.2);
}

.ladder-rank {
  color: var(--accent-soft);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1100px);
    padding-top: 20px;
  }

  .masthead,
  .scoreboard {
    align-items: stretch;
    flex-direction: column;
  }

  .masthead {
    padding: 20px;
  }

  .scoreboard {
    grid-template-columns: 1fr;
  }

  .stage-card {
    padding: 10px;
  }

  .legend {
    gap: 8px 16px;
    font-size: 0.92rem;
  }

  .lower-grid {
    grid-template-columns: 1fr;
  }
}
