:root {
  color-scheme: light;
  --brand: #3884c4; --brand-dark: #357ab2; --brand-deeper: #2f6c9e; --brand-soft: #eef3fb; --brand-mid: #b9d3ea;
  --ink: #2b3440; --muted: #5d6b7a; --line: #dfe5ec; --panel: #f4f7fb; --card: #ffffff; --accent: #ff6b05;
  --good: #2e7d4f; --good-bg: #e7f4ec; --bad: #d23f3d; --bad-bg: #fdeceb; --warn-bg: #fff6e5;
  --track: #e1e8f0; --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--panel); color: var(--ink); font: 16px/1.6 'Inter', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 24px; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 20; }
.topbar .logo { height: 30px; width: auto; display: block; flex: none; }
.topbar .right { display: flex; align-items: center; gap: 12px; }
.views { display: inline-flex; border: 1px solid #c9d6e3; border-radius: 99px; overflow: hidden; }
.views button { border: 0; background: #fff; color: var(--ink); padding: 6px 14px; cursor: pointer; font-size: .88rem; white-space: nowrap; }
.views button + button { border-left: 1px solid #c9d6e3; }
.views button.on { background: var(--brand); color: #fff; }
.saved { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px 11px; white-space: nowrap; transition: background .2s, color .2s; }
.saved .dot { width: 8px; height: 8px; border-radius: 50%; background: #b6c2cf; }
.saved.saving { color: var(--brand-dark); background: var(--brand-soft); border-color: var(--brand-mid); }
.saved.saving .dot { background: var(--brand); animation: pulse .6s infinite alternate; }
.saved.ok { color: var(--good); background: var(--good-bg); border-color: #bfe0cb; }
.saved.ok .dot { background: var(--good); }
@keyframes pulse { to { opacity: .3; } }

.steps { background: #fff; border-bottom: 1px solid var(--line); }
.steps ol { list-style: none; margin: 0 auto; padding: 10px 24px; max-width: 920px; display: flex; gap: 4px; align-items: center; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); min-width: 0; }
.steps li .n { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 600; background: var(--track); color: var(--muted); }
.steps li.done .n { background: var(--brand-mid); color: var(--brand-deeper); }
.steps li.cur .n { background: var(--brand); color: #fff; }
.steps li.cur { color: var(--ink); font-weight: 600; }
.steps li .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps .ctx { max-width: 920px; margin: 0 auto; padding: 0 24px 8px; font-size: .82rem; color: var(--brand-dark); font-weight: 600; }

.wrap { max-width: 920px; margin: 0 auto; padding: 28px 24px 120px; }
.sheet { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 40px; box-shadow: 0 1px 3px rgba(43, 52, 64, .06); }
.kicker { color: var(--brand); font-weight: 600; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
h1 { margin: 4px 0 10px; font-size: 32px; line-height: 1.2; color: var(--brand); letter-spacing: -.01em; }
h2 { color: var(--brand-dark); font-size: 22px; line-height: 1.25; margin: 34px 0 10px; }
h2.first { margin-top: 6px; }
h3 { font-size: 17px; margin: 18px 0 6px; }
p { margin: 8px 0 14px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
ul.plain { padding-left: 20px; margin: 8px 0 18px; }
ul.plain li { margin: 6px 0; }
.note { background: var(--warn-bg); border-left: 4px solid var(--accent); border-radius: 6px; padding: 10px 14px; margin: 14px 0; color: #6b4300; font-size: .92rem; }
.info { background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 6px; padding: 10px 14px; margin: 14px 0; font-size: .92rem; }

.btn { border: 0; background: var(--brand); color: #fff; font-weight: 600; border-radius: 99px; padding: 13px 26px; cursor: pointer; font-size: 1rem; min-height: 48px; transition: background .15s, opacity .15s; }
.btn:hover:not(:disabled) { background: var(--brand-deeper); }
.btn:disabled { background: #b6c2cf; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand-dark); border: 1px solid #c9d6e3; }
.btn.ghost:hover:not(:disabled) { background: var(--brand-soft); }
.btn.small { padding: 7px 14px; min-height: 0; font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; align-items: center; }
.linkbtn { border: 0; background: none; color: var(--brand-dark); cursor: pointer; padding: 6px 0; font-weight: 500; text-decoration: underline; }
.lockhint { font-size: .86rem; color: var(--muted); }

input[type=text], input[type=password] { font: inherit; width: 100%; max-width: 420px; padding: 11px 14px; border: 1px solid #c9d6e3; border-radius: 8px; background: #fff; color: var(--ink); }
input[type=text]:focus, input[type=password]:focus { outline: 2px solid var(--brand-mid); border-color: var(--brand); }
label.lbl { display: block; font-weight: 600; margin: 18px 0 6px; }

.langrow { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0; background: #fff; }
.langrow.on { border-color: var(--brand); background: #fbfdff; }
.langrow .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.langrow .pick { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; min-height: 32px; }
.langrow .pick input { width: 20px; height: 20px; accent-color: var(--brand); }
.langrow .sub { font-size: .86rem; color: var(--muted); margin: 6px 0 0 30px; }
.langrow .sub.lock { color: #6b4300; }
.langrow .sub.ok { color: var(--good); }
.seg { display: inline-flex; border: 1px solid #c9d6e3; border-radius: 99px; overflow: hidden; }
.seg button { border: 0; background: #fff; color: var(--ink); padding: 6px 14px; cursor: pointer; font-size: .88rem; min-height: 36px; }
.seg button + button { border-left: 1px solid #c9d6e3; }
.seg button.on { background: var(--brand); color: #fff; }

.roundhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.count { font-weight: 600; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.pbar { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 8px 0 22px; }
.pbar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s; }
.word { text-align: center; margin: 4px 0 20px; }
.word .w { font-size: 40px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.word .g { color: var(--muted); font-size: .95rem; }
.sentence { text-align: center; margin: 4px 0 20px; }
.sentence .w { font-size: 22px; font-weight: 600; line-height: 1.35; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.clipcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.clip { display: flex; align-items: center; gap: 14px; }
.play { width: 64px; height: 64px; flex: none; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .1s; padding: 0; box-shadow: 0 2px 6px rgba(56, 132, 196, .3); }
.play:hover { background: var(--brand-deeper); }
.play:active { transform: scale(.95); }
.play svg { width: 26px; height: 26px; }
.clip.done .play { background: var(--brand-dark); }
.clip-body { flex: 1; min-width: 0; }
.clip-label { font-weight: 700; font-size: 1.15rem; }
.bar { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.bar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; }
.clip-state { font-size: .82rem; color: var(--muted); }
.clip.done .clip-state { color: var(--good); font-weight: 500; }
.tags { margin-top: 12px; }
.tags .h { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
button.chip { font-size: .84rem; border: 1px solid #c9d6e3; background: #fff; color: var(--ink); border-radius: 99px; padding: 6px 12px; cursor: pointer; min-height: 34px; }
button.chip:hover { border-color: var(--brand); background: var(--brand-soft); }
button.chip.on { background: var(--bad-bg); border-color: #f0b4b2; color: var(--bad); font-weight: 600; }

.vote { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; margin-top: 18px; }
.vote .btn { width: 100%; }
.vote .btn.same { background: #fff; color: var(--ink); border: 1px solid #c9d6e3; }
.vote .btn.same:hover:not(:disabled) { background: var(--brand-soft); }
.vote .btn.same:disabled { background: #f0f3f6; color: #9aa6b2; }

.scale { margin: 18px 0 6px; }
.scale .q { font-weight: 600; margin-bottom: 8px; }
.scale .row { display: flex; gap: 8px; }
.scale .row button { flex: 1; min-height: 50px; border: 1px solid #c9d6e3; background: #fff; border-radius: 10px; font-weight: 600; font-size: 1.05rem; cursor: pointer; color: var(--ink); }
.scale .row button:hover { background: var(--brand-soft); border-color: var(--brand); }
.scale .row button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.scale .ends { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 4px; }

.favs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fav { background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 14px; }
.fav.on { border-color: var(--brand); background: var(--brand-soft); }
.fav .pickbtn { width: 100%; margin-top: 12px; }

.summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 10px 0; background: #fff; }
.summary b { color: var(--brand-dark); }
.resume { background: var(--good-bg); border-left: 4px solid var(--good); border-radius: 6px; padding: 10px 14px; margin: 0 0 16px; font-size: .92rem; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0 16px; }
table { border-collapse: collapse; width: 100%; background: var(--card); font-size: .9rem; }
th, td { text-align: left; padding: 9px 11px; vertical-align: middle; }
thead th { background: var(--brand); color: #fff; font-weight: 600; font-size: .84rem; white-space: nowrap; }
td { border-top: 1px solid var(--line); }
tbody tr:nth-child(even) td { background: #fafcfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { display: block; color: var(--muted); font-size: .78rem; }
.mini { display: inline-block; vertical-align: middle; width: 60px; height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; margin-left: 6px; }
.mini i { display: block; height: 100%; background: var(--brand); }
.range { position: relative; height: 10px; width: 120px; margin-top: 4px; background: var(--track); border-radius: 99px; }
.range i { position: absolute; top: 0; bottom: 0; background: var(--brand-mid); border-radius: 99px; }
.range b { position: absolute; top: -2px; width: 4px; height: 14px; margin-left: -2px; background: var(--brand-deeper); border-radius: 2px; }
.pill { display: inline-block; font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.pill.good { color: var(--good); background: var(--good-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }
.pill.base { color: var(--brand-dark); background: var(--brand-soft); }
.pill.wait { color: var(--muted); background: var(--panel); }
table.heat td.cell { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; border-left: 1px solid #fff; }
table.heat th { text-align: center; }
table.heat th:first-child, table.heat td:first-child { text-align: left; }
.legend { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.legend .grad { width: 140px; height: 10px; border-radius: 99px; background: linear-gradient(to right, rgba(56,132,196,.04), rgba(56,132,196,1)); border: 1px solid var(--line); }
.langtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.langtabs button { border: 1px solid #c9d6e3; background: #fff; border-radius: 99px; padding: 6px 14px; cursor: pointer; font-size: .9rem; color: var(--ink); }
.langtabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.lead { border: 1px solid var(--brand); background: var(--brand-soft); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.reshead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

.howbtn { position: fixed; right: 16px; bottom: 16px; z-index: 40; border: 2px dashed var(--accent); background: #fff8f1; color: #8a4a00; border-radius: 99px; padding: 10px 16px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 16px rgba(43, 52, 64, .15); }
.howbtn small { display: block; font-size: .7rem; font-weight: 500; opacity: .8; }
.how { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100%; background: #fffdf9; border-left: 2px dashed var(--accent); z-index: 50; overflow-y: auto; padding: 20px 22px 60px; transform: translateX(105%); transition: transform .25s; box-shadow: -8px 0 30px rgba(43, 52, 64, .12); }
.how.open { transform: none; }
.how h2 { margin-top: 26px; font-size: 18px; color: #8a4a00; }
.how .x { position: sticky; top: 0; float: right; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.how p, .how li { font-size: .9rem; }
.how table { font-size: .82rem; }
.how td code { font-family: var(--mono); font-size: .8rem; white-space: nowrap; }
.wfbadge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #8a4a00; background: #ffe9d4; border-radius: 4px; padding: 2px 7px; }

@media (max-width: 760px) {
  .topbar { padding: 8px 12px; flex-wrap: wrap; }
  .topbar .logo { height: 22px; }
  .views button { padding: 5px 10px; font-size: .8rem; }
  .saved { font-size: .76rem; padding: 3px 9px; }
  .steps ol { padding: 8px 12px; gap: 3px; }
  .steps li { flex: none; }
  .steps li .t { display: none; }
  .steps li.cur { flex: 1; }
  .steps li.cur .t { display: inline; }
  .steps li .n { width: 24px; height: 24px; }
  .steps .ctx { padding: 0 12px 6px; }
  .wrap { padding: 14px 10px 110px; }
  .sheet { padding: 20px 16px; }
  h1 { font-size: 25px; }
  .pair { grid-template-columns: 1fr; }
  .favs { grid-template-columns: 1fr; }
  .vote { grid-template-columns: 1fr; }
  .vote .btn.same { order: 3; }
  .word .w { font-size: 34px; }
  .sentence .w { font-size: 19px; }
  .scale .row { gap: 5px; }
  .howbtn { right: 10px; bottom: 10px; padding: 7px 12px; font-size: .82rem; }
  .howbtn small { display: none; }
}

/* Additions for the live test */
.testpill { font-size: .76rem; font-weight: 700; color: #8a4a00; background: #ffe9d4; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.saved.wait { color: #6b4300; background: var(--warn-bg); border-color: #f3d9a6; }
.saved.wait .dot { background: var(--accent); }
.loadbar { height: 10px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 14px 0 6px; }
.loadbar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .15s; }
.err { background: var(--bad-bg); border-left: 4px solid var(--bad); border-radius: 6px; padding: 10px 14px; margin: 14px 0; color: #8a1f1d; font-size: .92rem; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--brand); }
.comments { list-style: none; padding: 0; margin: 8px 0 16px; }
.comments li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 6px 0; background: #fff; font-size: .92rem; }
.comments li .sub { color: var(--muted); font-size: .8rem; }
.how h2.first { margin-top: 14px; }
table.heat thead th { white-space: normal; min-width: 92px; vertical-align: bottom; line-height: 1.3; }
