:root {
  --bg: #f5f7f8;
  --panel: #fff;
  --line: #d9e1e5;
  --text: #17242b;
  --muted: #617079;
  --blue: #1f6fb5;
  --green: #2d8a63;
  --orange: #c96d2e;
  --red: #c94a5b;
  --shadow: 0 8px 24px rgba(26, 44, 52, .08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.65;
}

button {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid #b9c8d0;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
}

.eyebrow,
.label {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.35;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tab,
.copy-button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.tab.active,
.copy-button {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat {
  padding: 14px 16px;
}

.stat span,
.stat small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  margin: 4px 0;
  font-size: 26px;
  line-height: 1.1;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr);
  gap: 18px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef7fb;
  color: #195f8f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.source-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 14px;
  margin: 0;
  padding: 18px;
}

.source-list dt {
  color: var(--muted);
  font-weight: 800;
}

.source-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.rules {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.rule {
  display: grid;
  grid-template-columns: 48px minmax(160px, 1fr) minmax(130px, .7fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.rule span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f4f6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.lead-text {
  padding: 20px 22px 8px;
  font-size: 18px;
}

.tagged {
  padding: 1px 3px;
  border-radius: 3px;
  color: inherit;
}

.tagged.keyword {
  background: #e8f2ff;
  color: #135fa5;
  font-weight: 800;
}

.tagged.focus {
  background: #fff7cf;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.tagged.choice_label {
  background: #fbe9df;
  color: #9e4c1d;
  font-weight: 900;
}

.tagged.section_heading {
  background: #eaf7f0;
  color: #24754f;
  font-weight: 900;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 18px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

.tag-pill b {
  color: var(--text);
}

.tag-pill em {
  color: var(--muted);
  font-style: normal;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.figure-grid,
.material-grid {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.figure-grid {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.figure-card,
.material-image-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.figure-card {
  grid-template-columns: minmax(140px, 260px) 1fr;
  align-items: center;
  padding: 12px;
}

.figure-card img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfc;
}

.figure-card span,
.figure-card small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.material-grid {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
}

.material-image-card {
  grid-template-rows: 150px auto auto;
  overflow: hidden;
  padding-bottom: 12px;
}

.material-image-card img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  border-bottom: 1px solid var(--line);
  background: #f9fbfc;
}

.material-image-card strong,
.material-image-card span {
  display: block;
  padding: 0 12px;
  overflow-wrap: anywhere;
}

.material-image-card span {
  color: var(--muted);
  font-size: 13px;
}

.question-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.section-heading-card,
.support-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.section-heading-card {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 14px;
  border-left: 5px solid var(--blue);
}

.section-number {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  background: #466eb6;
  color: #fff !important;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.section-heading-card strong {
  color: var(--blue);
  font-size: 18px;
}

.section-heading-card span {
  color: var(--text);
  font-weight: 700;
}

.support-card {
  padding: 12px 14px;
  background: #fffdf7;
}

.support-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.support-head strong {
  font-size: 16px;
}

.support-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.word-bank-items,
.check-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.word-bank-items span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid #efd79b;
  border-radius: 5px;
  background: #fff8df;
  font-weight: 700;
}

.checklist-card {
  background: #fbfff9;
  border-color: #cfe5c8;
}

.checklist-card p,
.reflection-card p {
  margin-bottom: 10px;
  font-weight: 700;
}

.check-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.check-items.compact {
  grid-template-columns: repeat(5, minmax(92px, max-content));
  column-gap: 34px;
  row-gap: 7px;
  justify-content: start;
}

.check-items label {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 14px;
}

.check-items.compact label {
  font-size: 15px;
  font-weight: 500;
}

.check-items label span {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 1px solid #6f7c84;
  background: #fff;
}

.reflection-card {
  background: #fbfdff;
  border-color: #c8d8ef;
}

.writing-lines {
  height: 58px;
  border: 1px dashed #9aa9b3;
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 27px,
      #d6dee3 28px
    );
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lead-card {
  border-color: #cbddeb;
  background: #fbfdff;
}

.lead-linked-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 300px);
  gap: 16px;
  align-items: center;
  padding-right: 12px;
}

.lead-linked-layout .question-prompt {
  font-size: 17px;
  line-height: 1.85;
}

.lead-image {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lead-image img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #f9fbfc;
}

.lead-image figcaption {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 0;
}

.question-meta span,
.relations span,
.choices span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  background: #f1f5f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.question-prompt {
  margin: 0;
  padding: 12px 12px 8px;
  font-size: 16px;
  line-height: 1.9;
}

.question-inline-label {
  display: inline-flex;
  min-width: 38px;
  height: 24px;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  border-radius: 2px;
  background: #466eb6;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  vertical-align: 2px;
}

.relations,
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 2px 12px 14px;
}

.relations span {
  background: #edf8f2;
  color: var(--green);
}

.choices span {
  background: #fff4e8;
  color: var(--orange);
}

.choices b {
  margin-right: 6px;
}

.linked-assets {
  margin: 0 12px 12px;
  padding: 12px;
  border: 1px solid #d6e7dd;
  border-radius: 8px;
  background: #fbfefc;
}

.linked-assets-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.linked-assets-head span {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.linked-figures,
.linked-materials {
  display: grid;
  gap: 10px;
}

.linked-figures {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.linked-materials {
  grid-template-columns: repeat(4, minmax(210px, 1fr));
}

.linked-figure,
.linked-material {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.linked-figure {
  grid-template-columns: minmax(180px, 300px) 1fr;
  align-items: center;
}

.linked-figure img {
  width: 100%;
  max-height: 190px;
  object-fit: contain;
  border-right: 1px solid var(--line);
  background: #f9fbfc;
}

.linked-figure div,
.linked-material div {
  padding: 10px;
}

.linked-figure span,
.linked-figure small,
.linked-material small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.linked-material {
  grid-template-rows: 112px 1fr;
}

.linked-material img {
  width: 100%;
  height: 112px;
  object-fit: contain;
  border-bottom: 1px solid var(--line);
  background: #f9fbfc;
}

.linked-material strong {
  display: block;
  margin-bottom: 5px;
}

.linked-material strong span {
  margin-right: 6px;
  color: var(--blue);
}

.linked-material p {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.json-box {
  max-height: 72vh;
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: #101820;
  color: #e6edf3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .status-grid,
  .two-col,
  .figure-grid,
  .material-grid,
  .linked-figures,
  .linked-materials,
  .check-items,
  .check-items.compact {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .topbar,
  .panel-head,
  .figure-card,
  .linked-figure,
  .lead-linked-layout {
    display: block;
  }

  .tabs {
    justify-content: flex-start;
    margin-top: 14px;
  }

  main {
    padding: 14px;
  }

  .status-grid,
  .two-col,
  .figure-grid,
  .material-grid,
  .linked-figures,
  .linked-materials,
  .check-items,
  .check-items.compact,
  .source-list,
  .rule {
    grid-template-columns: 1fr;
  }

  .panel-head .pill,
  .figure-card div {
    margin-top: 10px;
  }
}

/* Public preview: keep the UI plain so the extracted structure is the focus. */
:root {
  --bg: #f6f7f8;
  --shadow: none;
}

.panel,
.stat,
.question-card,
.support-card,
.section-heading-card,
.figure-card,
.material-image-card,
.linked-assets,
.linked-figure,
.linked-material,
.lead-image {
  box-shadow: none;
}

.panel-head,
.support-card,
.checklist-card,
.reflection-card,
.lead-card,
.linked-assets {
  background: #fff;
}

.pill,
.question-meta span,
.relations span,
.choices span,
.tag-pill,
.word-bank-items span {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.tagged.keyword {
  background: transparent;
  color: var(--blue);
  font-weight: 800;
}

.tagged.focus {
  background: transparent;
}

.tagged.choice_label {
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.linked-assets-head span,
.support-head span,
.lead-image figcaption,
.figure-card span,
.figure-card small,
.material-image-card span {
  color: var(--muted);
}
