:root {
  --paper: #f5f2ec;
  --paper-strong: #ebe6dd;
  --surface: #fffefa;
  --ink: #17191d;
  --ink-soft: #5f625f;
  --line: #d8d2c7;
  --red: #e64531;
  --red-dark: #b92b1e;
  --amber: #f1b94d;
  --green: #2e6a4f;
  --shadow: 0 18px 60px rgb(36 31 24 / 8%);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 152px; }
body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(90deg, rgb(29 31 36 / 3%) 1px, transparent 1px) 0 0 / 32px 32px, var(--paper);
  color: var(--ink);
}
a { color: inherit; }
button, input { font: inherit; }
button { color: inherit; }
code {
  padding: 0.08em 0.3em;
  border-radius: 4px;
  background: #eeece7;
  color: #27292d;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgb(23 25 29 / 12%);
  background: rgb(245 242 236 / 92%);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}
.brand > span:last-child { display: flex; line-height: 1; flex-direction: column; gap: 4px; }
.brand strong { font-size: 0.93rem; letter-spacing: 0.12em; }
.brand small { color: var(--ink-soft); font-size: 0.68rem; }
.quiz-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}
.quiz-link:hover { background: var(--ink); color: white; }
main { overflow: clip; }

.hero {
  display: grid;
  max-width: 1160px;
  min-height: 410px;
  margin: 0 auto;
  padding: 72px clamp(20px, 5vw, 72px) 54px;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 0.65fr);
  align-items: end;
  gap: 56px;
}
.eyebrow, .section-index {
  margin: 0 0 12px;
  color: var(--red-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.eyebrow span { display: inline-block; width: 28px; height: 2px; margin-right: 8px; background: var(--red); vertical-align: middle; }
.hero h1 { margin: 0; font-size: clamp(3rem, 8vw, 6.8rem); line-height: 0.98; letter-spacing: -0.07em; }
.hero-lead { max-width: 680px; margin: 30px 0 0; color: var(--ink-soft); font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.9; }
.hero-lead strong { color: var(--ink); text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.hero-note {
  position: relative;
  padding: 70px 24px 24px;
  border: 1px solid var(--ink);
  background: var(--amber);
  box-shadow: 10px 10px 0 var(--ink);
  transform: rotate(1.2deg);
}
.note-number { position: absolute; top: 18px; left: 20px; font-family: Georgia, serif; font-size: 2.4rem; font-style: italic; }
.hero-note p { margin: 0 0 18px; font-size: 1.1rem; font-weight: 900; line-height: 1.5; }
.hero-note small { line-height: 1.55; }

.control-dock {
  position: relative;
  z-index: 10;
  display: grid;
  max-width: 1060px;
  margin: 0 auto 12px;
  padding: 14px;
  border: 1px solid var(--ink);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.38fr);
  gap: 14px;
}
.mode-switcher { display: grid; min-width: 0; margin: 0; padding: 0; border: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mode-switcher legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mode-switcher label { position: relative; min-width: 0; cursor: pointer; }
.mode-switcher input { position: absolute; opacity: 0; }
.mode-switcher label > span {
  display: flex;
  min-height: 62px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  flex-direction: column;
  justify-content: center;
  transition: 160ms ease;
}
.mode-switcher strong { font-size: 1rem; }
.mode-switcher small { margin-top: 3px; color: var(--ink-soft); font-size: 0.68rem; }
.mode-switcher input:checked + span { border-color: var(--ink); background: var(--ink); color: white; box-shadow: inset 4px 0 0 var(--red); }
.mode-switcher input:checked + span small { color: #cecfcc; }
.mode-switcher input:focus-visible + span { outline: 3px solid rgb(230 69 49 / 28%); outline-offset: 2px; }
.progress-panel { display: grid; min-width: 0; padding: 8px 10px; align-content: center; }
.progress-copy { display: flex; align-items: end; justify-content: space-between; gap: 12px; font-size: 0.72rem; font-weight: 800; }
.progress-copy strong { font-size: 1.1rem; }
.progress-track { height: 6px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: var(--paper-strong); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--red); transition: width 220ms ease; }
.reset-button { justify-self: end; min-height: 32px; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--ink-soft); cursor: pointer; font-size: 0.68rem; text-decoration: underline; text-underline-offset: 3px; }

.jump-nav {
  position: sticky;
  z-index: 9;
  top: 64px;
  display: flex;
  max-width: 780px;
  margin: 10px auto 0;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid rgb(23 25 29 / 10%);
  border-radius: 999px;
  background: rgb(245 242 236 / 94%);
  box-shadow: 0 8px 24px rgb(36 31 24 / 6%);
  backdrop-filter: blur(14px);
  scrollbar-width: none;
}
.jump-nav::-webkit-scrollbar { display: none; }
.jump-nav a { display: inline-flex; min-height: 38px; padding: 0 17px; border-radius: 999px; align-items: center; flex: 0 0 auto; color: var(--ink-soft); font-size: 0.75rem; font-weight: 800; text-decoration: none; }
.jump-nav a:hover { background: var(--surface); color: var(--ink); }
.content-shell { max-width: 1160px; margin: 0 auto; padding: 52px clamp(18px, 5vw, 72px) 72px; }
.review-section { margin-bottom: 110px; }
.section-head {
  display: grid;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 2px solid var(--ink);
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
  align-items: end;
  gap: 40px;
}
.section-head h2, .sources h2 { margin: 0; font-family: Georgia, "Yu Mincho", serif; font-size: clamp(2rem, 4.5vw, 3.7rem); line-height: 1.05; letter-spacing: -0.04em; }
.section-head > p, .sources > div > p:last-child { margin: 0; color: var(--ink-soft); font-size: 0.88rem; line-height: 1.8; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.core-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.review-card {
  position: relative;
  min-width: 0;
  padding: 24px 24px 70px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 18px rgb(36 31 24 / 3%);
}
.review-card::before { position: absolute; top: 0; left: 0; width: 4px; height: 0; border-radius: var(--radius) 0 0 var(--radius); background: var(--red); content: ""; transition: height 180ms ease; }
.review-card:hover::before, .review-card.is-learned::before { height: 100%; }
.review-card.is-learned { border-color: rgb(46 106 79 / 35%); background: #f4faf6; }
.review-card.is-learned::before { background: var(--green); }
.priority-card { min-height: 270px; }
.card-topline { display: flex; margin-bottom: 20px; align-items: center; justify-content: space-between; gap: 12px; }
.tag { display: inline-flex; min-height: 24px; padding: 0 9px; border: 1px solid var(--ink); border-radius: 999px; align-items: center; font-size: 0.62rem; font-weight: 900; letter-spacing: 0.08em; }
.tag-red { border-color: var(--red); background: #fff1ee; color: var(--red-dark); }
.tag-amber { border-color: #c78d17; background: #fff5d8; color: #765000; }
.tag-dark { background: var(--ink); color: white; }
.domain { margin: 0; color: #898983; font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.62rem; letter-spacing: 0.08em; text-align: right; }
.review-card h3 { margin: 0 0 14px; font-size: 1.15rem; line-height: 1.45; letter-spacing: -0.02em; }
.review-card > p, .topic-copy li { color: #4e514f; font-size: 0.86rem; line-height: 1.78; }
.review-card > p { margin: 0; }
.trap { margin-top: 16px !important; padding-top: 14px; border-top: 1px dashed var(--line); }
.trap span { margin-right: 6px; color: var(--red-dark); font-size: 0.66rem; font-weight: 900; letter-spacing: 0.08em; }
.learn-button {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  min-width: 84px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
}
.learn-button::before { width: 14px; height: 14px; margin-right: 7px; border: 1px solid #9b9b96; border-radius: 50%; content: ""; }
.learn-button:hover { border-color: var(--ink); }
.learn-button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: white; }
.learn-button[aria-pressed="true"]::before { border-color: white; background: radial-gradient(circle, white 0 35%, transparent 39%); }

.pattern-summary { display: grid; margin-bottom: 18px; padding: 28px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--ink); color: white; grid-template-columns: 180px minmax(0, 1fr); gap: 22px; }
.pattern-summary .eyebrow { color: #ff7a66; }
.pattern-summary ol { display: grid; margin: 0; padding: 0; list-style: none; gap: 16px; }
.pattern-summary li { display: grid; grid-template-columns: minmax(170px, 0.45fr) minmax(0, 1fr); gap: 20px; }
.pattern-summary strong { font-size: 0.88rem; }
.pattern-summary span { color: #b9bab7; font-size: 0.78rem; line-height: 1.55; }
.wide-card { margin-bottom: 14px; }
.git-flow { padding: 28px 28px 76px; background: #fff6db; }
.flow-steps { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: start; gap: 12px; }
.flow-steps > div { min-width: 0; }
.flow-steps > div > span { display: grid; width: 28px; height: 28px; margin-bottom: 12px; border-radius: 8px; background: var(--ink); place-items: center; color: white; font-size: 0.72rem; font-weight: 900; }
.flow-steps strong { font-size: 0.94rem; }
.flow-steps p { margin: 7px 0 0; color: #55564f; font-size: 0.76rem; line-height: 1.6; }
.flow-steps i { padding-top: 32px; color: var(--red); font-style: normal; font-weight: 900; }

.topic-list { display: grid; gap: 10px; }
.topic-row { display: grid; min-height: 0; padding: 26px 130px 26px 22px; grid-template-columns: 72px minmax(0, 1fr); gap: 22px; }
.topic-number { color: var(--red); font-family: Georgia, serif; font-size: 2.2rem; font-style: italic; }
.topic-copy h3 { margin-bottom: 8px; }
.topic-copy ul { display: grid; margin: 0; padding-left: 1.1rem; gap: 3px; }
.topic-copy li::marker { color: var(--red); }

.final-section { padding: 40px; border-radius: 28px; background: var(--ink); color: white; }
.inverse-head { border-color: #55575a; }
.inverse-head .section-index { color: #ff7a66; }
.inverse-head > p { color: #b9bab7; }
.final-card { padding: 12px 24px 80px; border: 0; background: transparent; box-shadow: none; color: white; }
.final-card::before { display: none; }
.final-card ol { display: grid; margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 34px; }
.final-card li { display: grid; min-height: 86px; padding: 17px 0; border-bottom: 1px solid #45474a; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; }
.final-card li > span { color: #ff7a66; font-family: Georgia, serif; font-style: italic; }
.final-card li p { margin: 0; color: #c8c9c6; font-size: 0.83rem; line-height: 1.65; }
.final-card li strong { color: white; }
.final-learn-button { right: 0; bottom: 0; border-color: #737579; color: white; }
.final-card.is-learned { background: transparent; }

.sources { display: grid; padding: 36px; border: 1px solid var(--line); border-radius: var(--radius); background: #ebe7df; grid-template-columns: minmax(0, 1fr) minmax(260px, 0.7fr); gap: 48px; }
.sources h2 { font-size: clamp(1.7rem, 3.5vw, 2.6rem); }
.sources > div > p:last-child { max-width: 640px; margin-top: 16px; }
.sources details { align-self: center; }
.sources summary { display: flex; min-height: 48px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 12px; background: var(--surface); align-items: center; cursor: pointer; font-size: 0.8rem; font-weight: 900; }
.sources ul { display: grid; margin: 14px 0 0; padding: 0 0 0 18px; gap: 8px; }
.sources li { font-size: 0.76rem; line-height: 1.5; }
.sources a { text-underline-offset: 3px; }
.page-footer { display: flex; min-height: 110px; padding: 28px clamp(20px, 5vw, 72px); border-top: 1px solid var(--line); background: var(--surface); align-items: center; justify-content: space-between; gap: 30px; }
.page-footer p { max-width: 720px; margin: 0; color: var(--ink-soft); font-size: 0.72rem; line-height: 1.6; }
.page-footer a { font-size: 0.74rem; font-weight: 900; white-space: nowrap; text-decoration: none; }

@media (max-width: 900px) {
  .hero { min-height: 360px; grid-template-columns: 1fr; gap: 38px; }
  .hero-note { max-width: 420px; }
  .control-dock { width: calc(100% - 32px); grid-template-columns: 1fr; }
  .jump-nav { width: calc(100% - 32px); }
  .core-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-head, .sources { grid-template-columns: 1fr; gap: 20px; }
  .flow-steps { grid-template-columns: 1fr 1fr; }
  .flow-steps i { display: none; }
}

@media (max-width: 640px) {
  html { scroll-padding-top: 136px; }
  .topbar { min-height: 58px; padding: 8px 14px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand small { display: none; }
  .quiz-link { min-height: 42px; padding: 0 13px; font-size: 0.74rem; }
  .hero { min-height: 0; padding: 48px 20px 40px; }
  .hero h1 { font-size: clamp(3.2rem, 16vw, 4.6rem); }
  .hero-lead { margin-top: 24px; font-size: 0.95rem; line-height: 1.75; }
  .hero-note { max-width: calc(100% - 10px); padding-top: 64px; box-shadow: 7px 7px 0 var(--ink); }
  .control-dock { width: calc(100% - 24px); margin-bottom: 8px; padding: 9px; border-radius: 16px; }
  .mode-switcher { gap: 5px; }
  .mode-switcher label > span { min-height: 58px; padding: 8px 9px; text-align: center; }
  .mode-switcher small { font-size: 0.6rem; }
  .progress-panel { padding: 7px 5px 2px; }
  .jump-nav { top: 58px; width: 100%; margin-top: 0; border-right: 0; border-left: 0; border-radius: 0; }
  .jump-nav a { min-height: 36px; padding: 0 13px; font-size: 0.69rem; }
  .content-shell { padding: 42px 14px 56px; }
  .review-section { margin-bottom: 76px; }
  .section-head { margin-bottom: 18px; padding: 0 4px 18px; }
  .section-head h2 { font-size: 2.35rem; }
  .section-head > p { font-size: 0.8rem; line-height: 1.7; }
  .card-grid, .core-grid { grid-template-columns: 1fr; }
  .review-card, .priority-card { min-height: 0; padding: 20px 19px 68px; border-radius: 15px; }
  .card-topline { margin-bottom: 15px; }
  .review-card h3 { font-size: 1.08rem; }
  .review-card > p, .topic-copy li { font-size: 0.82rem; line-height: 1.72; }
  .learn-button { min-height: 44px; }
  .pattern-summary { padding: 22px; grid-template-columns: 1fr; gap: 4px; }
  .pattern-summary li { grid-template-columns: 1fr; gap: 5px; }
  .git-flow { padding: 22px 19px 72px; }
  .flow-steps { grid-template-columns: 1fr; gap: 22px; }
  .flow-steps > div { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: start; }
  .flow-steps > div > span { grid-row: 1 / span 2; }
  .flow-steps p { grid-column: 2; }
  .topic-row { padding: 22px 19px 74px; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; }
  .topic-number { font-size: 1.6rem; }
  .topic-copy .domain { text-align: left; }
  .final-section { padding: 28px 14px 20px; border-radius: 22px; }
  .final-section .section-head { padding-right: 4px; padding-left: 4px; }
  .final-card { padding: 0 4px 74px; }
  .final-card ol { grid-template-columns: 1fr; }
  .final-card li { min-height: 0; }
  .sources { padding: 24px 20px; }
  .page-footer { min-height: 130px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 14px; }
}

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