:root {
  --bg: #f6f4f0;
  --paper: #fffdf8;
  --ink: #1a1a1a;
  --ink-2: #2a2a2a;
  --muted: #5c5854;
  --ink-soft: var(--muted);
  --line: rgba(26, 26, 26, 0.12);
  --orange: #ff6b2c;
  --orange-soft: #ff8a4c;
  --accent: #ff6b2c;
  --navy: #1b3a6b;
  --navy-deep: #0e2244;
  --chip: #1b3a6b;
  --white: #ffffff;
  --glow: rgba(255, 255, 255, 0.42);
  --inset: rgba(28, 25, 22, 0.04);
  --empty: rgba(255, 255, 255, 0.28);
  --accent-glow: rgba(255, 107, 44, 0.25);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Syne", sans-serif;
  --font-body: "Onest", "Segoe UI", sans-serif;
  --font-jp: "Zen Kaku Gothic New", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --uguisu: #2f6f5e;
  --wrong: #d4523c;
  --shadow: 10px 14px 0 var(--navy);
  --radius: 18px;
  --kinari: var(--bg);
  --persimmon: var(--orange);
  --persimmon-deep: var(--orange);
  --ai: var(--navy);
  --font: var(--font-body);
  --mincho: var(--font-jp);
  --theme-x: 90%;
  --theme-y: 2.5rem;
}

[data-theme="ink"] {
  color-scheme: dark;
  --bg: #12151c;
  --paper: #1c2230;
  --ink: #ece8e1;
  --ink-2: #d4cfc6;
  --muted: #b6b3ab;
  --ink-soft: var(--muted);
  --line: rgba(236, 232, 225, 0.14);
  --orange: #e0a882;
  --orange-soft: #ebc4a4;
  --accent: #c56a3e;
  --navy: #a8b8d0;
  --navy-deep: #0e1218;
  --chip: #3d5270;
  --uguisu: #8fb89a;
  --wrong: #d48982;
  --shadow: 8px 10px 0 #0e1218;
  --glow: rgba(255, 255, 255, 0.08);
  --inset: rgba(236, 232, 225, 0.06);
  --empty: rgba(255, 255, 255, 0.05);
  --accent-glow: rgba(197, 106, 62, 0.28);
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
  background-color: var(--bg);
}

html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

@property --bg {
  syntax: "<color>";
  inherits: true;
  initial-value: #f6f4f0;
}
@property --paper {
  syntax: "<color>";
  inherits: true;
  initial-value: #fffdf8;
}
@property --ink {
  syntax: "<color>";
  inherits: true;
  initial-value: #1a1a1a;
}
@property --muted {
  syntax: "<color>";
  inherits: true;
  initial-value: #5c5854;
}
@property --orange {
  syntax: "<color>";
  inherits: true;
  initial-value: #ff6b2c;
}
@property --accent {
  syntax: "<color>";
  inherits: true;
  initial-value: #ff6b2c;
}
@property --navy {
  syntax: "<color>";
  inherits: true;
  initial-value: #1b3a6b;
}
@property --chip {
  syntax: "<color>";
  inherits: true;
  initial-value: #1b3a6b;
}

html.is-theming {
  transition:
    --bg 0.5s var(--ease),
    --paper 0.5s var(--ease),
    --ink 0.5s var(--ease),
    --muted 0.5s var(--ease),
    --orange 0.5s var(--ease),
    --accent 0.5s var(--ease),
    --navy 0.5s var(--ease),
    --chip 0.5s var(--ease),
    background-color 0.5s var(--ease),
    color 0.5s var(--ease);
}

::view-transition-old(root) {
  z-index: 1;
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-new(root) {
  z-index: 2;
  mix-blend-mode: normal;
  animation: theme-wipe 0.55s var(--ease) both;
}

@keyframes theme-wipe {
  from {
    clip-path: circle(0 at var(--theme-x) var(--theme-y));
  }
  to {
    clip-path: circle(150vmax at var(--theme-x) var(--theme-y));
  }
}

body {
  font-family: var(--font-body);
  letter-spacing: -0.01em;
  font-kerning: normal;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.62;
}

a {
  color: inherit;
  text-decoration: none;
}

[data-theme="ink"] body,
body:has([data-theme="ink"]) {
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(47, 69, 102, 0.35), transparent 60%),
    radial-gradient(900px 400px at 100% 20%, rgba(197, 106, 62, 0.08), transparent 50%),
    var(--bg);
}

.grain,
.scanlines,
.paper-fibers,
.kanji-rain,
.wash,
.orbs,
.fx-sticker {
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 49;
  opacity: 0.04;
  background: repeating-linear-gradient(
    to bottom,
    rgba(26, 26, 26, 0.06) 0 1px,
    transparent 1px 4px
  );
}

[data-theme="ink"] .scanlines {
  opacity: 0.12;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05) 0 1px,
    transparent 1px 4px
  );
}

.paper-fibers {
  position: fixed;
  inset: -20%;
  z-index: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='64'%3E%3Cpath d='M0 32c12 0 12-12 24-12s12 12 24 12 12-12 24-12' fill='none' stroke='%23c9bfb2' stroke-width='1' opacity='.55'/%3E%3C/svg%3E");
  animation: pan 42s linear infinite;
}

