:root {
  --ink: #17213a;
  --muted: #56627a;
  --line: #dce2ec;
  --paper: #fbfcfe;
  --blue: #2457d6;
  --blue-soft: #eaf0ff;
  --yellow: #fff5c8;
  --green: #e8f6ee;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Yu Gothic", "Hiragino Sans", system-ui, sans-serif;
  line-height: 1.75;
}

a { color: var(--blue); }

.shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 72px;
}

.hero, .lesson-head {
  padding: clamp(28px, 6vw, 64px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: white;
  box-shadow: 0 18px 55px rgba(31, 47, 78, .08);
}

.compact-head {
  padding: clamp(22px, 5vw, 42px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-weight: 800;
  letter-spacing: .08em;
}

h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1.15; }
h2 { margin-top: 48px; font-size: 1.7rem; }
h3 { margin: 8px 0; }
.lead { max-width: 690px; font-size: 1.13rem; color: var(--muted); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.button {
  display: inline-block;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  background: white;
}
.button.primary { color: white; background: var(--blue); border-color: var(--blue); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.card {
  display: block;
  padding: 20px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}
.card span { color: var(--blue); font-weight: 900; }
.card p { margin: 0; color: var(--muted); }

.rule-panel, .explain, .model, .practice, .transfer, .scope-panel, .flash-panel {
  margin-top: 28px;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: white;
}
.rule-panel { background: var(--blue-soft); }
.explain { border-left: 6px solid var(--blue); }
.model { background: var(--yellow); }
.transfer { background: var(--green); }
.scope-panel {
  border-left: 6px solid #f59e0b;
  background: #fffaf0;
}

.flash-panel {
  border: 2px solid rgba(36, 87, 214, .28);
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.flash-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.flash-head h2 {
  margin-top: 0;
}

.flash-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 170px;
}

.flash-stats span,
.flash-tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 900;
}

.flash-controls,
.flash-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.flash-controls button,
.flash-buttons button {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: white;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.flash-controls button:hover,
.flash-buttons button:hover,
.flash-controls button:focus-visible,
.flash-buttons button:focus-visible {
  outline: 3px solid rgba(36, 87, 214, .24);
  border-color: var(--blue);
}

.flash-controls button:disabled,
.flash-buttons button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.flash-card {
  margin-top: 16px;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: white;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.flash-card:hover,
.flash-card:focus-visible {
  outline: 0;
  border-color: rgba(36, 87, 214, .45);
  box-shadow: 0 18px 45px rgba(31, 47, 78, .12);
  transform: translateY(-1px);
}

.flash-source {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .92rem;
}

.flash-question {
  margin: 18px 0;
  font-size: clamp(1.6rem, 4.3vw, 3.2rem);
  font-weight: 900;
  line-height: 1.55;
}

.flash-answer-box {
  margin: 18px 0 12px;
  padding: clamp(18px, 5vw, 34px);
  border: 3px solid rgba(36, 87, 214, .22);
  border-radius: 22px;
  background: #0f172a;
  color: white;
  text-align: center;
}

.flash-answer-kicker {
  margin: 0;
  color: #bfdbfe;
  font-weight: 900;
  letter-spacing: .16em;
}

.flash-answer-big {
  margin: 8px 0 10px;
  font-size: clamp(2.4rem, 9vw, 6rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: .02em;
}

.flash-feedback {
  min-height: 32px;
  margin: 10px 0 0;
  font-weight: 900;
}

.flash-feedback.ok {
  color: #bbf7d0;
}

.flash-feedback.ng {
  color: #fed7aa;
}

.scope-grid,
.flow-line {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.scope-grid article,
.flow-line article {
  min-height: 104px;
  padding: 14px;
  border: 1px solid rgba(23, 33, 58, .12);
  border-radius: 14px;
  background: white;
}

.scope-grid strong,
.flow-line strong {
  display: block;
  color: var(--blue);
  font-weight: 900;
}

.scope-grid span,
.flow-line span {
  display: block;
  color: var(--muted);
  font-size: .94rem;
}

.today-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
  gap: 18px;
  align-items: center;
  margin-top: 28px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

.today-panel h2 {
  margin-top: 0;
}

.quick-loop {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quick-loop li {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  font-weight: 700;
}

.quick-loop span {
  min-width: 48px;
  color: var(--blue);
  font-weight: 900;
}

.loop-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.loop-steps article {
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.loop-steps article > span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: white;
  background: var(--blue);
  font-weight: 900;
}

.loop-steps h2 {
  margin: 12px 0 4px;
  font-size: 1.18rem;
}

.loop-steps label,
.record-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.loop-steps input[type="checkbox"] {
  width: 22px;
  height: 22px;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.record-grid input {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
}

.school-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.school-card {
  display: grid;
  gap: 6px;
  min-height: 110px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: white;
  text-decoration: none;
}

.school-card strong {
  color: var(--blue);
}

.school-card span {
  color: var(--muted);
}

.timer-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.timer-strip article {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.timer-strip strong {
  display: block;
  color: var(--blue);
  font-size: 1.05rem;
}

.timer-strip span {
  display: block;
  color: var(--ink);
  font-weight: 800;
}

.source-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-left: 4px solid var(--blue);
  color: var(--muted);
  background: #f8fafc;
  font-size: .92rem;
}

.exam-pack {
  display: grid;
  gap: 12px;
}

.choice-list {
  margin: 8px 0 0;
  padding-left: 1.5rem;
}

.choice-list li {
  margin: 4px 0;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.note {
  margin: 12px 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(36, 87, 214, .22);
  border-radius: 12px;
  background: var(--blue-soft);
}
.note p { margin: 0 0 8px; }
.note p:last-child { margin-bottom: 0; }

.big-list { list-style: none; padding: 0; counter-reset: rule; }
.big-list li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid rgba(36,87,214,.16); }
.big-list li:last-child { border-bottom: 0; }
.big-list strong { min-width: 200px; }

.question { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.question p { margin-top: 0; }
details { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #f4f6fa; }
summary { cursor: pointer; font-weight: 800; }

table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 9px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f2f5fa; }

.link-list li { margin: 8px 0; }
.nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; }
.mini { color: var(--muted); font-size: .92rem; }

@media (max-width: 620px) {
  .shell { width: min(100% - 20px, 920px); padding-top: 16px; }
  .hero, .lesson-head { border-radius: 18px; }
  .today-panel { grid-template-columns: 1fr; }
  .big-list li { display: block; }
  .big-list strong { display: block; }
  .flash-head { display: block; }
  .flash-stats { justify-content: flex-start; min-width: 0; }
  .flash-controls button,
  .flash-buttons button { flex: 1 1 44%; }
  table { font-size: .88rem; }
}

@media print {
  body { background: white; }
  .shell { width: 100%; padding: 0; }
  .hero, .lesson-head, .card { box-shadow: none; }
  .nav, .hero-actions { display: none; }
  details { break-inside: avoid; }
  details > * { display: block; }
}
