/* SmashSet Forever web portal — "pause menu" direction.
   Light, mid-grey page (the logo's floor tile), the stage framed like the game's pause panel.
   Block colours are only the three official ones (pink, green, blue), taken from media/logo.svg.
   System fonts only. No original game asset is used, copied, or traced. */

:root {
  color-scheme: light;

  /* Ground: the logo's grey floor tile, dotted like the in-game floor. */
  --ground: #a3a3b0;
  --ground-dot: #9696a4;
  --ground-edge: #767682;

  /* Light surfaces on the ground. */
  --panel: #e6e8ee;
  --panel-line: #7e7e8c;
  --kbd: #eef0f4;

  /* Pause-menu stage: cyan frame, pale cyan scanlined interior. */
  --pause-frame: #00a6db;
  --pause-fill: #cde5ef;
  --pause-line: rgb(255 255 255 / 0.28);

  --ink: #14151d;
  --ink-2: #2a2b38;
  --ink-3: #3a4250;

  /* The three official block colours (logo top faces: light band / base). */
  --pink: #f15eb9;
  --pink-hi: #fc7ecd;
  --green: #55eb8c;
  --green-hi: #78f8a8;
  --blue: #5a5aea;
  --blue-hi: #7f80f9;

  /* Primary action: the CONTINUE magenta. */
  --play: #da1570;
  --play-hover: #bd115f;
  --play-press: #a10e51;
  --play-tint: #fbe3ee;
  --play-ink: #a8104f;

  /* Secondary actions: satellites of the EXIT blue, darkened for white text (4.85:1). */
  --action: #0e74c6;
  --action-hover: #0b67b3;
  --action-press: #095997;

  --ok-ink: #17663f;
  --ok-tint: #e3f6e9;
  --warn-ink: #a8104f;
  --warn-tint: #fbe3ee;

  --focus: #14151d;

  --radius: 10px;
  --radius-sm: 7px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--ground-edge) var(--ground);
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--ground);
  background-image: radial-gradient(var(--ground-dot) 1px, transparent 1.4px);
  background-size: 4px 4px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--pink-hi);
  color: var(--ink);
}

a {
  color: var(--ink);
  text-decoration-color: var(--play);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--play-press);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

code {
  background: rgb(255 255 255 / 0.55);
  border-radius: 4px;
  padding: 0.05em 0.35em;
}

kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 0.1em 0.45em;
  border: 1px solid var(--panel-line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--kbd);
  text-align: center;
  font-size: 0.85em;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sprite {
  display: none;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.2em;
}

.icon-lg {
  width: 1.75rem;
  height: 1.75rem;
}

.nowrap {
  white-space: nowrap;
}

.muted {
  color: var(--ink-3);
}

/* Game-style lettering: heavy system sans in caps. */
.step h3,
.saves h2,
.details h2,
.panel-exit h2 {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Buttons ---------- */

.btn-blue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--action);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 8px -5px rgb(20 21 29 / 0.5);
  transition: background-color 140ms ease, transform 140ms var(--ease-out);
}

.btn-blue:hover:not(:disabled) {
  background: var(--action-hover);
  color: #fff;
  transform: translateY(-1px);
}

.btn-blue:active:not(:disabled) {
  background: var(--action-press);
  transform: none;
}

.btn-blue:disabled {
  background: var(--panel);
  color: var(--ink-3);
  box-shadow: inset 0 0 0 1px var(--panel-line);
  cursor: not-allowed;
}

.btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--play);
  color: #fff;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 0 0 3px #fff, 0 10px 18px -10px rgb(20 21 29 / 0.55);
  transition: background-color 140ms ease, transform 140ms var(--ease-out);
}

.btn-play .icon {
  width: 1.15em;
  height: 1.15em;
}

.btn-play:hover:not(:disabled) {
  background: var(--play-hover);
  transform: translateY(-1px);
}

.btn-play:active:not(:disabled) {
  background: var(--play-press);
  transform: none;
}

.btn-play:disabled {
  background: var(--play-tint);
  color: var(--play-ink);
  box-shadow: inset 0 0 0 2px rgb(218 21 112 / 0.4);
  cursor: not-allowed;
}

.btn-play-sm {
  min-height: 48px;
  font-size: 1.05rem;
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-quiet:hover:not(:disabled) {
  background: var(--play-tint);
  color: var(--play-ink);
}

.btn-quiet:disabled {
  color: var(--ink-3);
  cursor: not-allowed;
}

/* ---------- Page frame ---------- */

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.logo {
  width: 52px;
  height: 52px;
  flex: none;
  filter: drop-shadow(0 4px 6px rgb(20 21 29 / 0.25));
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-weight: 900;
  letter-spacing: 0.01em;
  font-size: 1.3rem;
  line-height: 1.1;
}

.brand-tag {
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.35;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 6px;
  font-weight: 700;
  font-size: 0.95rem;
}

.private-flag {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--play-tint);
  color: var(--play-ink);
  font-weight: 700;
  font-size: 0.8rem;
}