[data-theme="ink"] .paper-fibers {
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='64'%3E%3Cpath d='M0 32c12 0 12-12 24-12s12 12 24 12 12-12 24-12' fill='none' stroke='%237ea2ff' stroke-width='1' opacity='.35'/%3E%3C/svg%3E");
}

.kanji-rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.07;
  font-family: var(--font-jp);
  font-weight: 900;
  color: var(--navy);
  font-size: clamp(3rem, 8vw, 8rem);
  letter-spacing: 0.4em;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  mix-blend-mode: multiply;
  animation: rain 28s linear infinite;
}

[data-theme="ink"] .kanji-rain {
  mix-blend-mode: screen;
  color: #7ea2ff;
  opacity: 0.14;
}

.wash {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.wash__blob {
  position: absolute;
  width: 42rem;
  height: 42rem;
  border-radius: 50%;
  filter: blur(8px);
}

.wash__blob--navy {
  top: -12rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(27, 58, 107, 0.22), transparent 62%);
  animation: drift 22s ease-in-out infinite;
}

.wash__blob--orange {
  right: -10rem;
  bottom: -14rem;
  background: radial-gradient(circle, rgba(255, 107, 44, 0.18), transparent 62%);
  animation: drift 18s ease-in-out infinite reverse;
}

[data-theme="ink"] .wash__blob--navy {
  background: radial-gradient(circle, rgba(47, 69, 102, 0.4), transparent 62%);
}

[data-theme="ink"] .wash__blob--orange {
  background: radial-gradient(circle, rgba(197, 106, 62, 0.1), transparent 62%);
}

.orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  animation: float 8s ease-in-out infinite;
}

.orb--a {
  width: 14rem;
  height: 14rem;
  top: 18%;
  right: 8%;
  background: rgba(255, 107, 44, 0.16);
}

.orb--b {
  width: 11rem;
  height: 11rem;
  bottom: 16%;
  left: 6%;
  background: rgba(27, 58, 107, 0.18);
  animation-duration: 11s;
  animation-delay: -2s;
}

.orb--c {
  width: 8rem;
  height: 8rem;
  top: 48%;
  left: 42%;
  background: rgba(255, 107, 44, 0.1);
  animation-duration: 9s;
  animation-delay: -4s;
}

[data-theme="ink"] .orb--a { background: rgba(197, 106, 62, 0.1); }
[data-theme="ink"] .orb--b { background: rgba(47, 69, 102, 0.16); }
[data-theme="ink"] .orb--c { background: rgba(197, 106, 62, 0.07); }

.fx-sticker {
  display: none;
  position: fixed;
  z-index: 35;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--white);
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0.35;
  animation: wobble 7s ease-in-out infinite;
}

.fx-sticker--tl { top: 5.6rem; left: 1.2rem; animation-delay: -1s; }
.fx-sticker--tr { top: 6.2rem; right: 1.4rem; animation-delay: -2.4s; }
.fx-sticker--bl { bottom: 4.2rem; left: 1.4rem; animation-delay: -3.1s; }
.fx-sticker--br { bottom: 4.6rem; right: 1.6rem; animation-delay: -0.6s; }

@media (min-width: 900px) {
  .fx-sticker { display: inline-flex; }
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 6vw;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.nav::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 38%;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  animation: navShimmer 4.2s linear infinite;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 1.15rem;
  color: inherit;
  text-decoration: none;
}

.logo__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.logo__jp {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--navy);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.8rem);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: lowercase;
}

.nav__links a {
  color: inherit;
  text-decoration: none;
}

.nav__links a[aria-current="page"] {
  color: var(--orange);
}

.nav__cta {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
}

.nav__cta:hover,
.nav__cta[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
}

