:root {
  --paper: #f0ede4;
  --paper-deep: #e4dfd3;
  --ink: #181817;
  --muted: #6f6a5f;
  --line: rgba(24, 24, 23, 0.26);
  --blue: #2548ff;
  --acid: #dff251;
  --error: #be3f31;
  --serif: Georgia, "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --page-pad: clamp(18px, 2.8vw, 44px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 2%, rgba(255, 255, 255, 0.55), transparent 26rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

::selection {
  background: var(--blue);
  color: var(--paper);
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site {
  display: flex;
  flex-direction: column;
  width: min(100%, 1560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 76px;
  border-bottom: 1px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 12px;
  text-decoration: none;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1;
}

.brand-slash {
  padding: 0 0.1em;
  color: var(--blue);
  font-weight: 400;
}

.brand-cn {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.2;
}

.progress-block {
  width: clamp(150px, 15vw, 210px);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  line-height: 1;
}

.progress-track {
  display: block;
  height: 2px;
  overflow: hidden;
  background: var(--line);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.text-button {
  appearance: none;
  justify-self: end;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  line-height: 1.4;
  cursor: pointer;
}

.text-button:hover {
  color: var(--blue);
}

.text-button--small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.main {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(20px, 2.5vw, 36px) 0 clamp(26px, 3vw, 42px);
}

.boot {
  display: flex;
  flex: 1;
  min-height: 58vh;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.boot p {
  margin: 0;
}

.boot-mark {
  color: var(--blue);
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1;
  animation: boot-turn 1.3s ease-in-out infinite;
}

@keyframes boot-turn {
  50% {
    transform: rotate(90deg);
  }
}

#app {
  animation: app-in 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes app-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.game {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: clamp(34px, 5vw, 78px);
  align-items: start;
  width: 100%;
}

.art-column {
  min-width: 0;
}

.art-frame {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1;
  margin: 0 10px 20px 0;
  border: 1px solid var(--ink);
  background: var(--paper-deep);
  box-shadow: 10px 10px 0 var(--blue);
  overflow: hidden;
}

.art-frame::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  border: 1px solid rgba(24, 24, 23, 0.08);
  content: "";
  pointer-events: none;
}

.art-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.frame-meta {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.frame-meta span {
  display: inline-block;
  padding: 5px 8px 4px;
  border: 1px solid var(--ink);
  background: rgba(240, 237, 228, 0.94);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1;
}

.frame-meta span:last-child {
  min-width: 34px;
  text-align: center;
}

.reveal-stamp {
  position: absolute;
  z-index: 3;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  min-width: 142px;
  padding: 11px 14px 10px;
  border: 2px solid var(--blue);
  background: rgba(240, 237, 228, 0.95);
  color: var(--blue);
  transform: rotate(-4deg);
  transform-origin: 100% 100%;
  animation: stamp-in 280ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.reveal-stamp strong {
  font-family: var(--serif);
  font-size: clamp(20px, 2.3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}

.reveal-stamp span {
  margin-top: 6px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

@keyframes stamp-in {
  from {
    opacity: 0;
    transform: rotate(-4deg) scale(1.2);
  }
}

.art-caption {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-right: 10px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.art-caption span:first-child {
  color: var(--ink);
}

.quiz-column {
  display: flex;
  align-self: stretch;
  flex-direction: column;
  min-width: 0;
}

.quiz-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: clamp(12px, 3vw, 46px) 0 clamp(34px, 5vw, 72px);
}

.question-view,
.answer-view {
  animation: panel-in 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  color: var(--blue);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.18em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 20px;
  height: 2px;
  flex: 0 0 auto;
  background: currentColor;
  content: "";
}

.quiz-column h1 {
  max-width: 8em;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 4.2vw, 61px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.lead {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 1.1vw, 14px);
  line-height: 1.7;
}

.option-list {
  margin-top: clamp(26px, 3.5vw, 42px);
  border-top: 1px solid var(--ink);
}

.option {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 13px 10px 13px 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, padding 180ms ease;
}

.option-index {
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.option-word {
  font-family: var(--serif);
  font-size: clamp(20px, 1.9vw, 27px);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.option-arrow {
  color: var(--blue);
  font-size: 17px;
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.option:hover:not(:disabled) {
  padding-right: 4px;
  padding-left: 10px;
  background: var(--ink);
  color: var(--paper);
}

.option:hover:not(:disabled) .option-index {
  color: var(--acid);
}

.option:hover:not(:disabled) .option-arrow {
  color: var(--acid);
  opacity: 1;
  transform: translateX(0);
}

.option.is-wrong {
  background: rgba(190, 63, 49, 0.07);
  color: var(--error);
  cursor: default;
}

.option.is-wrong .option-word {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.option.is-wrong .option-index,
.option.is-wrong .option-arrow {
  color: var(--error);
}

.option.is-correct {
  padding-right: 4px;
  padding-left: 10px;
  border-bottom-color: var(--blue);
  background: var(--blue);
  color: var(--paper);
  cursor: default;
}

.option.is-correct .option-index,
.option.is-correct .option-arrow {
  color: var(--acid);
}

.option.is-correct .option-arrow {
  opacity: 1;
  transform: none;
}

.feedback-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  min-height: 34px;
  margin-top: 18px;
}

#feedback {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

#feedback.is-error {
  color: var(--error);
}

#feedback.is-success {
  color: var(--blue);
}

.answer-view {
  padding-top: 4px;
}

.answer-word {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(52px, 6.4vw, 88px);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 0.94;
  overflow-wrap: anywhere;
}

.answer-ipa {
  margin: 13px 0 0;
  color: var(--blue);
  font-family: var(--serif);
  font-size: clamp(14px, 1.4vw, 18px);
  line-height: 1.3;
}

.answer-meaning {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.65;
}

.answer-meaning .pos {
  margin-right: 7px;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
}

.answer-meaning .en {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.audio-row {
  display: flex;
  gap: 7px;
  margin-top: 23px;
}

.audio-button {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 4px 8px;
  align-items: center;
  padding: 8px 11px 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.audio-button span {
  color: var(--blue);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.audio-button:hover,
.audio-button.is-playing {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--paper);
}

.audio-button:hover span,
.audio-button.is-playing span {
  color: var(--acid);
}

.example {
  margin: 28px 0 0;
  padding: 2px 0 3px 17px;
  border-left: 2px solid var(--blue);
}

.example p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(16px, 1.5vw, 20px);
  line-height: 1.4;
}

.example cite {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  font-style: normal;
  line-height: 1.6;
}

.tip {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.tip::before {
  margin-right: 6px;
  color: var(--blue);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  content: "NOTE /";
}

.next-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  margin-top: clamp(26px, 3vw, 38px);
  padding: 15px 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.next-button:hover {
  border-color: var(--blue);
  background: var(--blue);
}

.next-button span:last-child {
  font-size: 18px;
  font-weight: 400;
  line-height: 0.8;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.quiz-footer strong {
  color: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.keyboard-hint {
  text-align: right;
}

.summary {
  width: 100%;
  padding: clamp(14px, 2vw, 28px) 0 10px;
  animation: app-in 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.summary-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.42fr);
  gap: 40px;
  align-items: end;
  padding-bottom: clamp(28px, 4vw, 54px);
}

.summary-head .eyebrow {
  margin-bottom: 16px;
}

.summary h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(54px, 7.4vw, 106px);
  font-weight: 600;
  letter-spacing: -0.065em;
  line-height: 0.94;
}

.summary h1:focus {
  outline: none;
}

.summary-copy {
  margin: 0 0 5px;
  padding-left: 18px;
  border-left: 2px solid var(--blue);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.summary-stats div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 18px 20px 17px;
}

.summary-stats div + div {
  border-left: 1px solid var(--line);
}

.summary-stats strong {
  font-family: var(--serif);
  font-size: clamp(30px, 3vw, 46px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.summary-stats span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(18px, 2.5vw, 32px) clamp(10px, 1.5vw, 22px);
  margin: clamp(28px, 4vw, 52px) 0 clamp(30px, 4vw, 48px);
}

.word-tile {
  position: relative;
  margin: 0;
  min-width: 0;
}

.word-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  background: var(--paper-deep);
  object-fit: cover;
}

.word-tile figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ink);
  margin-top: 7px;
  line-height: 1.2;
}

.word-tile strong {
  overflow: hidden;
  font-family: var(--serif);
  font-size: clamp(13px, 1.3vw, 18px);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-tile span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.summary-actions {
  display: flex;
  align-items: center;
  gap: 26px;
  padding-top: 4px;
}

.next-button--wide {
  width: auto;
  min-width: 250px;
  margin-top: 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 17px 0 20px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.5;
  text-transform: uppercase;
}

.site-footer a:hover {
  color: var(--blue);
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .game {
    grid-template-columns: minmax(0, 1.16fr) minmax(320px, 0.84fr);
    gap: 34px;
  }

  .quiz-body {
    padding-top: 4px;
  }

  .quiz-column h1 {
    font-size: clamp(35px, 4.6vw, 46px);
  }

  .option {
    min-height: 53px;
  }

  .summary-head {
    grid-template-columns: 1fr 0.38fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding: 17px 0 13px;
  }

  .progress-block {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .brand-cn {
    font-size: 9px;
  }

  .main {
    padding-top: 18px;
  }

  .game {
    display: flex;
    flex-direction: column;
    gap: 36px;
  }

  .art-column,
  .quiz-column {
    width: 100%;
  }

  .art-frame {
    margin-right: 7px;
    margin-bottom: 17px;
    box-shadow: 7px 7px 0 var(--blue);
  }

  .art-caption {
    margin-right: 7px;
  }

  .quiz-column h1 {
    max-width: 9em;
    font-size: clamp(35px, 8.2vw, 52px);
  }

  .quiz-body {
    padding: 2px 0 42px;
  }

  .option {
    min-height: 60px;
  }

  .option-word {
    font-size: clamp(21px, 5.3vw, 27px);
  }

  .answer-word {
    font-size: clamp(50px, 13vw, 78px);
  }

  .quiz-footer {
    padding-bottom: 4px;
  }

  .summary-head {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-bottom: 30px;
  }

  .summary-copy {
    max-width: 300px;
  }

  .summary h1 {
    font-size: clamp(54px, 15vw, 82px);
  }

  .word-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .site-footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .brand {
    gap: 9px;
  }

  .brand-name {
    font-size: 15px;
  }

  .brand-cn {
    padding-left: 9px;
    font-size: 8px;
    letter-spacing: 0.12em;
  }

  .text-button {
    font-size: 10px;
  }

  .frame-meta {
    top: 9px;
    left: 9px;
    right: 9px;
  }

  .frame-meta span {
    padding: 4px 6px 3px;
    font-size: 8px;
  }

  .reveal-stamp {
    right: 12px;
    bottom: 12px;
    min-width: 118px;
    padding: 9px 11px 8px;
  }

  .reveal-stamp strong {
    font-size: 21px;
  }

  .art-caption {
    gap: 10px;
    font-size: 7px;
    letter-spacing: 0.09em;
  }

  .eyebrow {
    margin-bottom: 14px;
    font-size: 8px;
  }

  .lead {
    margin-top: 13px;
  }

  .option-list {
    margin-top: 25px;
  }

  .option {
    grid-template-columns: 25px 1fr auto;
    gap: 7px;
    padding-right: 6px;
  }

  .feedback-row {
    gap: 12px;
  }

  .text-button--small {
    max-width: 124px;
    text-align: right;
  }

  .audio-row {
    gap: 5px;
  }

  .audio-button {
    flex: 1;
    justify-content: center;
    padding: 9px 7px 8px;
  }

  .quiz-footer {
    font-size: 8px;
  }

  .keyboard-hint {
    max-width: 160px;
  }

  .summary-stats div {
    flex-direction: column;
    gap: 5px;
    padding: 15px 12px;
  }

  .summary-stats strong {
    font-size: 32px;
  }

  .word-grid {
    gap: 16px 8px;
  }

  .word-tile figcaption {
    display: block;
    padding-top: 6px;
    margin-top: 5px;
  }

  .word-tile strong {
    display: block;
    font-size: 12px;
  }

  .word-tile span {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .summary-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 17px;
  }

  .summary-actions .text-button {
    align-self: flex-start;
    justify-self: auto;
  }

  .next-button--wide {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
