:root {
  --bg-deep: #000000;
  --bg-card: #111111;
  --bg-elevated: #1a1a1a;
  --border: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-muted: #a3a3a3;
  --accent: #ff5500;
  --accent-light: #ff7733;
  --accent-dark: #cc4400;
  --accent-soft: rgba(255, 85, 0, 0.14);
  --accent-glow: rgba(255, 85, 0, 0.38);
  --danger: #ff4444;
  --success: #22c55e;
  --warning: #ffaa00;
  --info: #38bdf8;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', var(--font);
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 70% at 50% -15%, rgba(255, 85, 0, 0.12) 0%, var(--bg-deep) 50%);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

a { color: var(--accent); }

.hidden { display: none !important; }

button, .btn {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s;
}
button:hover, .btn:hover { background: var(--accent-light); }
button:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button.secondary, .btn.secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
}
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
button.danger { background: var(--danger); }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.field { margin-bottom: 1rem; }

/* Auth — marketing + login */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.auth-layout {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1.25fr minmax(300px, 380px);
  gap: 1.25rem;
  align-items: stretch;
}
.auth-pitch {
  display: grid;
  gap: 1rem;
  min-width: 0;
}
.auth-pitch-hero {
  position: relative;
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 220px;
  box-shadow: var(--shadow);
}
.auth-pitch-bg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 240px;
  object-fit: cover;
}
.auth-pitch-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(0,0,0,0.82) 10%, rgba(0,0,0,0.35) 70%, rgba(255,85,0,0.18));
}
.auth-pitch-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.25rem 1.35rem 1.4rem;
  z-index: 1;
}
.auth-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-light);
}
.auth-pitch-copy h2 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  line-height: 1.2;
}
.auth-pitch-copy p {
  margin: 0;
  color: rgba(255,255,255,0.82);
  font-size: 0.95rem;
  max-width: 36rem;
}
.auth-pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}
.auth-pillar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-rows: 88px 1fr;
}
.auth-pillar img {
  width: 100%;
  height: 88px;
  object-fit: cover;
  display: block;
}
.auth-pillar-body {
  padding: 0.7rem 0.75rem 0.85rem;
}
.auth-pillar h3 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
}
.auth-pillar p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.auth-cast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem 1rem;
}
.auth-cast h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}
.auth-cast-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.auth-cast-card {
  text-align: center;
}
.auth-cast-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 0.35rem;
}
.auth-cast-card strong {
  display: block;
  font-size: 0.72rem;
  line-height: 1.25;
}
.auth-cast-card span {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
}
.auth-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
  align-self: center;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.35rem;
}
.auth-brand img {
  width: 48px;
  height: 48px;
}
.auth-brand h1 {
  margin: 0;
  font-size: 1.25rem;
}
.auth-brand p {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.auth-tabs button {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.auth-tabs button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.auth-error {
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.25rem;
  margin-bottom: 0.5rem;
}

/* Home hub */
.home-main {
  display: grid;
  gap: 1.1rem;
  max-width: 1040px;
}
.home-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  overflow: hidden;
  padding: 0 !important;
}
.home-hero-visual {
  position: relative;
  min-height: 240px;
}
.home-hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 240px;
}
.home-hero-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 40%, var(--bg-card) 100%);
  pointer-events: none;
}
.home-hero-body {
  padding: 1.25rem 1.35rem 1.35rem;
  display: grid;
  align-content: center;
  gap: 0.45rem;
}
.home-hero-body h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.2;
}
.home-hero-body > p {
  margin: 0;
}
.home-how-list {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.home-how-list li::marker {
  color: var(--accent);
  font-weight: 700;
}
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.home-start-card {
  display: grid;
  gap: 0.65rem;
  align-content: start;
}
.home-start-art {
  margin: -0.15rem -0.15rem 0.15rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  max-height: 120px;
}
.home-start-art img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.home-start-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.home-join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.home-path-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-top: 0.75rem;
}
.home-path-step {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
}
.home-path-step img {
  width: 100%;
  height: 78px;
  object-fit: cover;
  display: block;
}
.home-path-step div {
  padding: 0.55rem 0.65rem 0.7rem;
}
.home-path-step strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}
.home-path-step span {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* App shell */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
}
.app-header .brand img { width: 32px; height: 32px; }
.header-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.stat-pill-place.place-1 {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.08);
}
.stat-pill-place.place-2 {
  border-color: rgba(212, 212, 216, 0.4);
}
.stat-pill-place.place-3 {
  border-color: rgba(217, 119, 6, 0.4);
}

