:root {
  --bg: #f2eadf;
  --paper: rgba(255, 250, 243, 0.8);
  --panel: rgba(255, 248, 239, 0.88);
  --border: rgba(54, 36, 18, 0.16);
  --ink: #22170d;
  --muted: #6b5948;
  --road: #2f3842;
  --road-edge: #7a8791;
  --car: #d85d3c;
  --target: #146c63;
  --bystander: #3458b8;
  --prank: #b18912;
  --grid: rgba(34, 23, 13, 0.08);
  --shadow: 0 20px 50px rgba(65, 44, 24, 0.08);
  --button-text: #fff9f2;
  --button-secondary: rgba(34, 23, 13, 0.12);
  --toggle-track: rgba(34, 23, 13, 0.14);
  --toggle-thumb: #fff9f2;
  --radio-bg: rgba(34, 23, 13, 0.08);
  --radio-border: rgba(34, 23, 13, 0.06);
  --radio-active-bg: rgba(255, 255, 255, 0.94);
  --radio-active-ink: var(--ink);
  --card-border-soft: rgba(54, 36, 18, 0.08);
  --card-border: rgba(54, 36, 18, 0.12);
  --upload-border: rgba(54, 36, 18, 0.22);
  --upload-bg: rgba(255, 255, 255, 0.52);
  --scene-bg: #fbf6ef;
  --scene-prank-line: rgba(177, 137, 18, 0.75);
  --scene-bystander-line: rgba(52, 88, 184, 0.35);
  --scene-rings: rgba(216, 93, 60, 0.14);
  --canvas-card: rgba(255, 255, 255, 0.85);
  --canvas-card-border: rgba(34, 23, 13, 0.1);
  --canvas-axes: rgba(34, 23, 13, 0.16);
  --canvas-grid: rgba(34, 23, 13, 0.08);
  --canvas-cursor: rgba(34, 23, 13, 0.22);
  --canvas-text: #22170d;
  --canvas-muted: #6b5948;
  --bg-accent-a: rgba(216, 93, 60, 0.14);
  --bg-accent-b: rgba(20, 108, 99, 0.14);
  --bg-top: #efe4d6;
  --bg-bottom: #e9ddcf;
  --frame-top: rgba(255, 255, 255, 0.58);
  --frame-bottom: rgba(255, 255, 255, 0.14);
  --frame-sheen: rgba(255, 255, 255, 0.14);
  --frame-shadow: rgba(0, 0, 0, 0.03);
  --icon-button-bg: rgba(34, 23, 13, 0.08);
}

:root[data-theme="dark"] {
  --bg: #0f161d;
  --paper: rgba(20, 28, 36, 0.8);
  --panel: rgba(16, 24, 31, 0.88);
  --border: rgba(188, 205, 219, 0.14);
  --ink: #edf3f7;
  --muted: #a6b5c2;
  --road: #2c3640;
  --road-edge: #8698a6;
  --car: #ff8560;
  --target: #4fd0c1;
  --bystander: #82a7ff;
  --prank: #f3c84d;
  --grid: rgba(237, 243, 247, 0.09);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --button-text: #091116;
  --button-secondary: rgba(237, 243, 247, 0.12);
  --toggle-track: rgba(237, 243, 247, 0.2);
  --toggle-thumb: #f3f7fb;
  --radio-bg: rgba(237, 243, 247, 0.09);
  --radio-border: rgba(237, 243, 247, 0.06);
  --radio-active-bg: rgba(255, 255, 255, 0.1);
  --radio-active-ink: var(--ink);
  --card-border-soft: rgba(188, 205, 219, 0.1);
  --card-border: rgba(188, 205, 219, 0.14);
  --upload-border: rgba(188, 205, 219, 0.24);
  --upload-bg: rgba(255, 255, 255, 0.04);
  --scene-bg: #101921;
  --scene-prank-line: rgba(243, 200, 77, 0.82);
  --scene-bystander-line: rgba(130, 167, 255, 0.42);
  --scene-rings: rgba(255, 133, 96, 0.18);
  --canvas-card: rgba(12, 19, 26, 0.88);
  --canvas-card-border: rgba(237, 243, 247, 0.12);
  --canvas-axes: rgba(237, 243, 247, 0.2);
  --canvas-grid: rgba(237, 243, 247, 0.1);
  --canvas-cursor: rgba(237, 243, 247, 0.22);
  --canvas-text: #edf3f7;
  --canvas-muted: #a6b5c2;
  --bg-accent-a: rgba(255, 133, 96, 0.18);
  --bg-accent-b: rgba(79, 208, 193, 0.12);
  --bg-top: #131d25;
  --bg-bottom: #0a1117;
  --frame-top: rgba(255, 255, 255, 0.08);
  --frame-bottom: rgba(255, 255, 255, 0.02);
  --frame-sheen: rgba(255, 255, 255, 0.06);
  --frame-shadow: rgba(0, 0, 0, 0.18);
  --icon-button-bg: rgba(237, 243, 247, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--bg-accent-a), transparent 30%),
    radial-gradient(circle at top right, var(--bg-accent-b), transparent 26%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 55%, var(--bg-bottom) 100%);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  transition: background 180ms ease, color 180ms ease;
}

