:root {
  --page: #0b0c0d;
  --surface: #121416;
  --surface-strong: #181b1d;
  --text: #f1f2ec;
  --muted: #a4a8a3;
  --quiet: #767b76;
  --line: #292d2b;
  --line-strong: #3a3f3b;
  --accent: #74d6ab;
  --accent-ink: #0b2118;
  --danger: #f09f9f;
  --warning: #eed17e;
  --radius: 14px;
  --control-radius: 10px;
  --page-width: 1220px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --page: #f1f2ec;
  --surface: #f8f8f3;
  --surface-strong: #e8e9df;
  --text: #202219;
  --muted: #62665c;
  --quiet: #777b68;
  --line: #d3d5c9;
  --line-strong: #b8bcaa;
  --accent: #537b68;
  --accent-ink: #f8f8f3;
  --danger: #a12b36;
  --warning: #77580d;
  color-scheme: light;
}

body[data-game="marvel"] {
  --accent: #d7d640;
  --accent-ink: #171805;
}

html[data-theme="light"] body[data-game="marvel"] {
  --accent: #777916;
  --accent-ink: #f8f8f3;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--page);
}

body.instructions-hub {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 86% 2%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 32rem),
    var(--page);
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
}

button,
select,
a { font: inherit; }

a { color: inherit; }
img { max-width: 100%; }

.page-width {
  width: min(var(--page-width), calc(100% - 56px));
  margin-inline: auto;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  display: block;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface);
}

.header-controls,
.language-switch {
  display: flex;
  align-items: center;
}

.header-controls { gap: 10px; }

.language-switch {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
}

.language-button {
  width: 42px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}

.language-button:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.language-button:active { transform: scale(0.97); }
.language-button.active { background: var(--accent); }

.language-flag {
  width: 25px;
  height: 17px;
  display: block;
  overflow: hidden;
  border-radius: 2px;
}

.guide-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: center;
  gap: clamp(32px, 6vw, 90px);
  margin-top: 28px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.picker-copy {
  display: grid;
  gap: 8px;
}

