@font-face { font-family: "KL Sans"; src: url("fonts/kl-sans-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "KL Sans"; src: url("fonts/kl-sans-500.woff") format("woff"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "KL Sans"; src: url("fonts/kl-sans-700.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "KL Mono"; src: url("fonts/kl-mono-400.woff") format("woff"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "KL Serif"; src: url("fonts/kl-serif-500.woff") format("woff"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "KL Serif"; src: url("fonts/kl-serif-700.woff") format("woff"); font-weight: 600 700; font-display: swap; }


:root {
  --bg: #111d20;
  --bg-2: #172629;
  --bg-3: #2a4247;
  --surface: #1c2e32;
  --line: #2c4145;
  --fg: #edf3f3;
  --muted: #a6b8ba;
  --faint: #6f8487;
  --pill: #ffffff;
  --on-pill: #142226;
  --green: #3fa877;
  --red: #e0605a;
  --amber: #d9a54a;
  --blue: #5b9bd5;
  --flame: #ff9a3d;
  --ink: 255, 255, 255;
  --pill-hover: #dfeceb;
  --hero-end: #1f3438;
  --scrim: 17, 29, 32;

  --f-display: "KL Sans", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --f-body: "KL Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-jp: "KL Serif", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --f-mono: "KL Mono", ui-monospace, Menlo, Consolas, monospace;


  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 72px;
  --s9: 112px;

  --r-card: 20px;
  --r-tile: 14px;
  --r-pill: 999px;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
p { margin: 0; }

h1, h2, h3 {
  font-family: var(--f-display);
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); line-height: 1.08; }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); line-height: 1.15; }
h3 { font-size: 1.35rem; line-height: 1.3; }

.small { font-size: 0.9rem; color: var(--muted); }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: var(--s5);
}
@media (max-width: 520px) { .wrap { padding-inline: var(--s4); } }

:focus-visible { outline: 2px solid var(--flame); outline-offset: 3px; border-radius: 6px; }


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 52px;
  padding: 0 var(--s5);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--pill);
  color: var(--on-pill);
  font: 600 1rem/1 var(--f-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease;
}
.btn:hover { background: var(--pill-hover); transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { background: var(--surface); color: var(--faint); cursor: default; transform: none; }
.btn-small { min-height: 38px; padding: 0 var(--s4); font-size: .9rem; }
.btn-wide { width: 100%; }

.link {
  color: var(--fg);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 5px;
}
.link:hover { text-decoration-color: var(--fg); }


.bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.bar-in {
  display: flex;
  align-items: center;
  gap: var(--s5);
  min-height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.brand img { border-radius: 8px; }
.bar-nav { display: flex; gap: var(--s5); margin-left: auto; }
.bar-nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.bar-nav a:hover { color: var(--fg); }
.bar-actions { display: flex; align-items: center; gap: var(--s2); }
@media (max-width: 720px) {
  .bar-nav { display: none; }
  .bar-actions { margin-left: auto; }
}


.hero {
  position: relative;
  overflow: hidden;
  padding-block: var(--s8) var(--s8);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 55%, var(--hero-end) 100%);
}

.hero-mark {
  position: absolute;
  right: -4vw;
  top: -6vw;
  font-family: var(--f-jp);
  font-weight: 700;
  font-size: min(46vw, 620px);
  line-height: 1;
  color: var(--fg);
  opacity: .035;
  pointer-events: none;
  user-select: none;
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: var(--s7);
  align-items: center;
}
.hero-copy { display: grid; gap: var(--s5); max-width: 36rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 34rem; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s5); margin-top: var(--s2); }
.cta-meta { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); letter-spacing: .02em; }

.hero-shot { position: relative; justify-self: center; width: min(320px, 100%); }
.hero-shot .phone { width: 100%; }
.widget {
  position: absolute;
  left: -38%;
  bottom: 14%;
  width: 78%;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .45));
}

@media (max-width: 900px) {
  .hero { padding-block: var(--s7) var(--s7); }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-shot { width: min(300px, 78%); margin-left: 20%; }
  .widget { left: -30%; width: 80%; }
}


