:root {
  --ink: #f7f1e3;
  --paper: rgba(12, 28, 32, 0.78);
  --paper-strong: rgba(8, 20, 24, 0.9);
  --line: rgba(244, 220, 169, 0.35);
  --gold: #f4dca9;
  --zone-accent: #f4dca9;
  --moss: #6a8b6f;
  --ember: #dc8b4f;
  --sky: #8eb7c4;
  --shadow: rgba(5, 11, 14, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top, rgba(255, 222, 173, 0.18), transparent 35%),
    linear-gradient(180deg, #22424d 0%, #13242a 44%, #081316 100%);
  color: var(--ink);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

a,
button {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(244, 220, 169, 0.92);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(244, 220, 169, 0.14);
}

:focus:not(:focus-visible) {
  outline: none;
}

.app-shell {
  position: fixed;
  inset: 0;
}

#world {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
}

body.is-locked #world {
  cursor: none;
}

body.is-webgl-unavailable #world {
  display: none;
}

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0;
}

.top-bar__utilities {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  min-width: min(24rem, 34vw);
}

.top-bar__brand,
.top-bar__status,
.quick-cta,
.panel,
.legend,
.prompt {
  background:
    linear-gradient(180deg, rgba(255, 244, 220, 0.09), rgba(255, 244, 220, 0) 24%),
    linear-gradient(180deg, rgba(15, 35, 41, 0.92), rgba(7, 18, 22, 0.9));
  border: 1px solid var(--line);
  box-shadow:
    0 24px 70px rgba(3, 8, 11, 0.42),
    inset 0 1px 0 rgba(255, 247, 233, 0.08);
  backdrop-filter: blur(22px);
}

.top-bar__brand,
.top-bar__status {
  padding: 0.9rem 1rem;
  border-radius: 22px;
}

.top-bar__brand {
  min-width: min(22rem, 38vw);
}

.top-bar__brand h1,
.quick-cta h2,
.panel h2 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.top-bar__brand h1 {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
}

.top-bar__status {
  max-width: min(30rem, 45vw);
  text-align: right;
  border-color: color-mix(in srgb, var(--zone-accent) 35%, rgba(244, 220, 169, 0.16));
}

.quick-cta {
  width: min(23rem, 34vw);
  padding: 0.95rem 1rem;
  border-radius: 22px;
  pointer-events: auto;
}

.quick-cta h2 {
  font-size: 1rem;
}

.quick-cta p {
  margin: 0.45rem 0 0;
  color: rgba(247, 241, 227, 0.9);
  font-size: 0.9rem;
  line-height: 1.45;
}

.quick-cta__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.quick-cta .action-button {
  min-height: 2.25rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.84rem;
}

.top-bar__status span {
  display: block;
}

#zone-name {
  color: var(--zone-accent);
  font-weight: 700;
}

#zone-distance {
  margin-top: 0.2rem;
  color: rgba(247, 241, 227, 0.88);
  font-size: 0.95rem;
}

.eyebrow {
  display: block;
  margin-bottom: 0.25rem;
  color: rgba(244, 220, 169, 0.78);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel {
  pointer-events: auto;
  width: min(32rem, calc(100vw - 2rem));
  border-radius: 28px;
  padding: 1.4rem;
}

.panel p {
  margin: 0.9rem 0 0;
  color: rgba(247, 241, 227, 0.92);
  line-height: 1.6;
}

.panel__header {
  display: flex;
  gap: 1rem;
}

.panel__header--spread {
  align-items: flex-start;
  justify-content: space-between;
}

.panel--intro {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: min(38rem, calc(100vw - 2rem));
  overflow: hidden;
}

.panel--intro::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, transparent, rgba(244, 220, 169, 0.92), transparent);
  opacity: 0.9;
}