.nav-auth {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.nav-auth a {
  color: inherit;
  text-decoration: none;
}

.nav-auth a[aria-current="page"] {
  color: var(--orange);
}

.nav-user {
  max-width: 8.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
  color: var(--ink-soft);
}

.nav-logout {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-transform: lowercase;
  cursor: pointer;
}

.nav-logout:hover {
  color: var(--orange);
}

.nav-admin {
  color: var(--orange);
  text-decoration: none;
  text-transform: lowercase;
}

.nav-admin:hover {
  text-decoration: underline;
}

.theme-toggle {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-family: var(--font-jp);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.theme-toggle__sun { display: none; }

.theme-toggle[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.theme-toggle[aria-pressed="true"] .theme-toggle__moon { display: none; }
.theme-toggle[aria-pressed="true"] .theme-toggle__sun { display: inline; }

.frame {
  max-width: 1080px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 28px 36px 80px;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.top-nav:empty { display: none; }

.top-nav a {
  color: var(--ink-soft);
  text-decoration: none;
}

.top-nav a:hover { color: var(--orange); }

.top-nav a[aria-current="page"] { color: var(--orange); }

#app { padding-top: 24px; }

[data-page="home"] #app { padding-top: 8px; }
[data-page="home"] .frame { padding-top: 12px; padding-bottom: 72px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.home {
  position: relative;
}

.home-hero {
  position: relative;
  min-height: min(72vh, 38rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.5rem 0 2.2rem;
}

.home-glyphs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}

.home-glyphs span {
  position: absolute;
  font-family: var(--font-jp);
  font-weight: 900;
  color: color-mix(in srgb, var(--navy) 16%, transparent);
  font-size: clamp(3.4rem, 10vw, 8.5rem);
  line-height: 1;
  animation: float 10s ease-in-out infinite;
}

.home-glyphs span:nth-child(1) { top: 4%; left: 2%; }
.home-glyphs span:nth-child(2) { top: 10%; right: 8%; animation-duration: 12s; animation-delay: -2s; }
.home-glyphs span:nth-child(3) { top: 38%; left: 22%; animation-duration: 9s; animation-delay: -4s; }
.home-glyphs span:nth-child(4) { bottom: 18%; right: 4%; animation-duration: 11s; }
.home-glyphs span:nth-child(5) { top: 22%; right: 28%; animation-delay: -3s; }
.home-glyphs span:nth-child(6) { bottom: 8%; left: 6%; animation-duration: 13s; animation-delay: -1s; }

.home-meta {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.home-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
}

.home-live {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: homeBlink 1.6s ease-in-out infinite;
}

@keyframes homeBlink {
  0%, 40% { opacity: 1; }
  50%, 90% { opacity: 0.28; }
}

.home-jp {
  margin: 0;
  font-family: var(--font-jp);
  letter-spacing: 0.08em;
}

.home-title {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.12em 0.28em;
  margin: 1.1rem 0 0.35rem;
  animation: none;
  line-height: 0.88;
}

.home-title__cero {
  display: flex;
  gap: 0.02em;
  font-size: clamp(3.4rem, 14vw, 8.2rem);
  font-weight: 800;
  letter-spacing: -0.08em;
}

.home-letter {
  display: inline-block;
  animation: rise 1s var(--ease) both;
}

.home-letter:nth-child(1) { animation-delay: 0.04s; }
.home-letter:nth-child(2) { animation-delay: 0.12s; }
.home-letter:nth-child(3) { animation-delay: 0.2s; }
.home-letter:nth-child(4) { animation-delay: 0.28s; }
.home-letter:nth-child(5) { animation-delay: 0.36s; }

.home-letter--accent { color: var(--orange); }

.home-letter--ghost {
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
}

.home-title__jp {
  font-family: var(--font-jp);
  font-weight: 900;
  font-size: clamp(3.2rem, 12vw, 7.2rem);
  letter-spacing: -0.04em;
  animation: rise 1s var(--ease) 0.28s both;
}

.home-title__jp span:last-child { color: var(--orange); }

.home-sub {
  position: relative;
  z-index: 1;
  max-width: 38rem;
  margin: 0.6rem 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.65;
  animation: rise 0.7s var(--ease) 0.2s both;
}

.home-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1.5rem 0 1.1rem;
  animation: rise 0.7s var(--ease) 0.28s both;
}

.home-chips {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--navy);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}

.home-portals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0.4rem 0 2.8rem;
}

.home-portal {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
  padding: 20px 20px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  animation: rise 0.7s var(--ease) both;
  transition: border-color 0.25s var(--ease), transform 0.2s linear;
}

.home-portal:nth-child(2) { animation-delay: 0.08s; }
.home-portal:nth-child(3) { animation-delay: 0.16s; }
.home-portal:nth-child(4) { animation-delay: 0.24s; }

.home-portal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, var(--glow) 50%, transparent 64%);
  background-size: 220% 100%;
  background-repeat: no-repeat;
  background-position: 140% 0;
  opacity: 0;
}

.home-portal:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
}

.home-portal:hover::after { animation: shine 0.85s var(--ease); }

.home-portal__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--orange);
}

.home-portal__jp {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  color: var(--navy);
  text-transform: none;
}

.home-portal h2 {
  margin: 0.2rem 0 0;
  font-size: 1.55rem;
}

.home-portal p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 0.95rem;
}

.home-portal__stat {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--orange);
}

.home-why {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.5rem 2.5rem;
  align-items: start;
  margin: 0 0 2rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.home-kicker {
  margin: 0 0 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
}

.home-why h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.12;
}

.home-why__copy {
  margin: 1.7rem 0 0;
  color: var(--ink-soft);
  line-height: 1.7;
  font-size: 1.02rem;
}

.home-steps {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 16px 18px;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  line-height: 1.45;
}

.home-steps__n {
  font-family: var(--font-jp);
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--orange);
  line-height: 1;
}

.home-foot {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  max-width: 40rem;
  line-height: 1.55;
}

.home-philo {
  margin: 0.2rem 0 2.6rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--line);
}

.home-philo > h2 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.12;
}

.home-philo__lead {
  max-width: 42rem;
  margin: 0 0 1.5rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.7;
}

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

.home-principle {
  padding: 18px 18px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.home-principle__jp {
  margin: 0 0 0.45rem;
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.14em;
  color: var(--orange);
}

.home-principle h3 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
}

.home-principle p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 0.95rem;
}

.home-tools-head {
  margin: 0 0 0.9rem;
}

.home-tools-head h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.8vw, 2rem);
}

.loading, .muted { color: var(--ink-soft); }

