:root {
  --ink: #171717;
  --ink-soft: #34312e;
  --muted: #66615b;
  --line: #cfc9be;
  --line-strong: #918b81;
  --bg: #f3f0e9;
  --panel: #fbfaf6;
  --panel-strong: #fffefb;
  --accent: #b13a2e;
  --accent-dark: #7f2820;
  --accent-soft: #f5e9e5;
  --primary: var(--accent);
  --primary-dark: var(--accent-dark);
  --primary-2: var(--accent-dark);
  --soft: var(--accent-soft);
  --ok: #245c45;
  --ok-soft: #eaf2ed;
  --ng: #922f37;
  --ng-soft: #f8eaec;
  --warn: #765217;
  --warn-soft: #f7f0df;
  --shadow: 0 10px 30px rgba(23, 23, 23, .06);
  --radius: 6px;
  --radius-sm: 3px;
  --font-display: "Yu Mincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Noto Serif JP", serif;
  --font-ui: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --font-latin: Georgia, "Times New Roman", serif;
  --content-width: 1360px;
  --reading-measure: 44rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(243, 240, 233, .76), rgba(243, 240, 233, .76)),
    url("../textures/washi-paper.webp");
  background-size: auto, 1024px 1024px;
  font-family: var(--font-ui);
  font-feature-settings: "palt" 1;
  font-kerning: normal;
  line-height: 1.78;
}
button, select, input, textarea { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; }
a {
  color: var(--accent-dark);
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}
img, svg { max-width: 100%; }
[hidden], .hidden { display: none !important; }

h1, h2, h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .025em;
}

:focus-visible {
  outline: 3px solid #d7942e;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 9px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 246, .94);
  box-shadow: none;
  backdrop-filter: blur(12px);
}
.header-inner {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(var(--content-width), 100%);
  margin: auto;
  padding: 10px 34px;
}
.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: block;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  object-fit: contain;
}
.brand-title {
  display: inline-block;
  font-family: var(--font-latin);
  font-size: clamp(23px, 2.1vw, 31px);
  font-weight: 400;
  letter-spacing: .015em;
  line-height: 1.2;
}
.brand-subtitle {
  display: inline-block;
  margin-left: 22px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .09em;
  line-height: 1.4;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.top-btn {
  position: relative;
  min-height: 44px;
  padding: 8px 2px;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
}
.top-btn::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: "";
  opacity: 0;
  transform: scaleX(.35);
  transition: opacity .16s ease, transform .16s ease;
}
.top-btn:hover { color: var(--accent-dark); }
.top-btn:hover::after,
body[data-active-view="landing"] .top-btn[data-view-target="landing"]::after {
  opacity: 1;
  transform: scaleX(1);
}

main {
  width: min(var(--content-width), 100%);
  margin: auto;
  padding: 36px 34px 76px;
}
.view[aria-hidden="true"] { display: none; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(310px, .75fr);
  gap: clamp(30px, 5vw, 76px);
  align-items: center;
  padding: clamp(42px, 5vw, 68px) 4px clamp(36px, 4vw, 54px);
  border: solid var(--line-strong);
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.hero h1, .hero h2 {
  max-width: 16em;
  margin: 0 0 20px;
  font-size: clamp(34px, 4.7vw, 68px);
  line-height: 1.38;
  letter-spacing: .045em;
}
.hero h1 span, .hero h2 span { color: inherit; }
.hero p {
  max-width: 48rem;
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .04em;
}
.hero-copy { position: relative; min-width: 0; }
.hero-copy h1::after {
  display: block;
  width: 138px;
  height: 2px;
  margin-top: 24px;
  background: var(--accent);
  content: "";
}
.hero-eyebrow {
  display: block;
  margin-bottom: 15px;
  color: var(--accent-dark);
  font-family: var(--font-latin);
  font-size: 11px;
  letter-spacing: .2em;
}
.landing-hero {
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
  padding-top: clamp(44px, 5vw, 72px);
}
.hero-visual {
  position: relative;
  min-height: 360px;
  align-self: stretch;
}
.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.hero-vertical-label {
  position: absolute;
  top: 5%;
  right: 0;
  padding-bottom: 116px;
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: .15em;
  line-height: 1.05;
}
.hero-vertical-label::after {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 1px;
  height: 96px;
  background: var(--line-strong);
  content: "";
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}
.landing-hero .hero-stats {
  grid-column: 1 / -1;
  margin-top: 2px;
}
.training-hero h1 { font-size: clamp(32px, 4vw, 56px); }
.training-hero .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
.training-hero .stat:nth-child(3) { padding-left: 0; border-left: 0; }
.stat {
  min-width: 0;
  padding: 5px 28px 5px 28px;
  text-align: left;
  border: 0;
  border-left: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
}
.stat:first-child { padding-left: 0; border-left: 0; }
.stat b {
  display: block;
  color: var(--ink);
  font-family: var(--font-latin);
  font-size: clamp(31px, 3.2vw, 48px);
  font-weight: 400;
  letter-spacing: .02em;
  line-height: 1.15;
}
.stat small {
  display: block;
  margin-top: 5px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .04em;
}

.section { margin-top: 36px; }
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}
.section-title h2, .section-title h3 {
  margin: 0;
  font-size: 23px;
}
.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