.watch { padding-block: var(--s8); border-top: 1px solid var(--line); }
.watch-in { display: grid; gap: var(--s6); }
.watch-head { display: grid; gap: var(--s3); max-width: 40rem; }
.watch-head p { color: var(--muted); }
.watch-video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-card);
  background: var(--bg-2);
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .6);
}
.watch-frame { position: relative; }
.watch-video { cursor: pointer; }


.sound {
  position: absolute;
  top: var(--s4);
  right: var(--s4);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(var(--ink), .14);
  border-radius: 50%;
  background: rgba(var(--scrim), .78);
  color: var(--fg);
  cursor: pointer;
  transition: background-color .15s ease, transform .15s ease;
}
.sound:hover { background: rgba(var(--scrim), .95); transform: scale(1.06); }
.sound svg { width: 22px; height: 22px; }
.sound .ic-on { display: none; }
.sound[aria-pressed="true"] .ic-on { display: block; }
.sound[aria-pressed="true"] .ic-off { display: none; }

@media (max-width: 520px) {
  .watch { padding-block: var(--s7); }
  .watch-video { border-radius: var(--r-tile); }
  .sound { top: var(--s2); right: var(--s2); width: 40px; height: 40px; }
}

/* feather the left and right edges of the phone shots so they melt into the page */
.hero-shot .phone,
.shots img {
  --phone-fade: 8%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--phone-fade), #000 calc(100% - var(--phone-fade)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--phone-fade), #000 calc(100% - var(--phone-fade)), transparent 100%);
}

/* mini player: the watch video pops to the bottom left once you scroll past it */
.pip-close { display: none; }
.watch-frame.is-pip {
  position: fixed;
  left: clamp(12px, 3vw, 24px);
  bottom: clamp(12px, 3vw, 24px);
  width: min(320px, 44vw);
  margin: 0;
  z-index: 60;
  border-radius: var(--r-tile);
  overflow: hidden;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .6);
  animation: pip-in .25s ease;
}
.reduce-motion .watch-frame.is-pip { animation: none; }
.watch-frame.is-pip .watch-video {
  aspect-ratio: 16 / 9;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}
.watch-frame.is-pip .sound {
  top: var(--s2);
  right: var(--s2);
  width: 36px;
  height: 36px;
}
.watch-frame.is-pip .sound svg { width: 18px; height: 18px; }
.watch-frame.is-pip .pip-close {
  display: grid;
  place-items: center;
  position: absolute;
  top: var(--s2);
  left: var(--s2);
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(var(--ink), .14);
  border-radius: 50%;
  background: rgba(var(--scrim), .78);
  color: var(--fg);
  cursor: pointer;
  transition: background-color .15s ease, transform .15s ease;
}
.watch-frame.is-pip .pip-close:hover { background: rgba(var(--scrim), .95); transform: scale(1.06); }
.watch-frame.is-pip .pip-close svg { width: 16px; height: 16px; }
@keyframes pip-in {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: none; }
}


.try {
  padding-block: var(--s9);
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}
.try-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: var(--s8);
  align-items: start;
}
.try-copy { display: grid; gap: var(--s4); max-width: 30rem; }
.try-copy .sub { margin-top: var(--s5); font-size: 1.1rem; }
@media (max-width: 900px) {
  .try { padding-block: var(--s8); }
  .try-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s7); }
}


.theme-group { display: grid; gap: var(--s1); min-width: 0; }
.theme-label {
  font-family: var(--f-mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.picker { display: grid; gap: var(--s3); min-width: 0; }
.themes {
  --fade: 48px;
  --fade-l: 0px;
  --fade-r: 0px;
  display: flex;
  gap: var(--s2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--s1);
  padding: var(--s1) var(--s1) var(--s2);
  margin-inline: calc(var(--s1) * -1);
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent 100%);
}
.themes::-webkit-scrollbar { display: none; }
.themes.fade-start { --fade-l: var(--fade); }
.themes.fade-end { --fade-r: var(--fade); }
.themes.is-dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.themes.is-dragging .chip { pointer-events: none; }

.theme-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 30px; }
.row-nav { display: none; gap: var(--s1); }
@media (hover: hover) and (pointer: fine) {
  .row-nav { display: flex; }
}
.row-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  transition: background-color .15s ease, opacity .15s ease, transform .15s ease;
}
.row-btn svg { width: 16px; height: 16px; }
.row-btn:hover:not(:disabled) { background: var(--bg-3); transform: translateY(-1px); }
.row-btn:disabled { opacity: .35; cursor: default; }

