:root {
  --bg: #120914;
  --bg-deep: #07040b;
  --panel: #20142a;
  --panel-2: #2b1b39;
  --panel-3: #3a2250;
  --ink: #fff6d6;
  --muted: #d4b6ff;
  --line: #6a4aa1;
  --line-strong: #f7c84b;
  --accent: #ff7a5c;
  --accent-2: #56e0d0;
  --danger: #ff5d73;
  --success: #8cff98;
  --shadow: 0 0 0 4px #0b0710, 0 0 0 8px #3b2351, 0 18px 0 rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(255, 122, 92, 0.18), transparent 30%),
    linear-gradient(180deg, #23102b 0%, #120914 55%, #07040b 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "VT323", monospace;
  letter-spacing: 0.02em;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 2px,
      transparent 2px,
      transparent 4px
    ),
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), transparent 28%);
}

button {
  font: inherit;
}

#root {
  min-height: 100vh;
}

.app-shell {
  width: min(1360px, calc(100% - 24px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0 28px;
  position: relative;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(8, 6, 12, 0.28), rgba(8, 6, 12, 0.28)),
    var(--app-bg) center/cover no-repeat;
  filter: saturate(0.88) blur(2px) brightness(0.48);
  transform: scale(1.04);
  z-index: -2;
}

.app-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(86, 224, 208, 0.08), transparent 25%, transparent 75%, rgba(255, 122, 92, 0.08)),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 3px
    );
  opacity: 0.7;
  pointer-events: none;
  z-index: -1;
}

.poster,
.panel,
.event-card,
.result-card,
.candidate-card,
.ending-card {
  border: 4px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 26%),
    linear-gradient(180deg, var(--panel-3) 0%, var(--panel) 100%);
  box-shadow: var(--shadow);
}

.poster,
.ending-card {
  min-height: calc(100vh - 46px);
}

.poster,
.event-card,
.result-card,
.panel,
.candidate-card,
.ending-card {
  padding: 18px;
  position: relative;
}

.poster::before,
.panel::before,
.event-card::before,
.result-card::before,
.candidate-card::before,
.ending-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(255, 246, 214, 0.18);
  pointer-events: none;
}

.screen-block {
  display: grid;
  gap: 14px;
}

.screen-header,
.timeline-strip,
.stat-list,
.tag-row,
.summary-list,
.ending-stats,
.action-row,
.note-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.eyebrow,
.stat-chip,
.timeline-pill,
.delta,
.event-stage,
.rare-badge,
.scene-label,
.ending-stat {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  background: #130d1d;
  border: 2px solid var(--line);
  color: var(--ink);
  text-transform: uppercase;
  line-height: 1;
}

.eyebrow,
.event-stage,
.rare-badge,
.scene-label,
.timeline-pill {
  font-family: "Press Start 2P", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.section-title,
.hero-title,
.ending-title,
.event-title,
.candidate-name,
.big-label {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  line-height: 1.25;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(2rem, 4.6vw, 4.3rem);
  max-width: 10ch;
  color: #fff7b2;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.42);
}

.section-title {
  font-size: clamp(1.3rem, 2.7vw, 2.2rem);
}

.ending-title {
  font-size: clamp(1.8rem, 3.6vw, 3rem);
}

.event-title {
  font-size: clamp(1.2rem, 2.8vw, 2.1rem);
  margin: 16px 0 10px;
}

.candidate-name,
.big-label {
  font-size: 1rem;
}

.hero-grid,
.game-layout,
.select-layout {
  display: grid;
  gap: 16px;
}

.hero-grid {
  grid-template-columns: 1.05fr 0.95fr;
  align-items: start;
}

.game-layout {
  grid-template-columns: 330px minmax(0, 1fr);
  align-items: start;
}

.select-layout {
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  align-items: stretch;
}

.hero-copy,
.candidate-preview,
.hero-scene {
  display: grid;
  gap: 12px;
}

.hero-subtitle,
.candidate-description,
.candidate-role,
.tagline,
.muted,
.event-body,
.result-copy,
.ending-copy,
.note-value,
.choice-hint,
.log-item {
  margin: 0;
  font-size: 1.58rem;
  line-height: 1.28;
  color: var(--ink);
}

.muted,
.candidate-role,
.tagline,
.choice-hint {
  color: var(--muted);
}

.note-card {
  padding: 12px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 16, 0.72);
}

.note-label,
.panel-title,
.meter-name {
  font-family: "Press Start 2P", monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--accent-2);
}

.note-value {
  margin-top: 8px;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.candidate-card {
  display: grid;
  gap: 12px;
  cursor: pointer;
  transition: transform 120ms steps(2);
}

.candidate-card:hover,
.choice-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translate(-2px, -2px);
}

.candidate-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px #0b0710, 0 0 0 8px var(--accent), 0 18px 0 rgba(0, 0, 0, 0.34);
}

.candidate-portrait {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  image-rendering: auto;
  border: 2px solid var(--line);
  background:
    linear-gradient(180deg, rgba(86, 224, 208, 0.12), rgba(0, 0, 0, 0)),
    linear-gradient(180deg, #241531 0%, #120914 100%);
}

.panel {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 18px;
}

.panel-section {
  display: grid;
  gap: 8px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.status-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 2px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.14));
  box-shadow: inset 0 0 0 2px #0b0710;
}

.status-card.recognition {
  background-color: rgba(61, 192, 255, 0.12);
}

.status-card.favorability {
  background-color: rgba(140, 255, 152, 0.12);
}

