:root {
  color-scheme: dark;
  --bg: #0d1012;
  --panel: #181c20;
  --panel-strong: #232a30;
  --text: #f4f7fb;
  --muted: #a9b4c2;
  --line: #37414a;
  --accent: #7bd8c8;
  --accent-2: #f4c96b;
  --accent-3: #f08f73;
  --accent-4: #9ec7ff;
  --warn: #ffb36b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, #0d1012 0%, #171d21 48%, #111517 100%);
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  width: calc(100vw - 16px);
  height: calc(100vh - 16px);
  min-height: 620px;
  margin: 8px auto;
}

.stage {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.3);
}

.camera-frame {
  position: relative;
  width: min(100%, calc((100vh - 150px) * var(--camera-ratio, 1.7778)));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--camera-aspect, 16 / 9);
  overflow: hidden;
  border-radius: 8px;
  background: #050607;
}

video,
.tracking-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

video {
  object-fit: contain;
  opacity: 0;
}

.tracking-canvas {
  z-index: 1;
  background: #050607;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: stretch;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 28, 32, 0.95);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #111517 0 8px, transparent 9px),
    conic-gradient(from 34deg, var(--accent), var(--accent-4), var(--accent-2), var(--accent-3), var(--accent));
}

.brand h1,
.brand p,
.status,
.size-status,
.calibration-status,
.note-readout p {
  margin: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 760;
  text-transform: uppercase;
}

.brand h1 {
  font-size: 1.35rem;
  line-height: 1.05;
}

.status,
.size-status,
.calibration-status,
.note-readout,
.voice-panel,
.tone-panel {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-strong);
  line-height: 1.38;
}

.status.is-warning {
  border-color: rgba(255, 179, 107, 0.58);
  color: var(--warn);
}

.info-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 0.8fr) minmax(0, 1.25fr) minmax(0, 1.25fr);
  gap: 10px;
  min-height: 92px;
}

.info-strip .status,
.info-strip .size-status,
.info-strip .calibration-status,
.info-strip .note-readout {
  min-width: 0;
}

.info-strip .status,
.info-strip .size-status,
.info-strip .calibration-status {
  display: flex;
  align-items: center;
}

.info-strip .readout-main {
  font-size: 1.28rem;
}

.toggle-stack {
  display: grid;
  gap: 10px;
}

button {
  min-height: 46px;
  border: 1px solid rgba(123, 216, 200, 0.48);
  border-radius: 8px;
  color: #06100e;
  background: var(--accent);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #a4f0df;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

button[aria-pressed="false"] {
  color: var(--text);
  background: transparent;
}

.readout-label {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 760;
  text-transform: uppercase;
}

.readout-main {
  padding-top: 3px;
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 760;
  line-height: 1.08;
}

.readout-sub {
  padding-top: 4px;
  color: var(--muted);
}

.tone-panel,
.voice-panel {
  display: grid;
  gap: 12px;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.panel-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.voice-hand-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.voice-hand-group {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.voice-hand-group legend {
  margin-bottom: 2px;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 760;
}

.voice-check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 28px;
  color: var(--text);
  font-size: 0.84rem;
  cursor: pointer;
}

.voice-check-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.voice-check-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-row,
.slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
  color: var(--text);
  font-size: 0.86rem;
}

.select-row select {
  min-width: 118px;
  padding: 7px 9px;
  border: 1px solid rgba(123, 216, 200, 0.38);
  border-radius: 8px;
  color: var(--text);
  background: #11171a;
  font: inherit;
}

.slider-row output {
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

.slider-row input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--accent);
}

.cell-trim-row strong {
  color: var(--accent-4);
  font-weight: 760;
}

.secondary-button {
  min-height: 38px;
  color: var(--text);
  background: transparent;
  border-color: rgba(244, 247, 251, 0.24);
}

.secondary-button:hover:not(:disabled) {
  background: rgba(244, 247, 251, 0.08);
}

.song-panel {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.copyright-notice {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

@media (max-width: 840px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    min-height: calc(100vh - 12px);
    width: calc(100vw - 12px);
    margin: 6px auto;
  }

  .stage {
    min-height: 62vh;
  }

  .info-strip {
    grid-template-columns: 1fr;
  }
}
