/* ============================================================
   AirSchool — Design Tokens
   Motif: 赤ペン(red pen) grading on 原稿用紙(manuscript grid paper).
   Display: Shippori Mincho B1 / Body: Noto Sans JP / UI: Zen Kaku Gothic New
   ============================================================ */

:root {
  /* --- Paper & ink --- */
  --paper: #fbfaf5;
  --paper-2: #f3efe2;
  --surface: #ffffff;
  --line: #ddd6c2;
  --grid-line: rgba(33, 38, 46, 0.055);

  --ink: #21262e;
  --ink-soft: #5b6472;
  --ink-faint: #8c93a0;

  /* --- Red pen (primary accent, used for ○ / correct / primary actions) --- */
  --red: #c8372c;
  --red-dark: #9e2b22;
  --red-tint: #fbeae7;

  /* --- Echoes of the other two marking colors used inside the app itself --- */
  --blue: #2c5282;   /* × mark */
  --blue-tint: #e8eef5;
  --amber: #b8720b;  /* △ mark */
  --amber-tint: #f8ecd8;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(33, 38, 46, 0.06);
  --shadow: 0 10px 30px rgba(33, 38, 46, 0.09);
  --shadow-lg: 0 20px 48px rgba(33, 38, 46, 0.14);

  --font-display: "Shippori Mincho B1", serif;
  --font-body: "Noto Sans JP", sans-serif;
  --font-ui: "Zen Kaku Gothic New", sans-serif;

  --maxw: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0 39px,
      var(--grid-line) 39px 40px
    ),
    var(--paper);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0 0 0.5em; color: var(--ink); font-weight: 600; }
p { margin: 0 0 1em; color: var(--ink-soft); }
a { color: inherit; }
button { font-family: var(--font-ui); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------------- Nav ---------------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 250, 245, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-nav .container { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; text-decoration: none; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; }
.nav-links { display: flex; align-items: center; gap: 28px; font-family: var(--font-ui); font-size: 0.94rem; }
.nav-links a { text-decoration: none; color: var(--ink-soft); }
.nav-links a:hover { color: var(--red); }
.nav-cta {
  background: var(--red); color: #fff !important; padding: 10px 20px; border-radius: 999px;
  font-weight: 600; transition: transform .15s ease, box-shadow .15s ease;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.nav-toggle { display: none; }

@media (max-width: 820px) {
  .nav-links { position: fixed; inset: 68px 0 auto 0; background: var(--paper); flex-direction: column; align-items: flex-start; padding: 20px 24px 28px; border-bottom: 1px solid var(--line); gap: 18px; transform: translateY(-8px); opacity: 0; pointer-events: none; transition: all .2s ease; }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-toggle { display: inline-flex; background: none; border: none; cursor: pointer; padding: 6px; }
  .nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; }
}

/* ---------------- Hero ---------------- */
.hero { padding: 88px 0 64px; }
.hero .container { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-ui);
  font-size: 0.82rem; letter-spacing: .04em; color: var(--red-dark); background: var(--red-tint);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 18px; font-weight: 600;
}
.hero h1 { font-size: clamp(2.1rem, 4.2vw, 3.2rem); line-height: 1.35; letter-spacing: .01em; }
.hero h1 em { font-style: normal; color: var(--red); }
.hero-sub { font-size: 1.06rem; max-width: 46ch; }
.hero-actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 26px; border-radius: 999px; font-family: var(--font-ui); font-weight: 600;
  font-size: 0.98rem; text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-faint); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 30px; font-size: 1.05rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* --- Hero mark: hand-drawn ○ over an answer card (signature element) --- */
.hero-visual { position: relative; }
.exam-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 30px 30px 26px; position: relative; overflow: hidden;
}
.exam-card::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 33px, var(--grid-line) 33px 34px);
  pointer-events: none;
}
.exam-row { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-family: var(--font-ui); }
.exam-row:last-child { border-bottom: none; }
.exam-q { color: var(--ink-faint); font-size: .82rem; width: 46px; flex-shrink: 0; }
.exam-a { color: var(--ink); font-size: 1.02rem; flex: 1; }
.mark-wrap { position: absolute; width: 74px; height: 74px; }
.mark-wrap svg { width: 100%; height: 100%; overflow: visible; }
.mark-circle {
  fill: none; stroke: var(--red); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 220; stroke-dashoffset: 220;
  animation: draw-mark 1.1s ease-out .6s forwards;
}
@keyframes draw-mark { to { stroke-dashoffset: 0; } }
.score-stamp {
  position: absolute; font-family: var(--font-display); color: var(--red); font-size: 2.1rem;
  font-weight: 700; opacity: 0; transform: scale(.8) rotate(-4deg);
  animation: stamp-in .35s ease-out 1.5s forwards;
}
@keyframes stamp-in { to { opacity: 1; transform: scale(1) rotate(-4deg); } }

/* ---------------- Sections ---------------- */
section { padding: 88px 0; }
.section-head { max-width: 640px; margin: 0 auto 48px; text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.15rem); }
.eyebrow-line { font-family: var(--font-ui); font-size: .82rem; letter-spacing: .12em; color: var(--red); font-weight: 700; text-transform: uppercase; margin-bottom: 10px; display: block; }