.picker-copy span,
.game-select-field > span,
.section-heading .section-label {
  color: var(--accent);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.picker-copy strong {
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.game-select-field {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.game-select-control {
  position: relative;
  min-height: 60px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background: var(--page);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.game-select-control.is-open {
  border-color: var(--line-strong);
  background: var(--surface-strong);
}

.game-select-control > img,
.game-select-option img {
  width: 44px;
  height: 44px;
  display: block;
  border-radius: 8px;
  object-fit: cover;
}

.game-select-trigger {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 14px;
  padding: 0 8px 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 760;
  text-align: left;
  cursor: pointer;
}

.game-select-trigger:focus { outline: 0; }

.game-select-trigger:focus-visible {
  border-radius: 7px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.game-select-trigger.is-pointer-focus:focus-visible { outline: 0; }

.game-select-chevron {
  width: 8px;
  height: 8px;
  justify-self: center;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease, border-color 160ms ease;
}

.game-select-control.is-open .game-select-chevron {
  border-color: var(--accent);
  transform: translateY(2px) rotate(225deg);
}

.game-select-menu {
  position: absolute;
  inset: calc(100% + 8px) -1px auto;
  z-index: 18;
  margin: 0;
  padding: 6px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--page) 72%, transparent);
  list-style: none;
}

.game-select-menu[hidden] { display: none; }

.game-select-option {
  min-width: 0;
  min-height: 58px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.game-select-option:hover,
.game-select-option:focus {
  outline: 0;
  background: color-mix(in srgb, var(--text) 7%, transparent);
}

.game-select-option:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.game-select-option[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  color: var(--accent);
}

.game-select-option:active {
  transform: scale(0.99);
}

.game-select-field small {
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.45;
}

.guide-hero {
  min-height: min(720px, calc(100dvh - 190px));
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(430px, 1.1fr);
  align-items: center;
  gap: clamp(44px, 7vw, 100px);
  padding-block: clamp(48px, 7vh, 72px);
}

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

.hero-product {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.hero-copy h1,
.section-heading h2,
.completion h2 {
  margin: 0;
  color: var(--text);
  text-wrap: balance;
}

.hero-copy h1 {
  font-size: clamp(44px, 5.2vw, 68px);
  font-weight: 820;
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.hero-copy > p:not(.hero-product) {
  max-width: 560px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 1.7vw, 20px);
  line-height: 1.65;
}

.hero-actions,
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions { margin-top: 32px; }
.section-actions { margin-top: 24px; }

.primary-action,
.secondary-action,
.resource-action {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 780;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.primary-action {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.secondary-action,
.resource-action {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.primary-action:hover { filter: brightness(1.07); }
.secondary-action:hover,
.resource-action:hover {
  border-color: var(--accent);
  background: var(--surface-strong);
}

.primary-action:active,
.secondary-action:active,
.resource-action:active { transform: translateY(1px) scale(0.99); }

.hero-media {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 28px 72px rgb(4 8 7 / 0.28);
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 5%, transparent);
}

.hero-media img {
  width: 100%;
  height: clamp(360px, 54vh, 560px);
  display: block;
  object-fit: cover;
}

.section-nav {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(18px);
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar { display: none; }

.section-nav a {
  min-width: 150px;
  min-height: 54px;
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  padding: 0 16px;
  border-right: 1px solid var(--line);
  color: var(--quiet);
  font-size: 13px;
  font-weight: 760;
  text-align: center;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}

.section-nav a:last-child { border-right: 0; }
.section-nav a:hover,
.section-nav a.active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.guide-section {
  width: min(var(--page-width), calc(100% - 56px));
  margin-inline: auto;
  padding-block: clamp(82px, 10vw, 126px);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 72px;
}

.section-heading { max-width: 760px; }

.section-heading .section-label { display: block; margin-bottom: 15px; }

.section-heading h2,
.completion h2 {
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.section-heading p,
.completion p {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.instruction-grid,
.resource-grid {
  margin-top: 46px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.instruction-card,
.resource-card,
.note-panel,
.highlight-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.instruction-card,
.resource-card { padding: clamp(24px, 3vw, 34px); }

.instruction-card strong,
.resource-card h3,
.step-body h3,
.note-panel strong,
.highlight-panel strong {
  margin: 0;
  color: var(--text);
  font-size: 19px;
  letter-spacing: -0.025em;
}

.instruction-card p,
.resource-card p,
.step-body p,
.note-panel p,
.highlight-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.resource-card {
  display: grid;
  align-content: start;
}

.resource-action { margin-top: 22px; justify-self: start; }

.note-stack {
  max-width: 880px;
  margin-top: 46px;
  display: grid;
  gap: 14px;
}

.note-panel,
.highlight-panel { padding: clamp(26px, 4vw, 42px); }

.note-panel[data-tone="warning"] {
  border-color: color-mix(in srgb, var(--warning) 48%, var(--line));
  background: color-mix(in srgb, var(--warning) 6%, var(--surface));
}

.note-panel[data-tone="danger"] {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
}

.step-list {
  margin: 46px 0 0;
  padding: 0;
  display: grid;
  list-style: none;
  border-top: 1px solid var(--line-strong);
}

.step-item {
  min-height: 132px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding-block: 26px;
  border-bottom: 1px solid var(--line);
}

.step-marker {
  color: var(--accent);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 14px;
  font-weight: 800;
}

.step-value {
  color: var(--accent);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 820;
  letter-spacing: -0.05em;
}

.step-body code {
  display: inline-block;
  margin-top: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  white-space: normal;
}

.highlight-panel {
  max-width: 760px;
  margin-top: 46px;
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.highlight-value {
  display: block;
  margin-top: 12px;
  color: var(--accent);
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 840;
  line-height: 1;
  letter-spacing: -0.06em;
}

.reference-layout {
  margin-top: 46px;
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(440px, 1.22fr);
  align-items: center;
  gap: clamp(36px, 7vw, 92px);
}

.reference-copy { display: grid; gap: 14px; }

.reference-copy strong {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.reference-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.reference-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.reference-figure a,
.reference-figure img { display: block; }

.reference-figure img {
  width: 100%;
  height: auto;
}

.reference-figure figcaption {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.5;
}

.completion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 40px;
  margin-block: clamp(70px, 9vw, 112px);
  padding: clamp(28px, 5vw, 54px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.site-footer {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 13px;
}

.site-footer a {
  color: var(--muted);
  text-underline-offset: 4px;
}

.site-footer a:hover { color: var(--text); }

.noscript-notice {
  margin-block: 32px;
  padding: 18px;
  border: 1px solid var(--warning);
  border-radius: var(--control-radius);
  color: var(--text);
}

:is(a, button, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .guide-picker { grid-template-columns: 1fr; gap: 22px; }

  .guide-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .hero-copy { max-width: 720px; }
  .hero-media { max-width: 760px; }
  .hero-media img { height: auto; aspect-ratio: 16 / 10; }
  .reference-layout { grid-template-columns: 1fr; }
  .reference-figure { max-width: 760px; }
}

@media (max-width: 700px) {
  .page-width,
  .guide-section {
    width: min(var(--page-width), calc(100% - 32px));
  }

  .site-header { min-height: 66px; }
  .brand img { width: 38px; height: 38px; }
  .brand span { display: none; }

  .guide-picker {
    margin-top: 18px;
    padding: 18px;
  }

  .picker-copy strong { font-size: 21px; }

  .guide-hero {
    padding-block: 52px 42px;
  }

  .hero-copy h1 { font-size: clamp(42px, 13vw, 60px); }
  .hero-copy > p:not(.hero-product) { font-size: 17px; }
  .hero-actions { display: grid; }
  .primary-action,
  .secondary-action { width: 100%; }

  .section-nav a { min-width: 132px; }
  .guide-section { padding-block: 74px; }

  .instruction-grid,
  .resource-grid { grid-template-columns: 1fr; }

  .step-item {
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
    gap: 16px;
  }

  .step-value {
    grid-column: 2;
    margin-top: 8px;
  }

  .resource-action { width: 100%; }

  .completion {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 26px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-block: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
