:root {
  color-scheme: light;
  --paper: #efe8dc;
  --panel: rgba(249, 246, 239, 0.96);
  --panel-alt: #f3ede2;
  --ink: #1f1a15;
  --muted: #645d55;
  --line: rgba(74, 60, 43, 0.12);
  --line-strong: rgba(74, 60, 43, 0.2);
  --accent: #5d7080;
  --accent-warm: #8c7350;
  --stage: #102331;
  --shadow: 0 10px 24px rgba(26, 21, 16, 0.06);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, #f4efe7, var(--paper));
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1340px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 0.9rem 0 1.35rem;
}

.hero-panel,
.stage-panel,
.control-panel {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 0.95rem 1.1rem 1rem;
  border-radius: 12px;
  border-left: 3px solid var(--accent);
}

.hero-panel__eyebrow,
.stage-panel__eyebrow,
.control-card__eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-panel__copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
}

.hero-panel h1,
.stage-panel h2,
.control-card h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

.hero-panel h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero-panel p {
  max-width: 46rem;
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.hero-panel__meta {
  margin: 0;
  color: var(--muted);
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(310px, 0.86fr);
  gap: 0.9rem;
  margin-top: 0.95rem;
  align-items: start;
}

.stage-panel {
  padding: 0.95rem;
  border-radius: 14px;
}

.stage-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.stage-panel h2 {
  margin: 0.2rem 0 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.75rem 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.stage-toolbar__hint {
  margin: 0;
  max-width: 20rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: right;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 112px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alt);
}

.stat-pill strong,
.control-field strong,
.ui-button,
.preset-button {
  font-family: "Consolas", "SFMono-Regular", monospace;
}

.stat-pill strong {
  font-size: 0.85rem;
}

.stat-pill__label {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ui-button {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  background: #23292f;
  color: #f5f1ea;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.ui-button:hover,
.preset-button:hover {
  transform: translateY(-1px);
}

.ui-button:hover {
  background: #2e353c;
}

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

.ui-button--secondary:hover {
  background: rgba(35, 41, 47, 0.04);
}

.canvas-shell {
  position: relative;
  aspect-ratio: 1.42 / 1;
  overflow: hidden;
  border: 1px solid rgba(149, 177, 190, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(143, 208, 221, 0.08), rgba(143, 208, 221, 0)),
    linear-gradient(180deg, #173447, #102331 56%, #0f1d27);
}

#sim-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.7rem;
}

.stage-notes p {
  margin: 0;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  line-height: 1.45;
}

.stage-notes span {
  display: block;
  margin-bottom: 0.24rem;
  color: var(--accent-warm);
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.control-panel {
  display: grid;
  gap: 0;
  overflow: hidden;
  border-radius: 14px;
}

.control-card {
  padding: 1rem;
}

.control-card + .control-card {
  border-top: 1px solid var(--line);
}

.control-card h2 {
  margin: 0.16rem 0 0;
  font-size: 1.02rem;
}

.control-card p {
  margin: 0.45rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.preset-button {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.7rem 0.55rem;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.preset-button.is-active {
  border-color: rgba(93, 112, 128, 0.42);
  background: rgba(93, 112, 128, 0.08);
}

.control-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.95rem;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
}

.control-field span {
  color: var(--muted);
}

.control-field strong {
  color: var(--ink);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

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

.control-card--notes ul {
  margin: 0.75rem 0 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.control-card--notes li + li {
  margin-top: 0.45rem;
}

@media (max-width: 1080px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .hero-panel__copy {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero-panel__meta,
  .stage-toolbar__hint {
    white-space: normal;
    text-align: left;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 1rem, 1340px);
    padding-top: 0.65rem;
  }

  .stage-panel__head,
  .stage-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions > * {
    flex: 1 1 0;
  }

  .stage-notes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .preset-grid {
    grid-template-columns: 1fr;
  }
}
