/* =========================================================
   言葉 KOTOBA — paper, ink, vermilion
   ========================================================= */

:root {
  --paper: #ffffff;
  --paper-deep: #f4f3f0;
  --paper-light: #ffffff;
  --ink: #232220;
  --ink-soft: #4b4944;
  --muted: #77736b;
  --faint: #a5a097;
  --line: #e6e2db;
  --line-strong: #d5cfc5;
  --vermilion: #b8452f;
  --vermilion-deep: #973421;
  --vermilion-pale: #f7e9e4;
  --moss: #526b58;
  --moss-pale: #eaf0e8;
  --gold: #a8844c;
  --n5: #587563;
  --n4: #4d7480;
  --n3: #9a7946;
  --n2: #a8624b;
  --n1: #775b72;
  --serif: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", "Songti SC", "SimSun", serif;
  --sans: "Yu Gothic", "YuGothic", "Hiragino Sans", "Noto Sans JP", "PingFang SC", "Microsoft YaHei", sans-serif;
  --shadow-sm: 0 2px 10px rgba(35, 34, 32, 0.035);
  --shadow-md: 0 18px 50px rgba(35, 34, 32, 0.09);
  --radius: 14px;
  --header-height: 76px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:has(dialog[open]) {
  overflow: hidden;
}

body::before {
  display: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: 3px;
}

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

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

svg {
  display: block;
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 9px 14px;
  color: var(--paper-light);
  background: var(--ink);
  border-radius: 8px;
  transform: translateY(-150%);
  transition: transform 0.18s ease;
}

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

.noscript-note {
  margin: 16px;
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--paper-light);
  font-size: 12px;
  text-align: center;
}

/* ---------- shell & header ---------- */

.page-shell {
  width: min(100% - 64px, 1220px);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  height: var(--header-height);
  margin: 0 calc(50% - 50vw);
  padding: 0 max(32px, calc((100vw - 1220px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: box-shadow 0.25s ease, background 0.25s ease;
}

.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 30px rgba(35, 34, 32, 0.06);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-seal {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  color: #f8f2e5;
  background: var(--vermilion);
  border-radius: 5px;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(118, 36, 23, 0.22);
  transform: rotate(-1.5deg);
}

.brand-type {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-type strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.brand-type small {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(207, 194, 173, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.nav-item {
  position: relative;
  padding: 7px 18px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.06em;
  transition: color 0.18s ease, background 0.18s ease;
}

.nav-item:hover {
  color: var(--ink);
}

.nav-item.is-active {
  color: var(--paper-light);
  background: var(--ink);
}

.header-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 146px;
}

.today-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.today-chip strong {
  color: var(--ink);
  font-size: 15px;
}

.today-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vermilion);
  box-shadow: 0 0 0 3px rgba(184, 69, 47, 0.1);
}

/* ---------- views & type ---------- */

main {
  min-height: 72vh;
}

.view {
  padding-bottom: 80px;
  animation: view-in 0.38s ease both;
}

.view[hidden] {
  display: none !important;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--vermilion);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.eyebrow > span {
  display: inline-block;
  width: 24px;
  height: 1px;
  background: currentColor;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(39px, 5.3vw, 66px);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.035em;
}

h1 em {
  color: var(--vermilion);
  font-style: normal;
  font-weight: 650;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 30px;
  min-height: 445px;
  padding: 82px 0 56px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero::after {
  content: "";
  position: absolute;
  right: 31%;
  bottom: 0;
  width: 1px;
  height: 45%;
  background: linear-gradient(to bottom, transparent, var(--line-strong));
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero h1 {
  margin: 20px 0 23px;
}

.hero-desc,
.section-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.95;
}

.hero-stats {
  display: flex;
  gap: 30px;
  margin-top: 38px;
}

.hero-stats > div {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 5px;
}

.hero-stats strong {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.hero-stats span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.hero-art {
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 340px;
  min-height: 295px;
}

.hero-art::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 18px;
  width: 250px;
  height: 250px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  opacity: 0.7;
}

.art-kanji {
  position: absolute;
  top: 0;
  right: 45px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 155px;
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.13em;
  writing-mode: vertical-rl;
  opacity: 0.94;
}

.art-caption {
  position: absolute;
  right: 5px;
  bottom: 23px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.9;
  letter-spacing: 0.16em;
  writing-mode: vertical-rl;
}

.art-stamp {
  position: absolute;
  right: 252px;
  bottom: 35px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--vermilion);
  border: 1px solid var(--vermilion);
  border-radius: 3px;
  font-family: var(--serif);
  font-size: 18px;
  transform: rotate(-4deg);
}

.art-stroke {
  position: absolute;
  display: block;
  height: 1px;
  background: var(--line-strong);
  transform-origin: right center;
}

.stroke-one {
  top: 72px;
  right: 280px;
  width: 65px;
  transform: rotate(-18deg);
}

.stroke-two {
  bottom: 68px;
  left: 0;
  width: 90px;
  transform: rotate(10deg);
}

/* ---------- search & filter ---------- */

.toolbox {
  padding: 29px 0 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 64px;
  padding: 0 18px 0 21px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset, var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--ink-soft);
  background: var(--paper-light);
  box-shadow: 0 0 0 3px rgba(38, 35, 30, 0.055), var(--shadow-sm);
}

.search-box .icon {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  margin-right: 15px;
  color: var(--muted);
  stroke-width: 1.6;
}

.search-box input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
  letter-spacing: 0.01em;
  -webkit-appearance: none;
  appearance: none;
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-box input::placeholder {
  color: var(--faint);
}

.search-clear {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-left: 8px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--paper-deep);
}

.search-clear:hover {
  color: var(--ink);
}

.search-clear svg {
  width: 14px;
  height: 14px;
}

.search-kbd {
  flex: 0 0 auto;
  min-width: 25px;
  margin-left: 13px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.45);
  font-family: var(--sans);
  font-size: 11px;
  text-align: center;
}