button,
input,
label,
span,
p,
li {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.page-shell {
  width: min(1680px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 16px 0 40px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.panel-hero {
  padding-bottom: 6px;
}

.hero-topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
}

.hero-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-top: 4px;
}

.panel-hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.intro {
  max-width: 760px;
  margin: 16px 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 340px;
  grid-template-areas:
    "controls viz audio"
    "controls chart audio";
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.controls-panel,
.viz-panel,
.chart-panel {
  padding: 22px;
}

.controls-panel {
  grid-area: controls;
  align-self: stretch;
}

.viz-panel,
.chart-panel {
  min-width: 0;
}

.viz-panel {
  grid-area: viz;
}

.chart-panel {
  grid-area: chart;
}

.audio-panel {
  grid-area: audio;
  padding: 22px;
  align-self: stretch;
}

.audio-box,
.live-audio-card {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: var(--paper);
  border: 1px solid var(--card-border-soft);
}

.live-audio-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.live-audio-header h3 {
  margin: 0;
  font-size: 1rem;
}

.audio-box-title {
  margin: 0;
  font-size: 1rem;
}

.live-audio-header p,
.live-audio-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.85rem;
}

.song-progress {
  display: grid;
  gap: 6px;
}

.song-progress-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--toggle-track);
  overflow: hidden;
}

.song-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--target);
  transition: width 0.25s linear;
}

.song-progress-time {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.live-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.live-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.live-toggle-track {
  position: relative;
  width: 56px;
  height: 32px;
  border-radius: 999px;
  background: var(--toggle-track);
  transition: background 160ms ease;
}

.live-toggle-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--toggle-thumb);
  box-shadow: 0 3px 8px rgba(34, 23, 13, 0.16);
  transition: transform 160ms ease;
}

.live-toggle input:checked + .live-toggle-track {
  background: var(--target);
}

.live-toggle input:checked + .live-toggle-track::after {
  transform: translateX(24px);
}

.live-toggle input:focus-visible + .live-toggle-track {
  outline: 2px solid rgba(20, 108, 99, 0.45);
  outline-offset: 3px;
}

.live-monitor-field {
  display: grid;
  gap: 8px;
}

.live-monitor-field span,
.file-picker span {
  font-size: 0.9rem;
  font-weight: 600;
}

.radio-inputs {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  border-radius: 0.8rem;
  background: var(--radio-bg);
  box-sizing: border-box;
  box-shadow: inset 0 0 0 1px var(--radio-border);
  padding: 0.25rem;
  width: 100%;
  font-size: 14px;
}

.radio-inputs .radio {
  flex: 1 1 0;
  text-align: center;
}

.radio-inputs .radio input {
  display: none;
}

.radio-inputs .radio .name {
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  border: none;
  padding: 0.65rem 0.75rem;
  color: rgba(51, 65, 85, 1);
  transition: all 0.15s ease-in-out;
  line-height: 1.2;
}