#landingView .landing-modes { margin-top: 38px; }
#landingView .landing-modes > .section-title {
  display: grid;
  grid-template-columns: minmax(40px, 1fr) auto minmax(40px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0;
  border: 0;
  text-align: center;
}
#landingView .landing-modes > .section-title::before,
#landingView .landing-modes > .section-title::after {
  height: 1px;
  background: var(--line-strong);
  content: "";
}
#landingView .landing-modes > .section-title h2 { grid-column: 2; font-size: clamp(24px, 2.7vw, 36px); letter-spacing: .1em; }
#landingView .landing-modes > .section-title p { grid-column: 1 / -1; grid-row: 2; }

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(251, 250, 246, .94);
  box-shadow: var(--shadow);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.mode-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 330px;
  flex-direction: column;
  padding: 27px 30px 24px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(251, 250, 246, .82);
  box-shadow: none;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.mode-card::before {
  position: absolute;
  top: -1px;
  left: 30px;
  width: 56px;
  height: 2px;
  background: var(--accent);
  content: "";
}
.mode-card:hover {
  border-color: var(--ink);
  box-shadow: 0 12px 28px rgba(23, 23, 23, .07);
  transform: translateY(-2px);
}
.mode-card.diagnostic-card { background: rgba(239, 236, 228, .66); }
.mode-icon {
  display: inline-flex;
  width: auto;
  height: auto;
  align-items: baseline;
  gap: 7px;
  align-self: flex-start;
  color: var(--accent);
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
}
.mode-icon::before {
  color: var(--ink-soft);
  font-family: var(--font-latin);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .12em;
  content: "TRAINING /";
}
.diagnostic-card .mode-icon::before { content: "DIAGNOSTIC /"; }
.mode-card h2 {
  margin: 12px 0 7px;
  font-size: clamp(22px, 2.3vw, 30px);
  letter-spacing: .06em;
}
.mode-card p { margin: 0 0 14px; color: var(--ink-soft); font-size: 14px; }
.mode-card .mode-meta {
  margin: 0 0 20px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  list-style: none;
}
.mode-card .mode-meta li { position: relative; padding-left: 15px; }
.mode-card .mode-meta li::before { position: absolute; left: 0; color: var(--accent); content: "—"; }
.mode-card .btn { min-width: 230px; margin-top: auto; align-self: flex-end; }

.btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 18px;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .58; }
.btn-primary {
  color: #fff;
  background: var(--ink);
  box-shadow: none;
}
.btn-primary:hover:not(:disabled) { background: #000; box-shadow: 0 7px 16px rgba(23, 23, 23, .18); }
.btn-primary::after { margin-left: 3px; font-family: var(--font-ui); font-weight: 400; content: "›"; }
.btn-secondary { color: var(--ink); border: 1px solid var(--ink); background: var(--panel); }
.btn-ghost { color: var(--ink-soft); border: 1px solid var(--line-strong); background: transparent; }
.btn-danger { color: var(--ng); border: 1px solid var(--ng); background: var(--ng-soft); }
.button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.notice, .status-box {
  padding: 13px 15px;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #eeebe4;
  font-size: 13px;
}
.notice.info, .status-box.info { color: var(--ink-soft); border-color: var(--line); background: #efede7; }
.notice.success, .status-box.success { color: var(--ok); border-color: #8caf9c; background: var(--ok-soft); }
.notice.error, .status-box.error { color: var(--ng); border-color: #c89096; background: var(--ng-soft); }
.status-box:empty { display: none; }
.landing-assurance { border-width: 1px 0; background: rgba(251, 250, 246, .44); text-align: center; }

.form-field { margin-bottom: 16px; }
.form-fieldset { margin: 0; padding: 0; border: 0; }
.form-fieldset legend { margin: 0 0 14px; padding: 0; font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.form-field > label, .field-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; }
.form-field select,
.form-field input:not([type="checkbox"]):not([type="radio"]),
.form-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel-strong);
}
.checkbox-row { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; cursor: pointer; }
.checkbox-row input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--accent); }
.help-text { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.required { color: var(--ng); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  max-width: min(390px, calc(100vw - 32px));
  padding: 12px 16px;
  color: #fff;
  border: 1px solid #3d3935;
  border-radius: 4px;
  background: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: .2s;
}
.toast.show { opacity: 1; transform: none; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.site-footer {
  position: relative;
  width: min(var(--content-width), calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 20px 42px;
  color: var(--muted);
  border-top: 1px solid var(--line-strong);
  text-align: center;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .04em;
}
.site-footer::before {
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
  background: url("../brand/reading-seal.svg") center / contain no-repeat;
  content: "";
}
.footer-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-bottom: 9px; }
.footer-links a { display: inline-flex; min-height: 44px; align-items: center; padding-inline: 4px; }

.legal-page main { width: min(900px, 100%); padding-top: 44px; }
.legal-page .panel { padding: clamp(24px, 5vw, 52px); }
.legal-page .panel > h1 { margin-top: 0; padding-bottom: 18px; border-bottom: 3px double var(--ink); font-size: clamp(28px, 4vw, 40px); }
.legal-page .panel h2 { margin-top: 32px; font-size: 21px; }
.legal-page .panel p, .legal-page .panel li { max-width: 48rem; }
.legal-page dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; }
.legal-page dl dt { font-weight: 700; }
.legal-page dl dd { margin: 0; }

.contact-page main { width: min(1080px, 100%); }
.contact-panel { padding: clamp(24px, 5vw, 52px); }
.contact-heading {
  padding-bottom: 22px;
  border-bottom: 3px double var(--ink);
}
.contact-heading .hero-eyebrow { margin: 0 0 7px; }
.contact-heading h1 {
  margin: 0 0 9px;
  padding: 0;
  border: 0;
  font-size: clamp(30px, 4vw, 42px);
}
.contact-heading p:last-child { max-width: 48rem; margin-bottom: 0; color: var(--ink-soft); }
.contact-status { margin-top: 22px; }
.contact-status > b { display: block; }
.contact-error-list { margin: 8px 0 0; padding-left: 1.35rem; }
.contact-error-list li + li { margin-top: 3px; }
.contact-layout {
  display: grid;
  grid-template-columns: minmax(230px, .72fr) minmax(0, 1.28fr);
  gap: clamp(26px, 5vw, 54px);
  margin-top: 32px;
}
.contact-guide {
  align-self: start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f1eee7;
}
.contact-guide h2 { margin: 0 0 10px; font-size: 22px; }
.contact-guide > p:first-of-type { margin-top: 0; }
.contact-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 7px 14px;
  margin: 20px 0;
  padding: 15px 0;
  border-block: 1px solid var(--line);
}
.contact-meta dt { color: var(--muted); font-size: 12px; }
.contact-meta dd { min-width: 0; overflow-wrap: anywhere; }
.contact-form { min-width: 0; }
.contact-form .form-field { margin-bottom: 20px; }
.contact-form textarea { min-height: 210px; resize: vertical; line-height: 1.75; }
.contact-form [aria-invalid="true"] { border-color: var(--ng); box-shadow: 0 0 0 1px var(--ng); }
.field-optional { color: var(--muted); font-size: 11px; font-weight: 500; }
.field-error { margin: 6px 0 0; color: var(--ng); font-size: 12px; font-weight: 700; }
.contact-field-help { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.contact-field-help .help-text:last-child { flex: 0 0 auto; }
.contact-consent { margin-top: 4px; }
.contact-consent .field-error { margin-left: 34px; }
.contact-submit-row { align-items: stretch; }
.contact-submit-row .btn { min-width: 190px; }
.contact-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

@media (max-width: 960px) {
  .header-inner { padding-inline: 22px; }
  .brand-subtitle { display: block; margin: 2px 0 0; }
  .hero, .landing-hero { grid-template-columns: 1fr; }
  .hero-visual { min-height: 280px; }
  .hero-stats, .landing-hero .hero-stats { grid-column: 1; }
}

@media (max-width: 720px) {
  .site-header { position: relative; }
  .header-inner { min-height: auto; align-items: stretch; flex-direction: column; gap: 4px; padding: 9px 12px; }
  .brand { gap: 11px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-title { font-size: 22px; }
  .brand-subtitle { display: none; }
  .header-actions { width: 100%; min-width: 0; max-width: 100%; gap: 20px; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .header-actions::-webkit-scrollbar { display: none; }
  .top-btn { flex: 0 0 auto; min-height: 44px; font-size: 12px; }
  main { padding: 18px 12px 54px; }
  .hero { gap: 20px; padding: 28px 6px 30px; }
  .hero h1, .hero h2 { font-size: clamp(32px, 10vw, 48px); }
  .hero-visual { min-height: 220px; }
  .hero-vertical-label { font-size: 18px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .stat { padding-inline: 18px; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .card-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 0; padding: 24px 21px 21px; }
  .mode-card::before { left: 21px; }
  .mode-card .btn { width: 100%; min-width: 0; }
  .section-title { align-items: flex-start; flex-direction: column; gap: 3px; }
  #landingView .landing-modes > .section-title { grid-template-columns: minmax(20px, 1fr) auto minmax(20px, 1fr); gap: 12px; }
  #landingView .landing-modes > .section-title h2 { font-size: 23px; letter-spacing: .06em; }
  .legal-page main { padding-inline: 12px; }
  .contact-layout { grid-template-columns: 1fr; gap: 28px; }
  .contact-guide { padding: 19px; }
  .contact-submit-row .btn { width: 100%; min-width: 0; }
}

@media (max-width: 420px) {
  .hero-stats { grid-template-columns: 1fr; row-gap: 0; }
  .training-hero .hero-stats { grid-template-columns: 1fr; row-gap: 0; }
  .stat, .stat:nth-child(3) { padding: 14px 0; border-top: 1px solid var(--line); border-left: 0; }
  .stat:first-child { border-top: 0; }
  .hero-visual { min-height: 190px; }
  .hero-vertical-label { right: 3px; padding-bottom: 74px; }
  .hero-vertical-label::after { height: 62px; }
  #landingView .landing-modes > .section-title { display: block; }
  #landingView .landing-modes > .section-title::before,
  #landingView .landing-modes > .section-title::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (prefers-contrast: more) {
  :root { --line: #6e6962; --muted: #47433f; }
}

@media (forced-colors: active) {
  body, .hero { background-image: none !important; }
}

@media print {
  *, *::before, *::after { box-shadow: none !important; text-shadow: none !important; }
  body { background: #fff !important; }
  .site-footer::before, .hero-visual { display: none !important; }
  p, li { orphans: 3; widows: 3; }
}
