/* Revnosis. Calm glass over a dark workshop; amber is the one accent. */

:root {
  color-scheme: dark;
  --bg: #08090b;
  --bg-glow-1: rgba(255, 168, 38, 0.16);
  --bg-glow-2: rgba(64, 140, 255, 0.10);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(22, 25, 29, 0.62);
  --glass-line: rgba(255, 255, 255, 0.10);
  --glass-hi: rgba(255, 255, 255, 0.09);
  --field: rgba(255, 255, 255, 0.045);
  --field-line: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f1eee8;
  --muted: #9aa1a7;
  --accent: #ffb020;
  --accent-text: #ffbf47;
  --accent-ink: #1d1404;
  --accent-soft: rgba(255, 176, 32, 0.14);
  --red: #ff5a4d;
  --red-soft: rgba(255, 90, 77, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --plot-bg: #06080a;
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --col: 560px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #eef0f2;
    --bg-glow-1: rgba(255, 168, 38, 0.22);
    --bg-glow-2: rgba(64, 140, 255, 0.14);
    --glass: rgba(255, 255, 255, 0.58);
    --glass-strong: rgba(255, 255, 255, 0.68);
    --glass-line: rgba(255, 255, 255, 0.85);
    --glass-hi: rgba(255, 255, 255, 0.9);
    --field: rgba(255, 255, 255, 0.7);
    --field-line: rgba(20, 24, 28, 0.12);
    --line: rgba(20, 24, 28, 0.09);
    --text: #15181b;
    --muted: #5d656c;
    --accent-text: #a86500;
    --accent-soft: rgba(255, 176, 32, 0.18);
    --red: #d8382b;
    --red-soft: rgba(216, 56, 43, 0.10);
    --shadow: 0 10px 30px rgba(30, 40, 50, 0.10);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Soft colour behind everything, so the glass has something to bend. */
body::before {
  content: "";
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  background:
    radial-gradient(40vmax 34vmax at 18% 8%, var(--bg-glow-1), transparent 70%),
    radial-gradient(38vmax 32vmax at 92% 70%, var(--bg-glow-2), transparent 70%);
  pointer-events: none;
}

.phone { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- glass ---------- */

.top, .tabs, .card, .drop, .empty {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow);
}

/* ---------- header ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--glass-strong);
  border-width: 0 0 1px;
  box-shadow: inset 0 -1px 0 var(--line);
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
}
.top > * { max-width: var(--col); margin-left: auto; margin-right: auto; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand .mark {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #ffc65a, #ff9a0a);
  color: var(--accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 4px 12px rgba(255, 160, 20, 0.3);
}
.brand .mark svg { width: 24px; height: 24px; }
.brand .tag {
  font: 600 10px var(--mono);
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.who { display: flex; gap: 8px; margin-top: 10px; }
.roles {
  display: flex; flex: 1; padding: 3px; gap: 2px;
  background: var(--field);
  border: 1px solid var(--field-line);
  border-radius: 12px;
}
.roles button {
  flex: 1;
  background: none;
  color: var(--muted);
  border: 0;
  border-radius: 9px;
  padding: 6px 4px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.roles button:hover { color: var(--text); }
.roles button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 8px rgba(255, 160, 20, 0.25);
}
#name { width: 120px; flex: none; }
@media (max-width: 420px) { #name { width: 108px; padding-left: 10px; padding-right: 10px; } }

.banner { margin-top: 8px; margin-bottom: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.banner strong { color: var(--accent-text); font-weight: 600; }

/* ---------- content ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--col) + 32px);
  margin: 0 auto;
  padding: 20px 16px calc(110px + env(safe-area-inset-bottom));
  outline: none;
}
main.enter > * { animation: rise 0.42s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: 0.03s; }
main.enter > *:nth-child(3) { animation-delay: 0.06s; }
main.enter > *:nth-child(n + 4) { animation-delay: 0.09s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- tab bar: a floating pill ---------- */

.tabs {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 420px);
  display: flex;
  gap: 2px;
  padding: 5px;
  border-radius: 24px;
  background: var(--glass-strong);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 12px 40px rgba(0, 0, 0, 0.35);
}
.tabs button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none;
  border: 0;
  border-radius: 19px;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 7px 0 6px;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.tabs svg { width: 22px; height: 22px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); }

/* ---------- type ---------- */

