:root {
  --bg: #f5f8f5;
  --bg-soft: #edf3ee;
  --surface: #ffffff;
  --surface-2: #f8fbf8;
  --text: #1d2f2a;
  --muted: #5e706a;
  --heading: #153f31;
  --primary: #1f6847;
  --primary-strong: #155037;
  --accent: #b17a24;
  --blue: #256d85;
  --border: #d8e3da;
  --shadow: 0 14px 36px rgba(30, 52, 43, 0.1);
  --shadow-soft: 0 10px 24px rgba(30, 52, 43, 0.08);
  --radius: 8px;
  --shell: 1180px;
}

html[data-theme="dark"] {
  --bg: #0e1917;
  --bg-soft: #13221f;
  --surface: #182d29;
  --surface-2: #213d36;
  --text: #f4fbf7;
  --muted: #d5e5dd;
  --heading: #d9ffe8;
  --primary: #9de2bd;
  --primary-strong: #cdf8dd;
  --accent: #f0c76a;
  --blue: #8bd5e5;
  --border: #63867a;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--surface-2), var(--bg));
  line-height: 1.62;
  letter-spacing: 0;
}

body.mobile-nav-open {
  overflow: hidden;
}

body.mobile-nav-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 75;
  background: rgba(8, 18, 15, 0.36);
}

body.admin-modal-open {
  overflow: hidden;
}

img,
svg {
  max-width: 100%;
}

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

h1,
h2,
h3 {
  margin: 0;
  color: var(--heading);
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  font-size: 3.6rem;
  font-weight: 800;
}

h2 {
  font-size: 1.6rem;
  font-weight: 800;
}

h3 {
  font-size: 1.05rem;
  font-weight: 750;
}

p {
  margin: 0;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(100% - 32px, var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  color: var(--heading);
  background: var(--surface);
}

.skip-link:focus {
  left: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}

.header-shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--heading);
  font-size: 1.18rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 0;
  filter: drop-shadow(0 6px 10px rgba(21, 63, 49, 0.12));
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: center;
}

