:root {
  color-scheme: light;
  --ink: #111318;
  --ink-2: #20242c;
  --paper: #f7f6f2;
  --card: #ffffff;
  --muted: #646a73;
  --line: #d8d9dc;
  --blue: #2d6cff;
  --blue-soft: #e9efff;
  --acid: #c5ef41;
  --coral: #f2634b;
  --max: 760px;
  --radius: 18px;
  --shadow: 0 20px 55px rgb(17 19 24 / 10%);
  font-family:
    "Noto Sans TC", "Noto Sans JP", "PingFang TC", "Yu Gothic", system-ui,
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 78px;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(90deg, transparent 0 15px, rgb(45 108 255 / 5%) 15px 16px, transparent 16px),
    var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

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

button {
  touch-action: manipulation;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.18;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--acid);
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 800;
}

.skip-link:focus {
  transform: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 28px, var(--max));
  min-height: 66px;
  margin-inline: auto;
  border-bottom: 1px solid rgb(216 217 220 / 78%);
  background: rgb(247 246 242 / 93%);
  backdrop-filter: blur(16px);
}

.topbar::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: -1;
  height: 66px;
  background: inherit;
}

.identity {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.identity-code {
  display: grid;
  width: 44px;
  height: 34px;
  place-items: center;
  border-radius: 5px;
  background: var(--ink);
  color: var(--acid);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.identity strong,
.identity small {
  display: block;
  line-height: 1.15;
}

.identity strong {
  font-size: 0.9rem;
}

.identity small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
}

.reset-button {
  min-width: 48px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

main,
footer {
  width: min(100% - 28px, var(--max));
  margin-inline: auto;
}

.practice-shell {
  padding: 30px 0 18px;
}

.practice-intro {
  border-left: 5px solid var(--blue);
  padding-left: 16px;
}

.kicker {
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.practice-intro h1 {
  margin-bottom: 14px;
  font-size: clamp(2.35rem, 11vw, 4.9rem);
  letter-spacing: -0.06em;
}

.practice-intro > p:last-child {
  max-width: 38rem;
  margin-bottom: 0;
  color: var(--muted);
}

.progress-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 14px;
  margin: 22px 0 12px;
}

.progress-row > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.progress-row span,
.progress-row p {
  color: var(--muted);
  font-size: 0.77rem;
}

.progress-row strong {
  font-size: 0.95rem;
}

.progress-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 2px;
  background: #dfe2e8;
}

.progress-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 220ms ease;
}

.progress-row p {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.retrieval-card {
  border: 1px solid #2e333d;
  border-radius: 10px;
  background: var(--ink);
  box-shadow: var(--shadow);
  color: white;
  padding: 18px;
}

.retrieval-card > header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: rgb(255 255 255 / 58%);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.prompt {
  display: grid;
  min-height: 235px;
  place-content: center;
  text-align: center;
}

.prompt small {
  color: var(--acid);
  font-size: 0.76rem;
  font-weight: 800;
}

.prompt h2 {
  margin: 10px 0 14px;
  color: white;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: clamp(2.2rem, 12vw, 4.3rem);
  overflow-wrap: anywhere;
}

.prompt p {
  max-width: 29rem;
  margin: 0 auto;
  color: rgb(255 255 255 / 62%);
  font-size: 0.86rem;
}

.reveal-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 7px;
  background: var(--acid);
  color: #10130a;
  font-weight: 900;
  cursor: pointer;
}

.answer {
  margin-top: 20px;
  border-top: 1px solid rgb(255 255 255 / 18%);
  padding-top: 20px;
}

.answer-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.answer-heading strong,
.answer-heading span {
  display: block;
}

.answer-heading strong {
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 1.9rem;
}

.answer-heading div span {
  color: rgb(255 255 255 / 58%);
  font-size: 0.8rem;
}

.answer-heading > span {
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 999px;
  padding: 4px 9px;
  color: rgb(255 255 255 / 70%);
  font-size: 0.68rem;
}

.answer-meaning {
  margin: 14px 0 5px;
  color: var(--acid);
  font-size: 1.12rem;
  font-weight: 900;
}

.answer > p:not(.answer-meaning) {
  color: rgb(255 255 255 / 68%);
}

.speak-box {
  margin: 18px 0;
  border-left: 4px solid var(--coral);
  background: var(--ink-2);
  padding: 14px;
}

.speak-box span {
  color: var(--coral);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.12em;
}

.speak-box p {
  margin-bottom: 0;
}

