:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --text: #122033;
  --muted: #5d6c80;
  --border: rgba(15, 23, 42, 0.12);
  --accent-red: #b91c1c;
  --accent-blue: #1d4ed8;
  --accent-soft-red: rgba(185, 28, 28, 0.1);
  --accent-soft-blue: rgba(29, 78, 216, 0.12);
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #09111f;
    --panel: rgba(11, 18, 31, 0.9);
    --panel-strong: #0f172a;
    --text: #e7eefb;
    --muted: #9ab0cb;
    --border: rgba(148, 163, 184, 0.2);
    --accent-red: #f87171;
    --accent-blue: #60a5fa;
    --accent-soft-red: rgba(248, 113, 113, 0.14);
    --accent-soft-blue: rgba(96, 165, 250, 0.18);
    --shadow: 0 30px 80px rgba(2, 6, 23, 0.48);
  }
}

:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #09111f;
  --panel: rgba(11, 18, 31, 0.9);
  --panel-strong: #0f172a;
  --text: #e7eefb;
  --muted: #9ab0cb;
  --border: rgba(148, 163, 184, 0.2);
  --accent-red: #f87171;
  --accent-blue: #60a5fa;
  --accent-soft-red: rgba(248, 113, 113, 0.14);
  --accent-soft-blue: rgba(96, 165, 250, 0.18);
  --shadow: 0 30px 80px rgba(2, 6, 23, 0.48);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(185, 28, 28, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(29, 78, 216, 0.14), transparent 30%),
    linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 85%, #000 15%));
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.site-shell {
  width: min(1120px, calc(100% - 1.25rem));
  margin: 0 auto;
  padding: 1rem 0 1.75rem;
}

.site-header,
.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-blue);
}

h1,
 h2,
 h3,
 p {
  margin-top: 0;
}

.subtitle,
.helper-text,
.muted {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 1rem;
}

.panel {
  padding: 1.25rem;
}

.controls-panel,
.study-panel {
  display: grid;
  gap: 1rem;
}

.filter-group,
.metric-grid,
.action-row {
  display: grid;
  gap: 0.75rem;
}

.filter-group,
.action-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.metric {
  padding: 0.9rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel-strong) 84%, transparent 16%);
}

.metric strong {
  display: block;
  font-size: 1.1rem;
}

.theme-button,
.filter-button,
.ghost-button,
.primary-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.filter-button.is-active {
  border-color: var(--accent-blue);
  background: var(--accent-soft-blue);
  color: var(--accent-blue);
}

.primary-button {
  background: linear-gradient(90deg, var(--accent-red), var(--accent-blue));
  color: #ffffff;
  border: none;
}

.card-stack {
  position: relative;
}

.card-stack::before,
.card-stack::after {
  content: '';
  position: absolute;
  inset: 12px 10px -12px 10px;
  border-radius: 28px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel-strong) 70%, transparent 30%);
  z-index: 0;
}

.card-stack::after {
  inset: 22px 18px -22px 18px;
  opacity: 0.7;
}

.scenario-card {
  position: relative;
  z-index: 1;
  padding: 1.2rem;
  border-radius: 28px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-strong) 92%, transparent 8%), var(--panel-strong));
}

.card-top,
.technique-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.tag,
.difficulty-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-weight: 700;
}

.tag {
  background: var(--accent-soft-red);
  color: var(--accent-red);
}

.tag.is-defense {
  background: var(--accent-soft-blue);
  color: var(--accent-blue);
}

.difficulty-pill {
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent 18%);
}

.scenario-body {
  font-size: 1.05rem;
  line-height: 1.7;
}

.technique-row {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.technique-row a,
.site-footer a {
  color: var(--accent-blue);
}

.site-footer {
  margin-top: 1rem;
  text-align: center;
  color: var(--muted);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-blue) 55%, white 45%);
  outline-offset: 2px;
}

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

  .site-header,
  .card-top,
  .technique-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .site-shell {
    width: min(100%, calc(100% - 0.9rem));
  }

  .panel,
  .site-header,
  .scenario-card {
    border-radius: 20px;
    padding: 1rem;
  }

  .filter-group,
  .metric-grid,
  .action-row {
    grid-template-columns: 1fr;
  }
}
