/* DentalVista · 口腔解剖 — design system */
:root {
  --blue: #2457b8; --blue-2: #3b73d9; --blue-soft: rgba(36, 87, 184, 0.12); --red: #d9342b; --red-soft: rgba(217, 52, 43, 0.12);
  --ink: #15223a; --muted: #5b6b85; --line: rgba(20, 40, 80, 0.10);
  --glass: rgba(255, 255, 255, 0.74); --glass-2: rgba(255, 255, 255, 0.55); --glass-strong: rgba(255, 255, 255, 0.92);
  --shadow: 0 10px 40px rgba(20, 40, 80, 0.12), 0 1px 2px rgba(20, 40, 80, 0.06);
  --bg-a: #f7f9fd; --bg-b: #e6edf8; --bg-c: #dde6f4;
  --radius: 16px; --radius-s: 10px;
  --font: "Inter", "SF Pro Text", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}
body[data-theme="warm"] { --bg-a: #f6f2ea; --bg-b: #ebe4d8; --bg-c: #e0d7c8; --glass: rgba(255, 252, 246, 0.76); --glass-2: rgba(255, 252, 246, 0.58); --glass-strong: rgba(255, 252, 246, 0.94); --line: rgba(70, 50, 20, 0.10); --ink: #2a2218; --muted: #6f6253; }
body[data-theme="dark"] { --bg-a: #0e1526; --bg-b: #172036; --bg-c: #1f2b47; --glass: rgba(18, 26, 44, 0.72); --glass-2: rgba(18, 26, 44, 0.55); --glass-strong: rgba(18, 26, 44, 0.94); --line: rgba(255, 255, 255, 0.09); --ink: #e8edf6; --muted: #93a3bd; --shadow: 0 10px 40px rgba(0, 0, 0, 0.45); --blue-soft: rgba(80, 130, 230, 0.2); --blue-2: #6c9af0; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; }
#app { position: fixed; inset: 0; background: radial-gradient(1200px 800px at 20% 10%, var(--bg-a) 0%, var(--bg-b) 55%, var(--bg-c) 100%); transition: background 0.5s; }
#app canvas.gl { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; outline: none; touch-action: none; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.labels .label { pointer-events: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120, 140, 170, 0.35); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.ui { position: absolute; inset: 0; pointer-events: none; }
.ui > * { pointer-events: auto; }
.hidden { display: none !important; }

/* loading */
.loading { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; justify-items: center; color: var(--muted); font-size: 14px; letter-spacing: 0.08em; z-index: 50; }
.spin { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--blue-soft); border-top-color: var(--blue); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* header */
.header { position: absolute; top: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; gap: 18px; padding: 0 18px; background: linear-gradient(to bottom, var(--glass), transparent); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); }
.brand img { height: 30px; display: block; }
body[data-theme="dark"] .brand img { filter: brightness(1.15) drop-shadow(0 0 1px rgba(255,255,255,0.4)); }
.wordmark { display: flex; align-items: baseline; gap: 8px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
.wordmark .wm-cn { font-size: 17px; }
.wordmark .wm-dot { color: var(--muted); }
.wordmark .wm-en { font-size: 15px; color: var(--muted); font-weight: 500; }
.wordmark .wm-en b { color: var(--blue); font-weight: 700; }
.nav { display: flex; gap: 2px; margin-left: 6px; padding: 4px; background: var(--glass-2); border: 1px solid var(--line); border-radius: 999px; }
.navbtn { padding: 7px 14px; border-radius: 999px; font-size: 13.5px; color: var(--muted); font-weight: 500; transition: all 0.2s; white-space: nowrap; }
.navbtn:hover { color: var(--ink); }
.navbtn.active { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(36, 87, 184, 0.35); }
.hdr-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.iconbtn { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--muted); transition: all 0.15s; }
.iconbtn:hover { background: var(--blue-soft); color: var(--blue); }
.ic { display: inline-flex; width: 18px; height: 18px; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chip { padding: 6px 12px; border-radius: 999px; font-size: 12.5px; background: var(--glass-2); border: 1px solid var(--line); color: var(--muted); transition: all 0.15s; white-space: nowrap; }
.chip:hover { color: var(--ink); border-color: var(--blue); }
.chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip.static { cursor: default; }
.chips { display: flex; gap: 6px; }
.chips.wrap { flex-wrap: wrap; }

/* panels */
.panel { position: absolute; top: 74px; width: 338px; max-height: calc(100% - 190px); overflow: auto; background: var(--glass); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); animation: rise 0.35s cubic-bezier(.2,.8,.2,1); }
.panel.left { left: 16px; }
.panel.right { right: 16px; width: 390px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel-body { padding: 16px 18px 18px; }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 14px 0 8px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.panel h3:first-child { margin-top: 2px; }
.link { color: var(--blue); font-size: 12px; text-transform: none; letter-spacing: 0; }
.layers { display: flex; flex-direction: column; gap: 4px; }
.layer-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-s); }
.layer-row:hover { background: var(--blue-soft); }
.layer-row.sub { padding-left: 24px; }
.sublayers { border-left: 2px solid var(--line); margin-left: 14px; }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.layer-name { flex: 1; font-size: 13.5px; display: flex; align-items: baseline; gap: 6px; }
.layer-name small { color: var(--muted); font-size: 11px; }
.seg { display: inline-flex; background: var(--glass-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.segbtn { font-size: 11px; padding: 4px 7px; border-radius: 6px; color: var(--muted); }
.segbtn.on { background: var(--blue); color: #fff; }
.legend { font-size: 11px; color: var(--muted); margin-top: 10px; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.card { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass-2); transition: all 0.15s; }
.card:hover { border-color: var(--blue); transform: translateY(-1px); }
.card.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--blue); }
.card b { display: block; font-size: 14px; margin-bottom: 3px; }
.card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.card small { display: block; margin-top: 6px; color: var(--blue); font-size: 11px; }
.controls { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row label { font-size: 12.5px; color: var(--muted); min-width: 64px; }
.row .val { font-size: 12px; color: var(--blue); min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.slider { flex: 1; appearance: none; height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--blue), var(--blue-2)); outline: none; }
.slider::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); box-shadow: 0 2px 6px rgba(0,0,0,0.2); cursor: pointer; }
.milestones { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.milestones li { padding-left: 14px; position: relative; transition: color 0.3s; }
.milestones li::before { content: ""; position: absolute; left: 0; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.milestones li.on { color: var(--ink); }
.milestones li.on::before { background: var(--blue); }
.milestones b { color: var(--blue); font-variant-numeric: tabular-nums; }
.stages { margin: 0; padding-left: 20px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.stages li.on { color: var(--ink); font-weight: 600; }
.stages li.done { color: var(--blue); }
.btn { padding: 9px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; justify-content: center; transition: all 0.15s; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(36, 87, 184, 0.3); }
.btn.primary:hover { background: var(--blue-2); }
.btn.primary:disabled, .btn.ghost:disabled { opacity: 0.4; cursor: default; }
.btn.ghost { background: var(--glass-2); border: 1px solid var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--blue); }
.btn.big { font-size: 16px; padding: 14px 30px; border-radius: 14px; }
.btn.ai { width: 100%; margin-top: 14px; background: linear-gradient(135deg, var(--blue), #6b4ee6); color: #fff; }
.btn.option { width: 100%; justify-content: flex-start; background: var(--glass-2); border: 1px solid var(--line); margin-bottom: 6px; font-weight: 500; }
.btn.option:hover { border-color: var(--blue); }
.btn.option.ok { border-color: #1f9d55; background: rgba(31, 157, 85, 0.12); }
.btn.option.no { opacity: 0.55; }
.searchbox { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--line); }
.searchbox .ic { color: var(--muted); }
.search { flex: 1; border: 0; background: transparent; outline: none; font-size: 14px; }
.results { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.results .count { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.result { display: flex; align-items: center; gap: 10px; text-align: left; padding: 7px 8px; border-radius: 8px; }
.result:hover { background: var(--blue-soft); }
.r-name { flex: 1; font-size: 13px; display: flex; flex-direction: column; }
.r-name small { color: var(--muted); font-size: 11px; }
.fdi { font-family: var(--mono); font-size: 12px; color: var(--blue); background: var(--blue-soft); padding: 2px 6px; border-radius: 6px; }
.quiz .slogan { color: var(--muted); font-size: 12.5px; margin: -4px 0 12px; }
.qhead { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.qprompt { font-size: 14px; margin-bottom: 12px; }
.qprompt b { display: block; font-size: 18px; color: var(--blue); margin-top: 4px; }
.options { margin-bottom: 8px; }
.feedback { padding: 10px 12px; border-radius: 10px; margin: 8px 0 10px; font-weight: 600; font-size: 13.5px; }
.feedback.ok { background: rgba(31, 157, 85, 0.14); color: #1f9d55; }
.feedback.no { background: var(--red-soft); color: var(--red); }
.scorebox { padding: 12px 14px; border-radius: 12px; background: var(--blue-soft); margin: 10px 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

/* knowledge */
.knowledge.empty p { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.k-head { display: flex; align-items: flex-start; gap: 8px; }
.k-title { flex: 1; }
.k-title h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.k-en { color: var(--muted); font-size: 13px; margin-top: 2px; }
.k-actions { display: flex; gap: 2px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 6px; }
.badge { font-size: 11.5px; padding: 4px 9px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); }
.badge.sys { font-family: var(--font); color: var(--ink); border-color: transparent; background: color-mix(in srgb, var(--c, #ccc) 35%, transparent); }
.knowledge section { margin-top: 14px; }
.knowledge h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue); font-weight: 700; }
.knowledge p { margin: 0; font-size: 13.5px; line-height: 1.65; }
.facts { width: 100%; border-collapse: collapse; font-size: 13px; }
.facts th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 8px 4px 0; width: 40%; }
.facts td { padding: 4px 0; }
.dims { margin-top: 6px; font-size: 12px; color: var(--muted); }
.points { margin: 0; padding-left: 18px; font-size: 13.2px; line-height: 1.6; display: flex; flex-direction: column; gap: 4px; }
.points.clinical li::marker { color: var(--red); }
.layer-text { margin-top: 8px !important; padding: 10px 12px; background: var(--blue-soft); border-radius: 10px; font-size: 12.5px !important; }
.refs-list { margin: 0; padding-left: 18px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.tiny { font-size: 11.5px; color: var(--muted); }

/* toolbar */
.toolbar { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; padding: 8px; background: var(--glass); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); max-width: calc(100% - 32px); flex-wrap: wrap; justify-content: center; }
.tb-group { display: flex; gap: 2px; align-items: center; padding: 0 6px; border-right: 1px solid var(--line); }
.tb-group:last-of-type { border-right: 0; }
.tb { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-size: 12.5px; transition: all 0.15s; }
.tb .lbl { display: none; }
.tb:hover { background: var(--blue-soft); color: var(--blue); }
.tb.active { background: var(--blue); color: #fff; }
.tb.small { padding: 7px 9px; font-size: 12px; }
.tb-label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); padding: 0 6px; }
.slider.sec { width: 110px; }
@media (min-width: 1500px) { .tb .lbl { display: inline; } }
.popover { position: absolute; bottom: calc(100% + 10px); right: 0; width: 300px; background: var(--glass-strong); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pop-title { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 14px; }
.note { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* tooltip / toast */
.tooltip { position: absolute; z-index: 20; padding: 7px 11px; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; display: flex; align-items: center; gap: 8px; pointer-events: none !important; white-space: nowrap; }
.tooltip .en { color: var(--muted); font-size: 12px; }
.toast { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); padding: 10px 16px; background: var(--ink); color: var(--bg-a); border-radius: 12px; font-size: 13px; box-shadow: var(--shadow); z-index: 30; animation: rise 0.25s; }
body[data-theme="dark"] .toast { background: #e8edf6; color: #15223a; }
.hint { position: absolute; left: 18px; bottom: 14px; font-size: 11.5px; color: var(--muted); opacity: 0.8; }
.footer { position: absolute; right: 18px; bottom: 14px; font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; }
.footer a { color: var(--blue); text-decoration: none; }

/* tour card */
.tourcard { position: absolute; left: 50%; bottom: 118px; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); background: var(--glass-strong); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 18px; animation: rise 0.3s; }
.tc-head { display: flex; align-items: center; gap: 10px; }
.tc-title { font-weight: 700; font-size: 14px; flex: 1; }
.tc-step { font-size: 12px; color: var(--muted); }
.tc-text { margin: 8px 0 10px; font-size: 14px; line-height: 1.65; }
.tc-dots { display: flex; gap: 6px; margin-bottom: 10px; }
.tc-dots .dot { width: 22px; height: 5px; border-radius: 4px; background: var(--line); cursor: pointer; }
.tc-dots .dot.done { background: var(--blue-soft); }
.tc-dots .dot.on { background: var(--blue); }
.tc-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* 3-D labels */
.label { font-size: 12px; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; box-shadow: var(--shadow); white-space: nowrap; transform: translateY(-120%); }
.label.measure { color: var(--blue); font-family: var(--mono); font-weight: 600; }
.label.pin { display: flex; align-items: center; gap: 6px; }
.label.pin .num { width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; }
.label.pin .txt { outline: none; min-width: 40px; }

/* overlay dialogs */
.overlay { position: absolute; inset: 0; background: rgba(10, 20, 40, 0.35); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 40; }
.dialog { width: min(560px, calc(100% - 32px)); max-height: 80%; overflow: auto; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.help-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; }
.refs b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--blue); }
.refs ol { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* splash */
.splash { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: radial-gradient(900px 600px at 30% 20%, rgba(36, 87, 184, 0.16), transparent 60%), radial-gradient(700px 500px at 80% 90%, rgba(217, 52, 43, 0.12), transparent 60%), linear-gradient(160deg, rgba(255,255,255,0.55), rgba(255,255,255,0.25)); backdrop-filter: blur(6px); transition: opacity 0.7s; }
body[data-theme="dark"] .splash { background: radial-gradient(900px 600px at 30% 20%, rgba(80, 130, 230, 0.25), transparent 60%), radial-gradient(700px 500px at 80% 90%, rgba(217, 52, 43, 0.2), transparent 60%), linear-gradient(160deg, rgba(10,16,30,0.7), rgba(10,16,30,0.5)); }
.splash.out { opacity: 0; pointer-events: none; }
.splash-card { text-align: center; max-width: 640px; padding: 40px; animation: rise 0.8s cubic-bezier(.2,.8,.2,1); }
.splash-logo { height: 64px; margin-bottom: 26px; }
.splash h1 { margin: 0 0 10px; font-size: 54px; line-height: 1.05; letter-spacing: -0.02em; display: flex; flex-direction: column; gap: 6px; font-weight: 800; }
.splash h1 .wm-en { color: var(--ink); }
.splash h1 .wm-en b { color: var(--blue); }
.splash h1 .wm-cn { font-size: 26px; font-weight: 600; color: var(--muted); letter-spacing: 0.3em; margin-left: 0.3em; }
.splash .tag { font-size: 17px; color: var(--ink); margin: 14px 0 6px; }
.splash .sub { font-size: 13.5px; color: var(--muted); margin: 0 0 26px; }
.splash .tiny { margin-top: 18px; }
.splash-foot { position: absolute; bottom: 20px; left: 0; right: 0; display: flex; justify-content: center; gap: 18px; font-size: 12px; color: var(--muted); }
.splash-foot .lang { color: var(--blue); cursor: pointer; text-decoration: underline; }

@media (max-width: 1100px) {
  .nav { overflow-x: auto; max-width: 40vw; }
  .panel { width: min(360px, calc(100% - 32px)); }
  .panel.right { width: min(400px, calc(100% - 32px)); }
  .wordmark .wm-cn { font-size: 15px; }
}
@media (max-width: 760px) {
  .panel { top: auto; bottom: 110px; max-height: 42%; left: 8px !important; right: 8px !important; width: auto; }
  .toolbar { bottom: 10px; gap: 2px; padding: 5px; }
  .tb-group.sec { display: none; }
  .footer, .hint { display: none; }
  .splash h1 { font-size: 40px; }
}

body[data-theme="dark"] .brand img { background: rgba(255,255,255,0.94); padding: 3px 8px; border-radius: 8px; height: 32px; filter: none; }

/* video caption + end card */
.caption { position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); max-width: 70%; padding: 12px 22px; background: rgba(15, 23, 42, 0.78); color: #fff; border-radius: 14px; font-size: 22px; line-height: 1.4; text-align: center; display: flex; flex-direction: column; gap: 4px; z-index: 35; backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.caption span { font-size: 14px; opacity: 0.8; }
.endcard .url { font-size: 22px; color: var(--blue); font-weight: 700; letter-spacing: 0.04em; margin: 4px 0 10px; }
.endcard .splash-card { animation: rise 1.2s cubic-bezier(.2,.8,.2,1); }
