.anatomy { --atlas-line: var(--color-slate-200); --atlas-muted: var(--color-slate-500); --atlas-soft: var(--color-slate-50); --atlas-focus: var(--color-primary); display: grid; gap: 1.5rem; min-width: 0; }
[data-theme="dark"] .anatomy { --atlas-line: var(--color-slate-700); --atlas-muted: var(--color-slate-400); --atlas-soft: var(--color-ink); --atlas-focus: var(--color-blue-300); }
.anatomy button, .anatomy input { font: inherit; }
.anatomy button { cursor: pointer; touch-action: manipulation; }
.anatomy button:active { scale: .96; }
.anatomy button:focus-visible, .anatomy input:focus-visible, .anatomy canvas:focus-visible { outline: 2px solid var(--atlas-focus); outline-offset: 4px; }
.anatomy button:disabled { cursor: default; opacity: .45; }
.anatomy [hidden] { display: none !important; }
.anatomy-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.anatomy-heading h2 { margin: .3rem 0 .5rem; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
.anatomy-heading p:not(.anatomy-eyebrow), .anatomy-library-header p { color: var(--atlas-muted); font-size: .875rem; line-height: 1.8; }
.anatomy-eyebrow { color: var(--color-primary); font-size: .75rem; letter-spacing: .13em; font-weight: 600; }
[data-theme="dark"] .anatomy-eyebrow { color: var(--color-blue-300); }
.anatomy-count { border: 1px solid var(--atlas-line); border-radius: 999px; padding: .5rem .85rem; color: var(--atlas-muted); font-size: .8rem; white-space: nowrap; }
.anatomy-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.anatomy-studio { overflow: hidden; }
.anatomy-view-tabs { display: flex; flex-wrap: wrap; padding: .65rem; gap: .25rem; border-bottom: 1px solid var(--atlas-line); }
.anatomy-view-tabs button, .anatomy-filter button, .anatomy-tools button { min-height: 44px; padding: .5rem .75rem; border-radius: .5rem; font-size: .8rem; color: var(--atlas-muted); }
.anatomy-view-tabs button[aria-pressed="true"], .anatomy-filter button[aria-pressed="true"] { color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 8%, transparent); font-weight: 600; }
.anatomy-viewport { height: 810px; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--color-primary) 5%, var(--color-surface)), var(--atlas-soft)); isolation: isolate; }
[data-theme="dark"] .anatomy-viewport { background: radial-gradient(ellipse at 50% 45%, var(--color-slate-800), var(--color-ink)); }
.anatomy-viewport canvas { display: block; position: relative; width: 100%; height: 100%; z-index: 1; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.anatomy-stage-name { position: absolute; top: 1.5rem; left: 1.5rem; display: grid; gap: .25rem; pointer-events: none; color: var(--atlas-muted); opacity: .5; }
.anatomy-stage-name span:first-child { font-family: var(--font-display); font-size: 1.6rem; }
.anatomy-stage-name span:last-child { font-size: .6rem; letter-spacing: .22em; }
.anatomy-loading { position: absolute; z-index: 3; top: 40%; left: 1.5rem; right: 1.5rem; text-align: center; color: var(--atlas-muted); line-height: 1.8; }
.anatomy-hover { position: absolute; top: 1rem; right: 1rem; background: var(--color-surface); color: var(--color-accent); border: 1px solid var(--atlas-line); border-radius: .6rem; padding: .5rem .8rem; z-index: 3; pointer-events: none; box-shadow: 0 4px 18px #0000000b; }
[data-theme="dark"] .anatomy-hover { background: var(--color-ink-surface); }
/* On-model label: pinned to the selected part by a leader line; positioned by body-parts.js. */
.anatomy-callout-line { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.anatomy-callout-line line { stroke: var(--color-accent); stroke-width: 1.5; }
.anatomy-callout-line circle { fill: var(--color-surface); stroke: var(--color-accent); stroke-width: 2; }
.anatomy-callout { position: absolute; left: 0; top: 0; z-index: 3; display: flex; align-items: center; gap: .45rem; min-height: 44px; padding: .35rem .75rem; background: var(--color-surface); border: 1px solid color-mix(in srgb, var(--color-accent) 35%, var(--atlas-line)); border-radius: .65rem; box-shadow: 0 6px 20px #00000014; white-space: nowrap; }
.anatomy-callout [data-callout-word] { font-size: 1.15rem; font-weight: 700; }
.anatomy-callout [data-callout-reading] { font-size: .78rem; color: var(--atlas-muted); }
.anatomy-callout i { color: var(--color-accent); }
[data-theme="dark"] .anatomy-callout, [data-theme="dark"] .anatomy-callout-line circle { background: var(--color-ink-surface); fill: var(--color-ink-surface); }
.anatomy-current { position: absolute; z-index: 3; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: .65rem; padding: .25rem .35rem .25rem .85rem; background: var(--color-surface); border: 1px solid var(--atlas-line); border-radius: 999px; box-shadow: 0 4px 18px #0000000b; white-space: nowrap; max-width: calc(100% - 2rem); }
[data-theme="dark"] .anatomy-current { background: var(--color-ink-surface); }
.anatomy-current-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-accent); flex-shrink: 0; }
.anatomy-current [data-mini-word] { font-weight: 600; }
.anatomy-current [data-mini-reading] { color: var(--atlas-muted); font-size: .75rem; }
.anatomy-current button { min-width: 44px; min-height: 44px; color: var(--color-accent); }
.anatomy-tools, .anatomy-tools > div { display: flex; align-items: center; gap: .25rem; }
.anatomy-tools { justify-content: space-between; border-top: 1px solid var(--atlas-line); padding: .45rem .65rem; }
.anatomy-tools button { display: inline-flex; align-items: center; gap: .35rem; min-width: 44px; justify-content: center; white-space: nowrap; }
.anatomy-tools > div:first-child { flex-wrap: wrap; }
.anatomy-tools button:hover { background: var(--atlas-soft); }
.anatomy-help { display: flex; gap: .5rem; align-items: center; justify-content: center; padding: 0 1rem 1rem; font-size: .72rem; color: var(--atlas-muted); text-align: center; line-height: 1.7; }
.anatomy-word { padding: 1.6rem; min-width: 0; }
.anatomy-word h2 { font-size: 2.8rem; line-height: 2.1; margin-top: .6rem; font-weight: 600; overflow-wrap: anywhere; }
.anatomy ruby { ruby-position: over; }
.anatomy rt { font-weight: 400; font-size: .4em; color: var(--atlas-muted); }
.anatomy-kana { color: var(--atlas-muted); font-size: 1rem; }
.anatomy-romaji { color: var(--color-primary); font-size: 1.05rem; margin-top: .35rem; letter-spacing: .03em; }
[data-theme="dark"] .anatomy-romaji { color: var(--color-blue-300); }
.anatomy-meaning { font-size: 1.1rem; font-weight: 500; margin: .7rem 0 1.6rem; }
.anatomy-audio-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.anatomy-audio-actions button { min-height: 44px; }
.anatomy [data-playing="true"] { color: var(--color-accent); }
.anatomy-audio-actions [data-playing="true"] { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-white); }
.anatomy-autoplay { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; min-height: 44px; font-size: .8rem; color: var(--atlas-muted); }
.anatomy-autoplay input { width: 1rem; height: 1rem; accent-color: var(--color-accent); }
.anatomy-audio-status { min-height: 1.5rem; font-size: .8rem; color: var(--color-accent); line-height: 1.5; }
.anatomy-word-note { display: flex; align-items: flex-start; gap: .6rem; padding: 1rem 0; margin-top: .3rem; border-top: 1px solid var(--atlas-line); color: var(--atlas-muted); font-size: .8rem; line-height: 1.7; }
.anatomy-word-note i { padding-top: .15rem; }
.anatomy-related h3 { font-size: .75rem; color: var(--atlas-muted); margin: .8rem 0; }
.anatomy-related > div { display: flex; flex-wrap: wrap; gap: .4rem; }
.anatomy-related button { padding: .5rem .7rem; min-height: 44px; background: var(--atlas-soft); border: 1px solid var(--atlas-line); border-radius: .5rem; font-size: .85rem; }
.anatomy-library { padding: 1.4rem; }
.anatomy-library-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.anatomy-library-header h2 { font-weight: 600; margin-bottom: .3rem; }
.anatomy-search { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--atlas-line); border-radius: .6rem; padding: 0 .8rem; width: min(100%, 18rem); min-height: 44px; color: var(--atlas-muted); }
.anatomy-search input { width: 100%; min-width: 0; background: transparent; font-size: .8rem; border: 0; padding: .7rem 0; }
.anatomy-filter { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0; }
.anatomy-word-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.anatomy-word-item { display: flex; flex-direction: column; text-align: left; padding: .9rem .8rem; border: 1px solid var(--atlas-line); border-radius: .7rem; min-width: 0; gap: .25rem; transition: border-color 150ms, background-color 150ms; }
.anatomy-word-item > span:first-child { font-size: 1.1rem; line-height: 2.2; font-weight: 500; }
.anatomy-word-item > span:last-child, .anatomy-item-romaji { color: var(--atlas-muted); font-size: .75rem; overflow-wrap: anywhere; }
.anatomy-word-item[aria-pressed="true"] { border-color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 5%, transparent); }
.anatomy-word-item:hover { border-color: var(--color-primary); }
/* Matching exercise (連線題): word column, dots on the model, SVG lines between them. */
.anatomy[data-match] .anatomy-current, .anatomy[data-match] .anatomy-hover, .anatomy[data-match] .anatomy-callout, .anatomy[data-match] .anatomy-callout-line, .anatomy[data-match] .anatomy-stage-name { display: none !important; }
.anatomy-match { --match-col: 7.5rem; position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.anatomy-match-bar, .anatomy-match-words, .anatomy-match-foot { pointer-events: auto; }
.anatomy-match-bar { position: absolute; top: .6rem; left: .75rem; right: .75rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.anatomy-match-bar p { padding: .45rem .8rem; background: var(--color-surface); border: 1px solid var(--atlas-line); border-radius: 999px; font-size: .8rem; font-weight: 600; }
.anatomy-match-bar button { min-width: 44px; min-height: 44px; border-radius: 50%; background: var(--color-surface); border: 1px solid var(--atlas-line); color: var(--atlas-muted); }
.anatomy-match-words { position: absolute; top: 4rem; left: .75rem; width: var(--match-col); display: grid; gap: .45rem; }
.anatomy-match-word { display: grid; justify-items: start; min-height: 44px; padding: .35rem .65rem; background: var(--color-surface); border: 1px solid var(--atlas-line); border-radius: .6rem; text-align: left; touch-action: none; box-shadow: 0 2px 10px #00000008; }
.anatomy-match-word span:first-child { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.anatomy-match-word span:last-child { font-size: .7rem; color: var(--atlas-muted); }
.anatomy-match-word[aria-pressed="true"] { border-color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface)); }
.anatomy-match-word[data-state="correct"] { border-color: var(--color-emerald-600); }
.anatomy-match-word[data-state="wrong"] { border-color: var(--color-red-500); }
.anatomy-match-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.anatomy-match-lines line { stroke: var(--color-primary); stroke-width: 2.5; stroke-linecap: round; }
.anatomy-match-lines .is-drag { stroke: var(--color-accent); stroke-dasharray: 6 5; }
.anatomy-match-lines .is-correct { stroke: var(--color-emerald-600); }
.anatomy-match-lines .is-wrong { stroke: var(--color-red-500); }
.anatomy-match-lines .is-answer { stroke: var(--color-emerald-600); stroke-dasharray: 5 5; stroke-width: 2; }
.anatomy-match-dots { position: absolute; inset: 0; pointer-events: none; }
.anatomy-match-dot { position: absolute; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; display: grid; place-items: center; border-radius: 50%; background: var(--color-surface); border: 2px solid var(--color-primary); color: var(--color-primary); font-size: .8rem; font-weight: 700; pointer-events: auto; box-shadow: 0 2px 10px #0000001a; }
.anatomy-match-dot::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; }
.anatomy-match[data-picking] .anatomy-match-dot { border-color: var(--color-accent); color: var(--color-accent); }
.anatomy-match-dot[data-linked] { background: var(--color-primary); color: var(--color-white); }
.anatomy-match-foot { position: absolute; left: .75rem; right: .75rem; bottom: .6rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: .4rem .4rem .4rem .9rem; background: var(--color-surface); border: 1px solid var(--atlas-line); border-radius: .9rem; box-shadow: 0 4px 18px #0000000b; }
.anatomy-match-foot p { font-size: .78rem; color: var(--atlas-muted); line-height: 1.5; flex: 1 1 12rem; }
.anatomy-match-foot button { min-height: 44px; }
[data-theme="dark"] .anatomy-match-bar p, [data-theme="dark"] .anatomy-match-bar button, [data-theme="dark"] .anatomy-match-word, [data-theme="dark"] .anatomy-match-dot, [data-theme="dark"] .anatomy-match-foot { background: var(--color-ink-surface); }
[data-theme="dark"] .anatomy-match-dot[data-linked] { background: var(--color-primary); }
@media (min-width: 680px) { .anatomy-word-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .anatomy-layout { grid-template-columns: minmax(0, 1fr) 18rem; } .anatomy-word { position: sticky; top: 5.5rem; } .anatomy-word-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 480px) { .anatomy { gap: 1rem; } .anatomy-heading h2 { font-size: 1.5rem; } .anatomy-count { display: none; } .anatomy-viewport { height: 645px; } .anatomy-stage-name { left: .8rem; top: .8rem; } .anatomy-stage-name span:first-child { font-size: 1.2rem; } .anatomy-tools button { padding: .4rem .5rem; } .anatomy-word, .anatomy-library { padding: 1rem; } .anatomy-view-tabs button { padding: .5rem .6rem; } .anatomy-help { font-size: .65rem; } .anatomy-match { --match-col: 5.6rem; } .anatomy-match-word span:first-child { font-size: .95rem; } }
@media (prefers-reduced-motion: reduce) { .anatomy button:active { scale: 1; } .anatomy-word-item { transition: none; } }