h1 { font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; margin: 4px 0 6px; text-wrap: balance; }
h2 { font-size: 15px; letter-spacing: -0.01em; margin: 26px 0 8px; }
h3 { font-size: 15px; margin: 0 0 4px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- fields and buttons ---------- */

input[type="text"], textarea, select {
  width: 100%;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--field-line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
::placeholder { color: var(--muted); opacity: 0.75; }
textarea { min-height: 72px; resize: vertical; }
label.field { display: block; margin: 12px 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }
label.field > * { margin-top: 5px; }
label.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; margin: 12px 0; }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-block;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--field-line);
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: transform 0.15s var(--ease), background 0.2s, box-shadow 0.2s;
}
.btn:hover:not(:disabled) { background: var(--glass); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn.primary {
  background: linear-gradient(180deg, #ffc04a, var(--accent));
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 6px 18px rgba(255, 160, 20, 0.25);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffc95f, #ffb52e); }
.btn.wide { display: block; width: 100%; margin-top: 10px; text-align: center; }
.btn:disabled { opacity: 0.45; cursor: default; }

.card { border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.card > :last-child { margin-bottom: 0; }

/* ---------- record ---------- */

.rec-wrap { display: flex; flex-direction: column; align-items: center; margin: 26px 0 20px; }
.rec {
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.45), transparent 46%),
    linear-gradient(180deg, #ffc65a, #ff9800);
  color: var(--accent-ink);
  font: 600 15px system-ui, -apple-system, sans-serif;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer;
  box-shadow:
    inset 0 -6px 16px rgba(160, 80, 0, 0.35),
    0 0 0 10px var(--accent-soft),
    0 18px 40px rgba(255, 150, 10, 0.28);
  transition: transform 0.2s var(--ease), box-shadow 0.3s var(--ease);
}
.rec svg { width: 34px; height: 34px; }
.rec:hover:not(:disabled) { transform: scale(1.03); }
.rec:active:not(:disabled) { transform: scale(0.97); }
.rec.live {
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.4), transparent 46%),
    linear-gradient(180deg, #ff7a6e, #e8392c);
  color: #fff;
  box-shadow: inset 0 -6px 16px rgba(120, 10, 0, 0.35), 0 0 0 10px var(--red-soft), 0 18px 40px rgba(255, 60, 40, 0.28);
}
.rec.live::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--red);
  animation: pulse 1.6s var(--ease) infinite;
  pointer-events: none;
}
@keyframes pulse { from { opacity: 0.7; transform: scale(1); } to { opacity: 0; transform: scale(1.22); } }
.rec:disabled { cursor: default; }
.timer { font: 500 30px var(--mono); margin-top: 18px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.drop {
  border-radius: var(--radius);
  border-style: dashed;
  border-color: var(--field-line);
  box-shadow: none;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  transition: border-color 0.2s, background 0.2s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop button { background: none; border: 0; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.drop button:hover { text-decoration: underline; }

/* The spectrogram stays dark in both themes: it is data, not decoration. */
canvas { display: block; width: 100%; border-radius: 14px; background: var(--plot-bg); border: 1px solid var(--line); }
canvas.wave { height: 70px; margin: 14px 0 8px; }
canvas.spec { height: 150px; }
.axis { display: flex; justify-content: space-between; gap: 10px; font: 11px var(--mono); color: var(--muted); margin: 5px 4px 0; }

audio { width: 100%; height: 40px; margin-top: 10px; border-radius: 999px; }

/* ---------- answer ---------- */

.answer h1 { margin-top: 0; }
.eyebrow { font: 600 11px var(--mono); color: var(--accent-text); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 8px; }
.match { margin: 14px 0; }
.match .row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 500; }
.match .bar { height: 8px; background: var(--field); border-radius: 999px; margin-top: 6px; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.match .bar i {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, #ff9800, #ffc65a);
  border-radius: 999px;
  animation: grow 0.7s var(--ease) both;
  transform-origin: left;
}
@keyframes grow { from { transform: scaleX(0); } }
.match.dim .bar i { background: var(--muted); opacity: 0.6; }
.match .cut { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: 0.45; }
.safety {
  border: 1px solid var(--red);
  background: var(--red-soft);
  color: var(--red);
  padding: 10px 13px;
  border-radius: 12px;
  font-weight: 600;
  margin: 14px 0;
}
.note { border-left: 2px solid var(--field-line); padding: 2px 0 2px 12px; color: var(--muted); font-size: 13px; }
.ok-msg { color: var(--accent-text); font-size: 13px; margin-top: 10px; overflow-wrap: anywhere; }
.err-msg { color: var(--red); font-size: 13px; margin-top: 10px; }

details { margin: 12px 0; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; padding: 4px 0; list-style-position: outside; }
summary:hover { color: var(--text); }
details[open] > :not(summary) { animation: rise 0.3s var(--ease) both; }

/* ---------- lists ---------- */

.chip {
  display: inline-block; flex: none;
  font: 600 10px var(--mono);
  background: var(--field);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  vertical-align: 1px;
}
.chip.on { color: var(--accent-text); background: var(--accent-soft); }
.chip.red { color: var(--red); background: var(--red-soft); }
.meta { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.meta b { color: var(--text); font-weight: 500; }
.clip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.inline { display: flex; gap: 8px; margin-top: 10px; }
.inline select { flex: 1; min-width: 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

pre.out { background: var(--plot-bg); color: #e9e6df; border: 1px solid var(--line); border-radius: 14px; padding: 14px; font: 12.5px/1.6 var(--mono); white-space: pre-wrap; margin: 12px 0 0; }

.empty { text-align: center; color: var(--muted); padding: 30px 14px; border-radius: var(--radius); border-style: dashed; border-color: var(--field-line); box-shadow: none; margin: 14px 0; }

/* ---------- motion and wide screens ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (min-width: 720px) {
  main { padding-top: 32px; }
  h1 { font-size: 30px; }
}
