:root {
  --bg: #080c18;
  --surface: #0d1326;
  --surface2: #121b33;
  --border: #1a2640;
  --text: #c4d4ee;
  --dim: #7a9ac0;
  --accent: #f0a500;
  --coop: #38bdf8;
  --defect: #ef4444;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  min-height: 100vh;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(26,38,64,0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,38,64,0.35) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse at 15% 5%, rgba(56,189,248,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 95%, rgba(240,165,0,0.06) 0%, transparent 55%);
  pointer-events: none;
}

.app { position: relative; z-index: 1; max-width: 1140px; margin: 0 auto; padding: 0 16px 80px; }

/* ── HEADER ── */
header {
  padding: 32px 0 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 14px;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}
h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 0.95;
  color: #ddeaff;
}
h1 em { color: var(--accent); font-style: normal; }
.header-sub { margin-top: 8px; color: var(--dim); font-size: 13px; font-weight: 300; max-width: 460px; }

/* Payoff mini-matrix */
.payoff-ref { display: flex; flex-direction: column; gap: 4px; }
.payoff-ref-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; margin-bottom: 4px; }
.pmatrix { display: grid; grid-template-columns: auto auto auto; gap: 2px; }
.pc {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  padding: 5px 10px; border-radius: 3px; text-align: center;
}
.pc-hdr { color: var(--dim); background: transparent; }
.pc-cc { background: rgba(56,189,248,0.13); color: var(--coop); }
.pc-cd { background: rgba(239,68,68,0.1); color: #f87171; }
.pc-dc { background: rgba(239,68,68,0.1); color: #f87171; }
.pc-dd { background: rgba(100,116,139,0.08); color: var(--dim); }

/* ── TABS ── */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 10px 16px; border: none; background: none; color: var(--dim);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all 0.18s; white-space: nowrap; flex-shrink: 0;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel { display: none; }
.panel.active { display: block; }

/* ── CARD ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px;
}
.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 14px;
}

/* ── CONTROLS ── */
.ctrl-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.ctrl-group { display: flex; flex-direction: column; gap: 5px; }
.ctrl-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim);
}
select, input[type=number] {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 5px; color: var(--text);
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  height: 38px; padding: 0 10px; outline: none; transition: border-color 0.15s;
}
select:focus, input:focus { border-color: var(--accent); }

/* ── UNIFIED BUTTON SYSTEM ── */
.btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  height: 38px; padding: 0 18px;
  border: 1.5px solid var(--accent); border-radius: 5px;
  background: transparent; color: var(--accent); cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s, opacity 0.14s;
  white-space: nowrap; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { background: var(--accent); color: #080c18; }
.btn.primary { background: var(--accent); color: #080c18; }
.btn.primary:hover:not(:disabled) { background: transparent; color: var(--accent); }
.btn.muted { border-color: var(--border); color: var(--dim); }
.btn.muted:hover:not(:disabled) { border-color: var(--text); color: var(--text); background: transparent; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12px; }

/* ── INFO BOX ── */
.info-box {
  background: rgba(240,165,0,0.06); border: 1px solid rgba(240,165,0,0.18);
  border-radius: 6px; padding: 11px 15px;
  font-size: 13px; color: var(--dim); line-height: 1.55;
}
.info-box strong { color: var(--accent); }

/* ── STRATEGY BADGES ── */
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 500;
  padding: 3px 8px; border-radius: 3px; border: 1px solid; white-space: nowrap;
}
.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ══════════════════════════════════
   TOURNAMENT
══════════════════════════════════ */
.t-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 680px) { .t-grid { grid-template-columns: 1fr; } }