.chip {
  flex: 0 0 76px;
  scroll-snap-align: start;
  display: grid;
  justify-items: center;
  gap: var(--s1);
  padding: var(--s2) var(--s1) var(--s2);
  border: 2px solid transparent;
  border-radius: var(--r-tile);
  background: var(--surface);
  color: var(--muted);
  font: 500 .75rem/1.2 var(--f-body);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.chip:hover { transform: translateY(-2px); }
.chip[aria-pressed="true"] { border-color: var(--fg); color: var(--fg); }
.chip-face {
  display: grid;
  place-items: center;
  width: 52px;
  aspect-ratio: 1;
  border-radius: 12px;
  font-family: var(--f-jp);
  font-size: 1.35rem;
}
.chip-dots { display: flex; gap: 3px; margin-top: -14px; }
.chip-dots i { width: 5px; height: 5px; border-radius: 50%; }

@media (max-width: 520px) {
  .chip { flex-basis: 88px; font-size: .82rem; }
  .chip-face { width: 62px; font-size: 1.6rem; border-radius: 14px; }
  .chip-dots { margin-top: -15px; }
  .chip-dots i { width: 6px; height: 6px; }
}

.quiz.is-shaking { animation: shake .42s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}
.reduce-motion { scroll-behavior: auto; }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  animation: none !important;
  transition-duration: .01ms !important;
}
.reduce-motion .btn:hover, .reduce-motion .chip:hover, .reduce-motion .grade:hover, .reduce-motion .row-btn:hover, .reduce-motion .speak:hover, .reduce-motion .sound:hover, .reduce-motion .icon-btn:hover { transform: none; }

.is-light .hero-mark { opacity: .06; }
.quiz.is-light { box-shadow: 0 30px 60px -28px rgba(0, 0, 0, .22); }
.is-light .watch-video { box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .25); }
.is-light .widget { filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .18)); }


.quiz {
  --c-top: var(--bg);
  --c-mid: var(--bg-2);
  --c-bottom: var(--bg-3);
  --c-text: var(--fg);
  --c-muted: var(--muted);
  --c-ink: var(--ink);
  --c-pill: var(--pill);
  --c-onpill: var(--on-pill);
  --c-faint: var(--faint);
  --c-again: var(--red);
  --c-good: var(--green);
  --c-easy: var(--blue);
  --c-flame: var(--flame);

  display: grid;
  gap: var(--s3);
  padding: var(--s4);
  border-radius: 28px;
  background: linear-gradient(180deg, var(--c-top), var(--c-mid) 50%, var(--c-bottom));
  color: var(--c-text);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55);
  transition: background .3s ease, color .3s ease;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: rgba(var(--c-ink), .07);
  border: 1px solid rgba(var(--c-ink), .08);
}
.tab {
  min-height: 40px;
  padding: 0 var(--s2);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--c-muted);
  font: 600 .88rem/1 var(--f-body);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.tab:hover { color: var(--c-text); }
.tab[aria-selected="true"] { background: var(--c-pill); color: var(--c-onpill); }
.q-sub { min-height: 2.8em; padding-inline: var(--s1); font-size: .85rem; line-height: 1.4; color: var(--c-muted); }