.fallback-panel {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: auto;
  overflow: auto;
  background:
    radial-gradient(circle at top right, rgba(244, 220, 169, 0.15), transparent 28%),
    radial-gradient(circle at top left, rgba(118, 196, 210, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(7, 17, 20, 0.72), rgba(5, 11, 14, 0.86));
}

.fallback-panel__inner {
  width: min(72rem, calc(100vw - 2rem));
  margin: 6.25rem auto 1.5rem;
  padding-bottom: 2rem;
}

.fallback-hero,
.fallback-section,
.fallback-card {
  background: linear-gradient(180deg, rgba(15, 35, 41, 0.92), rgba(8, 20, 24, 0.9));
  border: 1px solid rgba(244, 220, 169, 0.16);
  box-shadow: 0 18px 48px rgba(5, 11, 14, 0.32);
  backdrop-filter: blur(18px);
}

.fallback-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(18rem, 0.9fr);
  gap: 1.25rem;
  padding: 1.4rem;
  border-radius: 32px;
}

.fallback-hero__copy h2,
.fallback-section__header h2,
.fallback-card h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  letter-spacing: 0.04em;
}

.fallback-hero__copy h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.fallback-hero__copy p,
.fallback-status,
.fallback-card p {
  margin: 0.75rem 0 0;
  color: rgba(247, 241, 227, 0.84);
  line-height: 1.65;
}

.fallback-hero__kicker,
.fallback-card__kicker {
  color: rgba(142, 183, 196, 0.98);
  font-weight: 700;
}

.fallback-hero__actions {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.fallback-hero__actions .panel__actions {
  margin-top: 0;
  justify-content: flex-end;
}

.fallback-close {
  align-self: flex-end;
}

.fallback-status {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(244, 220, 169, 0.18);
  background: rgba(244, 220, 169, 0.08);
}

.fallback-sections {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.fallback-section {
  padding: 1.2rem;
  border-radius: 28px;
}

.fallback-section__header h2 {
  font-size: 1.2rem;
}

.fallback-section__grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

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

.fallback-section__grid--projects {
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.fallback-card {
  position: relative;
  overflow: hidden;
  padding: 1.1rem;
  border-radius: 24px;
}

.fallback-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--fallback-accent, var(--gold)), transparent);
  opacity: 0.82;
}

.fallback-card--featured {
  border-color: var(--fallback-accent, var(--gold));
}

.fallback-card__meta {
  display: inline-flex;
  margin-bottom: 0.8rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--fallback-accent, var(--gold));
  background: rgba(244, 220, 169, 0.08);
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fallback-card__body {
  margin-top: 0.75rem;
}

.fallback-card__bullets {
  margin: 1rem 0 0;
  padding-left: 1rem;
  color: rgba(247, 241, 227, 0.92);
}

.fallback-card__bullets li + li {
  margin-top: 0.45rem;
}

.fallback-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.panel--inspect {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 2;
  width: min(34rem, calc(100vw - 2rem));
  max-height: min(78vh, 44rem);
  overflow: auto;
}

.panel--settings {
  position: fixed;
  right: 1.5rem;
  top: 6.3rem;
  z-index: 3;
  width: min(26rem, calc(100vw - 2rem));
}

.intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.intro-grid div {
  padding: 1rem;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(6, 16, 20, 0.22);
  border: 1px solid rgba(244, 220, 169, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 247, 233, 0.05);
}

.intro-grid h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.95rem;
  color: var(--gold);
}

.intro-grid p {
  margin-top: 0.5rem;
  font-size: 0.96rem;
  color: rgba(247, 241, 227, 0.88);
}

.panel--intro h2 {
  font-size: clamp(1.7rem, 3.8vw, 2.5rem);
}

.panel--intro p {
  font-size: 1rem;
}

.panel--intro .panel__actions {
  margin-top: 1.3rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(244, 220, 169, 0.12);
}

.panel__kicker {
  color: rgba(142, 183, 196, 0.95);
  font-weight: 700;
}

.panel__bullets {
  margin: 1rem 0 0;
  padding-left: 1.1rem;
  color: rgba(247, 241, 227, 0.92);
}

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

.panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.panel--inspect h2 {
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
}

.panel--inspect .panel__header {
  gap: 1.15rem;
}

.panel--inspect .panel__kicker {
  display: inline-block;
  margin-top: 0.15rem;
}

.panel--inspect .panel__bullets {
  margin-top: 1.15rem;
}

.panel--inspect .panel__actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(244, 220, 169, 0.12);
}

.utility-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.utility-button,
.toggle-chip,
.setting-choice {
  appearance: none;
  pointer-events: auto;
  border: 1px solid rgba(244, 220, 169, 0.22);
  background: rgba(8, 20, 24, 0.72);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.utility-button {
  min-height: 2.9rem;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
}

.utility-button--compact {
  min-height: 2.55rem;
  padding-inline: 0.85rem;
}

.utility-button:hover,
.toggle-chip:hover,
.setting-choice:hover {
  border-color: rgba(244, 220, 169, 0.58);
  background: rgba(255, 255, 255, 0.1);
}

.utility-hint,
.settings-note {
  margin: 0;
  max-width: 24rem;
  color: rgba(247, 241, 227, 0.9);
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: right;
}

.settings-note {
  margin-top: 1rem;
  text-align: left;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  margin-top: 1rem;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.95rem 0;
  border-top: 1px solid rgba(244, 220, 169, 0.12);
}

.setting-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.setting-copy {
  min-width: 0;
}

.setting-copy h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.95rem;
  color: var(--gold);
}

.setting-copy p {
  margin: 0.45rem 0 0;
  color: rgba(247, 241, 227, 0.86);
  font-size: 0.9rem;
  line-height: 1.5;
}

.toggle-chip {
  min-width: 4.5rem;
  min-height: 2.6rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  font-weight: 700;
}

.setting-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.setting-choice {
  min-height: 2.6rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
}

.toggle-chip.is-selected,
.setting-choice.is-selected {
  background: rgba(220, 139, 79, 0.32);
  border-color: rgba(244, 220, 169, 0.6);
}

.action-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(244, 220, 169, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  text-decoration: none;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(244, 220, 169, 0.56);
  background: rgba(255, 255, 255, 0.1);
}

.action-button--primary {
  background: linear-gradient(135deg, rgba(220, 139, 79, 0.95), rgba(180, 87, 39, 0.95));
  border-color: rgba(255, 216, 180, 0.45);
  color: #fff9ef;
  box-shadow: 0 14px 28px rgba(180, 87, 39, 0.24);
}

.action-button--subtle {
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(244, 220, 169, 0.14);
  color: rgba(247, 241, 227, 0.88);
}

.panel--inspect .panel__actions .action-button--subtle {
  width: 100%;
}

.prompt {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  width: min(23rem, calc(100vw - 2rem));
  padding: 1rem 1.1rem;
  border-radius: 22px;
  text-align: left;
  cursor: pointer;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

.prompt__eyebrow,
.prompt__title,
.prompt__hint {
  display: block;
}

.prompt__eyebrow {
  color: rgba(244, 220, 169, 0.78);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.prompt__title {
  margin-top: 0.15rem;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
}

.prompt__hint {
  margin-top: 0.25rem;
  color: rgba(247, 241, 227, 0.9);
  font-size: 0.9rem;
}

.legend {
  position: fixed;
  left: 1.5rem;
  bottom: 1.5rem;
  width: min(18.5rem, calc(100vw - 2rem));
  padding: 0.9rem 0.95rem;
  border-radius: 24px;
}

.legend p {
  margin: 0.25rem 0 0;
  color: rgba(247, 241, 227, 0.8);
  line-height: 1.5;
}

.debug-panel {
  position: fixed;
  left: 1.5rem;
  bottom: 10.1rem;
  width: min(15rem, calc(100vw - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(15, 35, 41, 0.82), rgba(8, 20, 24, 0.82));
  border: 1px solid rgba(244, 220, 169, 0.18);
  box-shadow: 0 18px 48px rgba(5, 11, 14, 0.34);
  pointer-events: none;
}

.debug-panel__row {
  margin: 0.35rem 0 0;
  color: rgba(247, 241, 227, 0.86);
  font-size: 0.88rem;
}

.debug-panel__row::before {
  content: attr(data-label) ": ";
  color: rgba(244, 220, 169, 0.78);
  font-weight: 700;
}

.crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  border: 1px solid rgba(244, 220, 169, 0.65);
  box-shadow:
    0 0 0 8px rgba(244, 220, 169, 0.04),
    0 0 18px rgba(244, 220, 169, 0.18);
}

.crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(244, 220, 169, 0.82);
}

.mobile-controls {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding: 0 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
}

.control-pad {
  pointer-events: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  width: min(12rem, 44vw);
  padding: 0.7rem;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 244, 220, 0.08), rgba(255, 244, 220, 0) 28%),
    rgba(8, 20, 24, 0.58);
  border: 1px solid rgba(244, 220, 169, 0.16);
  box-shadow: 0 18px 40px rgba(3, 8, 11, 0.3);
  backdrop-filter: blur(18px);
}

