:root {
  /* Simple, accessibility-friendly palette */
  --app-bg: #ffffff;
  --app-text: #111827;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --muted-text: #6b7280;
  --accent: #2563eb;
  --accent-2: #10b981;
  --nav-bg: #ffffff;
  --nav-border: #e5e7eb;
}

.strategy-landscape-card {
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background:
    radial-gradient(circle at 12% 5%, rgba(56, 189, 248, 0.16), transparent 36%),
    radial-gradient(circle at 90% 10%, rgba(139, 92, 246, 0.14), transparent 34%),
    var(--card-bg);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
}

.strategy-landscape-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.45rem 0.45rem 0;
}

.strategy-landscape-copy {
  max-width: 760px;
}

.strategy-landscape-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.strategy-landscape-key span,
.landscape-axis-note {
  padding: 0.38rem 0.66rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--app-text);
  font-size: 0.78rem;
  font-weight: 700;
}

.strategy-landscape-scale {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.2rem 0.75rem;
}

@media (max-width: 768px) {
  .strategy-landscape-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
  }

  .strategy-landscape-key {
    justify-content: flex-start;
  }

  .strategy-landscape-scale {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* App shell */
.app-shell {
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--app-text);
}

.app-body {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.app-sidebar {
  flex: 0 0 340px;
  max-width: 340px;
}

.app-main {
  flex: 1 1 0;
  min-width: 0;
}

.app-footer {
  padding: 1rem;
  border-top: 1px solid var(--card-border);
  color: var(--muted-text);
  text-align: center;
  font-size: 0.9rem;
}

.not-found-card {
  max-width: 760px;
  margin: clamp(2rem, 8vw, 6rem) auto;
}

@media (max-width: 992px) {
  .app-sidebar {
    flex: 1 1 100%;
    max-width: none;
  }
}

.app-navbar {
  background: var(--nav-bg) !important;
  border-bottom: 1px solid var(--nav-border) !important;
}


.app-navbar .nav-link {
  color: var(--app-text) !important;
}

.app-navbar .nav-link:hover {
  text-decoration: underline;
}

.app-navbar .nav-link.active {
  color: var(--app-text) !important;
  background: rgba(37, 99, 235, 0.10) !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
}

.app-navbar .navbar-brand {
  color: var(--app-text) !important;
}

@media (max-width: 992px) {
  .app-navbar .nav-link {
    padding: 10px 12px;
  }
}

.glass-card,
.card {
  background: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.glass-card,
.glass-card * ,
.card,
.card * {
  color: var(--app-text);
}


.muted {
  color: var(--muted-text) !important;
}

/* Strategy Lab workspace */
.experiment-shell {
  overflow: hidden;
  border-radius: 22px !important;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.10) !important;
}

.experiment-shell > .card-body {
  padding: 0;
}

.experiment-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  background:
    radial-gradient(circle at 85% 20%, rgba(45, 212, 191, 0.32), transparent 30%),
    linear-gradient(135deg, #0f172a 0%, #1d4ed8 58%, #0f766e 120%);
}

.experiment-hero::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  right: -90px;
  bottom: -150px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
}

.experiment-eyebrow,
.section-kicker {
  color: #0f766e !important;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.experiment-eyebrow {
  color: #99f6e4 !important;
}

.experiment-title {
  max-width: 780px;
  margin: 0.35rem 0 0.65rem;
  color: #fff !important;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.experiment-subtitle {
  max-width: 680px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82) !important;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.experiment-workflow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #dbeafe;
  border-bottom: 1px solid #bfdbfe;
}

.workflow-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.7rem;
  padding: 1rem 1.1rem;
  background: #eff6ff;
}

.workflow-step > span {
  grid-row: 1 / 3;
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  background: #2563eb;
  border-radius: 50%;
  font-weight: 800;
}

.workflow-step > strong {
  font-size: 0.92rem;
}

.workflow-step > small {
  color: var(--muted-text) !important;
}

.experiment-shell .btn-row.mb-2,
.experiment-mode-tabs,
.experiment-mode-tabs + .tab-content {
  margin-left: clamp(1rem, 3vw, 2.5rem);
  margin-right: clamp(1rem, 3vw, 2.5rem);
}

