:root {
  --bg: #0b0d10;
  --panel: rgba(22, 26, 32, 0.86);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f2f4f7;
  --muted: #9aa4b2;
  --accent: #5eead4;
  --accent-ink: #062a25;
  --warn: #fbbf24;
  --bad: #f87171;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

#preview {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

#preview.mirrored {
  transform: scaleX(-1);
}

.card-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(120% 80% at 50% 0%, #16212a 0%, var(--bg) 60%);
  text-align: center;
  overflow-y: auto;
}

.logo {
  width: 72px;
  height: 72px;
}

h1 {
  margin: 4px 0 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0;
  font-size: 17px;
}

.lead {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
}

.steps {
  max-width: 32ch;
  margin: 6px 0 10px;
  padding-left: 22px;
  color: var(--text);
  text-align: left;
}

.steps li {
  margin: 6px 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
}

.button.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

.button:active {
  transform: scale(0.98);
}

.quiet {
  color: var(--muted);
  font-size: 14px;
}

.error {
  max-width: 34ch;
  margin: 0;
  color: var(--bad);
}

#hud {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 13px;
  font-weight: 600;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--muted);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
}

.dot.live {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.18);
}

.dot.bad {
  background: var(--bad);
}

#controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.round {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
}

.round svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.round:active {
  transform: scale(0.94);
}

#mic[aria-pressed='true'] {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

#mic[aria-pressed='true'] .slash {
  display: none;
}

#sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  max-height: 82%;
  padding: 16px 18px max(18px, env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
}

@media (orientation: landscape) {
  #sheet {
    left: auto;
    top: 0;
    width: min(400px, 60%);
    max-height: none;
    border-radius: 22px 0 0 22px;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding-right: max(18px, env(safe-area-inset-right));
  }

  #controls {
    flex-direction: column;
    justify-content: center;
    top: 0;
    bottom: 0;
    left: auto;
    right: max(18px, env(safe-area-inset-right));
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.text-button {
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  border-top: 1px solid var(--line);
}

.row > span {
  flex: 1;
}

.row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

select {
  max-width: 58%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
}

input[type='range'] {
  width: 55%;
  accent-color: var(--accent);
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 50px;
  height: 30px;
  margin: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.15s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::after {
  transform: translateX(20px);
}

.actual {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

#dim {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  background: #000;
  color: #3a3f47;
  font-size: 14px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 76px);
  z-index: 8;
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 14px;
  text-align: center;
  transform: translateX(-50%);
}
