:root {
  --ink: #0c1a2b;
  --ink-soft: #0e1f30;
  --card: #122539;
  --border: #24384e;
  --body: #aeb7c2;
  --bright: #eef2f6;
  --cyan: #7fd1f0;
  --cyan-deep: #26bde2;
  --warn: #fcc30b;
  --ok: #56c02b;
  --err: #ff6b6b;
  --radius: 0.5rem;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  min-height: 100vh;
  background: var(--ink);
  color: var(--body);
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
body.lang-zh { font-family: 'Space Grotesk', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; }
.top-right { display: flex; align-items: center; gap: 1rem; }
.lang-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 0.375rem; overflow: hidden; }
.lang-toggle button {
  background: transparent; border: 0; color: rgba(174,183,194,0.8); font: inherit; font-size: 0.75rem; font-weight: 600;
  padding: 0.3rem 0.6rem; cursor: pointer; letter-spacing: 0.05em;
}
.lang-toggle button + button { border-left: 1px solid var(--border); }
.lang-toggle button.active { background: rgba(127,209,240,0.15); color: var(--cyan); }
a { color: var(--cyan); }
header.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(12, 26, 43, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.wordmark { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.disc {
  height: 1.4rem; width: 1.4rem; border-radius: 9999px;
  background: conic-gradient(#E5243B,#DDA63A,#4C9F38,#FF3A21,#26BDE2,#FCC30B,#FD6925,#DD1367,#3F7E44,#0A97D9,#56C02B,#00689D,#E5243B);
}
.wordmark span {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9rem; font-weight: 500; letter-spacing: 0.16em; color: var(--cyan);
}
.progress-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(174,183,194,0.8);
  white-space: nowrap;
}
.progress { height: 3px; background: var(--border); }
.progress > i { display: block; height: 100%; background: var(--cyan-deep); transition: width 300ms; }

main { max-width: 46rem; margin: 0 auto; padding: 2rem 1.25rem 6.5rem; }
.eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.2em; color: var(--cyan);
}
.eyebrow::before { content: '// '; opacity: 0.6; }
h1 {
  font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2;
  color: var(--bright); margin: 0.4rem 0 0.5rem;
}
.intro { max-width: 36rem; margin-bottom: 1.5rem; }

.q {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.1rem;
  margin-bottom: 1rem;
  transition: border-color 200ms;
}
.q.missing { border-color: var(--warn); }
.q .qtext { color: var(--bright); font-weight: 600; font-size: 1.02rem; }
.q .qtext .req { color: var(--cyan); margin-left: 0.2rem; }
.q .help { font-size: 0.88rem; margin-top: 0.35rem; color: rgba(174,183,194,0.85); }
.q .missing-note { display: none; font-size: 0.82rem; color: var(--warn); margin-top: 0.4rem; }
.q.missing .missing-note { display: block; }
.q .body { margin-top: 0.9rem; }
.q .body p { margin-bottom: 0.7rem; }
.q .body ul { margin: 0 0 0.7rem 1.25rem; }
.q .rich { color: var(--body); font-size: 0.95rem; }

/* radio */
.options { display: flex; flex-direction: column; gap: 0.45rem; }
.opt {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; background: rgba(255,255,255,0.02);
}
.opt:hover { border-color: rgba(127,209,240,0.5); }
.opt input { accent-color: var(--cyan-deep); width: 1.05rem; height: 1.05rem; flex: none; }
.opt.checked { border-color: var(--cyan); background: rgba(127,209,240,0.08); color: var(--bright); }
.opt .other-input { flex: 1; min-width: 8rem; }

/* text inputs */
input[type='text'], input[type='password'], input[type='number'], textarea {
  width: 100%;
  border-radius: 0.375rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.03);
  padding: 0.65rem 0.8rem;
  font-size: 0.95rem; font-family: inherit; color: var(--bright);
}
input::placeholder, textarea::placeholder { color: rgba(174,183,194,0.4); }
input:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(127,209,240,0.25); }
input[type='number'] { max-width: 9rem; }
.textlist { display: flex; flex-direction: column; gap: 0.5rem; }
.textlist label { display: flex; align-items: center; gap: 0.6rem; }
.textlist label b { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.8rem; color: var(--cyan); width: 1.2rem; }