.mobile-actions {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(8rem, 24vw);
  padding: 0.7rem;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 244, 220, 0.08), rgba(255, 244, 220, 0) 28%),
    rgba(8, 20, 24, 0.58);
  border: 1px solid rgba(244, 220, 169, 0.16);
  box-shadow: 0 18px 40px rgba(3, 8, 11, 0.3);
  backdrop-filter: blur(18px);
}

.control-pad .control-button:nth-child(1) {
  grid-column: 2;
}

.control-pad .control-button:nth-child(2) {
  grid-column: 1;
}

.control-pad .control-button:nth-child(3) {
  grid-column: 2;
}

.control-pad .control-button:nth-child(4) {
  grid-column: 3;
  grid-row: 2;
}

.control-button {
  appearance: none;
  min-height: 3.4rem;
  border-radius: 20px;
  border: 1px solid rgba(244, 220, 169, 0.22);
  background: rgba(8, 20, 24, 0.7);
  color: var(--ink);
  font-size: 1.1rem;
  backdrop-filter: blur(20px);
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
}

.control-button:hover {
  border-color: rgba(244, 220, 169, 0.52);
  background: rgba(255, 255, 255, 0.1);
}

.control-button--wide {
  min-height: 3.65rem;
  font-weight: 700;
}

.control-button.is-active {
  background: rgba(220, 139, 79, 0.4);
  border-color: rgba(244, 220, 169, 0.56);
}

.control-button.is-disabled,
.control-button:disabled {
  opacity: 0.48;
  border-color: rgba(244, 220, 169, 0.12);
}

.hidden {
  display: none !important;
}

body.is-fallback-open .panel--inspect,
body.is-fallback-open .prompt,
body.is-fallback-open .legend,
body.is-fallback-open .debug-panel,
body.is-fallback-open .crosshair,
body.is-fallback-open .mobile-controls,
body.is-fallback-open .quick-cta {
  display: none !important;
}

body.is-fallback-open #world {
  opacity: 0.16;
  pointer-events: none;
}

body.is-fallback-open .top-bar__status {
  opacity: 0.35;
}

body.is-intro-open .quick-cta,
body.is-intro-open .legend,
body.is-intro-open .debug-panel,
body.is-intro-open .prompt {
  display: none !important;
}

body.is-intro-open .top-bar__status,
body.is-settings-open .top-bar__status,
body.is-inspect-open .top-bar__status {
  opacity: 0.4;
}

body.is-settings-open .quick-cta,
body.is-settings-open .legend,
body.is-inspect-open .quick-cta,
body.is-inspect-open .legend {
  opacity: 0.28;
}

.noscript {
  position: fixed;
  inset: 1rem;
  display: grid;
  place-items: center;
  padding: 1rem;
  border-radius: 24px;
  background: var(--paper-strong);
  color: var(--ink);
  text-align: center;
}

