:root {
  color-scheme: light dark;
  --bg: #faf9f3;
  --surface: #fffef9;
  --text: #25231f;
  --muted: #6c675d;
  --faint: #6f6a5c;
  --line: #ded8ca;
  --accent: #9b5700;
  --accent-strong: #703c00;
  --accent-soft: #f7e6c9;
  --grammar-highlight: #006989;
  --grammar-highlight-soft: #e0f2f6;
  /* Text on accent fills, the same role --on-fill plays in the application
     tokens. It flips with the accent: the dark theme's accent is a light
     amber, on which white text is unreadable. */
  --on-fill: #ffffff;
  --shadow: 0 18px 50px rgb(55 41 20 / 10%);
  font-family:
    Inter,
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 8%, rgb(201 142 50 / 9%), transparent 24rem),
    var(--bg);
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--surface);
  background: var(--text);
  transform: translateY(-150%);
}

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

.site-shell {
  width: min(1160px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
}

.brand-mark .paw {
  display: block;
  width: 23px;
  height: 23px;
  transform-origin: 50% 70%;
  transition: transform 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* The mascot leans in under a pointer. Touch devices keep the paw still: iOS
   holds :hover on whatever was tapped last. */
@media (hover: hover) {
  .brand:hover .brand-mark .paw {
    transform: rotate(-9deg) scale(1.06);
  }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
  font-size: 15px;
}

/* The header call to action is a .button first: a bare `.site-nav a` rule wins
   on specificity and used to paint its label muted brown on the accent fill. */
.site-nav a:not(.button) {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:not(.button):focus-visible {
  color: var(--text);
}

@media (hover: hover) {
  .site-nav a:not(.button):hover {
    color: var(--text);
  }
}

.site-nav .language-link {
  color: var(--accent-strong);
  font-weight: 700;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-fill);
  font-weight: 750;
  text-decoration: none;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.button:focus-visible {
  box-shadow: 0 10px 24px rgb(112 60 0 / 20%);
  transform: translateY(-1px);
}

@media (hover: hover) {
  .button:hover {
    box-shadow: 0 10px 24px rgb(112 60 0 / 20%);
    transform: translateY(-1px);
  }
}

.button--quiet {
  border-color: var(--line);
  color: var(--text);
  background: transparent;
}

.hero {
  position: relative;
  display: grid;
  min-height: 560px;
  align-items: center;
  overflow: hidden;
  padding: 82px 0 92px;
  text-align: center;
}

.hero-watermark {
  position: absolute;
  top: 50%;
  right: clamp(-2rem, 4vw, 3rem);
  width: clamp(230px, 32vw, 420px);
  color: var(--text);
  line-height: 0;
  opacity: 0.035;
  pointer-events: none;
  transform: translateY(-50%);
  animation: watermark-settle 1400ms ease-out 160ms backwards;
}

.hero-watermark .paw {
  display: block;
  width: 100%;
  height: auto;
}

/* The public site ships no scripts, so every motion here is CSS: the hero
   column rises once on load, and the paw trail under it walks in. Browsers
   with scroll-driven timelines run the trail from the scroll position
   instead, see the @supports block below. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes watermark-settle {
  from {
    opacity: 0;
  }

  to {
    opacity: 0.035;
  }
}

@keyframes paw-step {
  from {
    opacity: 0;
  }

  to {
    opacity: 0.32;
  }
}

.hero-inner > * {
  animation: rise 640ms cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}

.hero-inner > :nth-child(1) {
  animation-delay: 40ms;
}

.hero-inner > :nth-child(2) {
  animation-delay: 120ms;
}

.hero-inner > :nth-child(3) {
  animation-delay: 200ms;
}

.hero-inner > :nth-child(4) {
  animation-delay: 280ms;
}

.hero-inner > :nth-child(5) {
  animation-delay: 360ms;
}

.paw-trail {
  display: flex;
  justify-content: center;
  gap: clamp(20px, 5vw, 52px);
  padding: 0 0 10px;
}

.paw-trail-step {
  display: block;
  width: 22px;
  color: var(--accent);
  opacity: 0.32;
  animation: paw-step 520ms ease-out backwards;
}

.paw-trail-step .paw {
  display: block;
  width: 100%;
  height: auto;
}

.paw-trail-step:nth-child(odd) .paw {
  transform: rotate(-11deg);
}

.paw-trail-step:nth-child(even) .paw {
  transform: translateY(13px) rotate(12deg);
}

.paw-trail-step:nth-child(1) {
  animation-delay: 520ms;
}

.paw-trail-step:nth-child(2) {
  animation-delay: 620ms;
}

.paw-trail-step:nth-child(3) {
  animation-delay: 720ms;
}

.paw-trail-step:nth-child(4) {
  animation-delay: 820ms;
}

.paw-trail-step:nth-child(5) {
  animation-delay: 920ms;
}

@supports (animation-timeline: view()) {
  .paw-trail-step {
    animation-delay: 0s;
    animation-fill-mode: both;
    animation-timeline: view();
  }

  .paw-trail-step:nth-child(1) {
    animation-range: entry 12% cover 26%;
  }

  .paw-trail-step:nth-child(2) {
    animation-range: entry 18% cover 32%;
  }

  .paw-trail-step:nth-child(3) {
    animation-range: entry 24% cover 38%;
  }

  .paw-trail-step:nth-child(4) {
    animation-range: entry 30% cover 44%;
  }

  .paw-trail-step:nth-child(5) {
    animation-range: entry 36% cover 50%;
  }
}

.hero-inner {
  position: relative;
  max-width: 780px;
  margin-inline: auto;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 16px;
  letter-spacing: 0.45em;
}

.hero h1 {
  max-width: 18ch;
  margin: 0 auto 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 6vw, 70px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.04;
}

.hero-copy {
  max-width: 58ch;
  margin: 0 auto 32px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.hero-note {
  margin: 17px 0 0;
  color: var(--faint);
  font-size: 14px;
}

.section {
  border-top: 1px solid var(--line);
  padding: 72px 0;
}

.section-heading {
  max-width: 720px;
  margin: 0 auto 42px;
  text-align: center;
}

.section-heading h2 {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.news-list {
  max-width: 880px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.news-list li {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 18px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.news-list time {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.news-list b {
  display: block;
  font-size: 18px;
}

.news-list p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.steps,
.features,
.plans {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.steps {
  grid-template-columns: repeat(4, 1fr);
}

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

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

.step,
.feature,
.plan {
  padding: 30px;
  background: var(--surface);
}

.step-number,
.feature-mark {
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 19px;
}

.step h3,
.feature h3,
.plan h3 {
  margin: 0 0 10px;
  font-size: 19px;
}

.step p,
.feature p,
.plan p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.community-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 30px;
  overflow: hidden;
  padding: clamp(30px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(
    145deg,
    var(--surface),
    color-mix(in srgb, var(--accent-soft) 48%, var(--surface))
  );
  box-shadow: var(--shadow);
}

.community-mark {
  position: absolute;
  top: 50%;
  right: clamp(16px, 6vw, 72px);
  color: var(--accent);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: clamp(150px, 23vw, 260px);
  line-height: 1;
  opacity: 0.08;
  pointer-events: none;
  transform: translateY(-50%);
}

.community-copy,
.community-points {
  position: relative;
}

.community-copy {
  max-width: 720px;
}

.community-eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.community-copy h2 {
  margin: 0 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
  line-height: 1.12;
}

.community-copy > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.community-points {
  display: grid;
  min-width: 190px;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.community-points li {
  font-size: 14px;
  font-weight: 800;
}

.community-points li::before {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 9px;
  background-color: var(--accent-strong);
  content: "";
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%3E%3Cg%20fill='black'%3E%3Cellipse%20cx='18.6'%20cy='23.3'%20rx='4.4'%20ry='6.1'%20transform='rotate%28-22%2018.6%2023.3%29'/%3E%3Cellipse%20cx='27.6'%20cy='17.5'%20rx='4.7'%20ry='6.7'%20transform='rotate%28-8%2027.6%2017.5%29'/%3E%3Cellipse%20cx='36.9'%20cy='17.5'%20rx='4.7'%20ry='6.7'%20transform='rotate%288%2036.9%2017.5%29'/%3E%3Cellipse%20cx='46'%20cy='23.3'%20rx='4.4'%20ry='6.1'%20transform='rotate%2822%2046%2023.3%29'/%3E%3Cpath%20d='M32%2027.3c9.2%200%2015%206.4%2015%2013.3%200%207-6.8%2011-15%2011s-15.2-4-15.2-11c0-6.9%205.8-13.3%2015.2-13.3Z'/%3E%3C/g%3E%3C/svg%3E")
    center / contain no-repeat;
  vertical-align: -1px;
}

.theme-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 26px;
  padding: 0;
  list-style: none;
}

.theme-list li {
  display: grid;
  min-width: 76px;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.theme-swatch {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgb(0 0 0 / 10%);
  border-radius: 50%;
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 20px;
}

.theme-default {
  color: #171717;
  background: #faf9f3;
}
.theme-sakura {
  color: #b3405f;
  background: #fbe7ec;
}
.theme-kawaii {
  color: #8e4fb0;
  background: #f5e6fa;
}
.theme-gameboy {
  color: #0f380f;
  background: #9bbc0f;
}
.theme-crt {
  color: #33ff66;
  background: #0a0f0a;
}
.theme-jrpg {
  color: #f2c94c;
  background: #1b2a55;
}
.theme-starwars {
  color: #ffe81f;
  background: #000;
}
.theme-zen {
  color: #8b5f30;
  background: #f1eadc;
}

.plan {
  display: flex;
  flex-direction: column;
  min-height: 310px;
}

.plan--featured {
  background: linear-gradient(
    160deg,
    var(--surface),
    color-mix(in srgb, var(--accent-soft) 55%, var(--surface))
  );
}

.plan-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.plan-name span {
  color: var(--faint);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
}

.plan-price {
  margin: 18px 0 22px;
  font-size: 28px;
}

.plan-price small {
  color: var(--faint);
  font-size: 13px;
}

.plan ul {
  display: grid;
  gap: 10px;
  margin: 0 0 26px;
  padding: 0;
  color: var(--muted);
  list-style: none;
}

.plan ul li::before {
  margin-right: 8px;
  color: var(--accent);
  content: "✓";
}

.plan .button {
  width: fit-content;
  margin-top: auto;
}

.faq-list {
  max-width: 820px;
  margin: 0 auto;
}

.faq-list details {
  border-top: 1px solid var(--line);
  padding: 20px 4px;
}

.faq-list summary {
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}

.faq-list p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.reference-hero {
  position: relative;
  overflow: hidden;
  padding: 58px 0 74px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 54px;
  color: var(--faint);
  font-size: 14px;
}

.breadcrumbs a {
  color: var(--muted);
}

.reference-mark {
  position: absolute;
  top: 36px;
  right: 5%;
  color: var(--accent);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: clamp(150px, 24vw, 280px);
  line-height: 1;
  opacity: 0.07;
  pointer-events: none;
}

.reference-hero .eyebrow {
  margin-bottom: 14px;
  color: var(--accent-strong);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.reference-hero h1 {
  position: relative;
  max-width: 16ch;
  margin: 0 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 6vw, 66px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.reference-hero > p:last-child {
  position: relative;
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.reference-content {
  background: color-mix(in srgb, var(--surface) 62%, transparent);
}

.kana-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kana-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  table-layout: fixed;
}

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

.kana-table td {
  height: 104px;
  border: 1px solid var(--line);
  text-align: center;
}

.kana-table tr:first-child td {
  border-top: 0;
}

.kana-table tr:last-child td {
  border-bottom: 0;
}

.kana-table td:first-child {
  border-left: 0;
}

.kana-table td:last-child {
  border-right: 0;
}

.kana-table a {
  display: grid;
  height: 100%;
  place-content: center;
  gap: 4px;
  text-decoration: none;
}

.kana-table a:focus-visible {
  background: var(--accent-soft);
}

@media (hover: hover) {
  .kana-table a:hover {
    background: var(--accent-soft);
  }
}

.kana-table b {
  color: var(--text);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 38px;
  font-weight: 500;
  line-height: 1;
}

.kana-table span {
  color: var(--faint);
  font-size: 13px;
}

.kana-table .kana-empty {
  background: color-mix(in srgb, var(--line) 28%, transparent);
}

.reference-notes {
  max-width: 820px;
  margin: 56px auto 0;
}

.reference-notes h2 {
  margin: 0 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
}

.reference-notes ol {
  display: grid;
  gap: 14px;
  margin: 0;
  padding-left: 24px;
  color: var(--muted);
  line-height: 1.65;
}

.kanji-reference-list,
.theme-gallery {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kanji-reference-list {
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--line);
  gap: 1px;
  box-shadow: var(--shadow);
}

.kanji-reference-list li {
  display: grid;
  min-height: 150px;
  align-content: center;
  padding: 22px;
  background: var(--surface);
}

.kanji-reference-list b {
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 42px;
  font-weight: 500;
}

.kanji-reference-list span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.kanji-reference-list small {
  margin-top: 6px;
  color: var(--faint);
  font-size: 12px;
}

.theme-gallery {
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.theme-gallery-card {
  --theme-card-bg: #faf9f3;
  --theme-card-surface: #fffef9;
  --theme-card-text: #25231f;
  --theme-card-accent: #9b5700;
  display: grid;
  grid-template-columns: 190px 1fr;
  align-items: center;
  gap: 26px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.theme-mini-screen {
  display: grid;
  height: 124px;
  align-content: center;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--theme-card-text) 16%, transparent);
  border-radius: 12px;
  background: var(--theme-card-bg);
  box-shadow: inset 0 0 0 5px var(--theme-card-surface);
}

.theme-mini-screen span {
  color: var(--theme-card-accent);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 32px;
}

.theme-mini-screen i {
  display: block;
  width: 78%;
  height: 5px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--theme-card-text);
  opacity: 0.22;
}

.theme-mini-screen i:last-child {
  width: 48%;
  background: var(--theme-card-accent);
  opacity: 0.75;
}

.theme-gallery-card b {
  font-size: 20px;
}

.theme-gallery-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.theme-gallery-card--sakura {
  --theme-card-bg: #fbe7ec;
  --theme-card-surface: #fff8fa;
  --theme-card-text: #542d38;
  --theme-card-accent: #b3405f;
}

.theme-gallery-card--kawaii {
  --theme-card-bg: #f5e6fa;
  --theme-card-surface: #fff8ff;
  --theme-card-text: #4d315c;
  --theme-card-accent: #8e4fb0;
}

.theme-gallery-card--gameboy {
  --theme-card-bg: #9bbc0f;
  --theme-card-surface: #8bac0f;
  --theme-card-text: #0f380f;
  --theme-card-accent: #306230;
}

.theme-gallery-card--crt {
  --theme-card-bg: #0a0f0a;
  --theme-card-surface: #101810;
  --theme-card-text: #b8ffc6;
  --theme-card-accent: #33ff66;
}

.theme-gallery-card--jrpg {
  --theme-card-bg: #1b2a55;
  --theme-card-surface: #223568;
  --theme-card-text: #f5f0df;
  --theme-card-accent: #f2c94c;
}

.theme-gallery-card--starwars {
  --theme-card-bg: #000;
  --theme-card-surface: #101010;
  --theme-card-text: #f4f4f4;
  --theme-card-accent: #ffe81f;
}

.theme-gallery-card--zen {
  --theme-card-bg: #f1eadc;
  --theme-card-surface: #fbf7ef;
  --theme-card-text: #382d23;
  --theme-card-accent: #8b5f30;
}

.reference-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 46px;
}

.grammar-directory-hero h1,
.grammar-article-hero h1 {
  max-width: none;
}

.grammar-directory-levels {
  margin: 34px 0 0;
  text-align: center;
  color: var(--muted);
}

.grammar-directory-levels a {
  font-weight: 600;
}

.grammar-article-hero h1 {
  color: var(--accent-strong);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: clamp(48px, 8vw, 76px);
}

.grammar-directory-groups {
  display: grid;
  gap: 42px;
}

.grammar-directory-group h3 {
  margin: 0 0 16px;
  color: var(--accent-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 500;
}

.grammar-directory-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.grammar-directory-card {
  display: grid;
  height: 100%;
  gap: 7px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-decoration: none;
}

a.grammar-directory-card {
  box-shadow: 0 8px 22px rgb(55 41 20 / 7%);
  transition:
    border-color 150ms ease,
    transform 150ms ease;
}

a.grammar-directory-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
}

@media (hover: hover) {
  a.grammar-directory-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
  }
}

.grammar-directory-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.grammar-directory-pattern {
  color: var(--text);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.35;
}

.grammar-directory-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--faint);
  background: color-mix(in srgb, var(--line) 45%, transparent);
  font-size: 11px;
  font-weight: 750;
}

.grammar-directory-badge.is-detailed {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.grammar-directory-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.grammar-directory-card small {
  color: var(--faint);
  font-size: 12px;
}

.grammar-article-layout {
  display: grid;
  max-width: 860px;
  gap: 16px;
}

.grammar-article-section {
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(55 41 20 / 6%);
}

.grammar-article-section h2,
.grammar-article-section h3,
.grammar-article-section p,
.grammar-article-section dl {
  margin-top: 0;
}

.grammar-article-section h2 {
  margin-bottom: 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 4vw, 30px);
  font-weight: 500;
}

.grammar-article-section h3 {
  margin: 28px 0 12px;
  font-size: 18px;
}

.grammar-article-section p,
.grammar-article-section li,
.grammar-article-section dd {
  line-height: 1.65;
}

.grammar-article-section ol,
.grammar-article-section ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.grammar-article-uses {
  display: grid;
  gap: 12px;
  margin-bottom: 0;
}

.grammar-article-uses div {
  padding: 14px 16px;
  border-left: 3px solid var(--grammar-highlight);
  border-radius: 0 12px 12px 0;
  background: var(--grammar-highlight-soft);
}

.grammar-article-uses dt {
  font-weight: 800;
}

.grammar-article-uses dd {
  margin: 4px 0 0;
  color: var(--muted);
}

.grammar-article-example {
  overflow: hidden;
  border-color: color-mix(in srgb, var(--grammar-highlight) 38%, var(--line));
  background: linear-gradient(
    145deg,
    var(--grammar-highlight-soft),
    var(--surface) 58%
  );
}

.grammar-example-japanese {
  margin-bottom: 16px;
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: clamp(25px, 5vw, 36px);
  line-height: 2.1 !important;
}

.grammar-example-token {
  padding: 2px 1px;
  border-radius: 4px;
}

.grammar-example-token--particle {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.grammar-example-token--grammar {
  color: var(--grammar-highlight);
  background: var(--grammar-highlight-soft);
  font-weight: 700;
}

.grammar-example-token ruby {
  ruby-position: over;
}

.grammar-example-token rt {
  color: var(--faint);
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 0.42em;
  font-weight: 500;
}

.grammar-example-translation {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
}

.grammar-article-similar {
  padding: 0 !important;
  list-style: none;
}

.grammar-article-similar a {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
}

.grammar-article-similar a:focus-visible {
  border-color: var(--accent);
}

@media (hover: hover) {
  .grammar-article-similar a:hover {
    border-color: var(--accent);
  }
}

.grammar-article-similar b {
  color: var(--accent-strong);
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 18px;
}

.grammar-article-similar span {
  color: var(--muted);
}

.grammar-article-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.site-footer {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px 0 46px;
  color: var(--faint);
  font-size: 14px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-left: auto;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171714;
    --surface: #201f1b;
    --text: #f3efe7;
    --muted: #beb6a8;
    --faint: #a49c8f;
    --line: #3b3932;
    --accent: #dda65d;
    --accent-strong: #f0c07e;
    --accent-soft: #3d2d1d;
    --grammar-highlight: #7ed3ef;
    --grammar-highlight-soft: #15343e;
    --on-fill: #241a0c;
    --shadow: 0 18px 50px rgb(0 0 0 / 24%);
  }
}

@media (max-width: 820px) {
  .site-shell {
    width: min(100% - 28px, 680px);
  }

  .site-header {
    min-height: 66px;
    flex-wrap: wrap;
    row-gap: 8px;
    padding-block: 12px;
  }

  .site-nav a:not(.language-link):not(.header-cta) {
    display: none;
  }

  .site-nav {
    max-width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-cta {
    min-height: 42px;
    padding-inline: 16px;
  }

  .hero {
    min-height: 500px;
    padding: 60px 0 72px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    max-width: 330px;
    margin-inline: auto;
  }

  .section {
    padding: 56px 0;
  }

  .steps,
  .features,
  .plans {
    grid-template-columns: 1fr;
  }

  .community-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .community-points {
    min-width: 0;
  }

  .news-list li {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .plan {
    min-height: 0;
  }

  .reference-hero {
    padding: 34px 0 54px;
  }

  .breadcrumbs {
    margin-bottom: 38px;
  }

  .kanji-reference-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .theme-gallery {
    grid-template-columns: 1fr;
  }

  .theme-gallery-card {
    grid-template-columns: minmax(128px, 40%) 1fr;
    gap: 18px;
  }

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

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer nav {
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .grammar-article-actions {
    grid-template-columns: 1fr;
  }

  .kanji-reference-list li {
    min-height: 132px;
    padding: 16px;
  }

  .theme-gallery-card {
    grid-template-columns: 1fr;
  }
}

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

  .button {
    transition: none;
  }

  .brand-mark .paw {
    transition: none;
  }

  .hero-inner > *,
  .hero-watermark,
  .paw-trail-step {
    animation: none;
  }
}

/* ---------- страница репетиторов ---------- */

.tutor-groups {
  display: grid;
  gap: 28px;
}

.tutor-groups h3 {
  margin: 0 0 14px;
  font-size: 19px;
  font-weight: 600;
}

.tutor-disclaimer {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.community-link {
  grid-column: 1 / -1;
  justify-self: start;
  color: var(--accent);
  font-size: 15px;
  text-decoration: none;
  border-bottom: 1px solid currentcolor;
}

/* Public reading pages share the reference site's palette and require no JS. */
.blog-page {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.blog-page .site-shell {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.blog-page .site-header {
  border-bottom: 1px solid var(--line);
}
.blog-page a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}
.blog-nav-link {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
}
.blog-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  margin-top: 22px;
  color: var(--muted);
  font-size: 14px;
}
.blog-breadcrumbs a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  text-underline-offset: 4px;
}
.blog-intro {
  max-width: 820px;
  padding: 42px 0 54px;
}
.blog-intro h1 {
  margin: 10px 0 22px;
  font-size: clamp(36px, 5.4vw, 64px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}
.blog-intro .eyebrow {
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.blog-intro > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.6;
}
.blog-series__heading {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.blog-series__heading h2 {
  margin: 0 0 8px;
  font-size: 22px;
}
.blog-series__heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}
.blog-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}
.blog-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}
.blog-card__image {
  display: block;
  padding: 24px;
  background: var(--accent-soft);
}
.blog-card__image img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.blog-card__body {
  padding: 24px 28px 22px;
}
.blog-card h2 {
  margin: 12px 0;
  font-size: clamp(22px, 2.3vw, 29px);
  line-height: 1.3;
  letter-spacing: -0.025em;
}
.blog-card h2 a {
  text-decoration: none;
}
.blog-card__body > p:not(.blog-meta) {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}
.blog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}
.blog-read {
  display: inline-flex;
  min-height: 44px;
  gap: 14px;
  align-items: center;
  color: var(--accent);
  text-underline-offset: 5px;
  font-weight: 600;
}
.blog-invitation {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 48px;
  align-items: center;
  justify-content: space-between;
  margin-top: 56px;
  padding: 30px;
  border-radius: 20px;
  background: var(--accent-soft);
}
.blog-invitation h2 {
  margin: 0 0 10px;
  font-size: 25px;
}
.blog-invitation p {
  margin: 0;
  max-width: 560px;
  line-height: 1.6;
}
.blog-article__header {
  max-width: 930px;
  padding: 38px 0 42px;
}
.blog-article h1 {
  margin: 18px 0 24px;
  font-size: clamp(31px, 4.2vw, 50px);
  line-height: 1.14;
  letter-spacing: -0.035em;
}
.blog-deck {
  font-size: 21px;
  line-height: 1.65;
  color: var(--muted);
}
.blog-byline {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.blog-byline span {
  padding: 0 8px;
}
.blog-reading-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 54px;
  align-items: start;
}
.blog-toc {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding-right: 8px;
}
.blog-toc summary {
  min-height: 44px;
  padding: 12px 0;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.blog-toc ol {
  padding: 0;
  margin: 8px 0 12px;
  list-style: none;
}
.blog-toc li + li {
  border-top: 1px solid var(--line);
}
.blog-toc a {
  display: block;
  min-height: 44px;
  padding: 10px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  text-decoration: none;
}
.blog-toc .blog-toc__all {
  color: var(--accent);
  font-weight: 600;
}
.blog-prose {
  min-width: 0;
  max-width: 820px;
  font-size: 19px;
  line-height: 1.8;
  overflow-wrap: break-word;
}
.blog-prose > :first-child {
  margin-top: 0;
}
.blog-prose p {
  margin: 0 0 22px;
}
.blog-prose h2 {
  margin: 46px 0 20px;
  font-size: clamp(25px, 2.7vw, 32px);
  line-height: 1.25;
  letter-spacing: -0.025em;
  scroll-margin-top: 24px;
}
.blog-prose h3 {
  margin: 32px 0 16px;
  font-size: 23px;
}
.blog-prose a {
  color: var(--accent);
  text-underline-offset: 4px;
}
.blog-prose li {
  margin-bottom: 10px;
  padding-left: 3px;
}
.blog-prose ul,
.blog-prose ol {
  padding-left: 26px;
}
.blog-prose blockquote {
  margin: 24px 0;
  padding: 16px 24px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}
.blog-prose blockquote > :last-child {
  margin-bottom: 0;
}
.blog-prose figure {
  margin: 32px 0;
}
.blog-prose img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.blog-image-link {
  display: block;
}
.blog-prose figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.blog-prose [lang="ja"] {
  font-family:
    "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-style: normal;
}
.blog-table {
  max-width: 100%;
  margin: 24px 0;
  overflow-x: auto;
}
.blog-table table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.65;
}
.blog-table th,
.blog-table td {
  padding: 14px;
  border: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
.blog-table th {
  background: var(--accent-soft);
}
.blog-prose details {
  margin: 18px 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--accent-soft);
}
.blog-prose summary {
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
}
.blog-prose details[open] summary {
  margin-bottom: 18px;
}
.blog-prose details > :last-child {
  margin-bottom: 0;
}
.blog-prose summary:focus-visible,
.blog-table:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.blog-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 56px 0 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.blog-pagination a {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
}
.blog-pagination span {
  color: var(--accent);
  font-size: 14px;
}
.blog-pagination strong {
  font-size: 19px;
  line-height: 1.5;
}
@media (hover: hover) {
  .blog-card h2 a:hover,
  .blog-toc a:hover,
  .blog-page .blog-nav-link:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  .blog-image-link:hover img,
  .blog-pagination a:hover {
    border-color: var(--accent);
  }
}
@media (max-width: 1100px) {
  .site-nav {
    gap: 14px;
  }
  .blog-reading-layout {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 32px;
  }
}
@media (max-width: 900px) {
  .blog-page .site-header {
    flex-wrap: wrap;
    gap: 0 16px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .blog-page .site-nav {
    flex-wrap: wrap;
    gap: 0 18px;
  }
  .blog-page .site-nav a {
    min-height: 44px;
    align-items: center;
  }
  .blog-reading-layout {
    display: block;
  }
  .blog-toc {
    position: static;
    max-height: none;
    padding: 16px 20px;
    margin-bottom: 36px;
    border: 1px solid var(--line);
    border-radius: 16px;
  }
  .blog-toc ol {
    columns: 2;
    column-gap: 24px;
  }
  .blog-toc li {
    break-inside: avoid;
  }
  .blog-prose {
    max-width: none;
  }
  .blog-card--featured {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 820px) {
  .site-nav .blog-nav-link:not(.language-link):not(.header-cta) {
    display: inline-flex;
  }
  .blog-page .site-header {
    gap: 12px;
  }
  .blog-page .site-nav {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
  .blog-intro {
    padding: 28px 0 36px;
  }
  .blog-grid {
    gap: 22px;
  }
}
@media (max-width: 600px) {
  .blog-table table {
    font-size: 14px;
  }
  .blog-table th,
  .blog-table td {
    padding: 10px;
  }
  .blog-grid,
  .blog-pagination {
    grid-template-columns: 1fr;
  }
  .blog-card__image {
    padding: 16px;
  }
  .blog-card__body {
    padding: 22px;
  }
  .blog-article__header {
    padding: 24px 0 30px;
  }
  .blog-deck {
    font-size: 19px;
  }
  .blog-toc ol {
    columns: auto;
  }
  .blog-prose {
    font-size: 18px;
    line-height: 1.75;
  }
  .blog-invitation {
    padding: 24px;
  }
}