.experiment-shell .btn-row.mb-2 {
  margin-top: 1.25rem;
}

.experiment-mode-tabs .nav-link {
  padding: 0.9rem 1.2rem;
  border-radius: 12px 12px 0 0;
  font-weight: 700;
}

.lab-section-heading {
  margin: 0.5rem 0 1.2rem;
  padding-left: 1rem;
  border-left: 4px solid #14b8a6;
}

.lab-section-heading h4 {
  margin: 0.15rem 0 0.2rem;
}

.insight-panel {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--card-border));
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--card-bg)), var(--card-bg));
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.insight-panel li + li {
  margin-top: 0.45rem;
}

.ranking-explorer {
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: 18px;
  background:
    radial-gradient(circle at 95% 0%, rgba(20, 184, 166, 0.14), transparent 35%),
    var(--card-bg);
}

.ranking-explorer-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.ranking-metric-picker {
  width: min(100%, 280px);
  min-width: 220px;
}

.ranking-statement {
  margin: 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--accent-2);
  border-radius: 0 12px 12px 0;
  background: rgba(16, 185, 129, 0.09);
  color: var(--app-text);
  font-weight: 600;
  line-height: 1.6;
}

.match-arena {
  padding: clamp(1rem, 3vw, 1.75rem);
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 20px;
  background:
    radial-gradient(circle at 10% 0%, rgba(37, 99, 235, 0.14), transparent 32%),
    radial-gradient(circle at 90% 0%, rgba(16, 185, 129, 0.14), transparent 32%),
    var(--card-bg);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.1);
}

.arena-round-header,
.arena-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.arena-round-header {
  margin-bottom: 1rem;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
}

.arena-round-label {
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.arena-outcome {
  text-align: right;
}

.arena-players {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.75rem, 3vw, 2rem);
}

.arena-player {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card-bg) 92%, var(--accent));
  text-align: center;
}

.arena-player-error {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.arena-player-name {
  margin: 0;
  overflow-wrap: anywhere;
}

.arena-move {
  display: grid;
  width: clamp(76px, 10vw, 104px);
  aspect-ratio: 1;
  place-items: center;
  border: 4px solid currentColor;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 900;
  line-height: 1;
}

.arena-move-cooperate {
  border-radius: 50%;
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}

.arena-move-defect {
  border-radius: 18px;
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.11);
}

.arena-intention {
  min-height: 1.25rem;
  color: var(--muted-text);
}

.arena-score {
  width: 100%;
  margin-top: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--card-border);
}

.arena-versus {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #0f172a;
  font-size: 0.8rem;
  font-weight: 900;
}

.arena-statement {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.08);
  line-height: 1.55;
}

.experiment-advanced {
  margin-bottom: 1rem;
}

.experiment-advanced .accordion-button {
  font-weight: 700;
  background: #f8fafc;
}

.experiment-command-bar {
  position: sticky;
  z-index: 10;
  bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(10px);
}

.experiment-run-actions {
  flex-direction: row;
}

.experiment-run-actions .btn:first-child {
  min-width: 150px;
}

/* Learn page */
.learn-page {
  max-width: 1320px;
  margin: 0 auto;
}