.quiz-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.quiz-stats .tile { padding: var(--s2) var(--s3); }
.quiz-stats .tile-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-tile);
  background: rgba(var(--c-ink), .07);
  border: 1px solid rgba(var(--c-ink), .08);
}
.tile-label { font-size: .8rem; color: var(--c-muted); }
.tile b {
  grid-column: 1 / -1;
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-blue { background: var(--c-easy); }
.dot-green { background: var(--c-good); }
.dot-flame { background: var(--c-flame); }

.card {
  padding: var(--s5) var(--s4) var(--s4);
  border-radius: var(--r-card);
  background: rgba(var(--c-ink), .07);
  border: 1px solid rgba(var(--c-ink), .08);
}
.card-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-muted);
}

.q-front {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 112px;
  margin-top: var(--s4);
}
.q-word {
  text-align: center;
  font-family: var(--f-jp);
  font-weight: 700;
  font-size: clamp(3.2rem, 9vw, 4.4rem);
  line-height: 1.15;
}
.q-word-sm { font-size: 2.5rem; }
.q-meaning {
  text-align: center;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.25;
}
.q-reveal { display: grid; justify-items: center; gap: 2px; margin-top: var(--s1); }
.q-reveal[hidden] { display: none; }
.q-reading {
  text-align: center;
  font-family: var(--f-jp);
  font-size: 1.2rem;
  color: var(--c-muted);
}
.q-gloss { text-align: center; color: var(--c-text); }


.speak {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(var(--c-ink), .1);
  background: rgba(var(--c-ink), .11);
  color: var(--c-text);
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease;
}
.speak:hover { transform: scale(1.05); background: rgba(var(--c-ink), .16); }
.speak svg { width: 36px; height: 36px; }
.speak-label { margin-top: var(--s2); font-size: .82rem; color: var(--c-muted); }

.options { display: grid; gap: var(--s2); margin-top: var(--s5); }
.options[hidden], .q-form[hidden] { display: none; }
.opt.opt-jp { font: 500 1.35rem/1.3 var(--f-jp); }


.q-form { margin-top: var(--s5); }
.q-input {
  width: 100%;
  min-height: 54px;
  padding: 0 var(--s4);
  border-radius: var(--r-tile);
  border: 1px solid rgba(var(--c-ink), .14);
  background: rgba(var(--c-ink), .06);
  color: var(--c-text);

  font: 500 1.25rem/1.2 "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", system-ui, sans-serif;
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease;
}
.q-input::placeholder { font: 400 .95rem/1.2 var(--f-body); color: var(--c-faint); }
.q-input:focus { outline: none; border-color: var(--c-text); }
.q-input:disabled { opacity: 1; }
.q-input.is-right { border-color: var(--c-good); background: color-mix(in srgb, var(--c-good) 18%, transparent); }
.q-input.is-wrong { border-color: var(--c-again); background: color-mix(in srgb, var(--c-again) 18%, transparent); }
.opt {
  min-height: 52px;
  padding: var(--s2) var(--s4);
  border-radius: var(--r-tile);
  border: 1px solid rgba(var(--c-ink), .1);
  background: rgba(var(--c-ink), .06);
  color: var(--c-text);
  font: 500 1rem/1.3 var(--f-body);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.opt:hover:not(:disabled) { background: rgba(var(--c-ink), .12); }
.opt:disabled { cursor: default; }

.opt.is-right { background: color-mix(in srgb, var(--c-good) 22%, transparent); border-color: var(--c-good); }
.opt.is-wrong { background: color-mix(in srgb, var(--c-again) 22%, transparent); border-color: var(--c-again); }
.opt.is-dim { color: var(--c-muted); }
.q-note { min-height: 1.5em; margin-top: var(--s3); text-align: center; font-size: .9rem; color: var(--c-muted); }
.q-note b { color: var(--c-text); font-weight: 600; }

.quiz .btn { background: var(--c-pill); color: var(--c-onpill); }
.quiz .btn:hover { transform: translateY(-2px); }
.quiz .btn:disabled { background: rgba(var(--c-ink), .08); color: var(--c-muted); transform: none; }
.q-actions { display: flex; gap: var(--s2); }
.quiz .btn-ghost {
  flex: none;
  background: rgba(var(--c-ink), .07);
  color: var(--c-text);
  border: 1px solid rgba(var(--c-ink), .1);
}
.quiz .btn-ghost:hover { background: rgba(var(--c-ink), .12); }
.quiz .btn-ghost[hidden] { display: none; }

@media (max-width: 400px) {
  .tab { font-size: .8rem; padding: 0 4px; }
  .quiz-stats .tile b { font-size: 1.35rem; }
}


.inside { padding-block: var(--s9); }
.inside > .wrap > h2 { margin-bottom: var(--s7); }
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s8);
  align-items: center;
  padding-block: var(--s7);
  border-top: 1px solid var(--line);
}
.feature.flip .shots { order: 2; }
.feature-copy { display: grid; gap: var(--s4); max-width: 30rem; }
.feature-copy p { color: var(--muted); }