.quick-searches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 13px;
  padding: 12px 2px 0;
  color: var(--faint);
  font-size: 11px;
}

.quick-searches > span {
  letter-spacing: 0.12em;
}

.quick-searches button {
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.quick-searches button:hover {
  color: var(--vermilion);
  border-bottom-color: currentColor;
}

.filter-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 27px 0 13px;
  border-bottom: 1px solid var(--line);
}

.level-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.level-tabs::-webkit-scrollbar {
  display: none;
}

.level-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.level-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.45);
}

.level-tab.is-active {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--paper-light);
  box-shadow: var(--shadow-sm);
}

.lv {
  display: inline-grid;
  width: 25px;
  height: 20px;
  place-items: center;
  border-radius: 3px;
  color: #fff;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lv-n5 { background: var(--n5); }
.lv-n4 { background: var(--n4); }
.lv-n3 { background: var(--n3); }
.lv-n2 { background: var(--n2); }
.lv-n1 { background: var(--n1); }

.tab-count {
  color: var(--faint);
  font-size: 9px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.level-tab.is-active .tab-count {
  color: var(--muted);
}

.result-meta {
  flex: 0 0 auto;
  padding-bottom: 7px;
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---------- vocabulary groups ---------- */

.level-groups {
  padding-top: 8px;
}

.level-group {
  padding: 28px 0 34px;
  border-bottom: 1px solid var(--line);
}

.level-group:last-child {
  border-bottom: 0;
}

.level-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 19px;
}

.level-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #f9f5eb;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.mark-n5 { background: var(--n5); }
.mark-n4 { background: var(--n4); }
.mark-n3 { background: var(--n3); }
.mark-n2 { background: var(--n2); }
.mark-n1 { background: var(--n1); }

.level-title {
  min-width: 0;
}

.level-title h2 {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.03em;
}

.level-title h2 small {
  color: var(--faint);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.16em;
}

.level-title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.level-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.level-progress {
  width: 74px;
  height: 3px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--line);
}

.level-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--moss);
  transition: width 0.35s ease;
}

