:root {
  --ink: #1c1915;
  --muted: #5c5348;
  --paper: #f6f1e7;
  --card: #fffdf8;
  --line: #e2d8c8;
  --red: #b42318;
  --indigo: #1e3a5f;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "IBM Plex Sans", "Noto Sans JP", sans-serif;
  font-size: 17px;
  line-height: 1.6;
}
a { color: var(--indigo); }
.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }
.nav { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 600; }
.mark { width: 36px; height: 36px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: "Noto Serif JP", serif; }
.nav-links { display: flex; gap: 16px; flex-wrap: wrap; }
.nav-links a { color: var(--muted); text-decoration: none; }
h1 { font-family: "Fraunces", "Noto Serif JP", serif; font-size: clamp(2.4rem, 5vw, 4.2rem); line-height: 0.98; letter-spacing: -0.03em; margin: 8px 0 12px; }
.kicker { color: var(--red); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.78rem; font-weight: 600; margin: 0; }
.lede { max-width: 68ch; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 22px 0; }
.cell {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  min-height: 118px; padding: 10px; text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.cell:hover, .cell[aria-pressed="true"] { border-color: var(--ink); }
.kana { font-family: "Noto Serif JP", serif; font-size: 2.2rem; line-height: 1; }
.romaji { margin: 6px 0 0; color: var(--indigo); font-weight: 600; }
.stroke-board { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.stroke-board svg { width: 72px; height: 72px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.stroke-board .guide { fill: none; stroke: #eadfce; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.stroke-board .drawn { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; transition: stroke-dashoffset 0.62s ease-in-out; }
.stroke-board .stroke-num {
  font-size: 13px; font-weight: 700; fill: #fff; font-family: "IBM Plex Sans", sans-serif;
  paint-order: stroke; stroke: var(--red); stroke-width: 4px; stroke-linejoin: round;
}
.strokes { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; }
.detail {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start;
}
.glyph { background: #fff; border: 1px solid var(--line); border-radius: 14px; min-height: 280px; }
.glyph svg { width: 100%; height: auto; display: block; }
.glyph-stroke { fill: var(--ink); opacity: 0; animation: appear 0.35s ease forwards; }
.stroke-badge { opacity: 0; animation: appear 0.2s ease forwards; }
.stroke-badge circle { fill: var(--red); }
.stroke-badge text { fill: #fff; font-size: 32px; font-family: "IBM Plex Sans", sans-serif; font-weight: 700; }
@keyframes appear { to { opacity: 1; } }
button.play, button.print {
  border: 0; border-radius: 999px; background: var(--red); color: #fff; font: inherit; font-weight: 600;
  padding: 10px 16px; cursor: pointer;
}
button.play.ghost { background: transparent; color: var(--red); border: 2px solid var(--red); padding: 8px 14px; }
.no-print .play + .play { margin-left: 8px; }
ol { margin: 8px 0 0; padding-left: 18px; }
.section { padding: 28px 0; }
h2 { font-family: "Fraunces", serif; font-size: 2rem; margin: 0 0 8px; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { border: 1px solid var(--line); padding: 8px; text-align: center; }
th { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
td b { font-family: "Noto Serif JP", serif; font-size: 1.4rem; font-weight: 500; }
footer { border-top: 1px solid var(--line); color: var(--muted); padding: 22px 0 36px; }
@media (max-width: 800px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .detail { grid-template-columns: 1fr; }
  .nav { align-items: flex-start; flex-direction: column; }
}
@media print {
  .nav, .detail, .no-print, footer { display: none; }
  body { background: #fff; }
  .grid { display: none; }
}
