/* ==========================================================================
   Science tools: periodic table, results grapher, fair test planner,
   label the diagram and sort it out. Loaded only on those pages.
   ========================================================================== */
.sci-msg { margin: 0; min-height: 1.4em; font-size: clamp(1rem, 1.8vw, 1.3rem); font-weight: 650; color: var(--text-2); text-align: center; }
.sci-msg.win { color: var(--green); }
.sci-msg.lose { color: var(--red); }
.seg-stack { display: grid; grid-template-columns: 1fr; }

/* Periodic table */
.pt-body { display: grid; gap: 14px; padding: 16px; align-content: start; }
.pt-scroll { overflow-x: auto; padding-bottom: 4px; }
.pt-grid { display: grid; grid-template-columns: repeat(18, minmax(36px, 1fr)); grid-auto-rows: auto; gap: 3px; min-width: 700px; position: relative; }
.pt-el {
  --fc: #999; position: relative; aspect-ratio: 1 / 1.08; border-radius: 6px; padding: 2px 3px; display: grid; grid-template-rows: auto 1fr auto; text-align: center; cursor: pointer; font: inherit; color: #14181f;
  background: color-mix(in srgb, var(--fc) 34%, #fff); border: 1.5px solid color-mix(in srgb, var(--fc) 70%, #fff); container-type: inline-size; transition: transform 0.12s, opacity 0.2s, box-shadow 0.15s;
}
[data-theme='dark'] .pt-el { background: color-mix(in srgb, var(--fc) 40%, #10141c); color: #fff; border-color: color-mix(in srgb, var(--fc) 70%, #10141c); }
.pt-el:hover { transform: scale(1.12); z-index: 3; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.4); }
.pt-el .z { font-size: 18cqw; font-weight: 650; line-height: 1.1; text-align: left; opacity: 0.8; }
.pt-el .s { font-size: 38cqw; font-weight: 800; line-height: 1; align-self: center; letter-spacing: -0.02em; }
.pt-el .n { font-size: 13.5cqw; font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.85; }
.pt-el .m { font-size: 14cqw; font-weight: 550; line-height: 1; opacity: 0.75; }
.pt-grid.no-names .pt-el .n { display: none; }
.pt-grid.no-mass .pt-el .m { display: none; }
.pt-el.dim { opacity: 0.22; }
.pt-el.sel { outline: 3px solid var(--text); outline-offset: 1px; z-index: 2; }
.pt-el.wrong { animation: shake 0.4s; background: var(--red); color: #fff; }
.pt-el.right { background: var(--green); border-color: var(--green); color: #fff; animation: pop 0.5s; }
.pt-el.made .s::after { content: ''; }
.pt-gap { grid-column: 3; display: grid; place-items: center; font-size: 0.62rem; font-weight: 700; color: var(--muted); border-radius: 6px; border: 1.5px dashed var(--border-strong); }
.pt-frow-gap { grid-column: 1 / -1; height: 8px; }
.pt-info { grid-column: 3 / 13; grid-row: 1 / 4; padding: 4px 8px 10px; display: flex; gap: 16px; align-items: center; min-width: 0; }
.pt-big { --fc: #999; flex-shrink: 0; width: clamp(96px, 11vw, 150px); aspect-ratio: 1; border-radius: 14px; display: grid; grid-template-rows: auto 1fr auto; padding: 8px 10px; text-align: center; background: color-mix(in srgb, var(--fc) 38%, #fff); border: 3px solid var(--fc); color: #14181f; }
.pt-big .z { text-align: left; font-weight: 700; font-size: clamp(0.9rem, 1.4vw, 1.2rem); }
.pt-big .s { font-size: clamp(2.6rem, 5vw, 4rem); font-weight: 800; line-height: 1; align-self: center; letter-spacing: -0.03em; }
.pt-big .m { font-size: clamp(0.8rem, 1.2vw, 1rem); font-weight: 650; }
.pt-detail { min-width: 0; display: grid; gap: 4px; }
.pt-detail h2 { margin: 0; font-size: clamp(1.3rem, 2.4vw, 2rem); letter-spacing: -0.02em; }
.pt-detail .fam { font-weight: 700; font-size: 0.92rem; }
.pt-detail .facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85rem; color: var(--text-2); }
.pt-detail .facts b { color: var(--text); }
.pt-detail p { margin: 2px 0 0; font-size: clamp(0.88rem, 1.3vw, 1.05rem); line-height: 1.4; }
.pt-hint { color: var(--muted); font-size: clamp(0.95rem, 1.6vw, 1.25rem); font-weight: 600; margin: 0; }
.pt-quiz { display: grid; gap: 8px; width: 100%; }
.pt-quiz h2 { margin: 0; font-size: clamp(1.2rem, 2.2vw, 1.9rem); }
.pt-clues { margin: 0; padding-left: 1.3em; display: grid; gap: 3px; font-size: clamp(0.9rem, 1.4vw, 1.15rem); font-weight: 600; }
.pt-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pt-find { font-size: clamp(1.8rem, 4vw, 3.4rem); font-weight: 800; letter-spacing: -0.03em; color: var(--accent); line-height: 1; }
.pt-legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pt-key { --fc: #999; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; }
.pt-key i { width: 14px; height: 14px; border-radius: 4px; background: var(--fc); }
.pt-key[aria-pressed='true'] { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 18%, var(--surface)); color: var(--text); }
@keyframes pop { 50% { transform: scale(1.3); } }
body.presenting .pt-body { padding: 56px 2vw 2vh; }
body.presenting .pt-grid { min-width: 0; width: min(100%, calc((100vh - 170px) * 18 / 10.4)); margin: 0 auto; }
body.presenting .pt-scroll { overflow: visible; }
body.presenting .pt-big { width: clamp(110px, 18vh, 200px); }
body.presenting .pt-big .s { font-size: clamp(3rem, 9vh, 6rem); }
body.presenting .pt-detail h2 { font-size: clamp(1.6rem, 4vh, 3rem); }
body.presenting .pt-detail p, body.presenting .pt-clues { font-size: clamp(1rem, 2.3vh, 1.6rem); }
.pt-info { text-align: left; align-items: center; overflow: hidden; }
.pt-info .pt-big { width: clamp(84px, 8.5vw, 128px); }
.pt-info .pt-big .s { font-size: clamp(2.2rem, 3.8vw, 3.4rem); }
.pt-detail p { font-size: clamp(0.85rem, 1.15vw, 1rem); }
.pt-detail h2 { font-size: clamp(1.2rem, 2vw, 1.8rem); }
.pt-body [data-mode] button, .pt-body ~ * [data-mode] button { white-space: nowrap; }
[data-mode] button { white-space: nowrap; }
body.presenting .pt-body { padding-top: 72px; }
body.presenting .pt-info .pt-big { width: clamp(110px, 16vh, 190px); }

/* Drag and drop (shared) */
.dnd-ghost { box-shadow: 0 16px 30px -10px rgba(0, 0, 0, 0.45) !important; opacity: 0.95; }
.dragging { opacity: 0.3; }
.picked { outline: 3px solid var(--amber) !important; outline-offset: 2px; }
.drop-over { outline: 3px dashed var(--accent); outline-offset: 2px; background: var(--accent-soft) !important; }
.has-picked [data-drop] { cursor: pointer; }

/* Sort it out */
.so-set { width: auto; max-width: 320px; height: 36px; font-weight: 650; padding: 0 30px 0 10px; }
.so-body { grid-template-columns: minmax(0, 1fr); justify-items: stretch; display: grid; gap: 14px; padding: 18px; align-content: start; }
.so-title { margin: 0; text-align: center; font-size: clamp(1.3rem, 2.6vw, 2rem); letter-spacing: -0.02em; }
.so-tray { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 64px; padding: 12px; border-radius: 16px; background: var(--surface-2); border: 2px dashed var(--border-strong); }
.so-empty { color: var(--muted); font-weight: 600; align-self: center; }
.so-card {
  font: inherit; font-weight: 700; font-size: clamp(0.95rem, 1.6vw, 1.2rem); padding: 10px 16px; border-radius: 12px; cursor: grab; touch-action: none; user-select: none;
  background: var(--surface); color: var(--text); border: 2px solid var(--border-strong); box-shadow: 0 3px 0 var(--border-strong);
}
.so-card:hover { border-color: var(--accent); }
.so-card.ok { background: color-mix(in srgb, var(--green) 16%, var(--surface)); border-color: var(--green); box-shadow: 0 3px 0 var(--green); }
.so-card.bad { background: color-mix(in srgb, var(--red) 14%, var(--surface)); border-color: var(--red); box-shadow: 0 3px 0 var(--red); animation: shake 0.4s; }
.so-groups { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 12px; }
.so-group { --gc: var(--accent); border-radius: 16px; border: 2px solid color-mix(in srgb, var(--gc) 45%, var(--border)); border-top: 6px solid var(--gc); background: color-mix(in srgb, var(--gc) 7%, var(--surface)); padding: 10px; min-height: 180px; display: flex; flex-direction: column; gap: 8px; }
.so-group h3 { margin: 0; text-align: center; font-size: clamp(1.05rem, 2vw, 1.5rem); color: color-mix(in srgb, var(--gc) 75%, var(--text)); }
.so-in { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-content: flex-start; flex: 1; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (max-width: 640px) { .so-groups { grid-template-columns: 1fr; } .so-group { min-height: 100px; } }
body.presenting .so-body { padding: 60px 3vw 2vh; }
body.presenting .so-card { font-size: clamp(1.1rem, 2.6vh, 1.8rem); }
body.presenting .so-group { min-height: 34vh; }
body.presenting .so-group h3 { font-size: clamp(1.3rem, 3.4vh, 2.4rem); }

/* Label the diagram */
.ld-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px 18px; align-content: start; justify-items: center; }
.ld-hint { margin: -6px 0 0; color: var(--muted); font-weight: 600; text-align: center; }
.ld-tray { width: 100%; min-height: 56px; }
.ld-fig { position: relative; width: min(100%, 900px); aspect-ratio: 8 / 5; container-type: inline-size; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.ld-fig svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ld-lead { stroke: #2b3240; stroke-width: 2.5; }
.ld-dot { fill: #2b3240; stroke: #fff; stroke-width: 2; }
.ld-zones { position: absolute; inset: 0; }
.ld-zone {
  position: absolute; transform: translate(-50%, -50%); width: 19.5%; min-height: 8.6cqw; display: grid; place-items: center; padding: 0.4cqw;
  border-radius: 1.2cqw; border: 2px dashed #8a94a6; background: #fff; color: #2b3240; font: inherit;
}
.ld-zone.filled { border-color: transparent; background: transparent; padding: 0; }
.ld-num { font-weight: 800; font-size: max(11px, 2.4cqw); color: #6b7485; }
.no-num .ld-zone:not(.ld-rev) .ld-num { visibility: hidden; }
.ld-chip {
  font: inherit; font-weight: 750; font-size: clamp(0.9rem, 1.5vw, 1.15rem); line-height: 1.15; padding: 8px 14px; border-radius: 10px; cursor: grab; touch-action: none; user-select: none;
  background: #fff; color: #1d2430; border: 2px solid #2b3240; box-shadow: 0 3px 0 #2b3240;
}
.ld-zone .ld-chip { width: 100%; min-height: 8.6cqw; font-size: max(10px, 1.85cqw); padding: 0.5cqw 0.6cqw; border-radius: 1.2cqw; box-shadow: 0 0.35cqw 0 #2b3240; }
.ld-chip.ok { background: #e2f6e9; border-color: #2fa66a; box-shadow: 0 3px 0 #2fa66a; color: #145a35; cursor: pointer; }
.ld-chip.bad { background: #fde6e6; border-color: #e5484d; box-shadow: 0 3px 0 #e5484d; color: #8a1d21; animation: shake 0.4s; }
.ld-rev { cursor: pointer; border-style: solid; border-color: #2b3240; }
.ld-rev .ld-word { display: none; font-weight: 750; font-size: max(10px, 1.85cqw); line-height: 1.15; }
.ld-rev.shown { background: #fff8db; border-color: #d9a400; }
.ld-rev.shown .ld-num { display: none; }
.ld-rev.shown .ld-word { display: block; }
.ld-rev:hover { border-color: var(--accent); }
.ld-fig .drop-over { background: #e8f0ff !important; border-color: #3e7bfa; outline: none; }
.ld-body .sci-msg { max-width: 900px; }
body.presenting .ld-body { padding: 56px 2vw 1vh; gap: 10px; }
body.presenting .ld-fig { width: min(100%, calc((100vh - 330px) * 1.6)); }
body.presenting .ld-chip { font-size: clamp(1rem, 2.2vh, 1.5rem); }

/* Fair test planner */
.ft-body { grid-template-columns: minmax(0, 1fr); justify-items: stretch; display: grid; gap: 14px; padding: 18px; align-content: start; }
.ft-q { display: grid; gap: 6px; }
.ft-q span, .ft-h { font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ft-q textarea { min-height: 0; font-size: clamp(1.2rem, 2.4vw, 1.8rem); font-weight: 750; letter-spacing: -0.01em; resize: none; padding: 12px 14px; field-sizing: content; }
.ft-safety { margin: 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--amber) 18%, var(--surface)); border: 1px solid var(--amber); font-weight: 650; }
.ft-safety::before { content: '⚠ '; }
.ft-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ft-card { --fc: var(--accent); display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 16px; border: 2px solid color-mix(in srgb, var(--fc) 40%, var(--border)); border-top: 7px solid var(--fc); background: color-mix(in srgb, var(--fc) 7%, var(--surface)); }
.ft-card .ft-h { color: color-mix(in srgb, var(--fc) 70%, var(--text)); font-size: 0.95rem; }
.ft-card .ft-h b { font-size: 1.25em; }
.ft-card small { color: var(--muted); font-weight: 600; margin-top: -4px; }
.ft-card textarea { min-height: 0; flex: 1; resize: none; font-size: clamp(1rem, 1.7vw, 1.3rem); font-weight: 650; background: var(--surface); field-sizing: content; }
.ft-change { --fc: #3e7bfa; } .ft-measure { --fc: #2fa66a; } .ft-same { --fc: #e5a000; } .ft-predict { --fc: #8b5cf6; }
.ft-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ft-list li { display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 12px; border-radius: 99px; background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--fc) 50%, var(--border)); font-weight: 650; font-size: clamp(0.9rem, 1.4vw, 1.1rem); }
.ft-list li.ft-none { border-style: dashed; color: var(--muted); padding-right: 12px; }
.ft-x { border: 0; background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; }
.ft-x:hover { background: var(--surface-2); color: var(--red); }
.ft-add { display: flex; gap: 6px; }
.ft-add input { flex: 1; min-width: 0; height: 36px; }
.ft-ideas { display: flex; flex-wrap: wrap; gap: 5px; }
.ft-idea { font: inherit; font-size: 0.8rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); cursor: pointer; }
.ft-idea:hover { color: var(--text); border-color: var(--fc); }
@media (max-width: 640px) { .ft-grid { grid-template-columns: 1fr; } }
body.presenting .ft-body { padding: 60px 3vw 2vh; }
body.presenting .ft-q textarea { font-size: clamp(1.4rem, 4vh, 2.6rem); }
body.presenting .ft-card textarea, body.presenting .ft-list li { font-size: clamp(1.1rem, 2.8vh, 1.9rem); }
body.presenting .ft-add, body.presenting .ft-ideas { display: none; }
@media print {
  .page-tool .ft-add, .page-tool .ft-ideas, .page-tool .ft-x, .page-tool .stage-bar, .page-tool .stage-controls, .page-tool .sci-msg { display: none !important; }
  .page-tool .ft-card textarea, .page-tool .ft-q textarea { border: 0; padding: 0; }
}

/* Results grapher */
.rg-seg { width: auto; }
.rg-seg button { white-space: nowrap; }
.rg-body { grid-template-columns: minmax(0, 1fr); justify-items: stretch; --rg0: #3e7bfa; --rg1: #2fa66a; --rg2: #f2803a; --rg3: #8b5cf6; --rg4: #e5484d; --rg5: #14a3b8; display: grid; gap: 12px; padding: 16px 18px; align-content: start; container-type: inline-size; }
.rg-titlein { font-size: clamp(1.1rem, 2.2vw, 1.6rem); font-weight: 750; text-align: center; border-color: transparent; background: var(--surface-2); }
.rg-wrap { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
@container (max-width: 680px) { .rg-wrap { grid-template-columns: 1fr; } }
.rg-tablebox { display: grid; gap: 8px; justify-items: start; overflow-x: auto; }
.rg-table { border-collapse: collapse; width: 100%; }
.rg-table th, .rg-table td { border: 1px solid var(--border-strong); padding: 0; }
.rg-table th { background: var(--surface-2); font-size: 0.78rem; font-weight: 700; color: var(--muted); vertical-align: bottom; }
.rg-table th input { font-weight: 750; font-size: 0.85rem; color: var(--text); background: transparent; }
.rg-table th span { display: block; padding: 0 6px 6px; text-align: center; }
.rg-table th.rg-y { min-width: 120px; }
.rg-table .rg-rep { padding: 6px; text-align: center; width: 64px; }
.rg-table th.rg-y { border-left-width: 2px; }
.rg-table input { width: 100%; border: 0; border-radius: 0; height: 40px; padding: 0 8px; background: transparent; font-size: 1rem; box-shadow: none; }
.rg-table input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.rg-table .rg-v { text-align: center; font-variant-numeric: tabular-nums; }
.rg-table .rg-v.odd { background: color-mix(in srgb, var(--amber) 30%, transparent); }
.rg-table .rg-mean { text-align: center; font-weight: 800; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-left-width: 2px; min-width: 70px; }
.rg-table td:last-child, .rg-table th:last-child { border: 0; background: transparent; width: 30px; text-align: center; }
.rg-oddnote { margin: 0; font-size: 0.85rem; font-weight: 600; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--amber) 18%, var(--surface)); }
.rg-graphbox { border: 1px solid var(--border); border-radius: 14px; background: #fff; padding: 6px; }
.rg-graph { width: 100%; height: auto; display: block; font-family: inherit; }
.rg-grid { stroke: #e3e7ee; }
.rg-axis { stroke: #2b3240; stroke-width: 2; }
.rg-tick { font-size: 14px; fill: #4a5262; }
.rg-lab { font-size: 15px; font-weight: 700; fill: #1d2430; }
.rg-title { font-size: 18px; font-weight: 800; fill: #1d2430; }
.rg-val { font-size: 13px; font-weight: 700; fill: #1d2430; }
.rg-line { fill: none; stroke: var(--rg1); stroke-width: 4; stroke-linejoin: round; }
.rg-pt { fill: var(--rg1); stroke: #fff; stroke-width: 2; }
.rg-empty { font-size: 16px; fill: #6b7485; }
.rg-sw { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.rg-sw [data-sw] { font-size: 1.8rem; font-weight: 800; min-width: 6ch; text-align: center; font-variant-numeric: tabular-nums; }
body.presenting .rg-body { padding: 60px 2vw 1vh; }
body.presenting .rg-table input { height: clamp(40px, 5.5vh, 60px); font-size: clamp(1rem, 2.4vh, 1.6rem); }
body.presenting .rg-graphbox { max-height: calc(100vh - 260px); }
body.presenting .rg-graph { max-height: calc(100vh - 280px); }
body.presenting .rg-sw [data-sw] { font-size: clamp(2rem, 6vh, 3.4rem); }
.rg-lab.sm { font-size: 11.5px; }
.rg-table th:first-child { min-width: 110px; }
.rg-table .rg-rep { width: 52px; min-width: 52px; }
.rg-table th.rg-y { min-width: 96px; }
.rg-tick { font-size: 16px; } .rg-lab { font-size: 17px; } .rg-lab.sm { font-size: 13px; } .rg-val { font-size: 15px; } .rg-title { font-size: 19px; }
.ft-grid { align-items: start; } .ft-predict textarea { flex: none; min-height: 110px; }

/* Language cards */
.lc-langs { width: auto; } .lc-langs button { white-space: nowrap; }
.lc-wrap { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: start; gap: 12px; padding: 16px 18px; }
.lc-modes { width: min(100%, 520px); }
.lc-modes button { white-space: nowrap; }
.lc-body { width: 100%; display: grid; justify-items: center; gap: 14px; }
.lc-pic { font-size: clamp(2.6rem, 6vw, 4.2rem); line-height: 1; }
.lc-swatch { width: clamp(52px, 8vw, 84px); aspect-ratio: 1; border-radius: 16px; border: 2px solid var(--border-strong); display: block; }
.lc-word { font-size: clamp(1.8rem, 4.6vw, 3.4rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.lc-card { position: relative; width: min(100%, 560px); aspect-ratio: 16 / 10; perspective: 1200px; cursor: pointer; outline: none; }
.lc-face { position: absolute; inset: 0; border-radius: 22px; display: grid; place-items: center; align-content: center; gap: 10px; padding: 18px; backface-visibility: hidden; transition: transform 0.45s var(--ease); border: 2px solid var(--border); box-shadow: var(--shadow-md, 0 10px 30px -12px rgba(0,0,0,.25)); }
.lc-front { background: var(--surface); }
.lc-back { background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--surface)); border-color: color-mix(in srgb, var(--c, var(--accent)) 50%, var(--border)); transform: rotateY(180deg); }
.lc-card.flip .lc-front { transform: rotateY(-180deg); }
.lc-card.flip .lc-back { transform: rotateY(0); }
.lc-card:focus-visible .lc-face { box-shadow: 0 0 0 3px var(--ring); }
.lc-tap { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.lc-nav { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.lc-nav .num { min-width: 60px; text-align: center; font-weight: 700; color: var(--muted); }
.lc-q { display: grid; justify-items: center; gap: 8px; }
.lc-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: min(100%, 640px); }
.lc-opt { font: inherit; font-size: clamp(1.1rem, 2.4vw, 1.6rem); font-weight: 750; padding: 16px 12px; border-radius: 14px; border: 2px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; box-shadow: 0 3px 0 var(--border-strong); }
.lc-opt:hover { border-color: var(--accent); }
.lc-opt.ok { background: color-mix(in srgb, var(--green) 18%, var(--surface)); border-color: var(--green); box-shadow: 0 3px 0 var(--green); }
.lc-opt.bad { background: color-mix(in srgb, var(--red) 14%, var(--surface)); border-color: var(--red); box-shadow: 0 3px 0 var(--red); animation: shake 0.4s; }
.lc-score { color: var(--muted); font-weight: 700; }
.lc-sub { margin: 0; color: var(--muted); font-weight: 600; }
.lc-match { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; width: min(100%, 720px); }
.lc-col { display: grid; gap: 8px; }
.lc-m { font: inherit; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: clamp(1rem, 2vw, 1.35rem); font-weight: 700; cursor: pointer; transition: opacity 0.3s, transform 0.15s; }
.lc-m .lc-pic { font-size: 1.5rem; } .lc-m .lc-swatch { width: 26px; border-radius: 6px; }
.lc-m.sel { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.03); }
.lc-m.done { background: color-mix(in srgb, var(--green) 16%, var(--surface)); border-color: var(--green); opacity: 0.55; cursor: default; }
.lc-m.bad { border-color: var(--red); animation: shake 0.4s; }
.lc-talk { display: grid; justify-items: center; gap: 12px; width: min(100%, 720px); padding: 22px; border-radius: 22px; background: var(--surface-2); border: 2px solid var(--border); }
.lc-badge { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.lc-reveal { display: grid; gap: 6px; justify-items: center; min-height: 20px; }
.lc-en { margin: 0; font-size: clamp(1.1rem, 2.4vw, 1.5rem); color: var(--muted); font-weight: 650; }
.lc-ans { margin: 0; font-size: clamp(1.2rem, 2.8vw, 1.8rem); font-weight: 700; }
.lc-ans b { display: block; font-size: 0.55em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--green); }
@media (max-width: 520px) { .lc-opts { grid-template-columns: 1fr; } .lc-match { gap: 8px; } .lc-m { min-height: 48px; font-size: 0.95rem; padding: 6px; } }
body.presenting .lc-wrap { padding: 60px 3vw 2vh; }
body.presenting .lc-card { width: min(100%, calc(62vh * 1.6)); }
body.presenting .lc-word { font-size: clamp(2.4rem, 8vh, 6rem); }
body.presenting .lc-pic { font-size: 10vh; }
body.presenting .lc-opt { font-size: clamp(1.3rem, 3.6vh, 2.4rem); padding: 2.4vh 12px; }
body.presenting .lc-m { font-size: clamp(1.1rem, 3vh, 2rem); min-height: 8vh; }
.stage-bar [data-topic] { margin-right: auto; max-width: 260px; }

/* Shape explorer */
.sh-seg { width: auto; } .sh-seg button { white-space: nowrap; }
.sh-body { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 10px; padding: 16px 18px; }
.sh-main { --sc: #14a3b8; display: grid; gap: 14px; }
.sh-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: center; text-align: left; }
.sh-big { width: min(100%, 360px); justify-self: center; touch-action: none; }
.sh-big .sh-3d { cursor: grab; }
.sh-svg { width: 100%; height: auto; display: block; overflow: visible; }
.sh-fill { fill: color-mix(in srgb, var(--sc) 22%, transparent); stroke: var(--sc); stroke-width: 4; stroke-linejoin: round; }
.sh-face { fill: var(--sc); stroke: none; }
.sh-edge { stroke: color-mix(in srgb, var(--sc) 60%, #0b3d47); stroke-width: 3.5; stroke-linecap: round; }
.sh-hid { stroke: color-mix(in srgb, var(--sc) 60%, #0b3d47); stroke-width: 2; stroke-dasharray: 6 6; opacity: 0.7; }
.sh-v { fill: #e5484d; stroke: #fff; stroke-width: 1.5; }
.sh-sym { stroke: #8b5cf6; stroke-width: 2.5; stroke-dasharray: 9 6; }
.sh-ra { fill: none; stroke: #e5484d; stroke-width: 2.5; }
.sh-info h2 { margin: 0 0 10px; font-size: clamp(1.4rem, 3vw, 2.2rem); letter-spacing: -0.02em; }
.sh-facts { display: grid; gap: 6px; }
.sh-fact { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: clamp(0.95rem, 1.6vw, 1.15rem); }
.sh-fact b { font-size: 1.15em; text-align: right; }
.sh-note { margin: 10px 0 0; font-weight: 600; }
.sh-tip { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; }
.sh-picker, .sh-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.sh-pick { font: inherit; display: grid; justify-items: center; gap: 4px; padding: 8px 6px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 0.74rem; font-weight: 650; line-height: 1.2; }
.sh-pick .sh-svg { width: 56px; }
.sh-pick:hover { border-color: var(--sc); }
.sh-pick.on { border-color: var(--sc); background: color-mix(in srgb, var(--sc) 10%, var(--surface)); }
.sh-pick.ok { border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, var(--surface)); }
.sh-pick.bad { opacity: 0.4; border-color: var(--red); }
.sh-myst { display: grid; gap: 12px; justify-items: center; }
.sh-myst h2 { margin: 0; }
.sh-clues { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; width: min(100%, 560px); counter-reset: c; }
.sh-clues li { counter-increment: c; padding: 10px 14px 10px 46px; position: relative; border-radius: 12px; background: color-mix(in srgb, var(--sc) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--sc) 35%, var(--border)); font-weight: 700; font-size: clamp(1rem, 2vw, 1.35rem); text-align: left; animation: mw-pop 0.25s; }
.sh-clues li::before { content: counter(c); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%; background: var(--sc); color: #fff; display: grid; place-items: center; font-size: 0.8rem; }
.sh-opts { width: 100%; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.sh-opts .sh-pick .sh-svg { width: 70px; }
.sh-score { font-weight: 700; color: var(--muted); }
@keyframes mw-pop { 50% { transform: scale(1.04); } }
@media (max-width: 640px) { .sh-view { grid-template-columns: 1fr; } }
body.presenting .sh-body { padding: 60px 3vw 2vh; }
body.presenting .sh-big { width: min(100%, 52vh); }
body.presenting .sh-fact { font-size: clamp(1.1rem, 2.6vh, 1.8rem); }
body.presenting .sh-clues li { font-size: clamp(1.2rem, 3vh, 2rem); }
.stage-bar .sh-seg + .sh-seg { margin-right: auto; }

/* Percentages */
.pc-body, .es-body { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 12px; padding: 18px; }
.pc-main, .es-main { display: grid; gap: 14px; justify-items: center; }
.pc-sq-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; width: 100%; }
.pc-sq { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; width: min(62vw, 360px); aspect-ratio: 1; padding: 6px; border-radius: 12px; background: var(--border-strong); touch-action: none; user-select: none; }
.pc-c { border: 0; padding: 0; border-radius: 3px; background: var(--surface); cursor: pointer; transition: background 0.08s; }
.pc-c.on { background: #e93d82; }
.pc-sq-sm { width: min(70vw, 220px); }
.pc-eq { display: grid; gap: 10px; text-align: left; }
.pc-box { display: grid; gap: 2px; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.pc-box > span { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.pc-box b { font-size: clamp(1.6rem, 3.6vw, 2.6rem); line-height: 1.1; display: flex; align-items: center; gap: 0.25em; flex-wrap: wrap; }
.pc-eq.hide .pc-box b { color: transparent; text-shadow: none; position: relative; }
.pc-eq.hide .pc-box b * { visibility: hidden; }
.pc-eq.hide .pc-box b::after { content: '?'; position: absolute; left: 0; color: var(--muted); }
.pc-frac { display: inline-grid; text-align: center; font-size: 0.8em; line-height: 1.05; }
.pc-frac span:first-child { border-bottom: 3px solid currentColor; padding: 0 4px; }
.pc-reveal { justify-self: start; }
.pc-slide { display: flex; gap: 8px; align-items: center; width: min(100%, 620px); }
.pc-slide input[type=range] { flex: 1; accent-color: #e93d82; height: 30px; }
.pc-of { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.pc-of label { display: flex; align-items: center; gap: 4px; font-size: 2rem; font-weight: 800; }
.pc-of input { width: 150px; height: 60px; font-size: 2rem; font-weight: 800; text-align: center; }
.pc-ofword { font-size: 1.6rem; font-weight: 700; color: var(--muted); }
.pc-bar { width: min(100%, 760px); display: grid; gap: 4px; }
.pc-bar-top { text-align: center; font-weight: 800; padding: 6px; border-radius: 10px; background: var(--surface-2); border: 2px solid var(--border-strong); }
.pc-segs { display: grid; grid-template-columns: repeat(10, 1fr); border: 2px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.pc-seg { position: relative; height: 56px; border-right: 2px solid var(--border-strong); display: grid; place-items: center; }
.pc-seg:last-child { border-right: 0; }
.pc-seg i { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, #e93d82 45%, transparent); }
.pc-seg span { position: relative; font-weight: 750; font-size: clamp(0.7rem, 1.6vw, 1rem); }
.pc-bar-lab { text-align: center; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.pc-steps { display: grid; gap: 6px; width: min(100%, 620px); }
.pc-step { padding: 8px 14px; border-radius: 10px; background: var(--surface-2); font-size: clamp(1rem, 2vw, 1.3rem); text-align: left; }
.pc-answer { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, #e93d82 14%, var(--surface)); border: 2px solid #e93d82; font-size: clamp(1.3rem, 3vw, 2rem); font-weight: 650; }
.pc-quiz { display: grid; gap: 14px; justify-items: center; }
.pc-qtext { font-size: clamp(1.5rem, 3.6vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; }
.pc-ansform { display: flex; gap: 8px; justify-content: center; }
.pc-ansform input { width: 190px; height: 52px; font-size: 1.5rem; font-weight: 750; text-align: center; }
@media (max-width: 640px) { .pc-sq-wrap { grid-template-columns: 1fr; justify-items: center; } }
body.presenting .pc-body, body.presenting .es-body { padding: 60px 3vw 2vh; }
body.presenting .pc-sq { width: min(60vw, 62vh); }
body.presenting .pc-box b { font-size: clamp(2rem, 6vh, 4rem); }

/* Estimation station */
.es-box { position: relative; width: min(100%, 520px); aspect-ratio: 1; border-radius: 18px; background: #fff; border: 2px solid var(--border); overflow: hidden; }
.es-dots { width: 100%; height: 100%; display: block; }
.es-cover { position: absolute; inset: 0; display: grid; place-items: center; background: var(--surface-2); font-size: 1.4rem; font-weight: 750; color: var(--muted); padding: 20px; }
.es-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--surface-3); }
.es-timer i { display: block; height: 100%; width: 100%; background: var(--accent); }
.es-ask { margin: 0; font-size: clamp(1.3rem, 3vw, 2.2rem); font-weight: 750; }
.es-line { width: min(100%, 1000px); height: auto; display: block; touch-action: none; cursor: crosshair; }
.es-axis { stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
.es-mid { stroke-width: 3; opacity: 0.7; }
.es-lab { fill: var(--text); font-size: 30px; font-weight: 800; text-anchor: middle; font-family: inherit; }
.es-sm { font-size: 18px; font-weight: 600; fill: var(--muted); }
.es-arrow path { fill: #e5484d; } .es-t { fill: #e5484d; }
.es-pin circle { fill: #3e7bfa; stroke: #fff; stroke-width: 3; } .es-p { fill: #3e7bfa; }
body.presenting .es-box { width: min(100%, 60vh); }
.stage-bar > .enter-present { margin-left: auto; }