.level-progress-label {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.word-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 111px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.67);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.word-card:hover {
  z-index: 1;
  border-color: var(--line-strong);
  background: var(--paper-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.word-card.is-mastered::after {
  content: "✓";
  position: absolute;
  top: 8px;
  left: 9px;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-light);
  background: var(--moss);
  font-size: 9px;
  font-weight: 800;
}

.word-card-main {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  padding: 15px 44px 13px 16px;
  border: 0;
  background: transparent;
  text-align: left;
}

.card-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 15px;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.card-topline .pos {
  overflow: hidden;
  max-width: 90px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-word-row {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  margin-top: 7px;
}

.card-word {
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-kana {
  overflow: hidden;
  min-width: 0;
  max-width: 56%;
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meaning {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sound-button {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--faint);
  background: transparent;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.sound-button:hover {
  color: var(--vermilion);
  border-color: var(--line);
  background: var(--paper-light);
}

.sound-button svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.65;
}

.word-card > .sound-button {
  position: absolute;
  top: 10px;
  right: 9px;
}

.sound-button.is-speaking {
  color: var(--vermilion);
  background: var(--vermilion-pale);
}

.mastery-btn {
  position: absolute;
  right: 10px;
  bottom: 9px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--faint);
  background: transparent;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.mastery-btn:hover {
  color: var(--moss);
  border-color: var(--line);
}

.word-card.is-mastered .mastery-btn {
  color: var(--moss);
}

.more-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.more-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.more-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--paper-light);
}

.more-button svg {
  width: 13px;
  height: 13px;
}

.more-note {
  color: var(--faint);
  font-size: 10px;
}

.empty-state {
  padding: 70px 20px;
  text-align: center;
}

.empty-mark {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--faint);
  font-family: var(--serif);
  font-size: 25px;
}

.empty-state h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}

.empty-state p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

mark {
  padding: 0 1px;
  color: inherit;
  background: rgba(184, 69, 47, 0.16);
  border-radius: 2px;
}

/* ---------- grammar ---------- */

.section-intro,
.practice-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding: 70px 0 5px;
}

.section-intro h1,
.practice-intro h1 {
  margin: 18px 0 18px;
  font-size: clamp(36px, 4.8vw, 58px);
}

.grammar-count-card,
.practice-badge {
  flex: 0 0 auto;
  min-width: 172px;
  padding: 20px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.55);
  text-align: right;
}