/* likert */
.scale-legend {
  display: none;
}
.item { padding: 0.75rem 0; border-top: 1px solid var(--border); }
.item:first-child { border-top: none; padding-top: 0; }
.item .item-text { margin-bottom: 0.5rem; color: var(--bright); font-size: 0.95rem; }
.item.single .item-text { display: none; }
.seg { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.seg label {
  flex: 1 1 auto;
  min-width: 5.5rem;
  text-align: center;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--border); border-radius: 0.375rem;
  font-size: 0.8rem; line-height: 1.25; cursor: pointer; background: rgba(255,255,255,0.02);
  position: relative;
}
.seg label:hover { border-color: rgba(127,209,240,0.5); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label.checked { border-color: var(--cyan); background: rgba(127,209,240,0.12); color: var(--bright); }
.seg label.na { opacity: 0.8; }

/* slider */
.slider-row { padding: 0.75rem 0; border-top: 1px solid var(--border); }
.slider-row:first-child { border-top: none; padding-top: 0; }
.slider-row .item-text { color: var(--bright); font-size: 0.95rem; margin-bottom: 0.4rem; }
.slider-row.single .item-text { display: none; }
.slider-wrap { display: flex; align-items: center; gap: 0.8rem; }
.slider-wrap input[type='range'] { flex: 1; accent-color: var(--cyan-deep); height: 1.4rem; cursor: pointer; }
.slider-wrap input[type='range'].untouched { accent-color: #4a5f77; }
.val {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem; width: 2.6rem; text-align: right; color: var(--cyan);
}
.val.empty { color: rgba(174,183,194,0.5); }
.slider-labels {
  display: flex; justify-content: space-between; gap: 0.5rem;
  font-size: 0.72rem; color: rgba(174,183,194,0.75); margin-top: 0.15rem; padding-right: 3.4rem;
}
.slider-labels span:nth-child(2):not(:last-child) { text-align: center; }
.slider-labels span:last-child { text-align: right; }

/* rank */
.rank-list { display: flex; flex-direction: column; gap: 0.45rem; }
.rank-opt {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; background: rgba(255,255,255,0.02); text-align: left; color: var(--body); font: inherit;
}
.rank-opt:hover { border-color: rgba(127,209,240,0.5); }
.rank-opt .badge {
  flex: none; width: 1.7rem; height: 1.7rem; border-radius: 9999px;
  border: 1px solid var(--border); display: grid; place-items: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.8rem; color: rgba(174,183,194,0.6);
}
.rank-opt.ranked { border-color: var(--cyan); background: rgba(127,209,240,0.08); }
.rank-opt.ranked .badge { background: var(--cyan-deep); color: var(--ink); border-color: var(--cyan-deep); font-weight: 700; }
.rank-opt b { color: var(--bright); font-weight: 600; }
.rank-opt small { display: block; font-size: 0.82rem; color: rgba(174,183,194,0.85); }

/* nav */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.btn {
  border-radius: 0.375rem; padding: 0.7rem 1.3rem; font-size: 0.95rem; font-weight: 600;
  font-family: inherit; cursor: pointer; border: 1px solid transparent; transition: background 150ms, opacity 150ms;
}
.btn.primary { background: var(--cyan-deep); color: var(--ink); }
.btn.primary:hover { background: var(--cyan); }
.btn.primary.soft { background: var(--warn); }
.btn.ghost { background: transparent; color: var(--body); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--cyan); color: var(--bright); }
.btn:disabled { opacity: 0.5; cursor: default; }
.nav-note { font-size: 0.85rem; color: var(--warn); flex: 1; text-align: right; }
.nav-note.err { color: var(--err); }

.end { text-align: center; padding: 3rem 0; }
.end h2 { color: var(--bright); font-size: 1.6rem; margin-bottom: 0.6rem; }
.end p { max-width: 30rem; margin: 0 auto 0.6rem; }
.end .actions { display: flex; gap: 0.6rem; justify-content: center; margin-top: 1rem; }
.end a.btn { display: inline-block; text-decoration: none; margin-top: 0.6rem; }
.end .disc-big { width: 3rem; height: 3rem; margin: 0 auto 1.25rem; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.85rem; }
footer { text-align: center; font-size: 0.75rem; color: rgba(174,183,194,0.5); padding: 1rem 1rem 4.5rem; }

/* bottom progress bar */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: rgba(12, 26, 43, 0.94);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1.25rem calc(0.6rem + env(safe-area-inset-bottom));
}
.bottom-inner { max-width: 46rem; margin: 0 auto; display: flex; align-items: center; gap: 0.9rem; }
.bottom-label, .bottom-pct {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(174,183,194,0.85);
  white-space: nowrap;
}
.bottom-pct { color: var(--cyan); min-width: 3rem; text-align: right; }
.bottom-track { flex: 1; height: 8px; border-radius: 9999px; background: var(--border); overflow: hidden; }
.bottom-track > i { display: block; height: 100%; border-radius: 9999px; background: linear-gradient(90deg, var(--cyan-deep), var(--cyan)); transition: width 300ms; }
.bottom-bar.done .bottom-track > i { background: var(--ok); }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }

@media (min-width: 640px) {
  .seg label { min-width: 0; }
  .seg.n5 label { flex-basis: calc(20% - 0.35rem); }
  .seg.n6 label { flex-basis: calc(16.66% - 0.35rem); }
  .seg.n7 label { flex-basis: calc(14.28% - 0.35rem); }
}

/* login */
.login .field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }
.login .field span { font-size: 0.85rem; color: rgba(174,183,194,0.85); }
.login .grid2 { display: grid; gap: 0 0.8rem; grid-template-columns: 1fr 1fr; }
.login input.pin { font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 0.2em; max-width: 12rem; }
.login .nav { margin-top: 0.4rem; }
.notice { color: var(--warn); font-size: 0.92rem; margin-bottom: 1rem; max-width: 36rem; }
@media (max-width: 480px) { .login .grid2 { grid-template-columns: 1fr; } }