.mobile-nav-head {
  display: none;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.nav-link svg,
.quick-link-list svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-link:hover,
.nav-link:focus,
.nav-link.active {
  color: var(--primary-strong);
  background: var(--surface-2);
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 230px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.nav-item.open .dropdown-panel,
.nav-item:focus-within .dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-panel a {
  display: block;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 650;
}

.dropdown-panel a:hover,
.dropdown-panel a:focus {
  color: var(--primary-strong);
  background: var(--surface-2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover,
.icon-button:focus {
  color: var(--primary-strong);
  border-color: var(--primary);
}

.menu-button {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.btn:hover,
.btn:focus {
  transform: translateY(-1px);
}

.btn-primary {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 10px 22px rgba(31, 104, 71, 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
  color: #ffffff;
  background: var(--primary-strong);
}

.btn-outline,
.btn-ghost {
  color: var(--primary-strong);
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.btn-outline:hover,
.btn-outline:focus,
.btn-ghost:hover,
.btn-ghost:focus {
  border-color: var(--primary);
  background: var(--surface-2);
}

.btn.compact {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.hero {
  position: relative;
  min-height: 590px;
  display: grid;
  align-items: end;
  overflow: hidden;
  background-image:
    linear-gradient(90deg, rgba(11, 30, 23, 0.9), rgba(11, 30, 23, 0.58), rgba(11, 30, 23, 0.16)),
    url("/images/pages/optimized/home-hero-1280.webp");
  background-position: center;
  background-size: cover;
  color: #ffffff;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 130px;
  background: linear-gradient(180deg, transparent, var(--surface-2));
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: block;
  padding: 82px 0 64px;
}

.hero-copy {
  max-width: 690px;
}

.hero h1 {
  color: #ffffff;
  font-size: 4.3rem;
}

.hero-subtitle {
  max-width: 780px;
  margin-top: 14px;
  color: #eef8f0;
  font-size: 1.45rem;
  font-weight: 750;
}

.hero-text {
  max-width: 680px;
  margin-top: 14px;
  color: #e2eee8;
  font-size: 1.06rem;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.kicker::before {
  content: "";
  width: 34px;
  height: 2px;
  background: currentColor;
}

.hero .kicker {
  color: #f4cb72;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.track-rail {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: -34px;
}

.track-card {
  min-height: 142px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}

.track-card:hover,
.track-card:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.track-card p {
  margin-top: 9px;
  color: var(--muted);
}

.section-band {
  padding: 56px 0;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 34px;
  align-items: start;
}

.main-stack {
  display: grid;
  gap: 26px;
  min-width: 0;
}

.section-block {
  padding: 0 0 28px;
  border-bottom: 1px solid var(--border);
}

.section-block > h2 {
  margin-bottom: 16px;
}

.section-block > p,
.lead-copy {
  max-width: 74ch;
  color: var(--muted);
}

.lead-copy + .lead-copy {
  margin-top: 12px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.info-card,
.icon-card,
.template-card,
.stat-card,
.auth-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.info-card {
  min-height: 154px;
  padding: 18px;
}

.info-card p,
.icon-card p,
.template-card p {
  margin-top: 9px;
  color: var(--muted);
}

.text-link {
  display: inline-flex;
  margin-top: 14px;
  font-weight: 800;
  text-decoration: none;
}

.content-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.content-list li + li {
  margin-top: 9px;
}

.quick-links {
  position: sticky;
  top: 92px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.quick-links h2 {
  font-size: 1.15rem;
}

.quick-links p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.quick-link-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.quick-link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-2);
  font-weight: 700;
  text-decoration: none;
}

.quick-link-list a:hover,
.quick-link-list a:focus {
  color: var(--primary-strong);
  border-color: var(--primary);
  border-left-color: var(--accent);
}

.quick-link-list svg {
  flex: 0 0 auto;
}

.page-hero {
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.page-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 36px;
  align-items: center;
}

.page-hero h1 {
  max-width: 850px;
  font-size: 3rem;
}

.page-hero-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.compact-hero .shell {
  max-width: var(--shell);
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title-row h2 {
  margin: 0;
}

.group-icon {
  width: 42px;
  height: 42px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.icon-card {
  min-height: 160px;
  padding: 18px;
}

.icon-card img {
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
}

.template-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.template-card {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: var(--surface);
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--heading);
  background: var(--surface-2);
  font-size: 0.9rem;
}

td {
  color: var(--muted);
}

.accordion-list {
  display: grid;
  gap: 10px;
}

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

summary {
  padding: 14px 16px;
  color: var(--heading);
  font-weight: 800;
  cursor: pointer;
}

details p {
  padding: 0 16px 16px;
  color: var(--muted);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quiz-main {
  min-height: calc(100vh - 72px);
}

.quiz-topbar {
  position: sticky;
  top: 64px;
  z-index: 25;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}

.quiz-topbar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 0;
}

.quiz-topbar h1 {
  font-size: 1.6rem;
}

.quiz-topbar p {
  color: var(--muted);
}

.quiz-stats {
  display: flex;
  gap: 10px;
}

.quiz-stats div {
  min-width: 116px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: right;
}

.quiz-stats span,
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.quiz-stats strong,
.stat-card strong {
  display: block;
  color: var(--heading);
  font-size: 1.45rem;
  line-height: 1.1;
}

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 22px;
  padding-top: 24px;
  padding-bottom: 42px;
}

.quiz-panel,
.question-palette {
  min-width: 0;
}

.loading-state,
.question-card,
.result-panel,
.question-palette {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.loading-state {
  padding: 24px;
  color: var(--muted);
}

.question-card {
  padding: 22px;
}

.question-meta {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
}

.question-card h2 {
  margin-top: 8px;
  color: var(--heading);
  font-size: 1.45rem;
  line-height: 1.35;
}

.question-image-wrap {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.question-image-wrap img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.option-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.option-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 56px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
}

.option-item:hover,
.option-item:focus-within,
.option-item.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--surface-2) 72%, var(--primary) 8%);
}

.option-item input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.option-item strong {
  color: var(--heading);
}

.option-item p {
  color: var(--muted);
}

.option-item img {
  display: block;
  max-height: 150px;
  object-fit: contain;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.quiz-action-bar {
  position: static;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}

.question-palette {
  position: sticky;
  top: 164px;
  padding: 16px;
}

.question-palette h2 {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.palette-grid button {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-2);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

.palette-grid button.active {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

.palette-grid button.answered:not(.active) {
  border-color: var(--blue);
  color: var(--heading);
  background: color-mix(in srgb, var(--surface-2) 75%, var(--blue) 15%);
}

.result-panel {
  padding: 24px;
}

.result-score {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.review-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.review-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.review-item.correct {
  border-left: 4px solid #198754;
}

.review-item.wrong {
  border-left: 4px solid #dc3545;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.stat-card {
  padding: 18px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.history-row strong {
  color: var(--heading);
}

.history-row span {
  color: var(--muted);
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 180px);
  padding: 48px 0;
}

.auth-card {
  width: min(100%, 460px);
  padding: 26px;
}

.auth-card h1 {
  font-size: 2.1rem;
}

.auth-card p {
  margin: 12px 0 18px;
  color: var(--muted);
}

.auth-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--heading);
  font-weight: 750;
}

.auth-card input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-2);
}

.auth-card .btn {
  width: 100%;
}

.admin-modal[hidden] {
  display: none;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 15, 0.56);
  backdrop-filter: blur(6px);
}

.admin-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.admin-modal-head h2 {
  font-size: 1.55rem;
}

.admin-modal-panel label {
  display: grid;
  gap: 7px;
  color: var(--heading);
  font-weight: 750;
}

.admin-modal-panel input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-2);
}

.admin-status {
  min-height: 1.5rem;
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-status.is-error {
  color: #b42318;
}

.admin-status.is-success {
  color: var(--primary-strong);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-shell {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0;
}

.site-footer p {
  margin-top: 4px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.footer-links a {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus {
  color: var(--primary-strong);
}

@media (max-width: 1100px) {
  h1 {
    font-size: 3rem;
  }

  .hero {
    min-height: 560px;
  }

  .hero h1 {
    font-size: 3.6rem;
  }

  .page-hero-grid {
    grid-template-columns: 1fr;
  }

  .page-hero-image {
    max-height: 320px;
  }

  .content-layout,
  .quiz-layout {
    grid-template-columns: 1fr;
  }

  .quick-links,
  .question-palette {
    position: static;
  }

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

@media (max-width: 980px) {
  body.mobile-nav-open .site-header {
    z-index: 90;
  }

  .header-shell {
    grid-template-columns: auto auto 1fr;
  }

  .menu-button {
    display: inline-grid;
  }

  .primary-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: auto;
    left: auto;
    width: min(88vw, 390px);
    height: 100vh;
    height: 100dvh;
    display: block;
    padding: 18px;
    border-left: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    z-index: 95;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  body.mobile-nav-open .primary-nav {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  .mobile-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  .nav-item + .nav-item {
    margin-top: 4px;
  }

  .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 0 12px;
  }

  .dropdown-panel {
    position: static;
    min-width: 0;
    margin: 4px 0 8px;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
  }

  .nav-item.open .dropdown-panel {
    display: block;
  }

  .header-actions {
    justify-self: end;
  }
}

@media (max-width: 740px) {
  .shell {
    width: min(100% - 24px, var(--shell));
  }

  .header-shell {
    min-height: 58px;
    gap: 10px;
  }

  .brand span {
    font-size: 1rem;
  }

  .brand img {
    width: 30px;
    height: 30px;
  }

  .header-actions .btn-outline {
    display: none;
  }

  h1,
  .page-hero h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  .hero {
    min-height: auto;
    background-image:
      linear-gradient(180deg, rgba(11, 30, 23, 0.86), rgba(11, 30, 23, 0.76)),
      url("/images/pages/optimized/home-hero-640.webp");
  }

  .hero-inner {
    padding: 56px 0 32px;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .hero-subtitle {
    font-size: 1.18rem;
  }

  .track-rail,
  .stats-grid,
  .result-score {
    grid-template-columns: 1fr;
  }

  .track-rail {
    margin-top: 0;
    padding-top: 14px;
  }

  .section-band {
    padding: 38px 0;
  }

  .page-hero {
    padding: 34px 0 28px;
  }

  .card-grid,
  .icon-grid {
    grid-template-columns: 1fr;
  }

  .quiz-topbar {
    top: 58px;
  }

  .quiz-topbar-grid {
    grid-template-columns: 1fr;
  }

  .quiz-stats {
    width: 100%;
  }

  .quiz-stats div {
    flex: 1;
    text-align: left;
  }

  .quiz-action-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

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

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

  .footer-shell {
    display: grid;
  }
}

@media (max-width: 430px) {
  .header-actions .btn-primary {
    display: none;
  }

  .hero h1 {
    font-size: 2.55rem;
  }

  .action-row .btn {
    width: 100%;
  }

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