/* Kwaikwayo Trainers. Brand colours: docs/PROJECT.md (deep black, sky-blue accent, very light
   blue for selected items). No external assets (CSP: self only). */
:root {
  color-scheme: dark;
  --bg: #0A0A0A; --panel: #141414; --soft: #1C1C1C; --line: #262626; --ink: #F5F5F5; --muted: #A3A3A3;
  --brand: #38BDF8; --brand-ink: #0A0A0A; --brand-soft: #BAE6FD; --focus: #BAE6FD;
  --ok: #4ADE80; --ok-bg: #0F2A1A; --info: #38BDF8; --info-bg: #0C2230;
  --warn: #FBBF24; --warn-bg: #2A210B; --bad: #F87171; --bad-bg: #2E1212; --grey-bg: #1F1F1F;
  --radius: 12px; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex-shrink: 0; text-decoration: none; color: var(--ink); }
.brand-mark { display: block; }
.brand-name { font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.brand-tag { color: var(--brand); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.nav { display: flex; flex-wrap: wrap; gap: 2px 4px; flex: 1; min-width: 0; }
.nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a.active { background: var(--soft); color: var(--brand); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }

.main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 48px; }
.main:focus { outline: none; }
h1 { font-size: 24px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.accent { color: var(--brand); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { background: var(--brand-soft); border-color: var(--brand-soft); }
.btn.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.btn.danger { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.big { min-height: 54px; padding: 10px 24px; font-size: 18px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.selected { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand-ink); }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=file], input[type=date], input[type=search],
input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-height: 42px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; }
textarea { min-height: 140px; resize: vertical; line-height: 1.6; font-size: 16px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 14px; margin: 6px 0; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--brand); }

/* badges and notices */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--grey-bg); color: var(--muted); white-space: nowrap; }
.badge.sel { background: var(--brand-soft); color: var(--brand-ink); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--info-bg); color: var(--info); margin: 8px 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }

/* lists and tables */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--panel); }
.card { display: block; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card:hover { border-color: var(--brand); }
.card h2 { color: var(--brand); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.stat { font-size: 28px; font-weight: 700; color: var(--brand); }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--grey-bg); }
.bar span { display: block; height: 100%; background: var(--brand); }

/* sign-in */
.login { max-width: 440px; margin: 48px auto; }
.secret { font-family: var(--mono); font-size: 18px; letter-spacing: .08em; padding: 12px; background: var(--bg); border: 1px dashed var(--brand); border-radius: 8px; text-align: center; word-break: break-all; }
.code-input { font-family: var(--mono); font-size: 24px; letter-spacing: .3em; text-align: center; }
.temp-password { font-family: var(--mono); font-size: 20px; padding: 12px; background: var(--bg); border: 1px solid var(--brand); border-radius: 8px; text-align: center; }

/* dialog and toast */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; max-width: 600px; width: 100%; max-height: 90vh; overflow: auto; padding: 22px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; }
.toast.bad { background: var(--bad); color: #0A0A0A; }
.hidden { display: none !important; }

/* recording */
.prompt { font-size: 28px; line-height: 1.5; font-weight: 600; padding: 20px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; }
.prompt.small-prompt { font-size: 18px; padding: 10px 12px; }
.meter { height: 10px; background: var(--grey-bg); border-radius: 5px; overflow: hidden; margin: 10px 0; }
.meter span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .05s linear; }
.meter.hot span { background: var(--bad); }
audio { width: 100%; margin: 8px 0; color-scheme: dark; }
.score { display: flex; gap: 6px; flex-wrap: wrap; }
.score .btn { flex-direction: column; gap: 0; min-width: 88px; min-height: 60px; }
.score .btn strong { font-size: 22px; line-height: 1.1; }

/* learning pages */
.lesson { max-width: 760px; }
.lesson p, .lesson li { line-height: 1.7; }
.lesson ul, .lesson ol { padding-left: 22px; }
.lesson .tip { border-left: 3px solid var(--brand); padding: 6px 12px; background: var(--soft); border-radius: 0 8px 8px 0; }
.lesson .example { font-size: 18px; font-weight: 600; }

@media (max-width: 820px) {
  .prompt { font-size: 22px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .main { padding: 14px 12px 40px; }
  .btn { min-height: 44px; }
  .who .who-name { display: none; }
}
