:root {
  --bg-page: #080e1c;
  --bg-panel: #0f172a;
  --bg-card: #131f35;
  --border-subtle: #283a57;
  --text-main: #f1f5f9;
  --text-muted: #cbd5e1;
  --accent-sky: #38bdf8;
  --accent-ice: #7dd3fc;
  --btn-blue: #0369a1;
  --btn-blue-hover: #0284c7;
  --btn-amber: #c2410c;
  --btn-emerald: #15803d;
  --btn-slate: #1e293b;
}

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

body {
  margin: 0;
  padding: 10px 14px 20px;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.42;
}

.top-header {
  max-width: 1120px;
  margin: 0 auto 8px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 1.32rem;
  letter-spacing: -0.01em;
  color: #f8fafc;
}

.badge-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #0c2540;
  border: 1px solid #38bdf8;
  color: #e0f2fe;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.lede {
  margin: 4px 0 8px;
  color: var(--text-muted);
  font-size: 0.86rem;
  max-width: 940px;
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

button {
  font-family: inherit;
  font-size: 0.79rem;
  font-weight: 600;
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  background: var(--btn-slate);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

button:hover {
  border-color: var(--accent-ice);
}

button:focus-visible,
input[type="range"]:focus-visible,
a:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

.btn-primary {
  background: var(--btn-blue);
  border-color: #38bdf8;
}

.btn-accent {
  background: var(--btn-amber);
  border-color: #fb923c;
}

.btn-emerald {
  background: var(--btn-emerald);
  border-color: #4ade80;
}

.btn-secondary {
  background: #1b283d;
}

.studio-grid {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.56fr) minmax(275px, 1fr);
  gap: 10px;
  align-items: start;
  isolation: isolate;
}

.canvas-column,
.control-panel {
  min-width: 0;
}

.canvas-frame {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #050b16;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
}

#studio-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

.hud-pill {
  position: absolute;
  right: 9px;
  bottom: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(8, 14, 28, 0.86);
  border: 1px solid rgba(125, 211, 252, 0.45);
  color: #f1f5f9;
  font-size: 0.73rem;
  font-weight: 600;
  pointer-events: none;
  max-width: 66%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.readout-bar {
  margin-top: 7px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.readout-item {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 5px 8px;
  min-width: 0;
}

.readout-label {
  display: block;
  font-size: 0.69rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.readout-item strong {
  display: block;
  font-size: 0.78rem;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.control-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.panel-group h2 {
  margin: 0 0 5px;
  font-size: 0.81rem;
  color: var(--accent-ice);
  letter-spacing: 0.01em;
}

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

.choice-btn {
  text-align: left;
  padding: 6px 8px;
  font-size: 0.75rem;
  background: #172338;
  color: #f1f5f9;
}

.choice-btn.active {
  background: var(--btn-blue);
  border-color: #7dd3fc;
  color: #ffffff;
}

.choice-btn.span-2 {
  grid-column: span 2;
  text-align: center;
}

.slider-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 68px;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.76rem;
}

.slider-row label {
  color: var(--text-muted);
  font-weight: 600;
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: #38bdf8;
}

.slider-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.74rem;
  padding: 2px 5px;
  border-radius: 5px;
  background: #172338;
  color: #f8fafc;
}

kbd, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  background: #1e293b;
  border: 1px solid #3b4f6b;
  border-radius: 4px;
  padding: 0 4px;
  color: #f8fafc;
}

.info-cards {
  max-width: 1120px;
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
}

.info-card h2 {
  margin: 0 0 5px;
  font-size: 0.92rem;
  color: #e0f2fe;
}

.info-card p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.site-footer {
  max-width: 1120px;
  margin: 12px auto 0;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.80rem;
  color: var(--text-muted);
}

.site-footer a {
  color: #7dd3fc;
  text-decoration: underline;
  font-weight: 600;
}

@media (max-width: 760px) {
  body {
    padding: 5px 7px 14px;
  }

  .top-header {
    margin-bottom: 5px;
  }

  .header-row {
    gap: 4px;
  }

  h1 {
    font-size: 0.94rem;
  }

  .badge-pill {
    font-size: 0.63rem;
    padding: 1px 6px;
  }

  .lede {
    font-size: 0.69rem;
    margin: 2px 0 4px;
    line-height: 1.24;
  }

  .action-strip {
    gap: 3px;
  }

  .action-strip button {
    font-size: 0.64rem;
    padding: 3px 6px;
    border-radius: 5px;
  }

  .studio-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

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

  .info-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}