.shots { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); max-width: 480px; }
.shots img:nth-child(2) { margin-top: var(--s8); }

.facts { display: grid; gap: 0; margin: var(--s2) 0 0; }
.facts div {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: var(--s4);
  padding-block: var(--s3);
  border-top: 1px solid var(--line);
}
.facts dt {
  font-family: var(--f-mono);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 3px;
}
.facts dd { margin: 0; }

@media (max-width: 900px) {
  .inside { padding-block: var(--s8); }
  .feature { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
  .feature.flip .shots { order: 0; }
  .shots { max-width: 400px; }
}
@media (max-width: 480px) {
  .facts div { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
}


.install {
  padding-block: var(--s9);
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}
.install-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: var(--s7) var(--s8);
}
.install-grid > div:first-child { display: grid; gap: var(--s4); align-content: start; }
.install-grid > div:first-child p { color: var(--muted); max-width: 26rem; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: var(--s5); }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: var(--s4);
  row-gap: var(--s1);
}
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--pill);
  color: var(--on-pill);
  font: 600 1rem/1 var(--f-body);
}
.steps b { font-family: var(--f-display); font-size: 1.15rem; padding-top: var(--s2); }
.steps span { color: var(--muted); }
.steps a { color: var(--fg); }

.faq {
  grid-column: 2;
  display: grid;
  gap: var(--s5);
  margin: 0;
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
}
.faq dt { font-weight: 600; }
.faq dd { margin: var(--s1) 0 0; color: var(--muted); }

@media (max-width: 900px) {
  .install { padding-block: var(--s8); }
  .install-grid { grid-template-columns: minmax(0, 1fr); }
  .faq { grid-column: 1; }
}


.foot { padding-block: var(--s7); border-top: 1px solid var(--line); }
.foot-in { display: grid; gap: var(--s3); }
.foot-kanji { font-family: var(--f-jp); font-weight: 700; font-size: 1.3rem; margin-right: var(--s1); }
.foot a { color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.foot-links a { color: var(--fg); font-weight: 500; }
.foot .small { max-width: 52rem; }


.doc {
  max-width: 46rem;
  padding-block: var(--s8) var(--s9);
}
.doc h1 { font-size: clamp(2.2rem, 4.4vw, 3rem); margin-bottom: var(--s3); }
.doc h2 { font-size: 1.35rem; margin: var(--s7) 0 var(--s3); }
.doc p, .doc ul { margin: 0 0 var(--s4); color: var(--muted); }
.doc li { margin-bottom: var(--s2); }
.doc b, .doc strong { color: var(--fg); font-weight: 600; }
.doc a { color: var(--fg); text-underline-offset: 3px; }
.doc code { font-family: var(--f-mono); font-size: .88em; color: var(--fg); }
.doc-date { font-family: var(--f-mono); font-size: .85rem; }
.license, .table-scroll { overflow-x: auto; }
.license {
  margin: 0 0 var(--s4);
  padding: var(--s4);
  background: var(--surface);
  border-radius: var(--r-tile);
  font: 400 .8rem/1.6 var(--f-mono);
  color: var(--muted);
}
.doc table { width: 100%; border-collapse: collapse; margin-bottom: var(--s4); font-size: .95rem; }
.doc th, .doc td { text-align: left; padding: var(--s3) var(--s4) var(--s3) 0; border-top: 1px solid var(--line); vertical-align: top; }
.doc th { font: 500 .75rem/1.4 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bar-nav a[aria-current="page"] { color: var(--fg); }
.foot a:hover { color: var(--fg); }


section[id] { scroll-margin-top: 72px; }


.q-subrow { display: flex; align-items: flex-start; gap: var(--s2); }
.q-subrow .q-sub { flex: 1; }
.sfx {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(var(--c-ink), .1);
  background: rgba(var(--c-ink), .07);
  color: var(--c-muted);
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.sfx:hover { color: var(--c-text); background: rgba(var(--c-ink), .12); }
.sfx svg { width: 18px; height: 18px; }
.sfx .ic-on { display: none; }
.sfx[aria-pressed="true"] { color: var(--c-text); }
.sfx[aria-pressed="true"] .ic-on { display: block; }
.sfx[aria-pressed="true"] .ic-off { display: none; }


.grades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); max-width: 26rem; }
.grade {
  --g: var(--green);
  min-height: 44px;
  padding: 0 var(--s2);
  border-radius: var(--r-tile);
  border: 1px solid color-mix(in srgb, var(--g) 55%, transparent);
  background: color-mix(in srgb, var(--g) 16%, transparent);
  color: var(--fg);
  font: 600 .9rem/1 var(--f-body);
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease;
}
.grade:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--g) 26%, transparent); }
.grade:active { transform: translateY(0); }
.grade-again { --g: var(--red); }
.grade-hard { --g: var(--amber); }
.grade-good { --g: var(--green); }
.grade-easy { --g: var(--blue); }