.noscript a {
  color: var(--gold);
}

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes prompt-rise {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.panel--inspect:not(.hidden),
.panel--settings:not(.hidden) {
  animation: panel-rise 220ms ease-out;
}

.panel--intro:not(.hidden) {
  animation: panel-rise 260ms ease-out;
}

.prompt:not(.hidden) {
  animation: prompt-rise 200ms ease-out;
}

@media (pointer: coarse) {
  .mobile-controls {
    display: flex;
  }

  .action-button,
  .utility-button,
  .toggle-chip,
  .setting-choice {
    min-height: 3rem;
  }

  .crosshair {
    display: none;
  }

  .legend {
    bottom: 8.9rem;
  }

  .debug-panel {
    bottom: 16.8rem;
  }
}

@media (max-width: 900px) {
  .top-bar {
    flex-direction: column;
  }

  .top-bar__status {
    max-width: 100%;
    text-align: left;
  }

  .top-bar__utilities {
    width: 100%;
    align-items: flex-start;
    min-width: 0;
  }

  .utility-actions {
    justify-content: flex-start;
  }

  .utility-hint {
    text-align: left;
  }

  .quick-cta {
    width: min(24rem, 100%);
  }

  .quick-cta__actions {
    justify-content: flex-start;
  }

  .panel--inspect {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: auto;
    max-height: min(65vh, 36rem);
  }

  .panel--settings {
    left: 1rem;
    right: 1rem;
    top: auto;
    bottom: 1rem;
    width: auto;
  }

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

  .setting-row {
    flex-direction: column;
  }

  .setting-options {
    justify-content: flex-start;
  }

  .fallback-panel__inner {
    width: calc(100vw - 2rem);
  }

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

  .fallback-hero__actions .panel__actions {
    justify-content: flex-start;
  }

  .fallback-close {
    align-self: flex-start;
  }

  .fallback-section__grid--split {
    grid-template-columns: 1fr;
  }

  .debug-panel {
    left: 1rem;
  }
}

@media (max-width: 640px) {
  .top-bar {
    padding: 1rem 1rem 0;
  }

  .panel {
    padding: 1.15rem;
    border-radius: 24px;
  }

  .panel--intro {
    top: auto;
    bottom: 1rem;
    transform: translateX(-50%);
  }

  .panel--inspect .panel__actions .action-button {
    width: 100%;
  }

  .fallback-panel__inner {
    width: calc(100vw - 1rem);
    margin-top: 5.5rem;
  }

  .fallback-section,
  .fallback-card,
  .fallback-hero {
    border-radius: 24px;
  }

  .legend {
    left: 1rem;
    right: 1rem;
    width: auto;
    bottom: 10rem;
  }

  .prompt {
    bottom: 10rem;
  }

  .mobile-controls {
    gap: 0.65rem;
    padding: 0 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .control-pad {
    width: min(10.75rem, 42vw);
    padding: 0.6rem;
  }

  .mobile-actions {
    width: min(7.5rem, 28vw);
    padding: 0.6rem;
  }

  .quick-cta {
    width: 100%;
  }

  .intro-grid {
    grid-template-columns: 1fr;
  }
}

body.is-reduced-motion .fallback-panel,
body.is-reduced-motion .fallback-panel *,
body.is-reduced-motion .panel,
body.is-reduced-motion .action-button,
body.is-reduced-motion .utility-button,
body.is-reduced-motion .toggle-chip,
body.is-reduced-motion .setting-choice,
body.is-reduced-motion .prompt,
body.is-reduced-motion .control-button {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

body.is-reduced-motion .action-button:hover {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .fallback-panel,
  .fallback-panel *,
  .panel,
  .action-button,
  .utility-button,
  .toggle-chip,
  .setting-choice,
  .prompt,
  .control-button {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .action-button:hover {
    transform: none;
  }
}