.speak-box p:nth-child(2) {
  margin-top: 5px;
  font-size: 1rem;
  font-weight: 750;
}

.speak-box p:last-child {
  margin-top: 3px;
  color: rgb(255 255 255 / 58%);
  font-size: 0.8rem;
}

.ratings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 0;
  border: 0;
  padding: 0;
}

.ratings legend {
  grid-column: 1 / -1;
  width: 100%;
  margin-bottom: 5px;
  color: rgb(255 255 255 / 55%);
  font-size: 0.75rem;
}

.ratings button {
  min-height: 48px;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 7px;
  background: transparent;
  color: white;
  padding: 7px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.ratings button:last-child {
  border-color: var(--blue);
  background: var(--blue);
}

.session-note,
.copyright-scope {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.62;
}

.jump-nav {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 16px -14px 0;
  padding: 10px 14px 14px;
  scrollbar-width: none;
}

.jump-nav::-webkit-scrollbar,
.filter-row::-webkit-scrollbar {
  display: none;
}

.jump-nav a {
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.course-overview {
  position: relative;
  margin-top: 38px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--blue);
  color: white;
  padding: 28px 20px;
}

.course-overview::after {
  content: "190";
  position: absolute;
  right: -12px;
  bottom: -42px;
  color: rgb(255 255 255 / 10%);
  font-size: 9rem;
  font-weight: 950;
  line-height: 1;
}

.course-overview .kicker {
  color: var(--acid);
}

.course-overview h2 {
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
  font-size: clamp(1.8rem, 8vw, 3.2rem);
  letter-spacing: -0.04em;
}

.course-overview > p {
  position: relative;
  z-index: 1;
  color: rgb(255 255 255 / 78%);
}

.fact-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 22px;
  background: rgb(255 255 255 / 18%);
}

.fact-strip div {
  background: rgb(17 19 24 / 22%);
  padding: 12px 5px;
  text-align: center;
}

.fact-strip strong,
.fact-strip span {
  display: block;
}

.fact-strip strong {
  font-size: 1.15rem;
}

.fact-strip span {
  color: rgb(255 255 255 / 66%);
  font-size: 0.66rem;
}

.course-overview .copyright-scope {
  margin-top: 14px;
  color: rgb(255 255 255 / 62%);
}

.section {
  padding: 60px 0 12px;
}

.section-heading {
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-bottom: 10px;
  font-size: clamp(1.75rem, 7vw, 2.9rem);
  letter-spacing: -0.045em;
}

.section-heading > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.timeline {
  position: relative;
  display: grid;
  gap: 10px;
  padding-left: 13px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 3px;
  background: linear-gradient(var(--blue), var(--acid), var(--coral));
}

.timeline details,
.pattern-stack details,
.transfer-list details,
.research-panel {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
}

.timeline summary,
.pattern-stack summary,
.transfer-list summary,
.research-panel summary {
  position: relative;
  min-height: 58px;
  cursor: pointer;
  list-style: none;
  padding: 15px 44px 15px 15px;
  font-weight: 850;
}

.timeline summary::-webkit-details-marker,
.pattern-stack summary::-webkit-details-marker,
.transfer-list summary::-webkit-details-marker,
.research-panel summary::-webkit-details-marker {
  display: none;
}

.timeline summary::after,
.pattern-stack summary::after,
.transfer-list summary::after,
.research-panel summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: var(--blue);
  font-size: 1.35rem;
}

details[open] > summary::after {
  content: "−";
}

.day-code {
  display: inline-grid;
  min-width: 38px;
  height: 28px;
  margin-right: 9px;
  place-items: center;
  border-radius: 4px;
  background: var(--ink);
  color: var(--acid);
  font-size: 0.7rem;
  font-weight: 900;
}

.detail-body {
  border-top: 1px solid var(--line);
  padding: 15px;
}

.detail-body p:last-child,
.detail-body ul:last-child {
  margin-bottom: 0;
}

.learning-loop {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin-top: 13px;
}

.learning-loop span {
  flex: 1 0 auto;
  border-radius: 5px;
  background: var(--blue-soft);
  padding: 7px 9px;
  color: #264487;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.word-tools {
  position: sticky;
  top: 66px;
  z-index: 20;
  margin: 0 -14px 12px;
  border-block: 1px solid rgb(216 217 220 / 82%);
  background: rgb(247 246 242 / 95%);
  padding: 11px 14px;
  backdrop-filter: blur(14px);
}

.word-tools input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: white;
  padding: 10px 13px;
  color: var(--ink);
  font-size: 1rem;
}