/* Compact race / ranking strip under stats */
.race-strip {
  margin-bottom: 0.85rem;
}
.race-strip.hidden { display: none; }
.race-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.race-chip {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  min-width: 9.5rem;
  max-width: 14rem;
  flex: 1 1 9.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.race-chip.me {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(255, 85, 0, 0.2);
}
.race-chip.turn {
  outline: 1px dashed rgba(255, 85, 0, 0.45);
  outline-offset: 1px;
}
.race-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.race-chip-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.race-chip-top {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  font-size: 0.8rem;
}
.race-place {
  font-weight: 700;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
}
.race-chip.place-1 .race-place { color: #fbbf24; }
.race-chip.place-2 .race-place { color: #d4d4d8; }
.race-chip.place-3 .race-place { color: #d97706; }
.race-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.race-turn { color: var(--accent-light); font-size: 0.75rem; }
.race-bar {
  height: 4px;
  border-radius: 999px;
  background: #222;
  overflow: hidden;
}
.race-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  border-radius: 999px;
}
.race-chip.me .race-bar > span {
  background: linear-gradient(90deg, #ff5500, #ff8844);
}
.race-chip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.45rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.race-strip-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.race-gap.ahead { color: #f87171; }
.race-gap.behind { color: #4ade80; }
.race-gap.me-tag { color: var(--accent-light); font-weight: 600; }

/* Rival cards (Rivals tab) */
.rival-cards {
  display: grid;
  gap: 0.65rem;
}
.rival-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 0.75rem 0.85rem;
}
.rival-card.me {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.rival-card.turn {
  box-shadow: inset 3px 0 0 var(--accent);
}
.rival-card-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}
.rival-avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.rival-id {
  min-width: 0;
  flex: 1;
}
.rival-id h4 {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rival-id p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.rival-place-block {
  text-align: right;
  flex-shrink: 0;
}
.rival-place-val {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.rival-place-val.place-1 { color: #fbbf24; }
.rival-place-val.place-2 { color: #d4d4d8; }
.rival-place-val.place-3 { color: #d97706; }
.rival-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.rival-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.rival-stat .res-ico {
  width: 1.15rem;
  height: 1.15rem;
  font-size: 0.75rem;
  border-radius: 6px;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.7rem 0.35rem 0.5rem;
  font-size: 0.85rem;
}
.stat-pill strong { color: var(--accent-light); }
.stat-name {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}
.stat-sub {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.res-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
}
.res-power { background: rgba(255, 200, 60, 0.14); }
.res-compute { background: rgba(100, 140, 255, 0.16); }
.res-battery { background: rgba(80, 220, 140, 0.14); }
.res-standing { background: rgba(255, 85, 0, 0.12); }
.res-phase { background: rgba(180, 180, 200, 0.12); }
.res-space { background: rgba(140, 100, 255, 0.14); }
.res-capability { background: rgba(255, 85, 0, 0.12); }
.res-alignment { background: rgba(34, 197, 94, 0.12); }
.res-emergence { background: rgba(239, 68, 68, 0.12); }
.meter-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.tabs button {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
}
.tabs button.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Character cards */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}
.char-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.char-card:hover, .char-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.char-card img,
.char-card img.char-portrait {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center top;
  border-radius: 10px;
  background: #0a0a0a;
  margin-bottom: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.char-card h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.char-card p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

/* Base view — clean full scene + CSS mood FX + corner growth badges
   (layer JPGs are standalone art, NOT transparent full-frame overlays) */
.base-view {
  position: relative;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0a0a0a;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 85, 0, 0.08);
  transition: box-shadow 0.25s ease, filter 0.25s ease;
}
.base-view > img.base-scene {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  vertical-align: middle;
  position: absolute;
  inset: 0;
  z-index: 1;
}
/* Growth badges: small cards, never cover the whole scene */
.base-layers {
  position: absolute;
  right: 0.55rem;
  bottom: 2.35rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-end;
  pointer-events: none;
  max-width: 38%;
}
.base-layer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.35rem 0.2rem 0.2rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  max-width: 100%;
}
.base-layer img {
  width: 52px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  flex-shrink: 0;
}
.base-layer .layer-badge-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--text-muted, #c8c8d0);
  letter-spacing: 0.02em;
  padding-right: 0.15rem;
}
.base-layer.layer-solar { border-color: rgba(255, 180, 60, 0.45); }
.base-layer.layer-solar.tier-3,
.base-layer.layer-solar.tier-4 { box-shadow: 0 0 12px rgba(255, 160, 40, 0.35); }
.base-layer.layer-battery { border-color: rgba(80, 220, 140, 0.4); }
.base-layer.layer-compute { border-color: rgba(120, 160, 255, 0.45); }
.base-layer.layer-compute.tier-3 { box-shadow: 0 0 12px rgba(120, 160, 255, 0.35); }
.base-view.juice-flash {
  animation: juice-flash-pulse 0.45s ease-out;
}
.base-view.juice-expand { box-shadow: 0 0 0 2px rgba(255, 160, 40, 0.7), 0 20px 50px rgba(0,0,0,0.55); }
.base-view.juice-energy { box-shadow: 0 0 28px rgba(255, 180, 40, 0.45), 0 20px 50px rgba(0,0,0,0.55); }
.base-view.juice-compute { box-shadow: 0 0 28px rgba(100, 140, 255, 0.45), 0 20px 50px rgba(0,0,0,0.55); }
.base-view.juice-sabotage { box-shadow: 0 0 28px rgba(255, 50, 40, 0.5), 0 20px 50px rgba(0,0,0,0.55); filter: saturate(1.2); }
.base-view.juice-research { box-shadow: 0 0 24px rgba(160, 100, 255, 0.4), 0 20px 50px rgba(0,0,0,0.55); }
.base-view.juice-repair { box-shadow: 0 0 20px rgba(80, 220, 140, 0.4), 0 20px 50px rgba(0,0,0,0.55); }
@keyframes juice-flash-pulse {
  0% { filter: brightness(1.25); }
  100% { filter: brightness(1); }
}

/* Floating gain/loss juice (viewport-fixed) */
#fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}
.fx-float {
  position: fixed;
  transform: translate(-50%, 0);
  font-family: Outfit, Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: transform 1.35s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 1.35s ease;
  white-space: nowrap;
  pointer-events: none;
}
.fx-float.fx-float-go {
  opacity: 1;
  transform: translate(-50%, -72px);
}
.fx-float.fx-up { color: #7dffa0; }
.fx-float.fx-down { color: #ff7a6e; }
.fx-float.fx-neutral { color: #e8e8f0; }
.fx-float.fx-kind-expand { color: #ffb84a; font-size: 1.25rem; }
.fx-float.fx-kind-sabotage { color: #ff5a4a; }

/* Rival / race drama feed */
.drama-feed {
  margin-top: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated, rgba(255,255,255,0.03));
}
.drama-feed-hint,
.drama-feed-empty {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
}
.drama-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.drama-item {
  display: grid;
  grid-template-columns: 1.4rem 1fr auto;
  gap: 0.45rem;
  align-items: start;
  font-size: 0.84rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid transparent;
}
.drama-item.is-rival {
  border-color: rgba(255, 120, 60, 0.18);
}
.drama-item.is-self {
  opacity: 0.72;
}
.drama-icon {
  line-height: 1.3;
  text-align: center;
}
.drama-text {
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}
.drama-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  align-self: center;
}
.card-inset { /* alias for drama on Base */ }
.base-view-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-top: 0.75rem;
}
.base-chip {
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.base-chip strong {
  color: var(--accent-light);
  font-weight: 600;
}
.base-caption {
  text-align: center;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

/* ── Theater / base-development map (abstract board) ── */
.world-map-wrap,
.theater-wrap {
  margin: 0.85rem 0 1rem;
}
.wmap-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.45rem;
}
.wmap-header .rivals-section-title { margin: 0; }
.wmap-hint { font-size: 0.78rem; }
.theater-map {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  min-height: 360px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: #020617;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.theater-board-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.88;
  filter: saturate(1.05) contrast(1.05);
}
.theater-map.has-board::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(2, 6, 23, 0.5) 100%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.2), transparent 25%, transparent 75%, rgba(2, 6, 23, 0.35));
}
.theater-board {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
/* Horizontal development path */
.theater-path {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 52%;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg,
    rgba(148, 163, 184, 0.25),
    rgba(251, 146, 60, 0.45),
    rgba(96, 165, 250, 0.5),
    rgba(167, 139, 250, 0.55));
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}
.theater-path::before {
  content: '';
  position: absolute;
  inset: -40px 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 48px,
    rgba(255, 255, 255, 0.03) 48px,
    rgba(255, 255, 255, 0.03) 49px
  );
}
.theater-track {
  position: absolute;
  top: 0.55rem;
  transform: translateX(-50%);
  z-index: 1;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}
.theater-track.phase-house { color: #cbd5e1; }
.theater-track.phase-expanded { color: #fdba74; }
.theater-track.phase-industrial { color: #93c5fd; }
.theater-track.phase-orbital { color: #c4b5fd; }
.theater-sites {
  position: absolute;
  inset: 0;
  z-index: 3;
}
.theater-site {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 148px;
  transition: transform 0.15s ease, z-index 0s;
}
.theater-site.tier-2 { width: 168px; }
.theater-site.tier-3 { width: 192px; }
.theater-site.tier-4 { width: 216px; }
.theater-site.me { z-index: 6; }
.theater-site:hover,
.theater-site.focus {
  z-index: 8;
  transform: translate(-50%, -50%) scale(1.05);
}
/* Living campus of real buildings */
.campus {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(165deg, rgba(6, 12, 24, 0.88), rgba(4, 8, 16, 0.94));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
  backdrop-filter: blur(4px);
}
.theater-site.me .campus {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3), 0 14px 36px rgba(0, 0, 0, 0.6);
}
.theater-site.orbital .campus {
  border-color: rgba(167, 139, 250, 0.7);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.28), 0 12px 32px rgba(0, 0, 0, 0.55);
}
.campus-core {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 0.45rem 0.35rem 0.15rem;
  background:
    radial-gradient(ellipse at 50% 80%, rgba(56, 189, 248, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  min-height: 78px;
}
.theater-site.tier-3 .campus-core,
.theater-site.tier-4 .campus-core { min-height: 92px; }
.campus-hq {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
  image-rendering: auto;
}
.theater-site.tier-3 .campus-hq,
.theater-site.tier-4 .campus-hq {
  width: 88px;
  height: 88px;
}
.campus-avatar {
  position: absolute;
  left: 0.4rem;
  bottom: 0.35rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.campus-rank {
  position: absolute;
  top: 0.3rem;
  right: 0.35rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #fbbf24;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theater-site.place-1 .campus-rank { color: #fbbf24; }
.theater-site.place-2 .campus-rank { color: #e4e4e7; border-color: #a1a1aa; }
.theater-site.place-3 .campus-rank { color: #d97706; border-color: #d97706; }
.campus-plots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 0.15rem;
  padding: 0.25rem 0.35rem 0.35rem;
  min-height: 42px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.campus-plot {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.campus-plot.worn {
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.25);
}
.campus-bldg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}
.campus-count {
  position: absolute;
  right: 1px;
  bottom: 0;
  font-size: 0.55rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 3px;
  padding: 0 0.15rem;
  color: #e2e8f0;
  line-height: 1.15;
}
.campus-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.65rem;
  padding: 0.25rem;
}
.campus-label {
  padding: 0.3rem 0.4rem 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.campus-label strong {
  display: block;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.campus-label > span {
  display: block;
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.campus-bars { padding: 0; }
.theater-bars {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.3rem 0.4rem 0.4rem;
}
.wmap-legend-sprite {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
}
.theater-bar-row {
  display: grid;
  grid-template-columns: 0.9rem 1fr;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.65rem;
}
.theater-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.theater-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width 0.35s ease;
}
.theater-bar.cap span { background: linear-gradient(90deg, #7c3aed, #c4b5fd); }
.theater-bar.power span { background: linear-gradient(90deg, #d97706, #fbbf24); }
.theater-bar.compute span { background: linear-gradient(90deg, #2563eb, #93c5fd); }
.wmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  justify-content: center;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.wmap-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.wmap-legend-ico { font-size: 0.85rem; }
@media (max-width: 700px) {
  .theater-map { min-height: 380px; aspect-ratio: auto; height: 420px; }
  .theater-site { width: 118px; }
  .theater-site.tier-2 { width: 128px; }
  .theater-site.tier-3,
  .theater-site.tier-4 { width: 138px; }
  .theater-track { font-size: 0.58rem; padding: 0.12rem 0.35rem; }
}

/* ── Facility map (own base schematic) ── */
.facility-map {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(20, 28, 40, 0.95), rgba(12, 14, 20, 0.98));
}
.fmap-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.2rem;
}
.fmap-header .rivals-section-title { margin: 0; }
.fmap-phase {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-light);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 140, 60, 0.35);
  background: rgba(255, 120, 40, 0.12);
}
.fmap-totals { font-size: 0.78rem; margin-left: auto; }
.fmap-hint { font-size: 0.78rem; margin: 0.15rem 0 0.55rem; }
.fmap-grid {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.fmap-grid.power-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.fmap-grid.support-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.fmap-zone {
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fmap-zone.active { border-color: rgba(255, 255, 255, 0.14); }
.fmap-zone.idle { opacity: 0.45; }
.fmap-zone.worn {
  border-color: rgba(250, 180, 40, 0.55);
  box-shadow: 0 0 0 1px rgba(250, 160, 20, 0.15);
}
.fmap-zone.kind-power.active { border-color: rgba(255, 180, 60, 0.28); }
.fmap-zone.kind-compute.active { border-color: rgba(120, 160, 255, 0.35); }
.fmap-zone.kind-battery.active { border-color: rgba(80, 220, 140, 0.35); }
.fmap-zone-head {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}
.fmap-ico { font-size: 0.9rem; line-height: 1; }
.fmap-name {
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fmap-worn {
  margin-left: auto;
  font-weight: 800;
  color: #fbbf24;
  font-size: 0.8rem;
}
.fmap-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.fmap-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  min-width: 0;
  transition: width 0.35s ease;
}
.fmap-zone.kind-compute .fmap-bar span {
  background: linear-gradient(90deg, #3b82f6, #93c5fd);
}
.fmap-zone.kind-battery .fmap-bar span {
  background: linear-gradient(90deg, #059669, #6ee7b7);
}
.fmap-zone.kind-power[title*="Diesel"] .fmap-bar span,
.fmap-zone#diesel .fmap-bar span { background: linear-gradient(90deg, #78716c, #a8a29e); }
.fmap-val {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.fmap-meters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.fmap-meter {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.35rem;
  align-items: center;
}
.fmap-meter-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.fmap-meter-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.fmap-meter-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
}
.fmap-meter.cap .fmap-meter-bar span {
  background: linear-gradient(90deg, #a78bfa, #c4b5fd);
}
.fmap-meter.align .fmap-meter-bar span {
  background: linear-gradient(90deg, #34d399, #6ee7b7);
}
.fmap-meter.emerge .fmap-meter-bar span {
  background: linear-gradient(90deg, #f97316, #fb923c);
}
.fmap-meter-val {
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Race map (rivals comparison) ── */
.race-map {
  margin: 0.85rem 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(18, 22, 36, 0.96), rgba(10, 12, 18, 0.98));
}
.race-map.is-compact {
  margin-top: 0.75rem;
  padding: 0.65rem 0.7rem;
}
.rmap-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.55rem;
}
.rmap-header .rivals-section-title { margin: 0; }
.rmap-sub { font-size: 0.78rem; }
.rmap-lanes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rmap-lane {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.65rem;
  align-items: center;
  padding: 0.45rem 0.5rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}
.rmap-lane.me {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(14, 80, 120, 0.18);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.12);
}
.rmap-lane.compact {
  grid-template-columns: 72px 1fr;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem;
}
.rmap-thumb-wrap {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.rmap-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rmap-avatar {
  position: absolute;
  left: 0.25rem;
  bottom: 0.25rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.rmap-lane.compact .rmap-avatar {
  width: 20px;
  height: 20px;
}
.rmap-place {
  position: absolute;
  top: 0.2rem;
  right: 0.25rem;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fbbf24;
}
.rmap-lane.place-1 .rmap-place { color: #fbbf24; }
.rmap-lane.place-2 .rmap-place { color: #e4e4e7; }
.rmap-lane.place-3 .rmap-place { color: #d97706; }
.rmap-body { min-width: 0; }
.rmap-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.45rem;
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
}
.rmap-ai {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.rmap-lead {
  font-size: 0.75rem;
  line-height: 1;
}
.rmap-phase { font-size: 0.72rem; margin-left: auto; }
.rmap-bars { display: flex; flex-direction: column; gap: 0.2rem; }
.rmap-bar-row {
  display: grid;
  grid-template-columns: 1.1rem 1fr 2.4rem;
  gap: 0.3rem;
  align-items: center;
}
.rmap-bar-ico { font-size: 0.72rem; text-align: center; opacity: 0.9; }
.rmap-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.rmap-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width 0.35s ease;
}
.rmap-bar.cap span { background: linear-gradient(90deg, #7c3aed, #c4b5fd); }
.rmap-bar.power span { background: linear-gradient(90deg, #d97706, #fbbf24); }
.rmap-bar.compute span { background: linear-gradient(90deg, #2563eb, #93c5fd); }
.rmap-bar-n {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text-muted);
}
@media (max-width: 560px) {
  .fmap-meters { grid-template-columns: 1fr; }
  .rmap-lane { grid-template-columns: 80px 1fr; }
  .rmap-lane.compact { grid-template-columns: 64px 1fr; }
}

.rivals-round-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.table tr.rival-current td {
  background: var(--accent-soft);
  color: var(--text);
}

.victory-panel {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
}
.victory-panel.hidden { display: none; }
.victory-panel.agi-strip {
  border-color: rgba(255, 85, 0, 0.35);
}
.victory-rules {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.victory-rules li { margin-bottom: 0.35rem; }
.victory-rules strong { color: var(--accent-light); }
.victory-note {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.victory-note.ok { color: var(--success); }
.victory-note.warn { color: var(--warning); }
.victory-note.danger { color: var(--danger); }

/* First-open how-to-win modal */
.howto-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.howto-modal-card {
  width: min(440px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}
.howto-modal-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  color: var(--accent-light);
}
.howto-modal-card .victory-rules { margin-bottom: 1rem; }
.howto-modal-card button { width: 100%; }
.howto-hint {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Event modal (same overlay shell as how-to-win) */
.event-modal-card {
  width: min(480px, 100%);
}
.event-modal-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-light);
}
.event-modal-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  line-height: 1.35;
  color: var(--text);
}
.event-modal-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.event-modal-opts {
  display: grid;
  gap: 0.65rem;
}
.event-modal-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.event-modal-opt:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(255, 85, 0, 0.25);
}
.event-modal-opt .event-opt-label {
  font-weight: 600;
  font-size: 0.95rem;
}
.event-modal-opt .event-fx {
  width: 100%;
}

/* Compact confirmation chip in turn tray after modal pick */
.turn-event-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 85, 0, 0.35);
  background: rgba(255, 85, 0, 0.08);
  font-size: 0.82rem;
}
.turn-event-chip.hidden { display: none; }
.event-chip-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.event-chip-choice { font-weight: 600; }
.event-chip-change {
  margin-left: auto;
  padding: 0.25rem 0.55rem !important;
  font-size: 0.78rem !important;
}

.rivals-section-title {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.how-to-win-section {
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.how-to-win-section .rivals-section-title { margin-top: 0; }
.rank-cell { width: 2.5rem; }
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-light);
}
.rank-badge.place-1 { color: #fbbf24; }
.rank-badge.place-2 { color: #d4d4d8; }
.rank-badge.place-3 { color: #d97706; }
.table tr.rival-me td { font-weight: 500; }
.agi-box.compact {
  margin-top: 0;
  padding: 0.55rem 0.65rem;
}
.agi-box.compact .btn-activate-agi {
  margin-top: 0.45rem;
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
}
.finish-headline {
  color: var(--accent-light);
  font-weight: 700;
}
/* Narrative HUD — chapters + AGI voice */
.narrative-hud {
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: grid;
  gap: 0.55rem;
}
.chapter-row {
  display: grid;
  gap: 0.45rem;
}
.chapter-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
}
.chapter-chip {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-elevated);
}
.chapter-chip.active {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-soft);
  font-weight: 600;
}
.chapter-chip.done {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.35);
}
.chapter-sep { color: var(--text-muted); opacity: 0.5; }
.chapter-goal {
  font-size: 0.88rem;
}
.chapter-bar {
  margin: 0.35rem 0 0.2rem;
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.chapter-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
  border-radius: 99px;
}
.chapter-progress-label {
  font-size: 0.75rem;
}
.next-goal-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(14, 116, 144, 0.22);
  font-size: 0.82rem;
  color: var(--text);
  max-width: 100%;
}
.next-goal-chip strong {
  color: var(--accent-light);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.next-goal-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.turn-summary-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
}
.turn-summary-strip.hidden { display: none; }
.turn-summary-strip .ts-label {
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}
.turn-summary-strip .ts-income { color: var(--accent-light); }
.turn-summary-strip .ts-hl {
  color: var(--text-muted);
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field-check { margin-top: 0.5rem; }
.check-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.92rem;
}
.check-label input { margin-top: 0.2rem; }
.field-hint { font-size: 0.78rem; margin: 0.25rem 0 0 1.5rem; }
.project-badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
  font-size: 0.72rem;
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: #fde68a;
}
.side-streak-badge {
  font-size: 0.72rem;
  color: var(--accent-light);
  margin-left: 0.35rem;
}
.agi-voice {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(160, 120, 255, 0.35);
  background: rgba(80, 40, 140, 0.18);
}
.agi-voice.tone-cold { border-color: rgba(120, 160, 255, 0.4); background: rgba(40, 60, 120, 0.22); }
.agi-voice.tone-emergent { border-color: rgba(255, 100, 40, 0.45); background: rgba(120, 40, 10, 0.25); }
.agi-voice.tone-ally { border-color: rgba(80, 220, 140, 0.4); background: rgba(20, 80, 50, 0.22); }
.agi-voice-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.agi-voice p {
  margin: 0;
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.4;
}
.btn-week-report {
  justify-self: start;
  font-size: 0.82rem !important;
  padding: 0.35rem 0.65rem !important;
}

/* Week report modal */
.week-report-overlay {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.week-report-overlay.hidden { display: none; }
.week-report-box {
  width: min(440px, 100%);
  padding: 1.35rem 1.25rem 1.15rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.week-report-box h2 {
  margin: 0 0 0.65rem;
  font-size: 1.45rem;
}
.week-chapter-change {
  margin: 0 0 0.65rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-light);
  font-size: 0.88rem;
  font-weight: 600;
}
.week-lines {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.week-line {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 0.45rem;
  align-items: start;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.88rem;
  line-height: 1.35;
}
.week-ico { text-align: center; }
.btn-week-ok {
  width: 100%;
  font-size: 1.02rem;
  padding: 0.7rem 1rem;
}
.agi-voice.in-modal { margin-bottom: 0.85rem; }

/* Immediate AGI result dialog */
.agi-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.agi-result-overlay.hidden { display: none; }
.agi-result-box {
  width: min(420px, 100%);
  padding: 1.5rem 1.35rem 1.25rem;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--bg-elevated, #141418);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
}
.agi-result-box.win {
  border-color: rgba(80, 220, 140, 0.75);
  box-shadow: 0 0 40px rgba(60, 200, 120, 0.25), 0 24px 60px rgba(0, 0, 0, 0.55);
}
.agi-result-box.lose {
  border-color: rgba(255, 70, 60, 0.8);
  box-shadow: 0 0 40px rgba(255, 50, 40, 0.28), 0 24px 60px rgba(0, 0, 0, 0.55);
}
.agi-result-box.fail {
  border-color: rgba(255, 180, 60, 0.7);
  box-shadow: 0 0 36px rgba(255, 160, 40, 0.22), 0 24px 60px rgba(0, 0, 0, 0.55);
}
.agi-result-badge {
  width: 3.2rem;
  height: 3.2rem;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
}
.agi-result-box.win .agi-result-badge {
  background: rgba(80, 220, 140, 0.2);
  color: #7dffa0;
}
.agi-result-box.lose .agi-result-badge {
  background: rgba(255, 70, 60, 0.2);
  color: #ff7a6e;
}
.agi-result-box.fail .agi-result-badge {
  background: rgba(255, 180, 60, 0.2);
  color: #ffb84a;
}
.agi-result-title {
  margin: 0 0 0.35rem;
  font-family: Outfit, Inter, system-ui, sans-serif;
  font-size: 1.65rem;
  letter-spacing: 0.04em;
}
.agi-result-box.win .agi-result-title { color: #7dffa0; }
.agi-result-box.lose .agi-result-title { color: #ff7a6e; }
.agi-result-box.fail .agi-result-title { color: #ffb84a; }
.agi-result-sub {
  margin: 0 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
}
.agi-result-body {
  text-align: left;
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.88rem;
}
.agi-result-line { margin: 0.25rem 0; color: var(--text); }
.btn-agi-result-ok {
  width: 100%;
  font-size: 1.05rem;
  padding: 0.75rem 1rem;
}

.agi-box {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
}
.agi-probs-title {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.agi-probs-title .ok { color: var(--success); }
.agi-probs-title .danger { color: var(--danger); }
.agi-probs-title .warn { color: var(--warning); }
.btn-activate-agi {
  width: 100%;
  font-size: 1.05rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Focus + Events — compact in bottom turn tray (not a full card over tabs) */
.turn-extras { display: none !important; }

/* Base scene visual variants (single image + FX) */
.base-view .base-fx {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.35s, background 0.35s, box-shadow 0.35s;
}
.base-variant-tag {
  position: absolute;
  left: 0.65rem;
  bottom: 0.65rem;
  z-index: 4;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: rgba(0,0,0,0.55);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.base-view.solar-tier-1 .base-fx { background: rgba(255, 180, 60, 0.06); }
.base-view.solar-tier-2 .base-fx { background: rgba(255, 160, 40, 0.12); box-shadow: inset 0 0 40px rgba(255, 140, 0, 0.15); }
.base-view.solar-tier-3 .base-fx { background: rgba(255, 140, 20, 0.18); box-shadow: inset 0 0 60px rgba(255, 120, 0, 0.25); }
.base-view.compute-tier-1 .base-fx { box-shadow: inset -30px 0 40px rgba(80, 120, 255, 0.12); }
.base-view.compute-tier-2 .base-fx { box-shadow: inset -40px 0 50px rgba(100, 140, 255, 0.2); }
.base-view.compute-tier-3 .base-fx { box-shadow: inset -50px 0 60px rgba(120, 160, 255, 0.28), inset 0 0 30px rgba(160, 100, 255, 0.12); }
.base-view.mood-sabotaged .base-fx { background: rgba(180, 0, 0, 0.18); box-shadow: inset 0 0 50px rgba(255, 40, 40, 0.25); }
.base-view.mood-emergence .base-fx { background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,85,0,0.04) 2px, rgba(255,85,0,0.04) 4px); }
.base-view.mood-agi .base-fx { background: radial-gradient(circle at 50% 40%, rgba(255,85,0,0.25), transparent 60%); animation: agi-pulse 2s ease-in-out infinite; }
.base-view.focus-overclock .base-fx { outline: 2px solid rgba(255, 100, 50, 0.35); outline-offset: -2px; }
.base-view.focus-grid_sync .base-fx { outline: 2px solid rgba(80, 180, 255, 0.3); outline-offset: -2px; }
.base-view.focus-safety_drill .base-fx { outline: 2px solid rgba(80, 220, 120, 0.3); outline-offset: -2px; }
.base-view.focus-espionage .base-fx { outline: 2px solid rgba(180, 100, 255, 0.35); outline-offset: -2px; }
@keyframes agi-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}


/* Asset inventory (Base tab) */
.asset-inventory { margin-top: 1rem; }
.asset-table { font-size: 0.88rem; }
.asset-total {
  margin: 0.65rem 0 0.35rem;
  font-size: 0.95rem;
}
.asset-log {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.asset-log li { margin-bottom: 0.3rem; }
.asset-log strong { color: var(--text); }
.asset-worn-row td { color: var(--warning); }
.asset-repair-cell { white-space: nowrap; }
.btn-repair {
  font-size: 0.75rem !important;
  padding: 0.3rem 0.5rem !important;
}
.btn-repair:disabled,
.btn-repair.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

/* Plans */
.plans-panel { display: grid; gap: 0.75rem; }
.plan-mode-row {
  display: grid;
  gap: 0.45rem;
}
.plan-mode-opt {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
}
.plan-mode-opt.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.plan-mode-opt input { margin: 0; }
.plan-mode-opt span { font-weight: 600; font-size: 0.9rem; }
.plan-mode-opt small { color: var(--text-muted); font-size: 0.78rem; }
.plan-preset-grid {
  display: grid;
  gap: 0.5rem;
}
.plan-preset-card {
  text-align: left;
  display: grid;
  gap: 0.2rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.plan-preset-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(255, 85, 0, 0.25);
}
.plan-preset-card strong { font-size: 0.95rem; }
.plan-preset-card span { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }
.plan-preview-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.88rem;
}
.plan-tray-banner {
  width: 100%;
  margin-bottom: 0.35rem;
}
.plan-tray-banner.hidden { display: none; }
.plan-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 85, 0, 0.35);
  background: rgba(255, 85, 0, 0.08);
  font-size: 0.85rem;
}
.plan-banner.preview {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}
.plan-banner-text {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: baseline;
  min-width: 0;
}
.plan-banner-text em { font-style: normal; color: var(--accent-light); font-weight: 600; }
.plan-banner-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* Interact / market */
.interact-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.interact-section:last-child { border-bottom: none; }
.trade-qty-field { max-width: 8rem; margin-bottom: 0.75rem; }
.trade-deals {
  display: grid;
  gap: 0.65rem;
}
.trade-deal-card, .trade-offer-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 0.75rem 0.85rem;
}
.trade-deal-card h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.trade-deal-card p { margin: 0 0 0.55rem; font-size: 0.8rem; }
.trade-swap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0.45rem 0 0.65rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.trade-leg.neg { color: #f87171; }
.trade-leg.pos { color: #4ade80; }
.trade-arrow { color: var(--text-muted); }
.trade-offer-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.trade-offer-card.incoming { border-color: rgba(255, 85, 0, 0.4); }
.trade-offer-card.mine { opacity: 0.9; }
.trade-offer-card.filled { border-color: rgba(74, 222, 128, 0.35); }
.trade-offer-card.rejected, .trade-offer-card.cancelled { opacity: 0.7; }
.market-subhead {
  margin: 1.1rem 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Multiplayer chat */
.chat-section { margin-top: 0.25rem; }
.chat-log {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
}
.chat-msg {
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  max-width: 92%;
}
.chat-msg.mine {
  align-self: flex-end;
  border-color: rgba(255, 85, 0, 0.4);
  background: var(--accent-soft);
}
.chat-msg-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.chat-msg-text {
  font-size: 0.9rem;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-compose {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.chat-compose input {
  flex: 1 1 12rem;
  min-width: 0;
}
.chat-compose button { flex-shrink: 0; }
.chat-empty { margin: 0.35rem 0; }

/* Actions */
.action-list {
  display: grid;
  gap: 0.65rem;
}
.action-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
  padding: 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.action-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.action-card.locked { opacity: 0.55; }
.action-card.unaffordable {
  opacity: 0.62;
  filter: saturate(0.75);
}
.action-card.unaffordable.selected {
  opacity: 0.8;
  filter: none;
}
.action-card h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.action-card p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.action-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}
.costs {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  font-size: 0.8rem;
  color: var(--accent-light);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.cost-label,
.action-gains-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cost-item {
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}
.cost-item.cost-short {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
}
.action-gains {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
  margin-top: 0.45rem;
}
.action-gains .event-fx { margin: 0; }
.gain-tag {
  font-size: 0.78rem;
}
.turn-tray {
  position: sticky;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  border-top: 1px solid var(--border);
  padding: 0.65rem 1.15rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  z-index: 15;
  backdrop-filter: blur(8px);
}
.turn-tray.hidden { display: none; }
.turn-tray-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.turn-tray-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.1rem;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}
.turn-tray-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.turn-focus-panel {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 100%;
}
.turn-focus-label {
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.turn-focus-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.focus-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  text-align: left;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  line-height: 1.25;
  max-width: 14rem;
}
.focus-chip:hover {
  border-color: rgba(255, 85, 0, 0.45);
}
.focus-chip.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(255, 85, 0, 0.25);
}
.focus-chip-name {
  font-size: 0.82rem;
  font-weight: 600;
}
.focus-chip-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}
#selected-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 0;
}
.event-fx {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.fx-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}
.fx-tag.pos { color: #4ade80; border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.1); }
.fx-tag.neg { color: #f87171; border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.1); }

/* Progress */
.meter {
  height: 8px;
  background: #222;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.meter > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
}
.meter.align > span { background: linear-gradient(90deg, #166534, #22c55e); }
.meter.emerge > span { background: linear-gradient(90deg, #7f1d1d, #ef4444); }

.game-list { display: grid; gap: 0.65rem; }
.game-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-light);
}
.badge.live { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge.done { background: rgba(163, 163, 163, 0.15); color: var(--text-muted); }

.log-list {
  max-height: 320px;
  overflow: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.log-list div {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.toast {
  position: fixed;
  bottom: 5rem;
  right: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 50;
  max-width: 360px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th, .table td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.table th { color: var(--text-muted); font-weight: 500; }

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-card { order: -1; }
  .auth-pillars { grid-template-columns: 1fr; }
  .auth-pillar { grid-template-columns: 100px 1fr; grid-template-rows: auto; }
  .auth-pillar img { height: 100%; min-height: 88px; }
  .home-hero { grid-template-columns: 1fr; }
  .home-hero-fade {
    background: linear-gradient(180deg, transparent 30%, var(--bg-card) 100%);
  }
  .home-grid { grid-template-columns: 1fr; }
  .home-path-track { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .app-main { padding: 0.85rem; }
  .auth-card { padding: 1.5rem 1.15rem; }
  .action-card { grid-template-columns: 1fr; }
  .auth-cast-grid { grid-template-columns: 1fr 1fr; }
  .home-path-track { grid-template-columns: 1fr; }
  .home-join-row { grid-template-columns: 1fr; }
}