.radio-inputs .radio input:checked + .name {
  background: var(--radio-active-bg);
  color: var(--radio-active-ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(34, 23, 13, 0.08);
}

.radio-inputs .radio input:disabled + .name {
  cursor: not-allowed;
  color: rgba(107, 89, 72, 0.45);
}

.radio-inputs .radio input:focus-visible + .name {
  outline: 2px solid rgba(20, 108, 99, 0.45);
  outline-offset: 2px;
}

.panel-heading h2,
.assumptions h3 {
  margin: 0;
  font-size: 1.2rem;
}

.panel-heading p,
.assumptions p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.transport {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 18px 0 14px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--button-text);
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: var(--button-secondary);
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border-radius: 999px;
  background: var(--button-secondary);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--card-border-soft);
  transition:
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.hero-action:hover {
  transform: translateY(-1px);
}

.hero-action:focus-visible,
.live-toggle input:focus-visible ~ .audio-icon {
  outline: 2px solid rgba(20, 108, 99, 0.45);
  outline-offset: 3px;
}

.theme-toggle-icon,
.audio-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  line-height: 1;
}

.theme-toggle-icon svg,
.audio-icon svg {
  width: 20px;
  height: 20px;
}

.theme-toggle-icon-sun,
:root[data-theme="dark"] .theme-toggle-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle-icon-sun {
  display: inline-flex;
}

.audio-monitor-toggle {
  position: relative;
  cursor: pointer;
}

.audio-monitor-toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
}

.audio-monitor-toggle input:disabled {
  cursor: wait;
}

.audio-monitor-toggle:has(input:checked) {
  background: var(--target);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.audio-monitor-toggle:has(input:disabled) {
  opacity: 0.6;
}

.audio-icon-on,
.audio-monitor-toggle input:checked ~ .audio-icon-off {
  display: none;
}

.audio-monitor-toggle input:checked ~ .audio-icon-on {
  display: inline-flex;
}

.control-groups {
  display: grid;
  gap: 18px;
}

.control-group {
  padding: 16px;
  border-radius: 22px;
  background: var(--paper);
  border: 1px solid var(--card-border-soft);
}

.control-group h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.control {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.control:last-child {
  margin-bottom: 0;
}

.control-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
}

.control-header span:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--car);
}

.assumptions {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(177, 137, 18, 0.08);
  border: 1px solid rgba(177, 137, 18, 0.2);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 0;
}

.stat-card {
  padding: 14px;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--card-border-soft);
}

.stat-card .label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.canvas-frame {
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--card-border-soft);
  background:
    linear-gradient(180deg, var(--frame-top), var(--frame-bottom)),
    linear-gradient(135deg, var(--frame-sheen), var(--frame-shadow));
}

.chart-frame {
  min-height: 430px;
}

.audio-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.file-picker {
  flex: 1 1 320px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.file-picker input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px dashed var(--upload-border);
  background: var(--paper);
  color: var(--ink);
}

.uploaded-audio {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: var(--upload-bg);
}

.uploaded-audio-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
}

.uploaded-audio-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--icon-button-bg);
  color: var(--ink);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.audio-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#scene-canvas {
  height: 332px;
  cursor: grab;
  touch-action: none;
}

#scene-canvas.dragging {
  cursor: grabbing;
}

#chart-canvas {
  height: 430px;
}

.scene-overlay-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 8px;
}

.overlay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.overlay-toggle input {
  cursor: pointer;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
}

.swatch.car {
  background: var(--car);
}

.swatch.target {
  background: var(--target);
}

.swatch.bystander {
  background: var(--bystander);
}

.swatch.prank {
  background: var(--prank);
}

.settings-sheet {
  display: contents;
}

.sheet-body {
  display: contents;
}

.sheet-header,
.sheet-tabs,
.sheet-backdrop,
.mobile-bar {
  display: none;
}

@media (max-width: 1380px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "controls"
      "viz"
      "chart"
      "audio";
  }

  .controls-panel,
  .chart-panel,
  .audio-panel {
    align-self: auto;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 20px, 1400px);
    padding-top: 12px;
  }

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

  .hero-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions {
    align-self: flex-end;
  }

  .live-audio-header {
    flex-direction: column;
    align-items: stretch;
  }

  #scene-canvas {
    height: 340px;
  }

  #chart-canvas {
    height: 300px;
  }
}