.status-card.funds {
  background-color: rgba(255, 226, 122, 0.14);
}

.status-label {
  font-family: "Press Start 2P", monospace;
  font-size: 0.58rem;
  color: var(--accent-2);
  text-transform: uppercase;
}

.status-value {
  font-family: "Press Start 2P", monospace;
  font-size: 1rem;
  line-height: 1.2;
  color: #fff7b2;
}

.meter-row {
  display: grid;
  gap: 6px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 1.35rem;
}

.meter-track,
.risk-box {
  border: 2px solid var(--line);
  background: #100916;
}

.meter-track {
  height: 18px;
  padding: 2px;
}

.meter-fill {
  height: 100%;
}

.meter-fill.name {
  background: linear-gradient(90deg, #3dc0ff, #56e0d0);
}

.meter-fill.likeability {
  background: linear-gradient(90deg, #8cff98, #49d96f);
}

.meter-fill.funds {
  background: linear-gradient(90deg, #ffe27a, #ffb84d);
}

.risk-track {
  display: flex;
  gap: 8px;
}

.risk-box {
  width: 100%;
  height: 18px;
}

.risk-box.active {
  background: linear-gradient(90deg, #ff9879, #ff5d73);
}

.pixel-scene {
  position: relative;
  min-height: 320px;
  border: 4px solid var(--line-strong);
  overflow: hidden;
  background:
    linear-gradient(rgba(11, 7, 16, 0.18), rgba(11, 7, 16, 0.18)),
    var(--scene-bg) center/cover no-repeat;
  box-shadow: inset 0 0 0 4px #0b0710;
}

.pixel-scene.compact {
  min-height: 220px;
}

.pixel-scene.align-left .portrait-wrap {
  justify-content: flex-start;
}

.scene-overlay,
.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene-overlay {
  background:
    linear-gradient(180deg, rgba(86, 224, 208, 0.12), transparent 38%, rgba(255, 122, 92, 0.14)),
    linear-gradient(0deg, rgba(8, 6, 12, 0.1), rgba(8, 6, 12, 0.3));
}

.scanlines {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.06) 0,
      rgba(255, 255, 255, 0.06) 1px,
      transparent 1px,
      transparent 4px
    );
  mix-blend-mode: screen;
  opacity: 0.36;
}

.scene-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
}

.portrait-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 18px;
}

.portrait-sprite {
  max-height: 92%;
  max-width: 72%;
  object-fit: contain;
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.36));
}

.event-card,
.result-card,
.ending-card {
  display: grid;
  gap: 12px;
}

.event-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.rare-badge {
  border-color: var(--accent);
  color: #fff2c9;
  background: #401721;
}

.choice-list {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.choice-button,
.primary-button,
.secondary-button,
.ghost-button {
  border: 3px solid var(--line-strong);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.28);
}

.choice-button {
  width: 100%;
  text-align: left;
  padding: 16px;
  background: linear-gradient(180deg, #2b1b39 0%, #1c1226 100%);
  display: grid;
  gap: 8px;
}

.choice-title {
  font-family: "Press Start 2P", monospace;
  font-size: 0.88rem;
  line-height: 1.7;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 62px;
  padding: 14px 18px;
  font-family: "Press Start 2P", monospace;
  font-size: 0.84rem;
  line-height: 1.45;
  text-transform: uppercase;
}

.result-card .primary-button,
.ending-card .primary-button,
.ending-card .secondary-button {
  font-size: 0.92rem;
  min-height: 68px;
}

.result-copy {
  font-size: 1.75rem;
}

.delta {
  font-size: 1rem;
}

.primary-button {
  background: linear-gradient(180deg, #ff9a6d 0%, #ff7a5c 100%);
  color: #2b1020;
}

.secondary-button,
.ghost-button {
  background: linear-gradient(180deg, #1c1226 0%, #130d1d 100%);
}

.delta.positive {
  color: var(--success);
}

.delta.negative {
  color: #ff9ca9;
}

.delta.neutral {
  color: var(--muted);
}

.tag {
  padding: 7px 10px;
  border: 2px solid var(--line);
  background: rgba(86, 224, 208, 0.1);
  color: #bffbf3;
  font-size: 1.15rem;
}

.timeline-pill.active {
  border-color: var(--accent);
  background: #401721;
}

.log-list {
  display: grid;
  gap: 8px;
}

.log-item {
  padding: 10px;
  border: 2px solid var(--line);
  background: rgba(11, 7, 16, 0.8);
}

.ending-emphasis {
  color: #fff7b2;
}

@media (max-width: 1100px) {
  .candidate-grid,
  .hero-grid,
  .game-layout,
  .select-layout {
    grid-template-columns: 1fr;
  }

  .panel {
    position: static;
  }

  .status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 12px, 100%);
    padding-top: 10px;
    padding-bottom: 14px;
  }

  .poster,
  .event-card,
  .result-card,
  .panel,
  .candidate-card,
  .ending-card {
    padding: 12px;
  }

  .pixel-scene,
  .pixel-scene.compact {
    min-height: 220px;
  }

  .portrait-sprite {
    max-width: 82%;
  }

  .hero-subtitle,
  .candidate-description,
  .candidate-role,
  .tagline,
  .muted,
  .event-body,
  .result-copy,
  .ending-copy,
  .note-value,
  .choice-hint,
  .log-item {
    font-size: 1.28rem;
  }

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

  .status-value {
    font-size: 1.1rem;
  }

  .choice-title {
    font-size: 0.8rem;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
    font-size: 0.74rem;
    min-height: 58px;
  }
}
