/* NiCE brand: charcoal ground, NiCE blue accent, warm white for panels only.
   Be Vietnam Pro — SemiBold headings, Light body, Medium labels. */
@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600&display=swap");

:root {
  --charcoal: #21212b;
  --charcoal-lift: #2a2a36;
  --white: #ffffff;
  --warm: #f2f0eb;
  --blue: #3694fc;
  --electric: #025afb;
  --blue-link: #90b6fd;
  --blue-tint: #a7d0fe;
  --emerald: #00e2a0;
  --emerald-soft: #9ceed2;
  --coral: #ff5b8a;
  --coral-soft: #f3b1c4;
  --muted: #b4b4c0;
  --line: #3a3a48;
  --radius: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--charcoal);
  color: var(--white);
  font: 300 17px/1.55 "Be Vietnam Pro", Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 32px 20px 96px; }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 5vw, 2.5rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 12px 0; max-width: 62ch; }
a { color: var(--blue-link); }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(135deg, var(--blue), var(--electric));
  display: grid; place-items: center; flex: none;
}
.brand-mark::after { content: ""; width: 15px; height: 8px; border-bottom: 3px solid #fff; border-radius: 0 0 12px 12px; }
.brand-name { font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: 0.82rem; font-weight: 300; }

.label {
  font-weight: 500; font-size: 0.72rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--blue-tint);
}

.lede { font-size: 1.08rem; color: var(--muted); }

.panel {
  background: var(--warm); color: var(--charcoal);
  border-radius: var(--radius); padding: 24px; margin: 20px 0;
}
.panel h2, .panel h3 { color: var(--charcoal); }
.panel p { color: #43434f; }

.card {
  background: var(--charcoal-lift); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin: 18px 0;
}

/* Buttons are full pills, per brand */
.btn {
  font: 500 16px/1 "Be Vietnam Pro", Arial, sans-serif;
  border: none; border-radius: 999px; padding: 15px 28px;
  background: var(--blue); color: var(--charcoal); cursor: pointer;
  transition: filter 0.15s, transform 0.06s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--white); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--blue); }
.btn.rec { background: var(--coral); color: var(--charcoal); }
.btn.big { padding: 19px 40px; font-size: 1.05rem; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 3px;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1 1 auto; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field span { font-weight: 500; font-size: 0.85rem; color: var(--muted); }
input[type="text"], input[type="password"], select {
  font: 300 16px "Be Vietnam Pro", Arial, sans-serif;
  padding: 13px 15px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--charcoal); color: var(--white);
}
.check { display: flex; gap: 11px; align-items: flex-start; margin: 12px 0; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
.check span { font-size: 0.95rem; }

/* The sentence to read — the one thing that must be readable at arm's length */
.prompt {
  font-size: clamp(1.5rem, 4.6vw, 2.1rem); font-weight: 400; line-height: 1.28;
  color: var(--charcoal); margin: 6px 0 10px; text-wrap: balance;
}
.say {
  font-weight: 500; font-size: 0.92rem; color: var(--electric);
  background: #fff; border-radius: 999px; padding: 7px 15px; display: inline-block;
}

.meter { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 18px 0 6px; }
.meter i { display: block; height: 100%; width: 0%; background: var(--emerald); transition: width 0.07s linear; }
.meter.hot i { background: var(--coral); }
.meterhint { font-size: 0.82rem; color: var(--muted); min-height: 1.2em; margin: 0; }

.progress { display: flex; align-items: center; gap: 12px; margin: 22px 0 6px; }
.bar { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--blue), var(--electric)); transition: width 0.3s; }
.count { font-weight: 500; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }

.pill {
  display: inline-block; border-radius: 999px; padding: 5px 13px;
  font-weight: 500; font-size: 0.76rem; letter-spacing: 0.02em;
}
.pill.good { background: var(--emerald-soft); color: var(--charcoal); }
.pill.warn { background: var(--coral-soft); color: var(--charcoal); }
.pill.info { background: var(--blue-tint); color: var(--charcoal); }