h1, h2, h3, .btn, .score-num {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

h1, h2, h3 {
  margin: 0 0 0.4em;
}

h1 {
  animation: rise 0.65s var(--ease) both;
}

.loading {
  color: var(--ink-soft);
}

.loading::after {
  content: "";
  display: inline-block;
  width: 1.6em;
  text-align: left;
  animation: loadingDots 1.2s steps(4, end) infinite;
}

@keyframes loadingDots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

.q-prompt,
.flash-main,
.example-jp,
.kana-glyph,
.lesson-card h2,
.match-anchor,
ruby {
  font-family: var(--font-jp);
  letter-spacing: 0;
  font-weight: 500;
}

.lede {
  max-width: 42rem;
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 0 0 28px;
}

.catalog-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-end;
  margin: 0 0 14px;
}

.catalog-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 9rem;
}

.catalog-field span {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.catalog-search {
  flex: 1 1 220px;
  min-width: 180px;
}

.catalog-bar input[type="search"],
.catalog-bar select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  padding: 8px 2px;
  outline: none;
}

.catalog-bar input[type="search"]:focus,
.catalog-bar select:focus {
  border-bottom-color: var(--orange);
}

.catalog-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 22px;
}

.catalog-topics:empty {
  display: none;
  margin: 0;
}

.catalog-topics .topic {
  cursor: pointer;
  border: 1px solid transparent;
}

.catalog-topics .topic.on,
.catalog-topics .topic[aria-pressed="true"] {
  color: var(--paper);
  background: var(--chip);
  animation: pillPulse 2.4s ease-in-out infinite;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.lesson-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 210px;
  transition: border-color 0.25s var(--ease), transform 0.2s linear;
  animation: rise 0.7s var(--ease) both;
}

.grid .lesson-card:nth-child(2) { animation-delay: 0.06s; }
.grid .lesson-card:nth-child(3) { animation-delay: 0.12s; }
.grid .lesson-card:nth-child(4) { animation-delay: 0.18s; }
.grid .lesson-card:nth-child(5) { animation-delay: 0.24s; }
.grid .lesson-card:nth-child(n + 6) { animation-delay: 0.3s; }

.lesson-card::after,
.article::after,
.q-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 36%,
    var(--glow) 50%,
    transparent 64%
  );
  background-size: 220% 100%;
  background-repeat: no-repeat;
  background-position: 140% 0;
  opacity: 0;
}

.lesson-card:hover::after,
.article:hover::after,
.q-card:hover::after {
  animation: shine 0.85s var(--ease);
}

.lesson-card:hover {
  border-color: var(--orange);
}

.lesson-card.demo {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--orange) 12%, transparent), transparent 42%),
    var(--paper);
}

.card-kicker {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: lowercase;
  letter-spacing: 0.04em;
  color: var(--orange);
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.chip.demo { color: var(--orange); border-color: var(--orange); }

.lesson-card h2 {
  font-size: 1.45rem;
  line-height: 1.35;
}

.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.topic {
  font-size: 0.78rem;
  color: var(--navy);
  background: color-mix(in srgb, var(--navy) 12%, transparent);
  padding: 3px 8px;
  border-radius: 999px;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn, button.btn, a.btn {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--white);
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  min-height: 2.55rem;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 18px var(--accent-glow);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease);
  animation: glowPulse 2.8s ease-in-out infinite;
}

.btn.ghost,
.btn.soft,
.flash-rate .btn {
  animation: none;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: none;
}

.btn.soft {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
  box-shadow: none;
}

.btn:hover { transform: translateY(-2px); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  animation: none;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 36px;
  background: var(--empty);
}

.quiz-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.progress {
  height: 3px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 28px;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--orange), var(--navy));
  background-size: 200% 100%;
  width: var(--p, 0%);
  animation: shimmer 2.2s linear infinite;
}

.q-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  animation: rise 0.7s var(--ease) both;
}

.q-note {
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.q-prompt {
  font-family: var(--mincho);
  font-size: 1.7rem;
  line-height: 1.7;
  margin-bottom: 22px;
}

ruby rt {
  font-family: var(--font);
  font-size: 0.55em;
  color: var(--ink-soft);
}

[data-furigana="off"] rt { display: none; }

.options {
  display: grid;
  gap: 10px;
}

.option {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  text-align: left;
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
}

.option:hover, .pair-item:hover { border-color: var(--ink); }

.option.selected {
  border-color: var(--orange);
  box-shadow: inset 3px 0 0 var(--orange);
}

.option.correct,
.option.selected.correct {
  border-color: var(--uguisu);
  box-shadow: inset 3px 0 0 var(--uguisu);
  background: rgba(63, 107, 82, 0.12);
}

.option.wrong,
.option.selected.wrong {
  border-color: var(--wrong);
  box-shadow: inset 3px 0 0 var(--wrong);
  background: rgba(163, 59, 50, 0.08);
}

.option-key {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 0.78rem;
}

.type-input, input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  padding: 10px 2px;
  outline: none;
}

textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  min-height: 120px;
  resize: vertical;
  background: var(--paper);
}

.type-input:focus, input[type="text"]:focus, input[type="password"]:focus {
  border-bottom-color: var(--orange);
}

.blank-input {
  display: inline-block;
  width: 7em;
  margin: 0 6px;
  text-align: center;
}

.quiz-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.explain {
  margin-top: 18px;
  padding: 14px 16px;
  color: var(--ink-soft);
}

.explain.ok,
.explain:has(.verdict.ok) {
  border-left: 3px solid var(--uguisu);
  background: rgba(63, 107, 82, 0.1);
}

