/* The landing page. The accent is the app's violet (client/src/ui/theme.ts),
   so the page and the app read as one product. */

:root {
  --bg: #FFFFFF;
  --bg-alt: #F6F6FB;
  --surface: #FFFFFF;
  --border: #E7E6F0;
  --text: #16151F;
  --muted: #5F5D74;
  --accent: #6C5CE7;
  --accent-ink: #3B2EB3;
  --accent-soft: #EFEDFF;
  --good: #097A52;
  --good-soft: #E3F6EF;
  --bad: #C62B3C;
  --bad-soft: #FDEBEE;
  --shadow: 0 1px 2px rgba(22, 21, 31, 0.04), 0 16px 40px -12px rgba(22, 21, 31, 0.16);
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Segoe UI Variable", "Segoe UI", "Yu Gothic UI", "Meiryo", Roboto, "Noto Sans JP",
    "Noto Sans CJK JP", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111019;
    --bg-alt: #17161F;
    --surface: #1C1B26;
    --border: #2B2A38;
    --text: #EEEDF6;
    --muted: #A3A1B8;
    --accent: #8B7FF0;
    --accent-ink: #C9C2FF;
    --accent-soft: #252140;
    --good: #4CC79A;
    --good-soft: #14302A;
    --bad: #F2788A;
    --bad-soft: #3A1C24;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111019;
  --bg-alt: #17161F;
  --surface: #1C1B26;
  --border: #2B2A38;
  --text: #EEEDF6;
  --muted: #A3A1B8;
  --accent: #8B7FF0;
  --accent-ink: #C9C2FF;
  --accent-soft: #252140;
  --good: #4CC79A;
  --good-soft: #14302A;
  --bad: #F2788A;
  --bad-soft: #3A1C24;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* One language at a time: every sentence is written twice, and lang.js sets
   <html lang> to the visitor's. Without script the page stays Japanese. */
html[lang="ja"] span[lang="en"],
html[lang="en"] span[lang="ja"] {
  display: none;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; }
a { color: inherit; }

/* Japanese headings break between phrases, not inside a word. */
html[lang="ja"] :is(h1, h2, h3) { word-break: auto-phrase; }

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

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 720px) {
  .wrap { padding: 0 32px; }
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 8px;
  z-index: 10;
}
.skip:focus { top: 8px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
/* The app's own violet in both themes: white on it is 4.86:1. */
.btn-primary { background: #6C5CE7; color: #FFFFFF; }
.btn-primary:hover { background: #5847DE; }
.btn-ghost { color: var(--text); border: 1px solid var(--border); background: var(--surface); }
.btn-ghost:hover { border-color: var(--muted); }

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 750;
  font-size: 17px;
}
.brand img { border-radius: 7px; }
.top-actions { display: flex; align-items: center; gap: 8px; }

html:not(.js) .lang-switch { display: none; }
.lang-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}
.lang-switch button {
  font: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
@media (max-width: 340px) {
  .brand span { display: none; }
}

/* Hero */
.hero { padding: 56px 0 72px; }
.hero-grid { display: grid; gap: 48px; align-items: center; }
@media (min-width: 920px) {
  .hero { padding: 96px 0 112px; }
  .hero-grid { grid-template-columns: 1fr 440px; gap: 72px; }
}
.eyebrow {
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 650;
  color: var(--accent-ink);
}
h1 {
  font-size: clamp(34px, 7vw, 58px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 800;
}
html[lang="ja"] h1 { letter-spacing: 0; line-height: 1.3; }
.lead {
  margin-top: 22px;
  max-width: 34em;
  font-size: 18px;
  color: var(--muted);
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.beta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-soft);
}

/* The sample question */
.qcard {
  width: 100%;
  max-width: 440px;
  justify-self: center;
  padding: 24px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.q-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.q-type {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 650;
}
.q-meta { color: var(--muted); font-variant-numeric: tabular-nums; }
.q-context { margin-top: 18px; font-size: 13px; color: var(--muted); }
.q-stem { margin-top: 4px; font-size: 18px; font-weight: 650; }
.q-opts { display: grid; gap: 8px; margin-top: 16px; }
.q-opts li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
}
.q-opts .n {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.q-opts .is-correct { border-color: var(--good); background: var(--good-soft); }
.q-opts .is-correct .n { background: var(--good); color: var(--surface); }
.q-opts .is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.q-opts .is-wrong .n { background: var(--bad); color: var(--surface); }
.q-note {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

/* Sections */
section { padding: 72px 0; }
@media (min-width: 920px) { section { padding: 104px 0; } }
h2 {
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 800;
}
h3 { font-size: 17px; line-height: 1.5; font-weight: 700; }

.features { background: var(--bg-alt); border-block: 1px solid var(--border); }
.feature-grid { display: grid; gap: 36px 40px; }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .feature-grid { grid-template-columns: repeat(4, 1fr); } }
.icon {
  width: 40px;
  height: 40px;
  padding: 8px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.feature p { margin-top: 6px; font-size: 15px; color: var(--muted); }

.parts { display: grid; gap: 16px; margin-top: 32px; }
@media (min-width: 760px) { .parts { grid-template-columns: repeat(3, 1fr); } }
.part {
  padding: 24px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.part-no { font-size: 13px; font-weight: 650; color: var(--muted); }
.part h3 { font-size: 22px; }
.types { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.types li {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-size: 13px;
}

.closing { padding-top: 0; }
.closing-inner {
  padding: 56px 24px;
  border-radius: 20px;
  background: linear-gradient(135deg, #6C5CE7, #4B3BD4);
  color: #FFFFFF;
  text-align: center;
}
.closing p { margin: 10px auto 28px; max-width: 32em; color: #E8E4FF; }
.closing .btn-primary { background: #FFFFFF; color: #3B2EB3; }
.closing .btn-primary:hover { background: #EFEDFF; }

.foot { padding: 0 0 48px; }
.foot-inner { border-top: 1px solid var(--border); padding-top: 28px; }
.foot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  font-size: 14px;
}
.foot-row a { color: var(--muted); }
.foot-brand { font-weight: 650; }
.fine { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--muted); }

/* 404 */
.notfound { padding: 120px 0; }