.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; }
.pillar {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 26px; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease;
}
.pillar:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.pillar-icon { width: 44px; height: 44px; margin-bottom: 16px; }
.pillar h3 { font-size: 1.12rem; font-family: var(--font-ui); }
.pillar p { font-size: .94rem; margin-bottom: 0; }

.steps { counter-reset: step; display: grid; gap: 0; }
.step { display: grid; grid-template-columns: 64px 1fr; gap: 22px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: none; }
.step-num {
  counter-increment: step; font-family: var(--font-display); font-size: 1.5rem; color: var(--red);
  width: 56px; height: 56px; border: 1.5px solid var(--red); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.step-num::before { content: counter(step); }
.step h3 { font-family: var(--font-ui); font-size: 1.05rem; margin-bottom: 6px; }
.step p { margin: 0; font-size: .94rem; }

.kanten-band {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center;
}
.kanten-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.kanten-tag { font-family: var(--font-ui); font-size: .84rem; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2); }
.kanten-mock { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kanten-mock table { width: 100%; border-collapse: collapse; font-family: var(--font-ui); font-size: .86rem; }
.kanten-mock th, .kanten-mock td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--line); }
.kanten-mock th { background: var(--paper-2); font-weight: 600; }
.kanten-mock td:first-child, .kanten-mock th:first-child { text-align: left; }

.faq { max-width: 760px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--line); padding: 20px 0; }
.faq-item summary { cursor: pointer; font-family: var(--font-ui); font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--red); transition: transform .2s ease; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: 12px; font-size: .94rem; }

.final-cta { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 64px 32px; box-shadow: var(--shadow-sm); }
.final-cta h2 { font-size: clamp(1.5rem, 3vw, 2rem); }

footer.site-footer { border-top: 1px solid var(--line); padding: 40px 0; }
.footer-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; font-family: var(--font-ui); font-size: .86rem; color: var(--ink-faint); }
.footer-row a { color: var(--ink-faint); text-decoration: none; margin-left: 18px; }
.footer-row a:hover { color: var(--red); }

/* Ad slots — reserved, clearly separated content blocks (not intrusive) */
.ad-slot {
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px;
  text-align: center; font-family: var(--font-ui); font-size: .78rem; color: var(--ink-faint);
  background: var(--paper-2);
}

@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 40px; }
  .pillars { grid-template-columns: 1fr; }
  .kanten-band { grid-template-columns: 1fr; padding: 28px; }
  section { padding: 56px 0; }
}

/* ============================================================
   App shell (app.html)
   ============================================================ */
.app-shell { min-height: 100vh; display: flex; }
.app-sidebar {
  width: 300px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line);
  padding: 26px 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app-main { flex: 1; min-width: 0; padding: 40px clamp(20px, 4vw, 56px); max-width: 980px; margin: 0 auto; width: 100%; }

.app-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; text-decoration: none; color: var(--ink); margin-bottom: 26px; }
.app-brand svg { width: 26px; height: 26px; }

.field-label { font-family: var(--font-ui); font-size: .84rem; font-weight: 600; color: var(--ink); display: block; margin-bottom: 8px; }
.field-hint { font-size: .8rem; color: var(--ink-faint); margin-top: 6px; }
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px;
  font-family: var(--font-body); font-size: .92rem; color: var(--ink); background: var(--paper);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, textarea.input:focus, select.input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }
.input-row { display: flex; gap: 8px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-soft); margin-top: 10px; }

.key-status { display: flex; align-items: center; gap: 8px; font-size: .82rem; margin-top: 12px; font-family: var(--font-ui); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.dot.ok { background: #2f9e5c; }
.dot.warn { background: var(--amber); }

.sidebar-divider { height: 1px; background: var(--line); margin: 22px 0; }
.side-note { font-size: .78rem; color: var(--ink-faint); line-height: 1.6; }
.side-note a { color: var(--red); text-decoration: underline; }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 6px; margin-bottom: 34px; flex-wrap: wrap; font-family: var(--font-ui); }
.stepper-item { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--ink-faint); }
.stepper-item .num { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: .78rem; }
.stepper-item.active { color: var(--ink); font-weight: 700; }
.stepper-item.active .num { border-color: var(--red); color: var(--red); }
.stepper-item.done .num { background: var(--red); border-color: var(--red); color: #fff; }
.stepper-sep { width: 22px; height: 1px; background: var(--line); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; margin-bottom: 26px; box-shadow: var(--shadow-sm);
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-title h2 { font-size: 1.15rem; font-family: var(--font-ui); margin: 0; }

.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 34px 20px; text-align: center;
  font-family: var(--font-ui); font-size: .9rem; color: var(--ink-soft); cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--red); background: var(--red-tint); }
.dropzone strong { color: var(--red); }
.file-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .82rem; margin-top: 10px; }