.explain.bad,
.explain:has(.verdict.bad) {
  border-left: 3px solid var(--wrong);
  background: rgba(163, 59, 50, 0.08);
}

.verdict {
  font-family: var(--mincho);
  margin-bottom: 6px;
  color: var(--ink);
}

.verdict.bad { color: var(--wrong); }
.verdict.ok { color: var(--uguisu); }

.results {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 28px;
  align-items: start;
}

.stamp {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border: 5px solid var(--orange);
  color: var(--orange);
  border-radius: 12px;
  font-family: var(--font-jp);
  font-size: 2rem;
  transform: rotate(-11deg);
  letter-spacing: 0.12em;
  animation: stampIn 0.65s var(--ease) both;
}

.stamp.fail {
  border-color: var(--ink-soft);
  color: var(--ink-soft);
}

.score-num {
  font-family: var(--font-display);
  font-size: 4rem;
  line-height: 1;
}

.miss-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.miss {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--paper);
}

.match-board {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 18px;
  align-items: start;
}

.match-slots {
  display: grid;
  gap: 8px;
}

.match-slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  padding: 6px;
  border-radius: 14px;
}

.match-anchor {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  font-family: var(--mincho);
  font-size: 1.05rem;
}

.match-well {
  min-height: 46px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 4px;
}

.match-well.empty { background: var(--inset); }
.match-well.filled { border-style: solid; background: var(--paper); }

.match-slot.drop .match-well {
  border-color: var(--orange);
  border-style: solid;
  background: color-mix(in srgb, var(--orange) 10%, transparent);
}

.match-slot.correct .match-well {
  border-color: var(--uguisu);
  background: rgba(63, 107, 82, 0.12);
}

.match-slot.wrong .match-well {
  border-color: var(--wrong);
  background: rgba(163, 59, 50, 0.08);
}

.match-placeholder {
  color: var(--ink-soft);
  background: transparent;
  border: none;
  font: inherit;
  width: 100%;
  height: 100%;
  min-height: 38px;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.match-pool {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 4px 12px;
  border-left: 1px solid var(--line);
}

.match-pool-label {
  font-size: 0.78rem;
}

.match-pool-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-chip {
  border: 1px solid var(--line);
  background: var(--paper);
  color: inherit;
  font: inherit;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: grab;
  text-align: left;
  touch-action: none;
  user-select: none;
  width: 100%;
}

.match-chip.on {
  border-color: var(--orange);
  box-shadow: inset 3px 0 0 var(--orange);
}

.match-chip.match-dragging { opacity: 0.35; }

.match-ghost {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  margin: 0;
  box-shadow: var(--shadow);
  width: auto;
  cursor: grabbing;
}

.pair-item, .token {
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
}

.pair-item.used, .token.used { opacity: 0.35; }
.pair-item.on { border-color: var(--orange); }

.order-board {
  display: grid;
  gap: 16px;
}

.order-built {
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 8px;
}

.token-pool { display: flex; flex-wrap: wrap; gap: 8px; }

.form-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}

label .lbl {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.q-edit {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--paper);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.settings {
  display: grid;
  gap: 18px;
  max-width: 540px;
}

.auth-page {
  max-width: 26rem;
}

.btn-google {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: none;
  animation: none;
}

.btn-google:hover {
  background: var(--ink);
  color: var(--bg);
}

.btn-google__g {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.auth-page .btn-google {
  margin-top: 0.4rem;
}

.auth-form {
  display: grid;
  gap: 1.05rem;
  margin: 1.1rem 0 1rem;
}

.auth-form > .btn {
  justify-self: start;
}

.auth-field {
  display: grid;
  gap: 0.2rem;
}

.auth-field span {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.auth-field small {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.auth-error {
  margin: 0;
  color: var(--orange);
  font-size: 0.9rem;
}

.auth-switch {
  margin: 0;
}

.auth-switch a {
  color: var(--ink-soft);
  text-decoration: none;
}

.auth-switch a:hover {
  color: var(--orange);
}

.settings-password {
  max-width: 540px;
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.settings-password h2 {
  margin: 0;
  font-size: 1.15rem;
}

.choice-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.choice-row button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  box-shadow: none;
}

.server-warn {
  border: 1px solid var(--orange);
  color: var(--orange);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 18px;
  background: color-mix(in srgb, var(--orange) 10%, transparent);
}

.article-back {
  margin: 0 0 12px;
}

.article-back a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
}

.article-back a:hover { color: var(--orange); }

.article {
  position: relative;
  max-width: 40rem;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px 36px;
  box-shadow: var(--shadow);
  animation: rise 0.7s var(--ease) both;
}

.article-section + .article-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-section {
  scroll-margin-top: 20px;
}

.article-section h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.article-section p {
  margin: 0 0 0.85em;
  line-height: 1.75;
}

.article-section p:last-child { margin-bottom: 0; }

.article-wide { max-width: 52rem; }

.article-toc {
  margin: 0 0 30px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--navy) 6%, transparent);
}

.toc-title {
  margin-bottom: 8px;
  font-family: var(--mincho);
  font-weight: 600;
}

.article-toc ol {
  columns: 2;
  column-gap: 32px;
  margin: 0;
  padding-left: 1.35rem;
}

.article-toc li {
  break-inside: avoid;
  margin: 0 0 6px;
  padding-left: 3px;
  line-height: 1.4;
}

.article-toc a,
.article a {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-list {
  margin: 12px 0 18px;
  padding-left: 1.35rem;
}

.article-list li {
  margin: 0 0 7px;
  padding-left: 3px;
  line-height: 1.6;
}

.article-example,
.article-callout,
.article-check {
  margin: 14px 0;
  border-radius: 12px;
}

.article-example {
  padding: 15px 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--navy) 6%, transparent);
}