.steps { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 13px; align-items: flex-start; }
.steps b {
  flex: none; width: 25px; height: 25px; border-radius: 9px; background: var(--blue);
  color: var(--charcoal); display: grid; place-items: center; font-size: 0.82rem; font-weight: 600;
}

.muted { color: var(--muted); font-size: 0.9rem; }
.err { background: var(--coral-soft); color: var(--charcoal); border-radius: 14px; padding: 13px 17px; margin: 14px 0; font-size: 0.93rem; }
.hidden { display: none !important; }

audio { width: 100%; margin-top: 14px; }

details.legal { margin: 14px 0; }
details.legal summary { cursor: pointer; font-weight: 500; color: var(--blue-link); font-size: 0.92rem; }
details.legal .panel { margin-top: 12px; }
details.legal li { color: #43434f; font-size: 0.93rem; margin: 6px 0; }

.signoff { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--blue); font-weight: 600; font-size: 0.95rem; }

/* Gate screen */
.gate { min-height: 82vh; display: grid; place-items: center; }
.gate .card { max-width: 420px; width: 100%; }

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

/* Milestone line under the progress bar — quiet, never shouty */
.milestone {
  margin: 2px 0 0; min-height: 1.3em;
  font-size: 0.86rem; font-weight: 400; color: var(--blue-tint);
}

/* Aggregate spread of contributors by region, shown after taking part */
.spread { display: grid; gap: 7px; margin-top: 10px; }
.spreadrow {
  display: grid; grid-template-columns: minmax(96px, 34%) 1fr auto;
  align-items: center; gap: 11px; font-size: 0.88rem; color: var(--charcoal);
}
.spreadrow i {
  height: 9px; border-radius: 999px; display: block;
  background: linear-gradient(90deg, var(--blue), var(--electric)); min-width: 4px;
}
.spreadrow b { font-weight: 500; font-variant-numeric: tabular-nums; color: #43434f; }

/* Target band: -26 to -2 dBFS on a -60..0 scale, i.e. 57%-97% across. Set from the
   measured peak-hold envelope of real speech (median -17.5 dBFS), not from clip peaks. */
.meter { position: relative; }
.meter::before {
  content: ""; position: absolute; inset: 0 3% 0 57%;
  background: rgba(0, 226, 160, 0.16);
  border-left: 1px solid rgba(0, 226, 160, 0.55);
  border-right: 1px solid rgba(255, 91, 138, 0.55);
  pointer-events: none;
}
.meter i { position: relative; z-index: 1; }

/* Voice spectrum. Log-spaced bars over a shaded 300-3400 Hz telephony band. */
.scope {
  position: relative; height: 96px; margin: 4px 0 14px;
  background: #1b1b24; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
}
.scope.slim { height: 56px; margin-bottom: 10px; }
.scope-tag { transition: opacity 0.2s; }
.scope canvas { display: block; width: 100%; height: 100%; }
.scope-tag {
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  font-size: 0.66rem; font-weight: 500; letter-spacing: 0.05em;
  color: var(--blue-tint); background: rgba(27, 27, 36, 0.72);
  padding: 2px 9px; border-radius: 999px; pointer-events: none; white-space: nowrap;
}
.scope-axis {
  position: absolute; inset: auto 10px 4px 10px; display: flex;
  justify-content: space-between; pointer-events: none;
  font-size: 0.62rem; font-weight: 500; color: rgba(180, 180, 192, 0.6);
}
@media (max-width: 430px) { .scope-tag { font-size: 0.6rem; } }
.meterhint.status { color: var(--white); font-weight: 400; margin-top: 2px; }

/* Full quality / phone quality switch above the player */
.seg { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.seg-btn {
  font: 500 13px/1 "Be Vietnam Pro", Arial, sans-serif;
  padding: 9px 15px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--muted); border: 1.5px solid var(--line);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.seg-btn:hover { border-color: var(--blue); color: var(--white); }
.seg-btn.on { background: var(--blue); color: var(--charcoal); border-color: var(--blue); }
.seg-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.seg-note { font-size: 0.8rem; color: var(--muted); }
