/* No web fonts, no external anything: system stack only. */
:root {
  --bg: #fbfaf8;
  --fg: #1d1c1a;
  --muted: #5e5a54;
  --line: #ddd8d0;
  --accent: #2f5d8a;
  --accent-fg: #fff;
  --warn-bg: #fdf3e0;
  --warn-line: #d9b779;
  --error: #9b2c1e;
  --ok: #2e6b4f;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --fg: #eceae6;
    --muted: #a7a29a;
    --line: #35373a;
    --accent: #7fb0e0;
    --accent-fg: #10243a;
    --warn-bg: #332b1b;
    --warn-line: #7a6435;
    --error: #e59184;
    --ok: #7ec79d;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#main {
  max-width: 38rem;
  margin: 0 auto;
  padding: 1.5rem 16px 4rem;
}

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .6rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .4rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .3rem; }
p { margin: 0 0 .9rem; }
.pad { padding: 1.5rem; }

.hint { color: var(--muted); font-size: .92rem; }
.error { color: var(--error); font-weight: 500; }
.progress { color: var(--muted); font-size: .85rem; text-transform: uppercase;
            letter-spacing: .06em; margin-bottom: .3rem; }

/* ---- forms ---- */
label { display: block; font-weight: 600; margin: 1.1rem 0 .3rem; }
input[type="text"], select {
  width: 100%;
  padding: .7rem .6rem;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
input[type="text"]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#gate-code { text-transform: uppercase; letter-spacing: .12em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
label.check input { margin-top: .35rem; width: 1.15rem; height: 1.15rem; flex: none; }

button {
  font: inherit;
  font-weight: 600;
  padding: .75rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  margin-top: 1.1rem;
}
button.primary { background: var(--accent); color: var(--accent-fg); }
button.secondary { background: transparent; color: var(--fg); border-color: var(--line); }
button.big { font-size: 1.2rem; padding: 1rem 1.6rem; width: 100%; }
button:disabled { opacity: .5; cursor: default; }
button.danger { background: transparent; color: var(--error); border-color: var(--error);
                padding: .45rem .8rem; font-size: .88rem; margin: 0; }

.row { display: flex; gap: .8rem; flex-wrap: wrap; }
.row button { flex: 1 1 12rem; }

/* ---- banners ---- */
.banner {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: var(--radius);
  padding: .8rem .9rem;
  margin: 1.1rem 0;
  font-size: .95rem;
}
.banner.warn { background: var(--warn-bg); border-left-color: var(--warn-line); }
.banner.bad  { background: color-mix(in srgb, var(--error) 10%, transparent);
               border-left-color: var(--error); }

/* ---- consent prose ---- */
.prose { border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.prose h1 { font-size: 1.5rem; }
.prose ul { padding-left: 1.3rem; }
.prose li { margin-bottom: .3rem; }

.codes { margin: 1.2rem 0; }
.codes dt { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.codes dd { margin: .1rem 0 1rem; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 1.35rem; letter-spacing: .08em; user-select: all; }

ol.setup { padding-left: 1.4rem; }
ol.setup li { margin-bottom: .7rem; }

/* ---- level meter ---- */
.meter {
  height: 14px;
  background: color-mix(in srgb, var(--fg) 9%, transparent);
  border-radius: 999px;
  overflow: hidden;
  margin: .5rem 0;
}
.meter-fill { height: 100%; width: 0%; background: var(--ok); transition: width .05s linear; }
.meter-fill.hot { background: var(--error); }
.big-meter { height: 26px; }

/* ---- the take screen: readable from five metres ---- */
.step.take { text-align: center; }
.phase {
  font-size: clamp(2rem, 11vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.05;
  margin: .8rem 0 .2rem;
  text-transform: uppercase;
}
.phase.speak { color: var(--ok); }
.phase.listen { color: var(--muted); }
.count {
  font-size: clamp(5rem, 34vw, 13rem);
  font-weight: 800;
  line-height: .95;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.step.take .hint { font-size: 1.05rem; min-height: 1.6em; }
.step.take button { margin-top: 2rem; }

/* ---- clip review ---- */
ul.clips { list-style: none; padding: 0; margin: 1rem 0; }
ul.clips li {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .2rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
ul.clips li.deleted { opacity: .45; }
ul.clips li.deleted .clip-text { text-decoration: line-through; }
.clip-main { flex: 1 1 11rem; min-width: 0; }
.clip-text { font-weight: 600; }
.clip-meta { color: var(--muted); font-size: .82rem; }
.clip-flag { color: var(--error); font-size: .82rem; }
ul.clips audio { height: 34px; flex: 1 1 13rem; max-width: 100%; }
ul.clips button { margin: 0; }