.word-tools input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(45 108 255 / 16%);
}

.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 8px;
  scrollbar-width: none;
}

.filter-row button {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 7px 11px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.filter-row button[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.result-count {
  color: var(--muted);
  font-size: 0.78rem;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.word-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  padding: 13px;
}

.word-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 7px;
}

.word-card h3 {
  overflow-wrap: anywhere;
  margin-bottom: 1px;
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 1.25rem;
}

.word-card header span {
  flex: 0 0 auto;
  border-radius: 3px;
  background: var(--blue-soft);
  padding: 3px 6px;
  color: #35518f;
  font-size: 0.62rem;
}

.word-card .reading {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
}

.word-card .meaning {
  margin-bottom: 0;
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 850;
}

.word-card details {
  margin-top: 9px;
  border-top: 1px solid var(--line);
}

.word-card summary {
  min-height: 42px;
  cursor: pointer;
  padding-top: 9px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.word-card details p {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.76rem;
}

.word-card details p[lang="ja"] {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.dark-section {
  width: auto;
  margin-inline: -14px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  padding: 38px 14px 28px;
}

.dark-section .section-heading > p:last-child {
  color: rgb(255 255 255 / 62%);
}

.dark-section .kicker {
  color: var(--acid);
}

.contrast-grid {
  display: grid;
  gap: 8px;
}

.contrast-card {
  border: 1px solid rgb(255 255 255 / 17%);
  border-radius: 8px;
  background: var(--ink-2);
  padding: 15px;
}

.contrast-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.contrast-pair strong {
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 1.08rem;
  text-align: center;
}

.contrast-pair span {
  color: var(--coral);
  font-size: 0.66rem;
  font-weight: 950;
}

.contrast-card p {
  margin-bottom: 0;
  color: rgb(255 255 255 / 68%);
  font-size: 0.82rem;
}

.pattern-stack,
.transfer-list {
  display: grid;
  gap: 8px;
}

.pattern-form {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-family: "Noto Serif JP", "Yu Mincho", serif;
  font-size: 1.08rem;
}

.transfer-list .detail-body strong {
  color: var(--blue);
}

.method-list {
  display: grid;
  gap: 8px;
}

.method-list article {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 11px;
  border-top: 1px solid var(--line);
  padding: 16px 0 8px;
}

.method-list article > strong {
  color: var(--coral);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.method-list h3 {
  margin-bottom: 6px;
  font-size: 1.02rem;
}

.method-list p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.research-panel {
  margin-top: 16px;
}

.research-panel > div {
  border-top: 1px solid var(--line);
  padding: 15px;
}

.research-panel ul {
  padding-left: 1.2rem;
}

.research-panel li + li {
  margin-top: 8px;
}

.research-panel a {
  color: var(--blue);
  text-underline-offset: 3px;
}

footer {
  margin-top: 62px;
  border-top: 4px solid var(--ink);
  padding: 24px 0 calc(34px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.76rem;
}

footer strong {
  color: var(--ink);
}

footer p {
  margin: 4px 0 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(197 239 65 / 75%);
  outline-offset: 3px;
}

@media (min-width: 620px) {
  .practice-shell {
    padding-top: 48px;
  }

  .retrieval-card {
    padding: 26px;
  }

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

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

  .dark-section {
    margin-inline: 0;
    padding-inline: 24px;
  }
}

@media (max-width: 390px) {
  .topbar,
  main,
  footer {
    width: min(100% - 22px, var(--max));
  }

  .identity small {
    display: none;
  }

  .word-list {
    grid-template-columns: 1fr;
  }

  .fact-strip span {
    font-size: 0.6rem;
  }

  .ratings button {
    font-size: 0.7rem;
  }
}

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

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

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #f2f2ed;
    --ink-2: #272a31;
    --paper: #111318;
    --card: #1b1e24;
    --muted: #afb3bc;
    --line: #343840;
    --blue: #78a0ff;
    --blue-soft: #202a43;
  }

  body {
    background: #111318;
  }

  .topbar,
  .word-tools {
    background: rgb(17 19 24 / 94%);
  }

  .identity-code,
  .day-code,
  .retrieval-card,
  .dark-section {
    background: #050608;
  }

  .word-tools input,
  .filter-row button {
    background: #1b1e24;
  }

  .learning-loop span,
  .word-card header span {
    color: #aec4ff;
  }

  .course-overview {
    background: #214db8;
  }

  footer {
    border-top-color: #f2f2ed;
  }
}