/* ---------- Stage ---------- */

.stage-area {
  max-width: 880px;
  margin: 0 auto;
}

/* Canvas and panels share one grid cell: 4:3 unless a panel needs more height (phones). */
.stage {
  display: grid;
  position: relative;
  border: 6px solid var(--pause-frame);
  border-radius: var(--radius);
  background: var(--pause-fill);
  box-shadow: inset 0 0 0 2px #fff, 0 22px 40px -22px rgb(20 21 29 / 0.6);
  overflow: hidden;
}

.stage > * {
  grid-area: 1 / 1;
}

/* SDL3 Emscripten requires the canvas itself to have zero border and zero padding. */
#canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  align-self: start;
  border: 0;
  padding: 0;
  margin: 0;
  outline: none;
  background: #000;
  /* SDL already upscales the 640x480 frame to the canvas size; only the small devicePixelRatio step is
     left to the browser, so let it smooth instead of duplicating rows unevenly. */
  image-rendering: auto;
}

.stage:not([data-state="running"]) #canvas {
  visibility: hidden;
}

.stage[data-state="running"] {
  background: #000;
  box-shadow: 0 22px 40px -22px rgb(20 21 29 / 0.6);
}

.stage[data-state="running"] #canvas:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

.touch-pad {
  display: none;
}

@media (any-pointer: coarse) {
  .stage[data-state="running"] .touch-pad {
    display: flex;
    grid-area: 2 / 1;
    justify-content: space-between;
    width: 100%;
    padding: 8px;
    gap: 8px;
    background: #15151d;
    touch-action: none;
    user-select: none;
  }

  .touch-pad > div {
    display: flex;
    gap: 5px;
  }

  .touch-pad button {
    min-width: 44px;
    min-height: 48px;
    padding: 4px 9px;
    border: 1px solid #878798;
    border-radius: 6px;
    background: #282838;
    color: #fff;
    font: inherit;
    font-weight: 700;
  }

  .touch-pad button:active {
    background: #fff;
    color: #15151d;
  }

  .stage[data-state="running"]:fullscreen {
    grid-template-rows: minmax(0, 1fr) auto;
  }


}

/* Full screen (feature/poc-recomp): the shell fullscreens the whole stage, SDL letterboxes the game, kept 4:3. */
.stage:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #000;
  place-items: center;
}

.stage:fullscreen #canvas {
  width: min(100vw, calc(100vh * 4 / 3));
  height: min(100vh, calc(100vw * 3 / 4));
  align-self: center;
}

@media (any-pointer: coarse) {
  .stage[data-state="running"]:fullscreen #canvas {
    width: min(100vw, calc((100dvh - 64px) * 4 / 3));
    height: auto;
  }
}

.stage-panel {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--pause-fill);
  background-image: repeating-linear-gradient(0deg, var(--pause-line) 0 2px, transparent 2px 4px);
}

.stage-panel > :not(.playfield, .visually-hidden) {
  position: relative;
}

/* Re-made isometric brick rows in the three block colours (logo face tones). Decorative only. */
.playfield {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bricks {
  position: absolute;
  left: 24px;
  width: calc(100% - 48px);
  height: 26px;
}

.bricks-a {
  top: 18px;
}

.bricks-b {
  top: 46px;
}


/* ---- First visit: three steps ---- */

.panel-setup {
  justify-content: center;
  gap: 24px;
  padding: 92px 32px 56px;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 44px;
}

.step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* Column dividers drawn in the gap, so no step becomes a bordered box. */
.step + .step::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -22px;
  width: 2px;
  background: #fff;
}

.step-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  color: var(--ink);
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: 0 3px 6px -2px rgb(20 21 29 / 0.35);
}

.mark-pink { background: linear-gradient(var(--pink-hi) 0 32%, var(--pink) 32%); }
.mark-green { background: linear-gradient(var(--green-hi) 0 32%, var(--green) 32%); }
/* Flat blue: white on the light top band would fall to 3.3:1, on the base it is 5.1:1. */
.mark-blue { background: var(--blue); color: #fff; }

.step.is-done .step-mark {
  background: linear-gradient(var(--green-hi) 0 32%, var(--green) 32%);
  color: var(--ink);
  font-size: 0;
}

.step.is-done .step-mark::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.step h3 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.15;
}

.step p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.download-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.download-link {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
}

