/* Styles specific to the Level 4 demos. Shared demo chrome is in ../demos.css */

.controls { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .9rem; }

.btn {
  padding: .55rem 1rem; min-height: 40px;
  font-size: .88rem; font-weight: 650;
  border: 1px solid var(--accent); border-radius: 99px;
  background: transparent; color: var(--accent); cursor: pointer;
}
.btn:hover { background: var(--accent-soft); }
.btn.solid { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
@media (prefers-color-scheme: dark) { .btn.solid { color: #14201a; } }
@media (pointer: coarse) { .btn { min-height: 44px; } }

.hint { font-size: .8rem; color: var(--muted); text-align: center; margin: .6rem 0 0; }

.readout {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .82rem; color: var(--muted);
  text-align: center; margin-top: .5rem; min-height: 1.2em;
}

/* A demo that needs your permission shows this until you say yes */
.permission {
  text-align: center; max-width: 300px;
  font-size: .9rem; color: var(--muted);
}
.permission .why {
  display: block; margin-top: .5rem; font-size: .84rem;
}
.unsupported { color: var(--warn); font-weight: 650; }

.stage canvas { max-width: 100%; }

/* 3 — camera */
#cam-out { border-radius: 10px; background: #000; }
video.hidden { display: none; }

/* 4 — pitch */
.note-big {
  font-size: clamp(2.4rem, 12vw, 3.6rem);
  font-weight: 800; color: var(--accent);
  line-height: 1; min-height: 1.1em;
  font-variant-numeric: tabular-nums;
}
.tuner {
  width: 100%; max-width: 300px; height: 10px;
  background: var(--line); border-radius: 99px;
  position: relative; margin-top: .8rem; overflow: hidden;
}
.tuner i {
  position: absolute; top: 0; bottom: 0; width: 4px;
  background: var(--accent); left: 50%; transform: translateX(-50%);
  transition: left .08s linear;
}
.tuner::after {
  content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px;
  width: 1px; background: var(--muted); opacity: .6;
}

/* 5 — speech */
.speech-out {
  min-height: 3.4em; max-width: 320px; text-align: center;
  font-size: 1.05rem; line-height: 1.5;
}
.speech-out .interim { opacity: .45; }

/* 6 — tilt */
.tilt-ball-box {
  width: 100%; max-width: 260px; aspect-ratio: 4/3;
  border: 2px solid var(--line); border-radius: 12px;
  position: relative; overflow: hidden; background: var(--bg);
}
.tilt-ball {
  position: absolute; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); left: 0; top: 0;
}

/* 7 — workers */
.race { width: 100%; max-width: 320px; display: grid; gap: .7rem; }
.lane-label { font-size: .82rem; font-weight: 650; margin-bottom: .25rem; }
.lane {
  height: 18px; background: var(--line); border-radius: 99px; overflow: hidden;
}
.lane i {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: 99px;
  transition: width .1s linear;
}
.lane.worker i { background: #2f6fb0; }
@media (prefers-color-scheme: dark) { .lane.worker i { background: #7fb6ec; } }

/* 9 — terrain */
#terrain { border-radius: 10px; }

/* 10 — handwriting */
.hw-wrap { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; align-items: center; }
#hw {
  background: #14100c; border-radius: 10px; touch-action: none; cursor: crosshair;
}
.hw-guess {
  font-size: 3.2rem; font-weight: 800; color: var(--accent);
  min-width: 2ch; text-align: center; line-height: 1;
}
.digit-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; max-width: 260px; }
.digit-keys button {
  min-height: 38px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer;
}
.digit-keys button:hover { border-color: var(--accent); color: var(--accent); }

/* Microphone level meter for the speech demo — proof the mic is live
   even before any words have been recognised. */
.mic-meter {
  width: 100%; max-width: 300px; height: 8px;
  background: var(--line); border-radius: 99px;
  overflow: hidden; margin-top: .9rem;
}
.mic-meter i {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: 99px;
  transition: width .06s linear;
}
