:root {
  color-scheme: dark;
  --text: #f4f4f4;
  --pending: #4d4d4d;
  --correct: #f4f4f4;
  --wrong: #ff5c5c;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: #000;
  overflow: hidden;
}

.speed-glow {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.1;
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity 220ms ease, transform 320ms ease;
  z-index: 0;
  mix-blend-mode: screen;
}

.speed-glow-a {
  top: 12vh;
  left: 8vw;
  width: 26rem;
  height: 26rem;
  background: radial-gradient(circle, rgba(98, 229, 255, 0.95) 0%, rgba(98, 229, 255, 0) 68%);
}

.speed-glow-b {
  right: 10vw;
  bottom: 10vh;
  width: 22rem;
  height: 22rem;
  background: radial-gradient(circle, rgba(255, 92, 92, 0.7) 0%, rgba(255, 92, 92, 0) 70%);
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 0 6vw;
  display: flex;
  align-items: center;
  justify-content: center;
}

.typing-shell {
  width: min(980px, 100%);
  display: grid;
  gap: 2.5rem;
}

.duration-switcher {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.duration-button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #a8a8a8;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.7rem 1.05rem;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.duration-button:hover {
  color: var(--text);
  border-color: rgba(98, 229, 255, 0.28);
  transform: translate3d(0, -1px, 0);
}

.duration-button.is-active {
  color: #061015;
  border-color: rgba(98, 229, 255, 0.9);
  background: linear-gradient(135deg, rgba(98, 229, 255, 0.96), rgba(163, 247, 255, 0.88));
  box-shadow: 0 10px 30px rgba(98, 229, 255, 0.22);
}

.quote-display {
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  line-height: 1.9;
  letter-spacing: 0.02em;
  text-align: left;
  user-select: none;
}

.typed-display {
  min-height: 180px;
  font-size: clamp(1.45rem, 2.5vw, 2.2rem);
  line-height: 1.8;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  transform: translate3d(0, 0, 0) scale(1);
  transition: transform 180ms ease;
}

.typed-display:empty::before {
  content: " ";
}

.result-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.result-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 220ms ease;
}

.result-card {
  position: relative;
  width: min(560px, calc(100vw - 2rem));
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(18, 18, 18, 0.98), rgba(10, 10, 10, 0.95)),
    radial-gradient(circle at top left, rgba(98, 229, 255, 0.08), transparent 28%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translate3d(0, 28px, 0) scale(0.96);
  transition: opacity 320ms ease, transform 380ms ease;
}

.result-kicker,
.result-hint {
  margin: 0;
  color: #9a9a9a;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-kicker {
  margin-bottom: 1rem;
  font-size: 0.82rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.result-grid article {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 280ms ease, transform 280ms ease;
}

.result-grid span {
  display: block;
  margin-bottom: 0.4rem;
  color: #8b8b8b;
  font-size: 0.9rem;
}

.result-grid strong {
  font-size: clamp(1.4rem, 2vw, 2rem);
  color: var(--text);
}

.result-modal.is-visible .result-backdrop {
  opacity: 1;
}

.result-modal.is-visible .result-card {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.result-modal.is-visible .result-grid article {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.result-modal.is-visible .result-grid article:nth-child(1) {
  transition-delay: 80ms;
}

.result-modal.is-visible .result-grid article:nth-child(2) {
  transition-delay: 140ms;
}

.result-modal.is-visible .result-grid article:nth-child(3) {
  transition-delay: 200ms;
}

.result-modal.is-visible .result-grid article:nth-child(4) {
  transition-delay: 260ms;
}

.result-hint {
  margin-top: 1rem;
  font-size: 0.82rem;
}

.quote-display .char {
  position: relative;
  color: var(--pending);
  transition: color 120ms ease, text-shadow 160ms ease;
}

.quote-display .char.current {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.quote-display .char.correct {
  color: var(--correct);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.05);
}

.quote-display .char.wrong {
  color: var(--wrong);
}

.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;
}