.download-link > span {
  text-decoration: underline;
  text-decoration-color: var(--play);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.download-link .icon {
  margin-top: 0.1em;
  color: var(--play-ink);
}

.download-link:hover > span {
  color: var(--play-press);
}

/* inline-block stops the parent's underline from reaching the note. */
.download-link small {
  display: inline-block;
  width: 100%;
  margin-top: 2px;
  font-weight: 400;
  color: var(--ink-3);
  font-size: 0.85rem;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 132px;
  padding: 16px 12px;
  border: 2px dashed var(--ink-3);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.6);
  color: var(--ink-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--action);
  background: rgb(255 255 255 / 0.85);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--ok-ink);
  background: var(--ok-tint);
}

.dropzone-title {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
}

.dropzone-title u {
  text-decoration-color: var(--play);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.dropzone-sub {
  font-size: 0.85rem;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.dropzone.has-file .dropzone-sub {
  color: var(--ok-ink);
  font-weight: 700;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink-2);
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: none;
  accent-color: var(--play);
  cursor: pointer;
}

.check-center {
  justify-content: center;
  align-items: center;
}

.check-center input {
  margin: 0;
}

.privacy {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--ok-tint);
  color: var(--ok-ink);
  font-size: 0.92rem;
}

.privacy .icon {
  margin-top: 0.15em;
}

/* ---- Play control (moved between panels by app.js) ---- */

.play-row:empty {
  display: none;
}

.play-control {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.play-reason {
  margin: -2px 0 0;
  color: var(--ink-2);
  font-size: 0.85rem;
  text-align: center;
}

.play-reason:empty {
  display: none;
}

.input-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.85rem;
}

.hint-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hint-off {
  flex-basis: 100%;
  justify-content: center;
}

/* ---- Returning visit ---- */

.panel-ready {
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 92px 24px 56px;
  text-align: center;
}

.panel-ready .play-row {
  width: min(320px, 100%);
}

.panel-ready .btn-play {
  min-height: 72px;
  font-size: 1.6rem;
}

.ready-archive {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.88rem;
}

/* ---- Exit ---- */

.panel-exit {
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
}

.panel-exit h2 {
  margin: 0;
  font-size: 1.6rem;
}

.panel-exit p {
  margin: 0 0 8px;
  color: var(--ink-2);
}

/* ---- Under the stage ---- */

.stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 14px 2px 0;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.status-line > :not(.hidden) ~ :not(.hidden)::before {
  content: "·";
  margin-right: 8px;
}

.status {
  font-weight: 700;
}

.status.is-error {
  color: var(--play-ink);
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fullscreen-note {
  width: 100%;
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-2);
  text-align: right;
}

/* Full screen only works while the game runs. */
.stage-area:not(:has(.stage[data-state="running"])) :is(.stage-actions, .fullscreen-note) {
  display: none;
}

/* ---------- Saves ---------- */

.saves {
  max-width: 880px;
  margin: 56px auto 0;
  scroll-margin-top: 16px;
}

.mobile-android {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .mobile-android {
    display: block;
  }

  .mobile-android-card {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
    background: var(--panel);
    text-align: center;
  }

  .mobile-android-card p {
    margin: 0;
    font-weight: 750;
  }

  .mobile-android-link {
    min-height: 44px;
    padding-inline: 16px;
    border-radius: 999px;
    background: var(--blue);
    font-size: 0.84rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .mobile-android-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-block: 10px;
    color: var(--ink-2);
    font-size: 0.85rem;
  }

  .mobile-android-divider::before,
  .mobile-android-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--panel-line);
  }
}

.memory-card-preview {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 16px;
  padding: 16px;
  margin-block: 16px;
  background: var(--chip-bg, #dddde4);
  border-radius: 7px;
}

.memory-card-preview h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.save-modes, .save-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.save-modes li, .save-items li {
  background: #f0f0f4;
  color: #232434;
  border-radius: 4px;
  font-size: 0.85rem;
  padding: 3px 7px;
}

.transfer-steps {
  padding-inline-start: 1.35em;
  margin: 0 0 16px;
}

.transfer-steps li + li {
  margin-top: 5px;
}

.memory-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.memory-card-actions [hidden] {
  display: none;
}

#save-notice {
  white-space: pre-line;
}

#save-reset-confirm:not([hidden]) {
  display: grid;
  gap: 8px;
}

.mic-monitor {
  margin-top: 16px;
  font-size: 0.9rem;
}

.mic-monitor label {
  display: block;
  font-weight: 700;
}

