:root { font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif; color: #17364e; --blue: #2f5fb7; --good: #17835f; --bad: #c2405a; --line: #c3d2e0; }
* { box-sizing: border-box; }
body { margin: 0; background: linear-gradient(#f2f8ff, #fff 42%); }
.lab { width: min(100%, 760px); margin: auto; padding: 12px max(12px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.eyebrow { margin: 0 0 3px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
h1 { margin: 0 0 6px; font-size: 21px; }
.lead { margin: 0 0 10px; color: #5a6b83; font-size: 13px; line-height: 1.55; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1 1 0; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: #17364e; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.tabs button.active { border-color: var(--blue); color: #fff; background: var(--blue); }

.panel { display: grid; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.panel label { display: grid; gap: 4px; color: #61728a; font-size: 12px; font-weight: 700; }
.panel select { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: #17364e; font: inherit; font-weight: 700; }

.stage { margin-top: 10px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.diagrams { display: grid; gap: 10px; }
.diagrams.pair { grid-template-columns: 1fr 1fr; }
.venn { margin: 0; }
.venn svg { display: block; width: 100%; height: auto; }
.venn figcaption { margin-top: 4px; color: #17364e; font-size: 13px; font-weight: 800; text-align: center; }
.venn .legend { display: block; margin-top: 2px; color: #61728a; font-size: 11.5px; font-weight: 600; }
.frame { fill: #f7fafd; stroke: #9fb0c6; stroke-width: 1.5; }
.universe { fill: #61728a; font-size: 15px; font-weight: 800; }
.outline { fill: none; stroke: var(--blue); stroke-width: 2; }
.shade { fill: var(--blue); opacity: .2; }
.set-label { fill: var(--blue); font-size: 17px; font-weight: 800; text-anchor: middle; }
.chip circle { fill: #fff; stroke: #b7c6d7; stroke-width: 1.5; }
.chip text { fill: #61728a; font-size: 13px; font-weight: 700; text-anchor: middle; }
.chip.on circle { fill: var(--blue); stroke: var(--blue); }
.chip.on text { fill: #fff; }
.chip.bad circle { fill: var(--bad); stroke: var(--bad); }
.chip.bad text { fill: #fff; }

.truth { width: 100%; margin-bottom: 12px; border-collapse: collapse; font-size: 13px; }
.truth caption { margin-bottom: 6px; color: #61728a; font-size: 12px; font-weight: 700; text-align: left; }
.truth th, .truth td { padding: 7px 6px; border-bottom: 1px solid #e2e9f2; text-align: left; }
.truth thead th { color: #61728a; font-size: 11.5px; }
.truth tbody th { white-space: nowrap; }
.truth tr.linked { background: #eef4ff; }
.truth .true { color: var(--good); font-weight: 800; }
.truth .false { color: var(--bad); font-weight: 800; }
.truth .muted { color: #8494a8; font-size: 12px; }

.result { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.value-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 5px 0; border-bottom: 1px dashed #e2e9f2; }
.value-row:last-of-type { border-bottom: 0; }
.value-row > span:first-child { min-width: 128px; color: #61728a; font-size: 12px; font-weight: 700; }
.value-row b { font-size: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.value-row b.answer { color: var(--blue); font-size: 19px; font-family: inherit; }
.value-row b.true { color: var(--good); }
.value-row b.false { color: var(--bad); }
.value-row .muted { color: #8494a8; font-size: 12px; font-weight: 600; }
.note { margin: 8px 0 0; color: #55657d; font-size: 12.5px; line-height: 1.7; }
.note.hint { padding: 8px 10px; border-radius: 9px; background: #fff6e2; color: #7a5a12; }

@media (max-width: 480px) {
  h1 { font-size: 19px; }
  .tabs button { font-size: 12px; }
  .diagrams.pair { grid-template-columns: 1fr; }
  .value-row b.answer { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