.block-label {
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.example-jp {
  font-family: var(--mincho);
  font-size: 1.18rem;
  line-height: 1.55;
}

.example-text {
  margin-top: 5px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.article-callout {
  padding: 14px 16px;
  border-left: 4px solid var(--navy);
  background: color-mix(in srgb, var(--navy) 8%, transparent);
}

.article-callout.warning {
  border-left-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 10%, transparent);
}

.article-callout p {
  margin-bottom: 0;
}

.article-check {
  border: 1px solid var(--line);
  background: rgba(63, 107, 82, 0.05);
  overflow: hidden;
}

.article-check summary {
  padding: 13px 42px 13px 16px;
  cursor: pointer;
  font-weight: 500;
  line-height: 1.45;
}

.article-check summary:hover {
  color: var(--uguisu);
}

.article-check[open] summary {
  border-bottom: 1px solid var(--line);
}

.check-answer {
  padding: 13px 16px 15px;
  line-height: 1.65;
}

.check-answer p {
  margin: 0;
}

.kana-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 14px 0 4px;
  -webkit-overflow-scrolling: touch;
}

.kana-chart {
  width: 100%;
  min-width: 28rem;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.kana-chart th,
.kana-chart td {
  border: 1px solid var(--line);
  text-align: center;
  padding: 8px 4px;
  vertical-align: middle;
}

.kana-chart thead th,
.kana-chart tr:first-child th {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--inset);
}

.kana-chart th[scope="row"] {
  width: 2.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--inset);
}

.kana-glyph {
  display: block;
  font-family: var(--mincho);
  font-size: 1.45rem;
  line-height: 1.2;
}

.kana-roma {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.kana-empty { background: var(--inset); }

.kana-chart.text-table {
  min-width: 22rem;
  table-layout: auto;
}

.kana-chart.text-table th,
.kana-chart.text-table td {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: normal;
}

.kana-chart.text-table th[scope="row"] {
  width: auto;
  min-width: 4.5rem;
  font-family: var(--mincho);
  font-size: 0.95rem;
  color: var(--ink);
}

.kana-text { font-family: var(--font); }

.cards-feeds-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 22px;
}

.cards-feeds-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  font-size: 0.92rem;
}

.cards-feeds-nav a[aria-current="page"] {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
  animation: pillPulse 2.4s ease-in-out infinite;
}

.cards-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.flash-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 8px auto 28px;
  min-height: 300px;
  perspective: 1600px;
}

.flash-stack {
  position: absolute;
  inset: 18px 6% 4px;
  pointer-events: none;
}