.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.lb-row:last-child { border-bottom: none; }
.lb-rank {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--dim); width: 22px; text-align: right; flex-shrink: 0;
}
.lb-rank.g { color: #f0a500; font-weight: 700; }
.lb-rank.s { color: #94a3b8; font-weight: 700; }
.lb-rank.b { color: #b45309; font-weight: 700; }
.lb-body { flex: 1; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.lb-name {
  font-family: 'Barlow Condensed', sans-serif; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 7px; justify-content: space-between;
}
.lb-score { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; }
.bar-bg { height: 3px; background: var(--border); border-radius: 2px; }
.bar { height: 3px; border-radius: 2px; transition: width 0.7s cubic-bezier(0.4,0,0.2,1); }

/* Matrix */
.mtx-wrap { overflow-x: auto; }
.mtx { border-collapse: collapse; font-family: 'JetBrains Mono', monospace; font-size: 12px; width: 100%; }
.mtx th {
  padding: 5px 7px; text-align: center; color: var(--dim);
  font-size: 10px; letter-spacing: 0.1em; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.mtx td { padding: 5px 8px; text-align: center; border: 1px solid rgba(26,38,64,0.5); font-size: 12px; }
.mtx .rl { text-align: right; color: var(--dim); font-size: 10px; white-space: nowrap; }

/* ══════════════════════════════════
   DUEL
══════════════════════════════════ */
.duel-scores {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px;
}
.player-card {
  border-radius: 8px; padding: 18px; border: 2px solid;
  transition: background 0.3s, border-color 0.3s;
}
.p-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; margin-bottom: 4px; opacity: 0.5;
}
.p-score {
  font-family: 'Barlow Condensed', sans-serif; font-size: clamp(2.5rem, 7vw, 3.5rem);
  font-weight: 800; line-height: 1;
}
.p-name {
  font-family: 'Barlow Condensed', sans-serif; font-size: 1.1rem; font-weight: 600;
  margin-top: 4px; opacity: 0.75;
}

.moves-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 14px 0; }
.moves-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.15em; color: var(--dim); margin-bottom: 6px; }
.moves-grid { display: flex; flex-wrap: wrap; gap: 3px; min-height: 25px; }
.mc {
  width: 22px; height: 22px; border-radius: 3px; display: flex; align-items: center;
  justify-content: center; font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 700;
}
.mc-C { background: rgba(56,189,248,0.18); color: var(--coop); border: 1px solid rgba(56,189,248,0.3); }
.mc-D { background: rgba(239,68,68,0.18); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.mc-new { animation: pop 0.28s cubic-bezier(0.4,0,0.2,1); }
@keyframes pop {
  0% { transform: scale(0) rotate(-10deg); opacity: 0; }
  70% { transform: scale(1.15) rotate(2deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.round-log { max-height: 220px; overflow-y: auto; }
.log-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; border-bottom: 1px solid rgba(26,38,64,0.5);
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  animation: fadeUp 0.18s ease;
}
.log-row:last-child { border-bottom: none; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
.log-n { color: var(--dim); width: 36px; flex-shrink: 0; }
.log-m { flex: 1; text-align: center; }
.log-p { width: 72px; text-align: right; color: var(--dim); font-size: 11px; }

.strat-desc { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }

/* Progress bar under scores */
.score-progress { height: 4px; background: var(--border); border-radius: 2px; margin-top: 10px; }
.score-fill { height: 4px; border-radius: 2px; transition: width 0.3s; }

/* ══════════════════════════════════
   EVOLUTION
══════════════════════════════════ */
.evo-layout { display: grid; grid-template-columns: 1fr 270px; gap: 22px; }
@media (max-width: 780px) { .evo-layout { grid-template-columns: 1fr; } }

canvas { display: block; width: 100%; border-radius: 6px; }

.gen-stat {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--dim); margin-top: 8px;
}
.gen-stat span { color: var(--accent); font-weight: 700; }

.leg-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 11px; border-radius: 4px; background: var(--surface2);
  border: 1px solid var(--border); margin-bottom: 6px; transition: background 0.2s;
}
.leg-color { width: 11px; height: 11px; border-radius: 2px; flex-shrink: 0; }
.leg-name { font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 600; flex: 1; }
.leg-n { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--dim); }
.leg-pct { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--accent); width: 38px; text-align: right; }

/* Utils */
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mt20 { margin-top: 20px; }
.mb16 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

select option { background: #1a2640; }

/* ══════════════════════════════════
   PLAY MODE
══════════════════════════════════ */
.play-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px;
}
@media (max-width: 600px) { .play-layout { grid-template-columns: 1fr; } }

.play-combatant {
  border-radius: 12px; overflow: hidden; border: 2px solid var(--border);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.play-combatant.highlight-coop { border-color: var(--coop); box-shadow: 0 0 24px rgba(56,189,248,0.3); }
.play-combatant.highlight-defect { border-color: var(--defect); box-shadow: 0 0 24px rgba(239,68,68,0.3); }

.combatant-portrait {
  padding: 20px 16px 14px; text-align: center; position: relative; overflow: hidden;
}
.combatant-scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.07) 2px, rgba(0,0,0,0.07) 4px);
}
.combatant-avatar {
  font-size: 3.5rem; line-height: 1; margin-bottom: 8px; position: relative; z-index: 1;
  transition: filter 0.3s, transform 0.3s;
}
.combatant-avatar.react-coop { animation: avatarCoop 0.5s ease; }
.combatant-avatar.react-defect { animation: avatarDefect 0.5s ease; }
@keyframes avatarCoop {
  0% { transform: scale(1); } 40% { transform: scale(1.3); filter: drop-shadow(0 0 20px #38bdf8); } 100% { transform: scale(1); }
}
@keyframes avatarDefect {
  0% { transform: scale(1); } 20% { transform: scale(0.85) rotate(-5deg); filter: drop-shadow(0 0 20px #ef4444); } 60% { transform: scale(1.1) rotate(3deg); } 100% { transform: scale(1) rotate(0); }
}
.combatant-class {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.2em;
  text-transform: uppercase; opacity: 0.6; margin-bottom: 3px; position: relative; z-index: 1;
}
.combatant-name {
  font-family: 'Barlow Condensed', sans-serif; font-size: 1.3rem; font-weight: 800;
  color: #ddeaff; position: relative; z-index: 1;
}
.combatant-score {
  font-family: 'Barlow Condensed', sans-serif; font-size: 3rem; font-weight: 800;
  line-height: 1.1; position: relative; z-index: 1; margin-top: 6px;
  transition: transform 0.2s;
}
.combatant-score.bump { animation: scoreBump 0.35s ease; }
@keyframes scoreBump { 0%{transform:scale(1)} 40%{transform:scale(1.25)} 100%{transform:scale(1)} }

.combatant-last-move {
  position: relative; z-index: 1; margin-top: 8px; min-height: 28px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
}
.last-move-chip {
  padding: 4px 10px; border-radius: 4px; font-weight: 700; font-size: 12px;
  border: 1px solid; transition: all 0.2s;
}
.lmc-C { background: rgba(56,189,248,0.15); color: var(--coop); border-color: rgba(56,189,248,0.3); }
.lmc-D { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.3); }
.lmc-? { background: rgba(100,116,139,0.15); color: var(--dim); border-color: rgba(100,116,139,0.3); }

/* Round status bar */
.play-status {
  text-align: center; margin-bottom: 20px;
}
.round-indicator {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--dim); margin-bottom: 6px;
}
.round-progress { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.round-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }

/* Outcome flash */
.outcome-flash {
  text-align: center; min-height: 48px; margin-bottom: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.outcome-text {
  font-family: 'Barlow Condensed', sans-serif; font-size: 1.6rem; font-weight: 800;
  line-height: 1.1; animation: outcomeIn 0.3s ease;
}
@keyframes outcomeIn {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.outcome-points {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--dim);
  margin-top: 3px; animation: outcomeIn 0.3s ease 0.05s both;
}

/* Choice buttons */
.choice-area {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px;
}
.choice-btn {
  padding: 18px 12px; border-radius: 10px; border: 2px solid; cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif; font-size: 1.5rem; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: all 0.15s; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: transparent;
}
.choice-coop {
  border-color: rgba(56,189,248,0.4); color: var(--coop);
}
.choice-coop:hover:not(:disabled) {
  background: rgba(56,189,248,0.12); border-color: var(--coop);
  box-shadow: 0 0 20px rgba(56,189,248,0.25); transform: translateY(-2px);
}
.choice-defect {
  border-color: rgba(239,68,68,0.4); color: #f87171;
}
.choice-defect:hover:not(:disabled) {
  background: rgba(239,68,68,0.12); border-color: var(--defect);
  box-shadow: 0 0 20px rgba(239,68,68,0.25); transform: translateY(-2px);
}
.choice-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.choice-btn .choice-icon { font-size: 1.8rem; line-height: 1; }
.choice-btn .choice-sub { font-size: 10px; letter-spacing: 0.12em; opacity: 0.65; font-weight: 600; }

/* Move history strip */
.play-history { display: flex; gap: 3px; flex-wrap: wrap; min-height: 22px; }

/* End screen */
.play-end {
  text-align: center; padding: 32px 24px; display: none;
  animation: outcomeIn 0.4s ease;
}
.play-end.visible { display: block; }
.end-result {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(2.5rem, 8vw, 4rem); font-weight: 800; line-height: 1;
  margin-bottom: 8px;
}
.end-scores {
  font-family: 'JetBrains Mono', monospace; font-size: 14px; color: var(--dim); margin-bottom: 24px;
}
.end-breakdown {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 24px;
  text-align: left;
}
@media (max-width: 500px) { .end-breakdown { grid-template-columns: 1fr 1fr; } }
.breakdown-item {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px;
}
.breakdown-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--dim); margin-bottom: 4px; }
.breakdown-val { font-family: 'Barlow Condensed', sans-serif; font-size: 1.4rem; font-weight: 700; }

/* ══════════════════════════════════
   CHARACTER MODAL
══════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(4,7,18,0.88);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%; max-width: 760px;
  max-height: 90vh; overflow-y: auto;
  position: relative;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  border-top: 3px solid var(--modal-color, #f0a500);
}
.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex; align-items: center; gap: 16px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
}
.modal-avatar {
  font-size: 3rem; line-height: 1;
  filter: drop-shadow(0 0 14px var(--modal-color, #f0a500));
  flex-shrink: 0;
}
.modal-title-block { flex: 1; min-width: 0; }
.modal-class {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--modal-color, #f0a500); margin-bottom: 3px;
}
.modal-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem; font-weight: 800; color: #ddeaff; line-height: 1; margin-bottom: 4px;
}
.modal-props { display: flex; gap: 5px; flex-wrap: wrap; }

.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--dim); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.modal-close:hover { border-color: var(--text); color: var(--text); background: var(--border); }

.modal-body { padding: 22px 24px 28px; }

.modal-quote {
  font-size: 14px; font-style: italic; color: var(--dim);
  border-left: 3px solid var(--modal-color, #f0a500);
  padding: 8px 14px; margin-bottom: 22px; line-height: 1.55;
}

.modal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 580px) { .modal-cols { grid-template-columns: 1fr; } }

.modal-section-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px;
}

.modal-stats { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }

/* Clickable strategy pill — used in tournament, duel, etc. */
.strat-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; border-radius: 4px;
  padding: 1px 6px 1px 4px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.strat-pill:hover { border-color: var(--pill-color, #f0a500); background: color-mix(in srgb, var(--pill-color) 10%, transparent); }

/* ══════════════════════════════════
   STRATEGIES — CHARACTER ROSTER
══════════════════════════════════ */

/* Roster grid */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* Character card */
.char-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  position: relative;
}
.char-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.char-card.selected {
  box-shadow: 0 0 0 2px var(--card-color, #f0a500);
}

/* Portrait area */
.char-portrait {
  position: relative;
  padding: 28px 20px 18px;
  display: flex; flex-direction: column; align-items: center;
  background: var(--card-bg, #0d1326);
  overflow: hidden;
}
/* Decorative corner lines */
.char-portrait::before, .char-portrait::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-color: var(--card-color, #f0a500);
  border-style: solid;
  opacity: 0.5;
}
.char-portrait::before { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.char-portrait::after  { top: 8px; right: 8px; border-width: 2px 2px 0 0; }

.char-avatar {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 0 16px var(--card-color, #f0a500));
  margin-bottom: 12px;
  position: relative; z-index: 1;
}

/* Scanline effect on portrait */
.char-scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
}

.char-class {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--card-color, #f0a500); opacity: 0.8; margin-bottom: 4px;
}
.char-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem; font-weight: 800; letter-spacing: 0.02em;
  color: #ddeaff; text-align: center; line-height: 1.1;
}
.char-badge-sm {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 3px; border: 1px solid;
  color: var(--card-color, #f0a500);
  border-color: color-mix(in srgb, var(--card-color) 40%, transparent);
  background: color-mix(in srgb, var(--card-color) 10%, transparent);
  margin-top: 6px;
}

/* Card body */
.char-body { padding: 14px 16px 16px; }

.char-quote {
  font-size: 12px; font-style: italic; color: var(--dim);
  line-height: 1.5; margin-bottom: 14px;
  border-left: 2px solid var(--card-color, #f0a500);
  padding-left: 10px;
  opacity: 0.8;
}

/* Stat bars */
.char-stats { display: flex; flex-direction: column; gap: 6px; }
.stat-row { display: flex; align-items: center; gap: 8px; }
.stat-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--dim); width: 72px; flex-shrink: 0;
}
.stat-track {
  flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.stat-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.stat-val {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 700;
  width: 24px; text-align: right; color: var(--dim);
}

/* Axelrod property chips */
.char-props { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px; }
.cprop {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  padding: 2px 6px; border-radius: 3px; border: 1px solid;
}
.cprop.yes     { color: #4ade80; border-color: #4ade8030; background: #4ade8010; }
.cprop.no      { color: #f87171; border-color: #f8717130; background: #f8717110; }
.cprop.partial { color: #fbbf24; border-color: #fbbf2430; background: #fbbf2410; }

/* ── Detail panel (shown below roster when a card is selected) ── */
.char-detail {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px; margin-top: 8px;
  display: none;
  animation: slideDown 0.2s ease;
}
.char-detail.visible { display: block; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }

.sg-prop {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 3px; border: 1px solid; white-space: nowrap;
}
.sg-prop.yes { color: #4ade80; border-color: #4ade8040; background: #4ade8010; }
.sg-prop.no  { color: #f87171; border-color: #f8717140; background: #f8717110; }
.sg-prop.partial { color: #fbbf24; border-color: #fbbf2440; background: #fbbf2410; }

.sg-rule {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  padding: 12px 14px; margin-top: 12px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--text); line-height: 1.6;
}
.sg-rule strong { color: var(--accent); }

/* Move preview in detail */
.sg-preview-title {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--dim); margin-bottom: 8px;
}
.sg-vs-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sg-vs-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--dim);
  width: 44px; flex-shrink: 0;
}
.sg-moves { display: flex; gap: 2px; flex-wrap: nowrap; overflow: hidden; }
.sg-move {
  width: 16px; height: 16px; border-radius: 2px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 8px; font-weight: 700;
}
.sg-move-C { background: rgba(56,189,248,0.2); color: var(--coop); }
.sg-move-D { background: rgba(239,68,68,0.2); color: #f87171; }

/* ── Lab Intro ── */
.lab-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 24px;
  margin-bottom: 24px;
}
.lab-intro-cols {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.lab-intro-section { display: flex; flex-direction: column; gap: 10px; }
.lab-intro-section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 2px;
}
.lab-intro-section p {
  font-size: 13px; line-height: 1.65; color: var(--dim); font-weight: 300;
}
.lab-intro-section p strong { color: var(--text); font-weight: 600; }
.c-coop { color: var(--coop) !important; }
.c-defect { color: var(--defect) !important; }
.intro-property-list {
  list-style: none; display: flex; flex-direction: column; gap: 5px;
  padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 5px;
}
.intro-property-list li {
  font-size: 12px; color: var(--dim); line-height: 1.5;
  padding-left: 12px; position: relative;
}
.intro-property-list li::before {
  content: '→'; position: absolute; left: 0; color: var(--accent); font-size: 11px;
}
.intro-property-list li strong { color: var(--text); font-weight: 600; }
@media (max-width: 900px) {
  .lab-intro-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .lab-intro { padding: 14px; }
  .lab-intro-cols { grid-template-columns: 1fr; gap: 16px; }
  .lab-intro-section p { font-size: 13px; }
}

/* ══════════════════════════════════
   MOBILE RESPONSIVE
══════════════════════════════════ */
@media (max-width: 680px) {
  .t-grid { grid-template-columns: 1fr; }
  .duel-scores { grid-template-columns: 1fr; gap: 10px; }
  .moves-panel { grid-template-columns: 1fr; }
  .strat-desc { grid-template-columns: 1fr; }
  .play-layout { grid-template-columns: 1fr; gap: 10px; }
  .evo-layout { grid-template-columns: 1fr; }
  .modal-cols { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .app { padding: 0 12px 60px; }
  header { padding: 18px 0 14px; }
  .payoff-ref-desktop { display: none; }
  .payoff-toggle { display: inline-flex; }
  .badge-row { display: none; }
  .header-sub { display: none; }
  h1 { font-size: 2.2rem; }
  .tab { padding: 9px 11px; font-size: 11px; letter-spacing: 0.03em; }
  .card { padding: 12px 11px; }
  .ctrl-row { gap: 8px; }
  select, input[type=number] { height: 44px; font-size: 14px; }
  .btn { height: 44px; padding: 0 14px; font-size: 13px; }
  .btn.sm { height: 34px; padding: 0 10px; font-size: 11px; }
  /* Roster */
  .roster-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
  .char-avatar { font-size: 2.5rem; }
  .char-name { font-size: 1.05rem; }
  /* Opponent picker */
  .opponent-grid { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .opp-pick-avatar { font-size: 1.8rem; }
  .opp-pick-name { font-size: 11px; }
  /* Play */
  .combatant-score { font-size: 2.2rem; }
  .combatant-avatar { font-size: 2.5rem; }
  .choice-btn { padding: 14px 8px; }
  .choice-btn .choice-icon { font-size: 1.4rem; }
  .choice-btn .choice-sub { font-size: 9px; }
  .end-result { font-size: 2.2rem; }
  .end-breakdown { grid-template-columns: 1fr 1fr; }
  .play-topbar-title { font-size: 11px; }
  /* Modal — slides up from bottom */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92vh; }
  .modal-header { padding: 16px 14px 12px; }
  .modal-body { padding: 14px 14px 28px; }
  .modal-avatar { font-size: 2rem; }
  .modal-name { font-size: 1.4rem; }
  /* Info box */
  .info-box { font-size: 12px; padding: 9px 12px; }
}

/* ── Opponent picker grid ── */
.opponent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.opp-pick-card {
  border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 2px solid var(--border);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.opp-pick-card:hover {
  transform: translateY(-2px);
  border-color: var(--card-color, #f0a500);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.opp-pick-card.selected {
  border-color: var(--card-color, #f0a500);
  box-shadow: 0 0 0 1px var(--card-color, #f0a500), 0 6px 20px rgba(0,0,0,0.5);
}
.opp-pick-portrait {
  padding: 14px 8px 10px; text-align: center;
  position: relative; overflow: hidden;
}
.opp-pick-avatar { font-size: 2.2rem; line-height: 1; margin-bottom: 5px; position: relative; z-index: 1; }
.opp-pick-class  {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; opacity: 0.65; margin-bottom: 2px; position: relative; z-index: 1;
}
.opp-pick-name {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
  color: #ddeaff; line-height: 1.1; position: relative; z-index: 1;
}
.opp-pick-quote {
  padding: 7px 8px; font-size: 10px; font-style: italic;
  color: var(--dim); line-height: 1.4;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* In-game top bar */
.play-topbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.play-topbar-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); flex: 1;
}

/* ── Strategy match panel ── */
.style-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; margin-bottom: 0;
}
.style-panel-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim);
  margin-bottom: 12px;
}
.style-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  cursor: pointer; border-radius: 4px; padding: 3px 4px; transition: background 0.15s;
}
.style-row:hover { background: var(--surface2); }
.style-rank {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--dim); width: 16px; text-align: right; flex-shrink: 0;
}
.style-avatar { font-size: 1rem; flex-shrink: 0; width: 22px; text-align: center; }
.style-name {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 600;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.style-pct {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700;
  width: 36px; text-align: right; flex-shrink: 0;
}
.style-bar-bg { width: 60px; height: 4px; background: var(--border); border-radius: 2px; flex-shrink: 0; }
.style-bar    { height: 4px; border-radius: 2px; transition: width 0.5s ease; }

/* Axelrod legend strip */
.prop-legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-bottom: 22px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  font-size: 12px;
}
.prop-legend-item { display: flex; align-items: center; gap: 6px; }
.prop-legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* #4: Resolving feedback during 1300ms delay */
.choice-area.resolving { position: relative; }
.choice-area.resolving::before {
  content: 'Resolving…';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--accent); letter-spacing: 0.1em; z-index: 1;
  animation: resolvePulse 0.65s ease-in-out infinite alternate;
}
@keyframes resolvePulse { from { opacity: 0.4; } to { opacity: 1; } }

/* #11: Mobile payoff toggle */
.payoff-toggle {
  display: none; font-family: 'JetBrains Mono', monospace; font-size: 11px;
  align-items: center; gap: 4px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 5px;
  color: var(--dim); padding: 5px 10px; cursor: pointer;
}
.payoff-collapse { display: none; margin-top: 8px; }
.payoff-collapse.open { display: block; }

/* #15: Extracted inline style classes */
.play-setup-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 18px;
}
.section-title-lg {
  font-family: 'Barlow Condensed', sans-serif; font-size: 1.6rem;
  font-weight: 800; color: #ddeaff; line-height: 1;
}
.subtitle-dim { font-size: 13px; color: var(--dim); margin-top: 3px; }
.move-hist-wrap { padding: 10px 14px; }
.move-hist-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--dim); margin-bottom: 5px;
}
.prop-legend-title {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; margin-right: 4px;
}
.info-text-sm { font-size: 12px; line-height: 1.6; }
.lore-text { font-size: 13.5px; line-height: 1.7; color: var(--text); margin-bottom: 16px; }
.analysis-text { font-size: 13px; line-height: 1.65; color: var(--dim); }
.note-text { margin-top: 12px; font-size: 12px; font-style: italic; opacity: 0.85; }
.bar { width: var(--bar-w, 0%); }

/* E3: Keyboard shortcut hint */
.key-hint {
  text-align: center; font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--dim); margin-top: 8px;
}
.key-hint kbd {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px; font-size: 11px; color: var(--accent);
}

/* E6: Evolution chart tooltip */
.evo-tooltip {
  display: none; position: fixed; z-index: 100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; pointer-events: none;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  max-width: 220px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.evo-tooltip-title { color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.evo-tooltip-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.evo-tooltip-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* E8: Compare */
.compare-badge {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  background: var(--accent); color: #080c18; border: none; border-radius: 4px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  padding: 2px 6px; cursor: pointer; opacity: 0.8; transition: opacity 0.15s;
}
.compare-badge:hover { opacity: 1; }
.compare-badge.active { background: var(--coop); }

/* #24: Evo generation range label */
.evo-range-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--dim); text-align: center; margin-top: 4px;
}

/* #13: prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .mc-new, .score-bump, .outcome-text, .outcome-points, .combatant-avatar.react-coop,
  .combatant-avatar.react-defect, .log-row, .char-detail, .play-end,
  .choice-area.resolving::before, .modal, .modal-backdrop {
    animation: none !important;
    transition: none !important;
  }
}