.learn-hero {
  padding: clamp(1.5rem, 4vw, 3.5rem);
  color: #fff;
  background: linear-gradient(135deg, #172554, #1e40af 62%, #0f766e);
  border-radius: 22px;
}

.learn-hero * {
  color: inherit;
}

.learn-kicker {
  color: #99f6e4 !important;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.learn-title {
  max-width: 820px;
  margin: 0.35rem 0 0.65rem;
  font-size: clamp(2.1rem, 5vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.learn-intro {
  max-width: 760px;
  margin-bottom: 1.5rem;
  color: rgba(255, 255, 255, 0.82) !important;
  font-size: 1.08rem;
}

.learn-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.learn-anchor {
  padding: 0.5rem 0.75rem;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  text-decoration: none;
}

.learn-anchor:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lesson-card {
  position: relative;
  margin-bottom: 1rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  scroll-margin-top: 90px;
}

.lesson-number {
  display: inline-flex;
  width: 34px;
  height: 34px;
  margin-bottom: 0.75rem;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #2563eb;
  border-radius: 50%;
  font-weight: 800;
}

.learn-result {
  margin-top: 1rem;
  padding: 1rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
}

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

.lesson-score {
  display: flex;
  flex-direction: column;
  padding: 0.65rem;
  text-align: center;
  background: #fff;
  border-radius: 10px;
}

.lesson-score small {
  color: var(--muted-text);
}

.lesson-score strong {
  font-size: 1.75rem;
}

.concept-grid > div > div {
  height: 100%;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 12px;
}

.learn-sidebar {
  position: sticky;
  top: 86px;
  padding: 1.25rem;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: 16px;
}

.learn-sidebar dt {
  margin-top: 0.8rem;
}

.learn-sidebar dd {
  color: var(--muted-text);
}

.matchup-replay-panel {
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: 16px;
}

.matchup-replay-summary .card {
  height: 100%;
}

.evolution-inspector {
  padding: clamp(1rem, 3vw, 1.5rem);
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: 16px;
}

.evolution-event-log {
  max-height: 280px;
  overflow-y: auto;
}

/* Scorecard pills */
.scorecard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.score-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.02);
}

.score-label {
  font-size: 14px;
  color: var(--app-text);
  font-weight: 600;
}

.score-bubble {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid transparent;
  flex: 0 0 auto;
}

.score-bubble-yes {
  color: #065f46;
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.35);
}

.score-bubble-no {
  color: var(--muted-text);
  background: rgba(107, 114, 128, 0.10);
  border-color: rgba(107, 114, 128, 0.25);
}

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

/* Focus states */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
}

/* Dash DataTable */
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner table {
  border-color: var(--card-border) !important;
}

/* Button rows (wrap nicely on mobile) */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Tabs: allow horizontal scroll on small screens */
@media (max-width: 576px) {
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .nav-tabs .nav-link {
    white-space: nowrap;
  }
}

/* Mobile-first polish */
@media (max-width: 576px) {
  /* Reduce overall padding density */
  .card-body {
    padding: 0.95rem;
  }

  /* Navbar: make collapsed actions easy to tap */
  .app-navbar .navbar-collapse .nav-item,
  .app-navbar .navbar-collapse .nav-link,
  .app-navbar .navbar-collapse .btn {
    width: 100%;
  }
  .app-navbar .navbar-collapse .btn {
    justify-content: center;
  }

  /* Stack action buttons vertically (big touch targets) */
  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-row .btn {
    width: 100%;
  }

  .experiment-workflow {
    grid-template-columns: 1fr 1fr;
  }

  .workflow-step {
    padding: 0.8rem;
  }

  .workflow-step > small {
    display: none;
  }

  .experiment-shell .btn-row.mb-2,
  .experiment-mode-tabs,
  .experiment-mode-tabs + .tab-content {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
  }

  .experiment-command-bar {
    align-items: stretch;
    flex-direction: column;
    bottom: 0.35rem;
  }

  .ranking-explorer-header {
    align-items: stretch;
    flex-direction: column;
  }

  .ranking-metric-picker {
    width: 100%;
  }

  .arena-round-header,
  .arena-score {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .arena-outcome {
    text-align: left;
  }

  .arena-players {
    grid-template-columns: 1fr;
  }

  .arena-versus {
    margin: -0.25rem auto;
  }

  .experiment-run-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .experiment-run-actions .btn,
  .experiment-run-actions .btn:first-child {
    width: auto;
    min-width: 0;
  }

  .experiment-run-actions .btn:first-child {
    grid-column: 1 / -1;
  }

  .learn-hero {
    border-radius: 16px;
  }

  .learn-nav {
    flex-direction: column;
  }

  .learn-anchor {
    border-radius: 10px;
  }

  .lesson-score-row {
    grid-template-columns: 1fr;
  }

  .learn-sidebar {
    position: static;
  }

  /* Tables: better horizontal swipe behavior */
  .dash-table-container,
  .dash-table-container .dash-spreadsheet-container {
    -webkit-overflow-scrolling: touch;
  }
}