.flash-backer {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.flash-backer:nth-child(1) { transform: translate(10px, 12px) rotate(2.2deg); opacity: 0.5; }
.flash-backer:nth-child(2) { transform: translate(-8px, 16px) rotate(-2.6deg); opacity: 0.34; }
.flash-backer:nth-child(3) { transform: translate(3px, 22px) rotate(0.8deg); opacity: 0.22; }

.flash-wrap {
  position: relative;
  z-index: 2;
  transform-style: preserve-3d;
}

.flash-wrap.deal-in { animation: flash-deal 0.55s cubic-bezier(0.2, 0.8, 0.2, 1); }
.flash-wrap.fly-left { animation: flash-fly-left 0.45s ease-in forwards; }
.flash-wrap.fly-right { animation: flash-fly-right 0.45s ease-in forwards; }
.flash-wrap.fly-down { animation: flash-fly-down 0.45s ease-in forwards; }

.flash-card {
  position: relative;
  width: 100%;
  min-height: 300px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.72s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.flash-card.flipped { transform: rotateY(180deg); cursor: default; }

.flash-face {
  position: absolute;
  inset: 0;
  min-height: 300px;
  padding: 36px 28px 32px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--glow), transparent 42%),
    var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.flash-front { transform: rotateY(0deg); }
.flash-back { transform: rotateY(180deg); }

.flash-stamp {
  position: absolute;
  top: 16px;
  right: 18px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: lowercase;
  color: var(--orange);
  opacity: 0.55;
}

.flash-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.flash-main {
  font-family: var(--mincho);
  font-size: 2.1rem;
  line-height: 1.45;
}

.flash-kana {
  margin: 10px 0 0;
  font-size: 1.15rem;
  color: var(--navy);
}

.flash-ex {
  margin: 16px 0 0;
  font-size: 1rem;
  line-height: 1.5;
}

.flash-controls { margin-bottom: 8px; }

.flash-rate {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.flash-rate .btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  line-height: 1.2;
}

.flash-when {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.9;
}

.rate-again { background: var(--wrong); color: #fff; border-color: var(--wrong); box-shadow: none; }
.rate-hard { background: transparent; color: var(--orange); border-color: var(--orange); box-shadow: none; }
.rate-good { background: var(--uguisu); color: #fff; border-color: var(--uguisu); box-shadow: none; }
.rate-easy { background: var(--chip); color: #fff; border-color: var(--chip); box-shadow: none; }

.flash-wait {
  max-width: 560px;
  margin: 12px auto 24px;
  padding: 36px 28px;
  text-align: center;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.flash-wait-clock {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--orange);
  margin: 8px 0 18px;
}

@keyframes flash-deal {
  from { transform: translateY(36px) rotate(-6deg) scale(0.94); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes flash-fly-left {
  to { transform: translateX(-130%) rotate(-22deg); opacity: 0; }
}

@keyframes flash-fly-right {
  to { transform: translateX(130%) rotate(16deg); opacity: 0; }
}

@keyframes flash-fly-down {
  to { transform: translateY(40%) rotate(8deg) scale(0.92); opacity: 0; }
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8%, 6%) scale(1.08); }
}

@keyframes pan {
  to { transform: translate(-36px, -32px); }
}

@keyframes rain {
  from { transform: translateY(-8%); }
  to { transform: translateY(8%); }
}

@keyframes float {
  50% { transform: translate(-6%, 8%) scale(1.08); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes shine {
  0% { opacity: 1; background-position: 140% 0; }
  100% { opacity: 1; background-position: -40% 0; }
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

@keyframes glowPulse {
  50% { box-shadow: 0 10px 22px var(--accent-glow); }
}

@keyframes wobble {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50% { transform: rotate(8deg) translateY(-8px); }
}

@keyframes stampIn {
  from { transform: rotate(-11deg) scale(1.45); opacity: 0; }
  to { transform: rotate(-11deg) scale(1); opacity: 1; }
}

@keyframes navShimmer {
  from { transform: translateX(-30%); }
  to { transform: translateX(280%); }
}

@keyframes pillPulse {
  50% { filter: brightness(1.12); }
}

[data-fx="off"] .wash,
[data-fx="off"] .paper-fibers,
[data-fx="off"] .scanlines,
[data-fx="off"] .kanji-rain,
[data-fx="off"] .orbs,
[data-fx="off"] .fx-sticker,
[data-fx="off"] .nav::after {
  display: none !important;
}

[data-fx="off"] h1,
[data-fx="off"] .lesson-card,
[data-fx="off"] .home-portal,
[data-fx="off"] .home-letter,
[data-fx="off"] .home-title__jp,
[data-fx="off"] .home-sub,
[data-fx="off"] .home-actions,
[data-fx="off"] .home-live,
[data-fx="off"] .home-glyphs span,
[data-fx="off"] .article,
[data-fx="off"] .q-card,
[data-fx="off"] .btn,
[data-fx="off"] .progress > span,
[data-fx="off"] .stamp,
[data-fx="off"] .catalog-topics .topic.on,
[data-fx="off"] .cards-feeds-nav a[aria-current="page"],
[data-fx="off"] .loading::after {
  animation: none;
}

[data-fx="off"] .lesson-card::after,
[data-fx="off"] .home-portal::after,
[data-fx="off"] .article::after,
[data-fx="off"] .q-card::after {
  content: none;
}

@media (max-width: 760px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 1rem 5vw;
  }
  .nav__links {
    flex-wrap: wrap;
    row-gap: 0.45rem;
  }
  .frame { padding: 18px 16px 60px; }
  .home-hero { min-height: 0; padding-bottom: 1.4rem; }
  .home-glyphs { display: none; }
  .home-title__cero { font-size: clamp(2.8rem, 16vw, 4.2rem); }
  .home-title__jp { font-size: clamp(2.6rem, 14vw, 3.8rem); }
  .home-letter--ghost { -webkit-text-stroke-width: 1.5px; }
  .home-portals,
  .home-why,
  .home-steps,
  .home-principles { grid-template-columns: 1fr; }
  .home-why__copy { margin-top: 0; }
  .article { padding: 20px 18px 28px; }
  .article-toc { padding: 15px 16px; }
  .article-toc ol { columns: 1; }
  .article-example,
  .article-callout { padding: 13px 14px; }
  .article-check summary { padding: 12px 34px 12px 14px; }
  .check-answer { padding: 12px 14px 14px; }
  .kana-glyph { font-size: 1.25rem; }
  .kana-chart th,
  .kana-chart td { padding: 6px 2px; }
  .results, .match-board { grid-template-columns: 1fr; }
  .match-pool {
    border-left: none;
    padding: 8px 0 0;
    border-top: 1px solid var(--line);
  }
  .match-pool-items { flex-direction: row; flex-wrap: wrap; }
  .match-pool-items .match-chip { width: auto; }
  .q-prompt { font-size: 1.35rem; }
  .flash-stage { min-height: 240px; }
  .flash-card,
  .flash-face { min-height: 240px; }
  .flash-face { padding: 22px 16px; }
  .flash-main { font-size: 1.55rem; }
  .flash-rate { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html.is-theming {
    transition: none;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
  .home-letter,
  .home-title__jp,
  .home-sub,
  .home-actions,
  .home-live,
  .home-glyphs span,
  .home-portal,
  .home-principle,
  .logo__dot,
  .wash__blob,
  .orb,
  .kanji-rain,
  .paper-fibers,
  .fx-sticker,
  .nav::after,
  h1,
  .lesson-card,
  .article,
  .q-card,
  .btn,
  .progress > span,
  .stamp,
  .catalog-topics .topic.on,
  .cards-feeds-nav a[aria-current="page"],
  .loading::after {
    animation: none !important;
  }
  .btn:hover { transform: none; }
  .home-portal:hover { transform: none; }
  .flash-card { transition: none; }
  .flash-wrap.deal-in,
  .flash-wrap.fly-left,
  .flash-wrap.fly-right,
  .flash-wrap.fly-down { animation: none; }
}

.option:focus-visible,
.btn:focus-visible,
.match-chip:focus-visible,
.k-cell:focus-visible,
.k-lesson:focus-visible,
.theme-toggle:focus-visible,
a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.k-kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--navy);
  margin: 0 0 0.4rem;
}

.k-hero {
  margin: 1rem 0 2rem;
}

.k-progress-num {
  font-size: 1.35rem;
  margin: 0 0 12px;
}

.k-progress-num strong {
  font-family: var(--font-display);
  font-size: 2rem;
}

.k-reviews {
  margin: 0.8rem 0 1.2rem;
  color: var(--ink-soft);
}

.k-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 1.2rem;
}

.k-stats div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.k-stats span {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 2px;
}

.k-section-title {
  font-size: 1.1rem;
  margin: 1.4rem 0 0.8rem;
}

.k-lessons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.k-lesson {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  min-height: 108px;
}

.k-lesson:hover { border-color: var(--ink); }

.k-lesson.is-locked {
  opacity: 0.55;
  border-style: dashed;
}

.k-lesson.is-done {
  box-shadow: inset 3px 0 0 var(--uguisu);
}

.k-lesson.is-open {
  box-shadow: inset 3px 0 0 var(--orange);
}

.k-lesson__n {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--navy);
}

.k-lesson__jp {
  font-family: var(--mincho);
  font-size: 1.15rem;
  letter-spacing: 0.12em;
}

.k-lesson__title {
  font-size: 0.85rem;
}

.k-lesson__band {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.k-glyph {
  font-family: var(--mincho);
  font-size: clamp(4.2rem, 18vw, 7rem);
  line-height: 1;
  text-align: center;
  margin: 0.2rem 0 0.6rem;
}

.k-meanings {
  text-align: center;
  font-size: 1.2rem;
  margin: 0 0 1rem;
}

.k-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 1.2rem;
}

.k-meta dt {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.k-meta dd {
  margin: 0;
  font-family: var(--mincho);
}

.k-examples { display: grid; gap: 8px; }

.k-ex-label {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 6px;
}

.k-ex {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.k-ex--main { border-color: var(--orange); }

.k-ex__jp { font-size: 1.15rem; }
.k-ex__ru { color: var(--ink-soft); text-align: right; }

.k-status {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.k-status--learning { color: var(--orange); }
.k-status--familiar { color: var(--navy); }
.k-status--learned,
.k-status--mastered { color: var(--uguisu); }

.k-prompt {
  font-family: var(--mincho);
  font-size: clamp(2.6rem, 10vw, 4.6rem);
  text-align: center;
  line-height: 1.2;
  margin: 0 0 1.2rem;
}

.k-prompt[lang="ru"] {
  font-family: var(--font-body);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}

.k-quiz.is-ok { box-shadow: 10px 14px 0 var(--uguisu); }
.k-quiz.is-bad { box-shadow: 10px 14px 0 var(--wrong); }

.k-complete { text-align: center; }
.k-complete-glyphs {
  font-family: var(--mincho);
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.18em;
  margin: 0.6rem 0 1rem;
}

.k-search input[type="search"] {
  width: 100%;
  max-width: 28rem;
  border: none;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 10px 0;
  font: inherit;
  margin: 0 0 1.2rem;
}

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

.k-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  font-family: var(--mincho);
  font-size: clamp(1.3rem, 4vw, 1.85rem);
  position: relative;
}

.k-cell:hover { border-color: var(--ink); }

.k-cell__dot {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}

.k-cell--locked { opacity: 0.4; border-style: dashed; }
.k-cell--new .k-cell__dot { background: var(--line); }
.k-cell--learning .k-cell__dot { background: var(--orange); }
.k-cell--familiar .k-cell__dot { background: var(--navy); }
.k-cell--learned .k-cell__dot { background: var(--uguisu); }
.k-cell--mastered {
  border-color: var(--uguisu);
  box-shadow: inset 0 0 0 2px var(--uguisu);
}
.k-cell--mastered .k-cell__dot { background: var(--uguisu); }

.match-chip.selected {
  border-color: var(--orange);
  box-shadow: inset 3px 0 0 var(--orange);
}

.settings-kanji {
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.settings-kanji h2 { font-size: 1.1rem; margin: 0 0 6px; }

.k-reset {
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--wrong);
  border-radius: 14px;
}

#kanji-reset-go {
  background: var(--wrong);
  border-color: var(--wrong);
  animation: none;
}

.k-card--compact .k-glyph { font-size: 3.2rem; }
.k-reveal { display: grid; gap: 12px; margin-top: 12px; }
.k-reveal-ex { margin: 8px 0 0; }

@media (max-width: 760px) {
  .k-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .k-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .k-meta { grid-template-columns: 1fr; }
  .k-ex { flex-direction: column; }
  .k-ex__ru { text-align: left; }
}
