@font-face { font-family: "Source Serif"; src: url(/fonts/source-serif-4-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0400-04FF, U+2116; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url(/fonts/source-serif-4-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 400; src: url(/fonts/inter-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0400-04FF, U+2116; font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 400; src: url(/fonts/inter-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 500; src: url(/fonts/inter-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0400-04FF, U+2116; font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 500; src: url(/fonts/inter-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #fff; --ink: #111; --text: #333; --soft: #767676; --line: #e4e4e4; --edge: #c9c9c9; --raised: #f4f4f4; --error: #8a2b2b; --figures: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15161a; --ink: #eceded; --text: #c9cacc; --soft: #8e9095; --line: #2c2e33; --edge: #44464c; --raised: #1f2126; --error: #e08a8a; --figures: invert(.93);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15161a; --ink: #eceded; --text: #c9cacc; --soft: #8e9095; --line: #2c2e33; --edge: #44464c; --raised: #1f2126; --error: #e08a8a; --figures: invert(.93);
}
/* Figures are drawn in black on white. Inverting keeps every shade distinct at night. */
.matrix svg, .scales svg, .reference svg, .sample svg, .option svg, .figure svg { filter: var(--figures); }
.theme { width: 18px; height: 18px; padding: 0; border: 1px solid var(--soft); border-radius: 50%; background: linear-gradient(90deg, var(--soft) 50%, transparent 50%); cursor: pointer; align-self: center; }
.theme:hover { border-color: var(--ink); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); display: flex; flex-direction: column; min-height: 100%;
  font: 400 15px/1.5 "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, .score, .wordmark { font-family: "Source Serif", Georgia, serif; font-weight: 400; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; width: 100%; height: 100%; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.primary {
  display: inline-block; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); border-radius: 2px;
  padding: 12px 34px; font-weight: 500; cursor: pointer; text-decoration: none; transition: opacity .15s;
}
.primary:hover:not(:disabled) { opacity: .82; }
.primary:disabled { background: var(--bg); color: var(--soft); border-color: var(--line); cursor: default; }
.secondary {
  display: inline-block; background: var(--bg); border: 1px solid var(--edge); border-radius: 2px;
  padding: 12px 26px; cursor: pointer; text-decoration: none;
}
.secondary:hover { border-color: var(--ink); }

/* Header and footer */
.site { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 40px; }
header.site { display: flex; align-items: center; justify-content: space-between; padding-top: 24px; padding-bottom: 24px; }
.wordmark { font-size: 23px; text-decoration: none; letter-spacing: .002em; }
nav { display: flex; align-items: center; gap: 28px; }
nav a { text-decoration: none; color: var(--soft); }
nav a:hover { color: var(--ink); }

/* Home */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 88px; align-items: center; padding-top: 48px; padding-bottom: 96px; }
.hero h1 { margin: 0 0 24px; font-size: 62px; line-height: 1.06; letter-spacing: -.018em; text-wrap: balance; }
.hero p { margin: 0 0 32px; font-size: 18px; line-height: 1.55; color: var(--text); max-width: 30em; }
.sample { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.sample > div { aspect-ratio: 1; background: var(--bg); }
.sample .blank { display: flex; align-items: center; justify-content: center; background: var(--raised); font: 400 32px "Source Serif", Georgia, serif; color: var(--soft); }

footer.site { margin-top: auto; padding-top: 28px; padding-bottom: 32px; color: var(--soft); font-size: 13.5px; display: flex; justify-content: space-between; gap: 24px; }
footer.site a { text-decoration: none; }
footer.site a:hover { color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px; padding-bottom: 96px; }
.stats > div { border-top: 1px solid var(--ink); padding-top: 16px; }
.stats strong { display: block; font: 400 56px/1.1 "Source Serif", Georgia, serif; letter-spacing: -.015em; }
.stats span { color: var(--soft); }
.fresh { padding-bottom: 96px; }
.fresh-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.fresh h2 { margin: 0; font-size: 38px; line-height: 1.15; letter-spacing: -.012em; }
.strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }

/* Narrow pages */
.page { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 24px 56px; }
.text { width: 100%; max-width: 480px; }
.text h1 { margin: 0 0 24px; font-size: 52px; line-height: 1.1; letter-spacing: -.015em; }
.text p { margin: 0 0 16px; font-size: 16px; color: var(--text); }
.text .primary { margin-top: 24px; }
.form .primary { margin-top: 0; justify-self: start; }
.facts { list-style: none; margin: 32px 0 0; padding: 0; border-top: 1px solid var(--line); }
.facts li { display: flex; justify-content: space-between; gap: 24px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts span:first-child { color: var(--soft); }
.text .note { font-size: 13.5px; color: var(--soft); margin-top: 24px; }
.text .error { font-size: 14px; color: var(--error); margin: 14px 0 0; }
.label { display: block; margin: 0 0 8px; color: var(--soft); }
.form { margin-top: 32px; display: grid; gap: 24px; }
.form input {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--edge); border-radius: 2px;
}
.form input.short { width: 120px; }
.form input:focus { outline: none; border-color: var(--ink); }
.choice { display: flex; gap: 8px; }
.choice button { padding: 10px 22px; background: var(--bg); border: 1px solid var(--edge); border-radius: 2px; cursor: pointer; }
.choice button:hover { border-color: var(--soft); }
.choice button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.text .switch { margin: 24px 0 0; font-size: 14px; color: var(--soft); }
.switch button { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: var(--ink); }

/* Result */
.text .iqlabel { margin: 0 0 6px; color: var(--soft); }
.text .score { font-size: 112px; line-height: 1; letter-spacing: -.02em; margin: 0; color: var(--ink); }
.text .range { font-size: 18px; color: var(--ink); margin: 8px 0 0; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.actions-row .primary { margin-top: 0; }
.cert { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.cert-row { display: flex; gap: 8px; }
.text .cert-row .primary { margin-top: 0; padding-left: 24px; padding-right: 24px; white-space: nowrap; }
.cert-row input { flex: 1; min-width: 0; padding: 10px 12px; font: inherit; border: 1px solid var(--edge); border-radius: 2px; }
.cert-row input:focus { outline: none; border-color: var(--ink); }

.buy, .report { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.text .buy-title { font: 400 23px "Source Serif", Georgia, serif; color: var(--ink); margin: 0 0 8px; }
.buy .primary { margin-top: 10px; }
.report .facts { margin-top: 12px; }
footer.site .legal { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 18px; }

.legal-page { flex: 1; max-width: 760px; padding-top: 24px; padding-bottom: 72px; }
.legal-page h1 { margin: 0 0 22px; font-size: 44px; letter-spacing: -.012em; }
.legal-page h2 { margin: 30px 0 8px; font-size: 21px; }
.legal-page p { margin: 0 0 12px; color: var(--text); }

.profile { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.text .profile-title { font: 400 23px "Source Serif", Georgia, serif; color: var(--ink); margin: 0 0 16px; }
.ability { display: grid; grid-template-columns: 148px minmax(0, 1fr) 48px; align-items: center; gap: 12px; padding: 8px 0; }
.ability-name { color: var(--text); font-size: 14px; }
.ability-score { text-align: right; font-variant-numeric: tabular-nums; }
.track { position: relative; height: 18px; }
.track i { position: absolute; display: block; }
.track .mid { left: 50%; top: 0; bottom: 0; width: 1px; background: var(--edge); }
.track .band { top: 7px; height: 4px; background: var(--edge); }
.track .dot { top: 4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--ink); }
:lang(zh) h1, :lang(zh) h2 { font-family: "Songti SC", "Noto Serif SC", "Source Serif", serif; }

/* Account */
.wide { flex: 1; padding-top: 32px; padding-bottom: 72px; }
.wide h1 { margin: 0 0 6px; font-size: 44px; letter-spacing: -.012em; }
.wide .who { color: var(--soft); margin: 0 0 40px; }
.account { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 72px; align-items: start; }
.account h2 { margin: 0 0 14px; font-size: 23px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 400; color: var(--soft); padding: 9px 0; border-bottom: 1px solid var(--ink); }
td { padding: 13px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.empty { color: var(--soft); margin: 0 0 22px; }
.linkish { background: none; border: 0; padding: 0; color: var(--soft); text-decoration: underline; cursor: pointer; }

/* Test */
.bar { position: fixed; inset: 0 0 auto 0; height: 2px; background: var(--line); }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .25s ease; }
.test { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px 48px; }
.frame { width: 100%; max-width: 1080px; margin: 0 auto; }
.top { display: flex; justify-content: space-between; color: var(--soft); font-variant-numeric: tabular-nums; margin-bottom: 24px; }
.time.low { color: var(--ink); font-weight: 500; }
.work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 72px; align-items: start; }
.matrix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.matrix > div { aspect-ratio: 1; background: var(--bg); }
.matrix .blank { display: flex; align-items: center; justify-content: center; background: var(--raised); font: 400 34px "Source Serif", Georgia, serif; color: var(--soft); }
.scales { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.scales > div { background: var(--bg); padding: 10px; }
.scales > div:last-child { background: var(--raised); }
.scales > div:nth-child(odd):last-child { grid-column: 1 / -1; }
.scales > div:nth-child(odd):last-child svg { width: calc(50% - 10px); margin: 0 auto; }
.scales svg { height: auto; aspect-ratio: 220 / 118; }
.reference { width: min(100%, 400px); margin: 0 auto; border: 1px solid var(--line); background: var(--bg); }
.reference > div { aspect-ratio: 1; }
.phrase { min-height: 300px; display: flex; flex-direction: column; justify-content: center; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); padding: 28px 0; }
.phrase .place { margin: 0 0 18px; color: var(--soft); }
.phrase .said { margin: 0; font: 400 32px/1.3 "Source Serif", Georgia, serif; }
.options.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.options.two .option { aspect-ratio: auto; padding: 22px 0; font-size: 17px; }
.cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.cell { aspect-ratio: 1; background: var(--bg); border: 0; padding: 0; font: 400 26px "Source Serif", Georgia, serif; color: var(--ink); transition: background .08s; }
button.cell { cursor: pointer; }
button.cell:hover { background: var(--raised); }
.cell.lit { background: var(--ink); }
.cell.chosen { background: var(--raised); }
.ask.sum { font: 400 44px/1.2 "Source Serif", Georgia, serif; margin: 40px 0 34px; font-variant-numeric: tabular-nums; min-height: 53px; }
.choice-row { display: flex; gap: 10px; }
.choice-row .secondary { flex: 1; padding: 18px 0; }
.actions { gap: 10px; }
.options.one { grid-template-columns: minmax(0, 1fr); }
.figure { width: 180px; height: 180px; }
.options.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.options.six .option { aspect-ratio: 10 / 7; }
.options.six .option svg { width: 100%; height: 100%; }
.options.cubes .option { aspect-ratio: 1; }
.ask { margin: 0 0 16px; font-size: 16px; }
.options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.option { aspect-ratio: 1; padding: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 2px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.option:hover { border-color: var(--soft); }
.option[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.actions { display: flex; justify-content: flex-end; margin-top: 24px; }

@media (max-width: 820px) {
  .site { padding-left: 20px; padding-right: 20px; }
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 28px; padding-bottom: 48px; }
  .hero h1 { font-size: 42px; }
  .account { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .legal-page h1 { font-size: 32px; overflow-wrap: anywhere; }
  .ability { grid-template-columns: 110px minmax(0, 1fr) 44px; gap: 8px; }
  .stats { gap: 24px; padding-bottom: 48px; }
  .stats strong { font-size: 36px; }
  .strip { grid-template-columns: minmax(0, 1fr); }
  .fresh-head { flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
  .fresh h2 { font-size: 30px; }
  .fresh { padding-bottom: 48px; }
  nav { gap: 18px; }
  .test { padding: 28px 16px; justify-content: flex-start; }
  .top { margin-bottom: 16px; }
  .work { grid-template-columns: 1fr; gap: 24px; }
  .options { gap: 8px; }
  .actions .primary { width: 100%; }
  .text h1 { font-size: 42px; }
  .cert-row { flex-direction: column; }
  /* Phone: big targets, no zoom on focus, and the whole task on one screen. */
  html { -webkit-text-size-adjust: 100%; }
  input, .form input, .cert-row input { font-size: 16px; }
  .primary, .secondary { min-height: 48px; }
  .choice button { flex: 1; min-height: 48px; }
  header.site { padding-top: 16px; padding-bottom: 16px; }
  nav { gap: 18px; }
  .theme { width: 24px; height: 24px; }
  .hero { padding-top: 12px; }
  .hero .primary { width: 100%; text-align: center; }
  .hero .sample { width: min(100%, 320px); margin: 0 auto; }
  .page { align-items: flex-start; padding-top: 12px; }
  .text h1 { font-size: 38px; }
  .text .primary, .text .secondary { width: 100%; text-align: center; }
  .text .score { font-size: 88px; }
  .actions-row { flex-direction: column; }
  .ability { grid-template-columns: 112px minmax(0, 1fr) 44px; }
  footer.site { flex-direction: column; gap: 10px; }
  footer.site .legal { justify-content: flex-start; }
  .test { padding: 12px 14px 84px; min-height: 100dvh; }
  .top { margin-bottom: 10px; font-size: 14px; }
  .work { gap: 14px; }
  .matrix, .scales, .cells { width: min(100%, 46dvh); margin: 0 auto; }
  .reference { width: min(100%, 34dvh); margin: 0 auto; }
  .reference.board { width: min(100%, 52dvh); }
  .scales > div { padding: 4px; }
  .ask { margin: 0 0 10px; font-size: 15px; }
  .ask.sum { font-size: 38px; margin: 8px 0 18px; text-align: center; min-height: 0; }
  .options { gap: 6px; }
  .options.cubes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .figure { width: 96px; height: 96px; margin: 0 auto; }
  .phrase { min-height: 0; padding: 16px 0; }
  .phrase .said { font-size: 25px; }
  .choice-row .secondary { padding: 14px 0; }
  .actions { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); z-index: 2; }
  .actions .primary { flex: 1; }
  .legal-page { padding-left: 20px; padding-right: 20px; }
}