.badge { font-family: var(--font-ui); font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge-ok { background: var(--red-tint); color: var(--red-dark); }
.badge-muted { background: var(--paper-2); color: var(--ink-faint); }

.status-line { display: flex; align-items: center; gap: 10px; font-family: var(--font-ui); font-size: .86rem; color: var(--ink-soft); margin: 14px 0; }
.progress-track { flex: 1; height: 8px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.progress-fill { height: 100%; background: var(--red); width: 0%; transition: width .3s ease; border-radius: 999px; }

table.data-table { width: 100%; border-collapse: collapse; font-family: var(--font-ui); font-size: .84rem; }
table.data-table th, table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
table.data-table th { background: var(--paper-2); font-weight: 700; position: sticky; top: 0; }
table.data-table td:nth-child(1), table.data-table th:nth-child(1) { text-align: left; position: sticky; left: 0; background: var(--surface); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }

.mark-cell.ok { color: var(--red); font-weight: 700; }
.mark-cell.no { color: var(--blue); font-weight: 700; }
.mark-cell.half { color: var(--amber); font-weight: 700; }

.criteria-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; margin-bottom: 14px; }
.criteria-item-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.criteria-item-head .qno { font-family: var(--font-display); font-size: 1.1rem; color: var(--red); }

.section-toggle summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.section-toggle summary::-webkit-details-marker { display: none; }
.section-toggle summary h2 { display: flex; align-items: center; gap: 10px; margin: 0; }
.section-toggle summary h2::before { content: "▸"; color: var(--red); font-size: 1rem; }
.section-toggle[open] summary h2::before { content: "▾"; }
.section-toggle-body { margin-top: 18px; }
.criteria-grid { display: grid; grid-template-columns: 110px 1fr; gap: 14px; margin-bottom: 12px; }
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-option { font-family: var(--font-ui); font-size: .8rem; border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; cursor: pointer; user-select: none; transition: all .12s ease; background: var(--paper); }
.chip-option input { display: none; }
.chip-option.checked { background: var(--red); border-color: var(--red); color: #fff; }
.chip-option.kanten.checked { background: var(--blue); border-color: var(--blue); }

.position-canvas-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; cursor: crosshair; max-width: 100%; }
.position-canvas-wrap canvas { display: block; max-width: 100%; height: auto; }

.pill-target { display: inline-flex; align-items: center; gap: 8px; background: var(--red-tint); color: var(--red-dark); font-family: var(--font-ui); font-weight: 700; font-size: .86rem; padding: 8px 16px; border-radius: 999px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff; padding: 13px 20px;
  border-radius: var(--radius-sm); font-family: var(--font-ui); font-size: .86rem; box-shadow: var(--shadow-lg);
  transform: translateY(12px); opacity: 0; transition: all .25s ease; z-index: 200; max-width: 340px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--red-dark); }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.kanten-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.kanten-summary-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--paper-2); }
.kanten-summary-card .label { font-family: var(--font-ui); font-size: .78rem; color: var(--ink-soft); }
.kanten-summary-card .value { font-family: var(--font-display); font-size: 1.5rem; color: var(--red-dark); }

.feedback-master summary {
  cursor: pointer; list-style: none; padding: 4px 2px;
  font-family: var(--font-ui); font-weight: 700; font-size: 1.05rem; color: var(--ink);
}
.feedback-master summary::-webkit-details-marker { display: none; }
.feedback-master summary::before { content: "▸ "; color: var(--red); }
.feedback-master[open] summary::before { content: "▾ "; }

.feedback-row { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 10px; background: var(--paper-2); }
.feedback-row-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-ui); font-weight: 700; font-size: .9rem; margin-bottom: 8px; }
.feedback-card-score { color: var(--red-dark); font-family: var(--font-display); font-size: 1.05rem; }
.feedback-card-body { margin: 0; font-size: .92rem; line-height: 1.8; color: var(--ink); white-space: pre-wrap; }

.no-kanten-chip { border-style: dashed; color: var(--ink-faint); }
.no-kanten-chip.checked { background: var(--ink-faint); border-color: var(--ink-faint); color: #fff; }

.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 6px; }
.review-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; background: var(--surface); }
.review-card canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; display: block; background: #fff; }
.review-card-label { font-family: var(--font-ui); font-size: .78rem; color: var(--ink-soft); margin: 8px 0 8px; }
.review-mark-row { display: flex; gap: 6px; }
.review-mark-chip {
  flex: 1; text-align: center; padding: 7px 0; border-radius: 6px; border: 1px solid var(--line);
  cursor: pointer; font-family: var(--font-ui); font-weight: 700; font-size: .88rem; background: var(--paper);
}
.review-mark-chip.active.ok { background: var(--red-tint); color: var(--red-dark); border-color: var(--red); }
.review-mark-chip.active.no { background: var(--blue-tint); color: var(--blue); border-color: var(--blue); }
.review-mark-chip.active.half { background: var(--amber-tint); color: var(--amber); border-color: var(--amber); }
.review-points-input { width: 100%; margin-top: 8px; }

@media (max-width: 980px) {
  .app-sidebar { display: none; }
  .app-main { padding: 24px 16px 60px; max-width: 100%; }
}

.hidden { display: none !important; }
