:root { color: #1b2434; background: #f7f9fd; font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; line-height: 1.6; }
* { box-sizing: border-box; }
body { margin: 0; }
.lab { max-width: 1180px; margin: 0 auto; padding: 22px 20px 28px; }
header { margin-bottom: 16px; }
.eyebrow { margin: 0; color: #2f8a63; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1 { margin: 4px 0 6px; font-size: 25px; }
header > p:last-child { margin: 0; color: #56627a; }
button { min-height: 44px; padding: 9px 14px; border: 1px solid #c3cddd; border-radius: 10px; background: #fff; color: #1b2434; font: inherit; font-weight: 650; cursor: pointer; }
button:hover { border-color: #2f8a63; }
button.primary, button.active { border-color: #2f8a63; background: #2f8a63; color: #fff; }
button:disabled { cursor: default; opacity: .5; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.figure-side { display: grid; gap: 12px; }
.info-side { display: grid; gap: 12px; align-content: start; }
.caption { margin: 0; color: #56627a; font-size: 13px; text-align: center; }

/* --- 細胞の図 --- */
.cell-svg { display: block; width: 100%; max-width: 420px; margin: 0 auto; }
.part { cursor: pointer; }
.part:focus { outline: none; }
.cytoplasm-shape ellipse, .cytoplasm-shape rect { fill: #f2e9d8; stroke: #d9c9a8; stroke-width: 2; }
.membrane-shape ellipse, .membrane-shape rect { fill: none; stroke: #c98a4b; stroke-width: 4; }
.wall-shape { fill: none; stroke: #8a6a3c; stroke-width: 9; }
.nucleus-shape { fill: #b39ddb; stroke: #7e5fc0; stroke-width: 2.5; }
.nucleolus { fill: #7e5fc0; }
.chloroplast-shape { fill: #4caf6d; stroke: #2f8a63; stroke-width: 1.5; }
.vacuole-shape { fill: #cfe7f5; stroke: #79b6dd; stroke-width: 2.5; opacity: .9; }
.mito-shape { fill: #f3a3a3; stroke: #d06a6a; stroke-width: 1.5; }
.part:hover .nucleus-shape, .part:hover .chloroplast-shape, .part:hover .vacuole-shape, .part:hover .mito-shape, .part:hover .wall-shape { stroke-width: 5; }
.part.selected .nucleus-shape, .part.selected .chloroplast-shape, .part.selected .vacuole-shape, .part.selected .mito-shape { stroke: #1b2434; stroke-width: 4; }
.part.selected .wall-shape, .part.selected .membrane-shape ellipse, .part.selected .membrane-shape rect { stroke: #1b2434; stroke-width: 7; }
.part.selected .cytoplasm-shape ellipse, .part.selected .cytoplasm-shape rect { stroke: #1b2434; stroke-width: 4; }
.part:focus-visible .nucleus-shape, .part:focus-visible .wall-shape, .part:focus-visible .vacuole-shape, .part:focus-visible .chloroplast-shape, .part:focus-visible .mito-shape { stroke: #1b2434; stroke-width: 5; }

.cell-switch { display: flex; gap: 8px; justify-content: center; }
.part-chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.part-chip { min-height: 38px; padding: 6px 11px; font-size: 14px; }
.part-chip .only { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #e0f2e8; color: #1f7a55; font-size: 10px; font-weight: 700; }
.part-chip.primary .only { background: rgba(255,255,255,.25); color: #fff; }

.detail-card { padding: 15px; border-radius: 13px; background: #eef4f1; }
.detail-card.plant { background: #e0f2e8; }
.detail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; }
.detail-head b { font-size: 21px; }
.where { color: #56627a; font-size: 12px; font-weight: 650; }
.work { margin: 8px 0 0; font-weight: 650; }
.note { margin: 6px 0 0; color: #56627a; font-size: 13px; }
.detail-card > b { display: block; color: #1f7a55; }

.hint { padding: 13px 15px; border-left: 4px solid #2f8a63; border-radius: 0 10px 10px 0; background: #f1f4fa; }
.hint b { display: block; margin-bottom: 4px; color: #1f7a55; }
.hint p { margin: 0; font-size: 14px; }

/* --- 比較 --- */
.compare { display: grid; gap: 16px; }
.compare-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare-figures figure { margin: 0; }
.compare-figures figcaption { margin-bottom: 6px; font-weight: 750; text-align: center; }
.table-wrap { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare-table th, .compare-table td { padding: 9px 11px; border-bottom: 1px solid #d6dded; text-align: left; }
.compare-table thead th { background: #eef4f1; font-size: 13px; }
.compare-table td.yes { color: #1f7a55; font-size: 17px; font-weight: 800; text-align: center; }
.compare-table td.no { color: #b34a4a; font-size: 17px; font-weight: 800; text-align: center; }
.compare-table tr.highlight { background: #e0f2e8; }
.work-cell { color: #56627a; }
.result { padding: 14px; border-left: 5px solid #8090aa; border-radius: 8px; background: #edf1f8; }
.result.correct { border-color: #138a62; background: #e6f7ef; }
.result.incorrect { border-color: #c64141; background: #fff0f0; }
.result b { display: block; margin-bottom: 3px; }
.result p { margin: 0; font-size: 14px; }

/* --- 染色 --- */
.stain-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.stain-table { display: grid; gap: 8px; padding: 13px; border-radius: 12px; background: #f1f4fa; }
.stain-row { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.stain-row span:last-child { color: #56627a; }
.swatch { width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; }

/* --- 階層 --- */
.hierarchy { display: grid; gap: 16px; }
.level-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.level-node { display: grid; min-height: 76px; padding: 11px 9px; place-content: center; border: 2px solid #d6dded; border-radius: 12px; background: #fff; text-align: center; cursor: pointer; transition: all .2s ease; }
.level-node b { display: block; font-size: 17px; }
.level-node small { display: block; margin-top: 3px; color: #7a869c; font-size: 12px; }
.level-node.done { border-color: #2f8a63; background: #e0f2e8; }
.level-node.current { border-color: #2f8a63; background: #2f8a63; color: #fff; transform: translateY(-3px); box-shadow: 0 8px 18px rgba(27,36,52,.18); }
.level-node.current small { color: rgba(255,255,255,.85); }
.step-explain { padding: 14px 16px; border-radius: 12px; background: #f1f4fa; }
.step-explain b { display: block; margin-bottom: 4px; color: #1f7a55; }
.step-explain p { margin: 0; }
.example { margin-top: 6px !important; color: #56627a; font-size: 14px; }
.step-controls { display: flex; gap: 9px; justify-content: center; }
.organisms { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.organism-group { padding: 13px 15px; border-radius: 12px; background: #eef4f1; }
.organism-group b { color: #1f7a55; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { padding: 4px 10px; border-radius: 999px; background: #fff; font-size: 13px; font-weight: 650; }

/* --- クイズ --- */
.quiz { display: grid; gap: 15px; }
.level { margin: 0; color: #1f7a55; font-weight: 700; }
.question { margin: 0; font-size: 19px; font-weight: 700; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice { min-height: 58px; font-size: 15px; }
.choice.correct { border-color: #138a62; background: #e6f7ef; }
.choice.incorrect { border-color: #c64141; background: #fff0f0; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .level-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .lab { padding: 17px 13px; }
  .tabs button { flex: 1 1 44%; }
  .compare-figures { grid-template-columns: 1fr; }
  .organisms { grid-template-columns: 1fr; }
  .step-controls button { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { .level-node { transition: none; } }

@media (prefers-color-scheme: dark) {
  :root { color: #edf2ff; background: #101522; }
  header > p:last-child, .note, .where, .caption, .level-node small, .work-cell, .stain-row span:last-child, .example { color: #b4bfd4; }
  button { color: #edf2ff; background: #1a2232; border-color: #46536b; }
  .detail-card, .organism-group { background: #17281f; }
  .hint, .step-explain, .stain-table, .result { background: #1a2232; }
  .level-node, .chip { background: #1a2232; border-color: #46536b; }
  .compare-table thead th { background: #17281f; }
  .compare-table th, .compare-table td { border-color: #46536b; }
  .compare-table tr.highlight { background: #17281f; }
  .cytoplasm-shape ellipse, .cytoplasm-shape rect { fill: #2b2418; stroke: #6b5a3c; }
  .part.selected .nucleus-shape, .part.selected .chloroplast-shape, .part.selected .vacuole-shape, .part.selected .mito-shape { stroke: #edf2ff; }
  .part.selected .wall-shape, .part.selected .membrane-shape ellipse, .part.selected .membrane-shape rect { stroke: #edf2ff; }
  .part.selected .cytoplasm-shape ellipse, .part.selected .cytoplasm-shape rect { stroke: #edf2ff; }
  .result.correct { background: #12392f; }
  .result.incorrect { background: #431f25; }
  .choice.correct { background: #12392f; }
  .choice.incorrect { background: #431f25; }
  .part-chip .only { background: #17281f; color: #7fd3a8; }
}
