:root {
  color-scheme: dark;
  --bg: #222529;
  --panel: #1c1f23;
  --text: #e0e1df;
  --muted: #989b9f;
  --faint: #70747a;
  --line: #34383d;
  --accent: #edc46a;
  --error: #ed848c;
  --error-bg: #613740;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --sans:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f5f6;
  --panel: #e9ebed;
  --text: #292e34;
  --muted: #646b73;
  --faint: #828991;
  --line: #dadddf;
  --accent: #966400;
  --error: #b73147;
  --error-bg: #f5d4da;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  transition:
    background 0.2s,
    color 0.2s;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  border: 0;
  background: none;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
  border-radius: 4px;
}
button:hover,
a:hover {
  color: var(--accent);
}
.shell {
  max-width: 1176px;
  padding: 0 48px;
  margin: auto;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.site-header {
  display: flex;
  align-items: center;
  gap: 68px;
  padding-top: 40px;
  height: 99px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.12em;
}
.brand-icon {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 37px;
  font-weight: 500;
  letter-spacing: -5px;
  line-height: 1;
}
.brand-icon span {
  font-size: 28px;
  margin-left: 2px;
}
.brand-en {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.11em;
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.site-header nav {
  display: flex;
  gap: 32px;
  align-self: stretch;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}
.site-header nav a {
  position: relative;
  padding: 12px 0;
}
.site-header nav .active {
  color: var(--text);
}
.site-header nav .active:after {
  content: '';
  position: absolute;
  height: 3px;
  width: 18px;
  background: var(--accent);
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 4px;
}
.icon-button {
  margin-left: auto;
  color: var(--muted);
  width: 42px;
  height: 42px;
  font-size: 25px;
}
.typing-main {
  flex: 1;
  padding-top: 75px;
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 37px;
}
.eyebrow {
  font: 12px var(--mono);
  letter-spacing: 0.15em;
  color: var(--muted);
}
.eyebrow span {
  margin-left: 12px;
  color: var(--faint);
}
h1 {
  font-size: 31px;
  font-weight: 500;
  letter-spacing: 0.05em;
  margin: 13px 0 0;
}
.heading-cursor {
  color: var(--accent);
  margin-left: 7px;
  font-family: var(--mono);
}
.page-heading p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}
.controls {
  display: flex;
  gap: 20px;
  align-items: center;
  background: var(--panel);
  padding: 12px 20px;
  border-radius: 9px;
  width: fit-content;
  margin: 0 auto 39px;
  max-width: 100%;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 19px;
  font-size: 14px;
  color: var(--muted);
}
.control-group button {
  padding: 6px 0;
  white-space: nowrap;
}
.control-group button.selected {
  color: var(--accent);
}
.control-divider {
  width: 1px;
  height: 19px;
  background: var(--line);
}
.option-unit {
  font-size: 12px;
  color: var(--faint);
  margin-left: -10px;
}
.test-info {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}
.live-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 23px 0 19px;
}
.timer {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 31px;
}
.timer > span + span {
  font-size: 16px;
  margin-left: 7px;
}
.live-metrics {
  display: flex;
  gap: 23px;
  color: var(--muted);
  font: 13px var(--mono);
}
.live-metrics b {
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
}
.typing-stage {
  position: relative;
  border-radius: 5px;
  min-height: 190px;
  cursor: text;
}
.word-window {
  height: 201px;
  overflow: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.words {
  font-family: var(--mono);
  font-size: 28px;
  line-height: 1.65;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 13px 0;
  align-content: flex-start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 2px 0 8px;
}
.word {
  display: inline-flex;
  flex-direction: column;
  position: relative;
  white-space: pre;
  line-height: 1.55;
}
.translation {
  font: 14px var(--sans);
  height: 27px;
  color: var(--muted);
  letter-spacing: 0.12em;
  user-select: none;
}
.letters {
  display: block;
  min-height: 1.55em;
}
.char {
  position: relative;
}
.char.correct {
  color: var(--text);
}
.char.incorrect {
  color: var(--error);
  background: var(--error-bg);
  border-radius: 2px;
}
.char.caret:before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  width: 2px;
  height: 1.2em;
  background: var(--accent);
  border-radius: 2px;
  animation: blink 1.05s step-end infinite;
}
.running .char.caret:before {
  animation: none;
}
.hanzi {
  font-family: var(--sans);
  font-size: 29px;
  line-height: 2.1;
  gap: 0;
}
.hanzi .word {
  display: inline;
  white-space: normal;
  line-height: 2.1;
}
.hanzi .letters {
  display: inline;
}
.english .translation,
.hanzi .translation {
  display: none;
}
.english {
  line-height: 1.8;
  row-gap: 9px;
}
.english .word {
  line-height: 1.8;
}
.typing-stage textarea {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  border: 0;
  outline: none;
  opacity: 0.015;
  font-size: 20px;
  padding: 0;
  z-index: 2;
  overflow: hidden;
}
.focus-prompt {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text);
  font-size: 15px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(5px);
}
.typing-stage.unfocused .focus-prompt {
  display: flex;
}
.typing-stage.unfocused .char.caret:before {
  display: none;
}
.practice-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 15px;
  gap: 15px;
  min-height: 18px;
}
.test-actions {
  text-align: center;
  margin-top: 32px;
}
.restart-button {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 8px 16px;
}
.restart-button > span:first-child {
  font: 26px var(--mono);
}
.shortcuts {
  margin-top: 42px;
  display: flex;
  justify-content: center;
  gap: 28px;
  color: var(--muted);
  font-size: 12px;
}
kbd {
  display: inline-block;
  font: 11px var(--mono);
  color: var(--text);
  background: var(--line);
  border-radius: 4px;
  padding: 4px 6px;
  margin-right: 6px;
}
.method-note {
  font-size: 12px;
  color: var(--faint);
  text-align: center;
  margin: 20px 0 40px;
}
footer {
  border-top: 1px solid var(--line);
  padding: 25px 0 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 12px;
  color: var(--muted);
}
.footer-slash {
  color: var(--faint);
  padding: 0 10px;
}
.tiny-key {
  font-family: var(--mono);
  margin-left: 14px;
  font-size: 17px;
  color: var(--accent);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none !important;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (min-width: 1400px) {
  .typing-main {
    padding-top: 100px;
  }
  .controls {
    margin-bottom: 48px;
  }
  .test-actions {
    margin-top: 45px;
  }
}
@media (max-width: 800px) {
  .shell {
    padding: 0 28px;
  }
  .site-header {
    gap: 38px;
  }
  .typing-main {
    padding-top: 55px;
  }
  .controls {
    gap: 13px;
    padding: 12px 14px;
  }
  .control-group {
    gap: 13px;
  }
  .page-heading p {
    display: none;
  }
  .words {
    font-size: 25px;
  }
  .shortcuts {
    margin-top: 32px;
  }
}
@media (max-width: 560px) {
  .shell {
    padding: 0 20px;
  }
  .site-header {
    padding-top: 20px;
    height: 77px;
    gap: 25px;
  }
  .brand {
    font-size: 20px;
  }
  .brand-icon {
    font-size: 32px;
  }
  .site-header nav {
    gap: 20px;
  }
  .brand-en {
    font-size: 12px;
  }
  .icon-button {
    width: 30px;
  }
  .typing-main {
    padding-top: 43px;
  }
  h1 {
    font-size: 27px;
  }
  .page-heading {
    margin-bottom: 28px;
  }
  .controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
    margin-bottom: 28px;
  }
  .controls > .control-divider:nth-of-type(2) {
    display: none;
  }
  .control-group {
    font-size: 14px;
  }
  .duration-options {
    flex-basis: 100%;
    justify-content: center;
    border-top: 1px solid var(--line);
    padding-top: 6px;
    margin-top: 4px;
    gap: 27px;
  }
  .words {
    font-size: 24px;
  }
  .translation {
    font-size: 14px;
  }
  .live-stats {
    margin-top: 22px;
  }
  .live-metrics {
    gap: 13px;
    font-size: 12px;
  }
  .live-metrics b {
    font-size: 16px;
  }
  .test-info {
    font-size: 12px;
  }
  .shortcuts {
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 24px;
  }
  .practice-bottom {
    font-size: 12px;
  }
  .method-note {
    line-height: 1.8;
    margin-bottom: 30px;
  }
  .footer-right {
    display: none;
  }
  footer {
    padding: 23px 0;
  }
  .test-actions {
    margin-top: 22px;
  }
}