@media (max-width: 820px) {
  .page-shell {
    padding: 0;
    width: 100vw;
  }

  .layout {
    display: contents;
  }

  .viz-panel {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      calc(78px + max(12px, env(safe-area-inset-bottom)))
      max(12px, env(safe-area-inset-left));
    border: none;
    border-radius: 0;
    background: var(--bg);
    box-shadow: none;
    backdrop-filter: none;
    z-index: 10;
  }

  .panel-hero {
    flex-shrink: 0;
    padding: 12px 0 0;
  }

  .hero-topbar {
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }

  .hero-topbar > div {
    flex: 1;
  }

  .panel-hero h1 {
    font-size: 1.4rem;
  }

  .eyebrow {
    display: none;
  }

  .stats-grid {
    flex-shrink: 0;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0 max(0px, calc(env(safe-area-inset-left) - 12px));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }

  .stat-card {
    flex-shrink: 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--card-border);
    min-width: 100px;
  }

  .stat-card .label {
    font-size: 0.72rem;
    margin-bottom: 4px;
  }

  .stat-card .value {
    font-size: 0.95rem;
  }

  .canvas-frame {
    flex: 1;
    margin: 12px 0 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: hidden;
  }

  #scene-canvas {
    height: 100%;
    cursor: grab;
  }

  .scene-overlay-controls {
    display: flex;
    gap: 12px;
    padding: 4px 0 8px;
    flex-direction: column;
  }

  .overlay-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    cursor: pointer;
    user-select: none;
  }

  .overlay-toggle span {
    display: inline;
    white-space: nowrap;
  }

  .overlay-toggle input {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--target);
  }

  .legend {
    display: none;
  }

  .settings-sheet {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 85vh;
    flex-direction: column;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    background: var(--panel);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 24px 24px 0 0;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    transform: translateY(100%);
    transition: transform 240ms ease;
    z-index: 30;
  }

  .settings-sheet.is-open {
    transform: translateY(0);
  }

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

  .sheet-grabber {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--muted);
    margin: 0 auto 0 0;
  }

  .sheet-header h2 {
    flex: 1;
    margin: 0;
    text-align: center;
    font-size: 1.1rem;
  }

  .sheet-header .icon-button {
    flex-shrink: 0;
    margin: 0 0 0 auto;
  }

  .sheet-tabs {
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    padding: 0 16px 12px;
    border-bottom: 1px solid var(--border);
  }

  .sheet-tab {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 160ms ease;
    border: 0;
    min-height: 44px;
  }

  .sheet-tab[aria-selected="true"] {
    background: var(--radio-active-bg);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(34, 23, 13, 0.08);
  }

  .sheet-body {
    display: block;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .sheet-body > .panel {
    display: none;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .settings-sheet[data-active="controls"] .controls-panel,
  .settings-sheet[data-active="audio"] .audio-panel,
  .settings-sheet[data-active="chart"] .chart-panel {
    display: block;
  }

  .controls-panel .panel-heading,
  .audio-panel .panel-heading,
  .chart-panel .panel-heading {
    display: none;
  }

  .controls-panel .transport {
    display: none;
  }

  .chart-frame {
    min-height: 320px;
  }

  #chart-canvas {
    height: 320px;
  }

  .sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 25;
    animation: fadeIn 240ms ease;
  }

  .settings-sheet.is-open ~ .sheet-backdrop {
    display: block;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  .mobile-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    gap: 12px;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    background: var(--panel);
    border-top: 1px solid var(--border);
    z-index: 10;
  }

  .mobile-bar-btn {
    flex: 1;
    padding: 12px 16px;
    min-height: 44px;
    background: var(--ink);
    color: var(--button-text);
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 12px;
    border: 0;
    cursor: pointer;
    transition: all 160ms ease;
  }

  .mobile-bar-btn.secondary {
    background: var(--button-secondary);
    color: var(--ink);
  }

  .mobile-bar-btn.primary {
    background: var(--target);
    color: #fff;
  }

  .hero-action {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }
}