.count-kicker {
  display: block;
  color: var(--faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.grammar-count-card strong {
  display: block;
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.grammar-count-card > span:not(.count-kicker):not(.count-levels) {
  color: var(--muted);
  font-size: 10px;
}

.count-levels {
  display: block;
  margin-top: 13px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.grammar-groups {
  padding-top: 0;
}

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

.grammar-card {
  position: relative;
  display: flex;
  min-height: 180px;
  flex-direction: column;
  align-items: flex-start;
  padding: 22px 24px 19px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.62);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.grammar-card:hover {
  border-color: var(--line-strong);
  background: var(--paper-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.grammar-card-top {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.grammar-card-pattern {
  display: block;
  margin-top: 9px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.015em;
}

.grammar-card-meaning {
  display: block;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
}

.grammar-card-example {
  display: block;
  width: 100%;
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.55;
}

.grammar-card-example span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grammar-card-arrow {
  position: absolute;
  right: 19px;
  bottom: 17px;
  color: var(--faint);
  transition: color 0.18s ease, transform 0.18s ease;
}

.grammar-card-arrow svg {
  width: 14px;
  height: 14px;
}

.grammar-card:hover .grammar-card-arrow {
  color: var(--vermilion);
  transform: translateX(2px);
}

.grammar-card-example {
  padding-right: 20px;
}

/* ---------- flashcards ---------- */

.practice-intro {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.practice-badge {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
  min-width: 190px;
  padding: 16px 20px;
}

.practice-badge span {
  color: var(--muted);
  font-size: 10px;
}

.practice-badge strong {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.practice-badge small {
  color: var(--faint);
  font-size: 9px;
}

.practice-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0;
}

.compact-tabs {
  gap: 2px;
}

.compact-tabs .level-tab {
  min-width: 43px;
  justify-content: center;
  padding: 7px 11px;
  font-size: 11px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.text-button:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper-light);
}

.text-button svg {
  width: 14px;
  height: 14px;
}

.flash-stage {
  width: min(100%, 790px);
  margin: 0 auto;
  padding-top: 12px;
}

.flash-progress {
  margin-bottom: 15px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 7px;
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.progress-copy span:first-child {
  color: var(--ink-soft);
  font-weight: 650;
}

.progress-track {
  height: 3px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--line);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--vermilion);
  transition: width 0.35s ease;
}

.flashcard {
  position: relative;
  height: 385px;
  outline: 0;
  perspective: 1600px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.flashcard:focus-visible .flash-inner {
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--vermilion);
}

.flash-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  transition: transform 0.55s cubic-bezier(0.22, 0.75, 0.25, 1), box-shadow 0.25s ease;
  transform-style: preserve-3d;
}

.flashcard.is-flipped .flash-inner {
  transform: rotateY(180deg);
}

.flashcard:hover .flash-inner {
  box-shadow: 0 16px 50px rgba(56, 45, 27, 0.08);
}

.flash-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 28px 32px 25px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent 55%),
    var(--paper-light);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.flash-face::after {
  content: "";
  position: absolute;
  right: -65px;
  bottom: -80px;
  width: 220px;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 50%;
  pointer-events: none;
}

.flash-back {
  transform: rotateY(180deg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent 55%),
    #ffffff;
}

.flash-topline {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 33px;
}

.level-name {
  display: inline-grid;
  min-width: 31px;
  height: 20px;
  place-items: center;
  padding: 0 6px;
  border-radius: 3px;
  color: #fff;
  background: var(--n4);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.level-name[data-level="N5"] { background: var(--n5); }
.level-name[data-level="N4"] { background: var(--n4); }
.level-name[data-level="N3"] { background: var(--n3); }
.level-name[data-level="N2"] { background: var(--n2); }
.level-name[data-level="N1"] { background: var(--n1); }

.flash-topline .pos {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.flash-topline .sound-button {
  margin-left: auto;
}

.sound-button.round {
  width: 35px;
  height: 35px;
  border-color: var(--line);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.35);
}

.sound-button.round svg {
  width: 17px;
  height: 17px;
}

.flash-word-wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  text-align: center;
}

.flash-kana {
  color: var(--vermilion);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.2em;
}

.flash-word {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: clamp(52px, 9vw, 78px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.045em;
}

.flash-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.hint-line {
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--line-strong);
}

.back-label {
  margin-top: 24px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.flash-meaning {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 0 12px;
  text-align: center;
}

.flash-meaning span {
  display: inline-block;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.4);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.55;
}

.flash-back-word {
  display: flex;
  align-items: baseline;
  gap: 11px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.flash-back-word span:first-child {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 650;
}

.flash-back-word span:last-child {
  color: var(--faint);
  font-family: var(--serif);
  font-size: 12px;
}

.back-tip {
  margin-top: 6px;
  color: var(--faint);
  font-size: 10px;
}

.flash-actions {
  display: grid;
  grid-template-columns: 1fr 0.75fr 1fr;
  gap: 9px;
  margin-top: 14px;
}

.grade-button {
  display: flex;
  min-height: 57px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.grade-button:hover {
  transform: translateY(-1px);
}

.grade-button span:not(.shortcut) {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.grade-button strong {
  font-size: 12px;
  font-weight: 650;
}

.grade-button small {
  color: var(--faint);
  font-size: 9px;
}

.grade-button.unknown:hover {
  border-color: #c88c7d;
  background: #fbf0ec;
}

.grade-button.known:hover {
  border-color: #8ba28f;
  background: #edf3ed;
}

.shortcut {
  display: inline-grid;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--faint);
  font-size: 8px;
  font-weight: 650;
}

.flip-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 57px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.flip-trigger:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.38);
}

.keyboard-note {
  margin-top: 17px;
  color: var(--faint);
  font-size: 9px;
  text-align: center;
  letter-spacing: 0.03em;
}

.deck-complete {
  display: flex;
  min-height: 385px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.45), transparent 55%),
    var(--paper-light);
  text-align: center;
}

.deck-complete[hidden] {
  display: none;
}

.complete-seal {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--vermilion);
  border-radius: 4px;
  color: var(--vermilion);
  font-family: var(--serif);
  font-size: 25px;
  transform: rotate(-3deg);
}

.complete-kicker {
  margin-top: 21px;
  color: var(--faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.deck-complete h2 {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.complete-result {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.complete-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.complete-actions .solid-button,
.complete-actions .ghost-button {
  min-width: 116px;
  flex: 0 0 auto;
}

kbd {
  display: inline-block;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.35);
  font-family: var(--sans);
  font-size: 9px;
}

/* ---------- listening ---------- */

.score-cluster {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  padding-bottom: 9px;
}

.score-cluster > div {
  text-align: right;
}

.score-cluster span {
  display: block;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.score-cluster strong {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.listen-stage {
  width: min(100%, 800px);
  margin: 8px auto 0;
  padding: 28px 34px 30px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.45);
}

.listen-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.listen-index {
  font-variant-numeric: tabular-nums;
}

.listen-level-tag {
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.listen-player {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 34px 0 26px;
  text-align: center;
}

.player-ring {
  position: absolute;
  top: 7px;
  left: 50%;
  display: block;
  width: 150px;
  height: 150px;
  border: 1px solid var(--line);
  border-radius: 50%;
  pointer-events: none;
  transform: translateX(-50%);
}

.player-ring-two {
  width: 190px;
  height: 190px;
  top: -13px;
  opacity: 0.6;
}

.play-main {
  position: relative;
  z-index: 1;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border: 1px solid var(--vermilion);
  border-radius: 50%;
  color: var(--paper-light);
  background: var(--vermilion);
  box-shadow: 0 8px 22px rgba(151, 52, 33, 0.2);
  transition: transform 0.18s ease, background 0.18s ease;
}

.play-main:hover {
  background: var(--vermilion-deep);
  transform: scale(1.025);
}

.play-main:active {
  transform: scale(0.98);
}

.play-main svg {
  width: 32px;
  height: 32px;
  stroke-width: 1.5;
}

.play-main.is-speaking {
  animation: pulse-speak 1.4s ease infinite;
}

@keyframes pulse-speak {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 69, 47, 0.25); }
  50% { box-shadow: 0 0 0 13px rgba(184, 69, 47, 0); }
}

.listen-player > p {
  margin-top: 28px;
  color: var(--ink-soft);
  font-size: 13px;
}

.listen-replay {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
  color: var(--faint);
  font-size: 10px;
}

.listen-replay button {
  padding: 1px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
}

.listen-replay button:hover {
  color: var(--vermilion);
  border-bottom-color: currentColor;
}

.voice-status {
  min-height: 16px;
  max-width: 310px;
  margin: 12px auto 0;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.6;
}

.voice-help {
  width: min(100%, 320px);
  margin: 2px auto 0;
  color: var(--faint);
  font-size: 9px;
  text-align: left;
}

.voice-help summary {
  width: fit-content;
  margin: 0 auto;
  color: var(--faint);
  cursor: pointer;
  list-style: none;
  text-align: center;
}

.voice-help summary::-webkit-details-marker {
  display: none;
}

.voice-help summary::after {
  content: " ↗";
  font-size: 8px;
}

.voice-help[open] summary::after {
  content: " ↓";
}

.voice-help p {
  margin-top: 7px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 5px;
  color: var(--muted);
  line-height: 1.7;
}

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

.listen-option {
  display: flex;
  min-height: 59px;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.listen-option:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--paper-light);
  transform: translateY(-1px);
}

.listen-option .option-index {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--faint);
  font-size: 9px;
}

.listen-option .option-text {
  flex: 1;
}

.listen-option.is-correct {
  border-color: #8aa18f;
  background: var(--moss-pale);
}

.listen-option.is-correct .option-index {
  color: var(--moss);
  border-color: #8aa18f;
}

.listen-option.is-wrong {
  border-color: #cf9b8e;
  background: #f8e8e2;
}

.listen-option.is-wrong .option-index {
  color: var(--vermilion);
  border-color: #cf9b8e;
}

.listen-option:disabled {
  cursor: default;
}

.listen-option.is-dimmed {
  opacity: 0.52;
}

.listen-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.listen-feedback[hidden] {
  display: none;
}

.feedback-copy {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.feedback-mark {
  display: inline-grid;
  min-width: 43px;
  height: 24px;
  place-items: center;
  border: 1px solid #8aa18f;
  border-radius: 3px;
  color: var(--moss);
  font-family: var(--serif);
  font-size: 11px;
}

.feedback-mark.is-wrong {
  border-color: #cf9b8e;
  color: var(--vermilion);
}

.feedback-copy strong {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-copy p {
  overflow: hidden;
  max-width: 340px;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.solid-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--ink);
  border-radius: 5px;
  color: var(--paper-light);
  background: var(--ink);
  font-size: 11px;
  font-weight: 600;
  transition: background 0.18s ease, transform 0.18s ease;
}

.solid-button:hover {
  background: #3a362e;
  transform: translateY(-1px);
}

/* ---------- dialog ---------- */

.detail-dialog {
  width: min(100% - 36px, 620px);
  max-height: min(86vh, 760px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
}

.detail-dialog::backdrop {
  background: rgba(32, 29, 24, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.detail-dialog[open] {
  animation: dialog-in 0.25s ease both;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.dialog-card {
  position: relative;
  max-height: min(86vh, 760px);
  overflow-y: auto;
  padding: 40px 43px 35px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.4), transparent 45%),
    var(--paper-light);
  box-shadow: 0 30px 80px rgba(35, 28, 19, 0.2);
}

.dialog-close {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 2;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--faint);
  background: transparent;
}

.dialog-close:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}

.dialog-close svg {
  width: 16px;
  height: 16px;
}

.word-detail-top {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.word-detail-kana {
  margin-top: 27px;
  color: var(--vermilion);
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.17em;
}

.word-detail-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 1px;
}

.word-detail-title h2 {
  font-family: var(--serif);
  font-size: 53px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.04em;
}

.word-detail-title .sound-button {
  margin-top: 6px;
  border-color: var(--line);
  color: var(--ink-soft);
}

.detail-section {
  margin-top: 25px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-label {
  display: block;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.meaning-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.meaning-list span {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.4);
  font-size: 16px;
  font-weight: 600;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-meta-grid > div {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.25);
}

.detail-meta-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 25px;
}

.detail-actions .solid-button {
  flex: 1;
}

.ghost-button {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
}

.ghost-button:hover {
  background: var(--paper);
}

.grammar-dialog-card {
  width: 100%;
}

.grammar-detail-level {
  display: inline-grid;
  min-width: 33px;
  height: 21px;
  place-items: center;
  padding: 0 6px;
  border-radius: 3px;
  color: #fff;
  background: var(--n3);
  font-size: 9px;
  font-weight: 800;
}

.grammar-detail-title {
  margin-top: 17px;
  font-family: var(--serif);
  font-size: clamp(31px, 6vw, 43px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.015em;
}

.grammar-detail-meaning {
  margin-top: 8px;
  color: var(--vermilion);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
}

.formation-box {
  margin-top: 9px;
  padding: 13px 16px;
  border-left: 2px solid var(--vermilion);
  background: rgba(184, 69, 47, 0.045);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.8;
}

.example-block {
  margin-top: 9px;
}

.example-jp {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 550;
  line-height: 1.8;
  letter-spacing: 0.02em;
}

.example-cn {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.note-box {
  margin-top: 9px;
  padding: 12px 15px;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

/* ---------- toast / footer / bottom nav ---------- */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 120;
  max-width: calc(100vw - 40px);
  padding: 10px 17px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: var(--paper-light);
  background: rgba(38, 35, 30, 0.94);
  box-shadow: 0 10px 30px rgba(28, 23, 17, 0.2);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.site-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin: 0 calc(50% - 50vw);
  padding: 34px max(32px, calc((100vw - 1220px) / 2)) 38px;
  border-top: 1px solid var(--line);
  color: var(--faint);
}

.site-footer > div {
  display: flex;
  align-items: center;
  gap: 11px;
}

.footer-seal {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--vermilion);
  font-family: var(--serif);
  font-size: 15px;
}

.site-footer p {
  font-size: 9px;
  line-height: 1.8;
  letter-spacing: 0.02em;
}

.site-footer strong {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.footer-note {
  text-align: right;
}

.footer-data {
  color: var(--faint);
  font-size: 8px;
}

.footer-data a {
  color: var(--muted);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 2px;
}

.footer-data a:hover {
  color: var(--vermilion);
}

.bottom-nav {
  display: none;
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .page-shell {
    width: min(100% - 48px, 1220px);
  }

  .hero {
    grid-template-columns: 1fr 300px;
  }

  .art-kanji {
    right: 24px;
    font-size: 135px;
  }

  .art-caption {
    right: -8px;
  }

  .art-stamp {
    right: 218px;
  }

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

@media (max-width: 860px) {
  :root {
    --header-height: 64px;
  }

  .page-shell {
    width: min(100% - 36px, 680px);
  }

  .site-header {
    padding: 0 18px;
    gap: 12px;
  }

  .desktop-nav {
    display: none;
  }

  .header-side {
    min-width: 0;
  }

  .brand-seal {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .brand-type strong {
    font-size: 18px;
  }

  .brand-type small {
    font-size: 7px;
  }

  .hero {
    display: block;
    min-height: 0;
    padding: 49px 0 38px;
  }

  .hero::after {
    display: none;
  }

  .hero h1 {
    margin: 16px 0 17px;
    font-size: clamp(38px, 10.6vw, 55px);
  }

  .hero-desc {
    font-size: 12px;
    line-height: 1.9;
  }

  .hero-desc br {
    display: none;
  }

  .hero-stats {
    gap: 24px;
    margin-top: 26px;
  }

  .hero-stats strong {
    font-size: 22px;
  }

  .hero-art {
    position: absolute;
    top: 17px;
    right: -22px;
    width: 190px;
    min-height: 190px;
    opacity: 0.06;
    pointer-events: none;
  }

  .hero-art::before,
  .art-caption,
  .art-stamp,
  .art-stroke {
    display: none;
  }

  .art-kanji {
    top: 0;
    right: 10px;
    font-size: 138px;
  }

  .toolbox {
    padding-top: 22px;
  }

  .search-box {
    height: 54px;
    padding: 0 13px 0 15px;
  }

  .search-box .icon {
    width: 19px;
    height: 19px;
    margin-right: 12px;
  }

  .search-box input {
    font-size: 15px;
  }

  .search-kbd {
    display: none;
  }

  .quick-searches {
    gap: 11px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .filter-row {
    display: block;
    padding: 17px 0 9px;
  }

  .level-tabs {
    margin: 0 -18px;
    padding: 0 18px;
  }

  .filter-row .level-tabs {
    flex-wrap: wrap;
    overflow: visible;
    margin: 0;
    padding: 0;
    row-gap: 5px;
  }

  .level-tab {
    padding: 7px 9px;
    font-size: 11px;
  }

  .level-tab .lv {
    width: 23px;
    height: 19px;
  }

  .result-meta {
    padding: 8px 0 0;
    font-size: 10px;
  }

  .level-group {
    padding: 24px 0 28px;
  }

  .level-mark {
    width: 42px;
    height: 42px;
    font-size: 14px;
  }

  .level-title h2 {
    font-size: 19px;
  }

  .level-progress-wrap {
    gap: 7px;
  }

  .level-progress {
    width: 48px;
  }

  .word-card {
    min-height: 106px;
  }

  .card-word {
    font-size: 21px;
  }

  .section-intro,
  .practice-intro {
    display: block;
    padding: 43px 0 25px;
  }

  .section-intro h1,
  .practice-intro h1 {
    margin: 14px 0 13px;
    font-size: clamp(34px, 9vw, 47px);
  }

  .practice-intro {
    padding: 29px 0 17px;
  }

  .practice-intro h1 {
    margin: 12px 0 10px;
    font-size: clamp(32px, 8.8vw, 43px);
  }

  .practice-intro .section-desc {
    font-size: 11px;
  }

  .section-desc {
    font-size: 12px;
    line-height: 1.9;
  }

  .section-desc br {
    display: none;
  }

  .grammar-count-card {
    display: none;
  }

  .practice-badge {
    display: none;
  }

  .grammar-grid {
    grid-template-columns: 1fr;
  }

  .grammar-card {
    min-height: 166px;
    padding: 19px 20px 17px;
  }

  .grammar-card-pattern {
    font-size: 23px;
  }

  .practice-toolbar {
    flex-wrap: wrap;
    gap: 11px;
    padding: 13px 0;
  }

  .practice-toolbar .level-tabs {
    margin: 0;
    padding: 0;
  }

  .toolbar-actions {
    margin-left: auto;
  }

  .flash-stage {
    padding-top: 7px;
  }

  .flashcard {
    height: 310px;
  }

  .flash-face {
    padding: 22px 22px 19px;
  }

  .flash-word {
    font-size: clamp(48px, 15vw, 64px);
  }

  .flash-meaning span {
    font-size: 17px;
  }

  .flash-actions {
    grid-template-columns: 1fr 0.55fr 1fr;
    gap: 7px;
  }

  .grade-button {
    min-height: 54px;
    gap: 8px;
    padding: 7px 9px;
  }

  .grade-button small {
    display: none;
  }

  .flip-trigger {
    min-height: 54px;
    font-size: 10px;
  }

  .flip-trigger .shortcut {
    display: none;
  }

  .keyboard-note {
    display: none;
  }

  .deck-complete {
    min-height: 355px;
    padding: 26px 20px;
  }

  .deck-complete h2 {
    font-size: 26px;
  }

  .complete-actions {
    width: 100%;
  }

  .complete-actions .solid-button,
  .complete-actions .ghost-button {
    min-width: 0;
    flex: 1;
  }

  .score-cluster {
    gap: 22px;
    margin-top: 20px;
    padding: 13px 0 0;
    border-top: 1px solid var(--line);
  }

  .score-cluster > div {
    text-align: left;
  }

  .score-cluster strong {
    font-size: 23px;
  }

  .listen-stage {
    margin-top: 4px;
    padding: 21px 17px 23px;
  }

  .listen-player {
    padding: 27px 0 22px;
  }

  .player-ring {
    width: 130px;
    height: 130px;
  }

  .player-ring-two {
    width: 162px;
    height: 162px;
    top: -9px;
  }

  .play-main {
    width: 82px;
    height: 82px;
  }

  .listen-options {
    grid-template-columns: 1fr;
  }

  .listen-option {
    min-height: 55px;
    font-size: 13px;
  }

  .listen-feedback {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .listen-feedback .solid-button {
    width: 100%;
  }

  .footer {
    padding-bottom: 100px;
  }

  .site-footer {
    display: block;
    margin-bottom: 76px;
    padding: 27px 18px 28px;
  }

  .site-footer .footer-note {
    margin-top: 13px;
    text-align: left;
  }

  .bottom-nav {
    position: fixed;
    right: 12px;
    bottom: calc(11px + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 6px;
    border: 1px solid rgba(207, 194, 173, 0.8);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 32px rgba(48, 38, 25, 0.13);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .bottom-item {
    display: flex;
    min-height: 50px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px;
    border: 0;
    border-radius: 8px;
    color: var(--faint);
    background: transparent;
    font-size: 9px;
    letter-spacing: 0.04em;
    transition: color 0.18s ease, background 0.18s ease;
  }

  .bottom-item svg {
    width: 19px;
    height: 19px;
    stroke-width: 1.55;
  }

  .bottom-item.is-active {
    color: var(--vermilion);
    background: rgba(184, 69, 47, 0.06);
  }

  .toast {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .detail-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
  }

  .dialog-card {
    max-height: 92vh;
    padding: 31px 22px calc(27px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
  }

  .detail-dialog[open] {
    animation: sheet-in 0.3s cubic-bezier(0.22, 0.75, 0.25, 1) both;
  }

  @keyframes sheet-in {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: none; }
  }

  .word-detail-title h2 {
    font-size: 46px;
  }

  .grammar-detail-title {
    font-size: 31px;
  }

  .example-jp {
    font-size: 18px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: calc(100% - 32px);
  }

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

  .word-card {
    min-height: 99px;
  }

  .card-word {
    font-size: 23px;
  }

  .level-progress-wrap {
    margin-left: auto;
  }

  .today-chip {
    font-size: 10px;
  }

  .today-chip strong {
    font-size: 13px;
  }

  .today-dot {
    width: 5px;
    height: 5px;
  }

  .quick-searches button:nth-of-type(4) {
    display: none;
  }

  .compact-tabs .level-tab {
    min-width: 39px;
    padding: 7px 8px;
  }

  .flashcard {
    height: 292px;
  }

  .flash-face {
    padding: 19px 18px 16px;
  }

  .flash-word {
    font-size: clamp(45px, 16vw, 59px);
  }

  .flash-kana {
    font-size: 13px;
  }

  .back-label {
    margin-top: 18px;
  }

  .flash-meaning span {
    font-size: 16px;
    padding: 4px 9px;
  }

  .flash-back-word span:first-child {
    font-size: 18px;
  }

  .flash-actions {
    grid-template-columns: 1fr 0.5fr 1fr;
  }

  .grade-button strong {
    font-size: 11px;
  }

  .grade-button .shortcut {
    display: none;
  }

  .detail-meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grammar-detail-title {
    font-size: 28px;
  }
}

@media (max-width: 380px) {
  .hero-stats {
    gap: 12px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .hero-stats > div {
    gap: 4px;
  }

  .hero-stats strong {
    font-size: 20px;
  }

  .hero-stats span {
    font-size: 8px;
    white-space: nowrap;
  }

  .practice-intro {
    padding-top: 21px;
    padding-bottom: 13px;
  }

  .practice-intro .section-desc {
    display: none;
  }

  .practice-intro h1 {
    margin: 9px 0 0;
    font-size: 30px;
  }

  .practice-toolbar {
    padding: 10px 0;
  }

  .flashcard {
    height: 276px;
  }

  .flash-word {
    font-size: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