.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  transition: background-color .15s ease, transform .15s ease;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--bg-3); transform: translateY(-1px); }
#open-settings svg { transition: transform .4s ease; }
#open-settings:hover svg { transform: rotate(45deg); }

.sheet-open { overflow: hidden; }
.sheet {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100%);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(0, 0, 0, .5); }
.sheet[open] { animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1); }
.sheet[open]::backdrop { animation: fade-in .28s ease; }
@keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

.sheet-in { display: grid; gap: var(--s6); padding: var(--s5); padding-bottom: calc(var(--s6) + env(safe-area-inset-bottom, 0px)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.sheet-title { font-size: 1.6rem; }
.set-block { display: grid; gap: var(--s3); min-width: 0; }
.set-label { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.set-label h3 { font-size: 1.05rem; }
.set-value { font-family: var(--f-mono); font-size: .78rem; letter-spacing: .04em; color: var(--muted); }

.switch-row {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-tile);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.switch-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.switch-text b { font-weight: 600; }
.switch-text span { font-size: .85rem; line-height: 1.4; color: var(--muted); }
.switch {
  appearance: none;
  flex: none;
  position: relative;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: var(--r-pill);
  background: rgba(var(--ink), .14);
  cursor: pointer;
  transition: background-color .15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .18s ease;
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--flame); outline-offset: 3px; }

.sheet-foot { display: grid; gap: var(--s3); justify-items: start; }
.btn-ghost-site {
  min-height: 44px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line);
}
.btn-ghost-site:hover { background: var(--bg-3); }

.sheet .chip { background: var(--bg); }

@media (max-width: 520px) {
  .sheet {
    inset: auto 0 0 0;
    width: 100%;
    height: auto;
    max-height: 88dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 24px 24px 0 0;
  }
  .sheet[open] { animation-name: sheet-up; }
  @keyframes sheet-up { from { transform: translateY(60px); opacity: 0; } }
  .sheet-in { padding: var(--s5) var(--s4); padding-bottom: calc(var(--s6) + env(safe-area-inset-bottom, 0px)); gap: var(--s5); }
}

.preview-bar {
  display: grid;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-tile);
  border: 1px solid var(--line);
  background: var(--surface);
}
.preview-bar[hidden] { display: none; }
.preview-bar p { font-size: .92rem; color: var(--muted); }
.preview-bar b { color: var(--fg); font-weight: 600; }
.preview-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.preview-actions .btn { min-height: 40px; }
.preview-bar:not([hidden]) { animation: fade-in .2s ease; }