.mic-monitor progress {
  width: min(100%, 320px);
  height: 12px;
  margin: 5px 8px 5px 0;
  accent-color: var(--blue, #0879b7);
  vertical-align: middle;
}

.mic-monitor span {
  font-variant-numeric: tabular-nums;
}

.save-confirm {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  border: 2px solid #3e3fcb;
  border-radius: 10px;
  color: #232434;
  background: #e6e6ed;
  padding: 20px;
}

.save-confirm::backdrop {
  background: #191b31b3;
}

.save-confirm h3 {
  margin: 0;
}

@media (max-width: 640px) {
  .saves {
    margin-block: 0 24px;
  }

  .memory-card-preview {
    grid-template-columns: 1fr;
  }
}

.saves-head h2 {
  margin: 0 0 6px;
  font-size: 1.6rem;
}

.saves-head p {
  margin: 0 0 18px;
  max-width: 65ch;
  color: var(--ink-2);
}

.tabs {
  display: flex;
  gap: 4px;
  padding-left: 12px;
  overflow-x: auto;
}

/* Folder tabs: the selected tab joins the panel below it. */
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: rgb(230 232 238 / 0.45);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  background: rgb(230 232 238 / 0.75);
  color: var(--ink);
}

.tab[aria-selected="true"] {
  background: var(--panel);
  border-color: var(--panel-line);
  color: var(--ink);
  margin-bottom: -1px;
  z-index: 1;
}

.tab-panel {
  padding: 24px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: var(--panel);
}

.tab-panel:focus-visible {
  outline-offset: 3px;
}

.save-method {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}

.save-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.save-col h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.save-col p {
  margin: 0;
  max-width: 60ch;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.saves-hint {
  margin: 20px 0 0;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.notice {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.notice-ok {
  background: var(--ok-tint);
  color: var(--ok-ink);
}

.notice-warn {
  background: var(--warn-tint);
  color: var(--warn-ink);
}

/* ---------- Details ---------- */

.details {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 48px;
  max-width: 880px;
  margin: 64px auto 0;
}

.details h2 {
  margin: 0 0 16px;
  font-size: 1.6rem;
}

.details p {
  margin: 0 0 12px;
  color: var(--ink-2);
  max-width: 65ch;
}

.details strong {
  color: var(--ink);
}

.controls {
  margin: 0;
  display: grid;
  gap: 10px;
}

.controls > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.controls dt {
  font-weight: 700;
  font-size: 0.92rem;
}

.controls dd {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.version-line {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Developer tools ---------- */

.dev-tools {
  max-width: 880px;
  margin: 56px auto 0;
  border-top: 1px solid var(--ground-edge);
  padding-top: 16px;
}

.dev-tools summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dev-tools summary:hover {
  color: var(--ink);
}

.dev-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
}

.console-log {
  width: 100%;
  margin: 0;
  max-height: 260px;
  min-height: 120px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink-2);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Footer ---------- */

.site-footer {
  max-width: 880px;
  margin: 40px auto 0;
  padding: 20px 0 40px;
  border-top: 1px solid var(--ground-edge);
  font-size: 0.86rem;
  color: var(--ink-2);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--ink);
  text-decoration-color: var(--ground-edge);
  text-decoration-thickness: 1px;
}

.footer-links a:hover {
  text-decoration-color: var(--play);
}

.footer-note {
  margin: 0;
  max-width: 75ch;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .stage-panel .bricks {
    animation: bricks-drop 650ms var(--ease-out) both;
  }

  .stage-panel .bricks-b {
    animation-delay: 80ms;
  }

  @keyframes bricks-drop {
    from {
      transform: translateY(-8px);
      opacity: 0.35;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  .steps {
    grid-template-columns: 1fr;
    row-gap: 46px;
  }

  .step {
    flex-direction: row;
    align-items: flex-start;
    gap: 14px;
  }

  .step + .step::before {
    top: -24px;
    bottom: auto;
    left: 0;
    right: 0;
    width: auto;
    height: 2px;
  }

  .step-body {
    flex: 1;
  }

  .dropzone {
    min-height: 104px;
  }

  .bricks-b {
    display: none;
  }

  .bricks {
    left: 16px;
    width: calc(100% - 32px);
    top: 16px;
  }

  .panel-setup,
  .panel-ready {
    padding: 56px 18px 24px;
  }

  /* Privacy reassurance first on phones, so it lands in the first screen. */
  .panel-setup .privacy {
    order: -1;
  }

  .save-method {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .details {
    grid-template-columns: 1fr;
    gap: 36px;
  }
}

@media (max-width: 560px) {
  .site-header {
    align-items: flex-start;
  }

  .logo {
    width: 44px;
    height: 44px;
  }

  .brand-name {
    font-size: 1.1rem;
  }

  .brand-tag {
    font-size: 0.82rem;
  }

  /* Icon-only on phones; the label stays for screen readers. */
  .nav-link span,
  #repo-link span {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .nav-link,
  #repo-link {
    padding: 0 10px;
  }

  .stage-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .fullscreen-note {
    text-align: left;
  }

  .tabs {
    padding-left: 0;
  }

  .tab {
    flex: 1;
    justify-content: center;
    padding: 0 8px;
  }

  .tab-panel {
    padding: 18px;
  }

  .controls > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
