:root {
  --bg: #060b15;
  --panel: rgba(13, 23, 42, .78);
  --panel-strong: #101b30;
  --line: rgba(142, 179, 219, .16);
  --line-bright: rgba(117, 224, 255, .45);
  --text: #f5f9ff;
  --muted: #8fa3bc;
  --cyan: #70e4ff;
  --violet: #a98cff;
  --lime: #abf36f;
  --amber: #ffca6b;
  --rose: #ff83a8;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: radial-gradient(circle at 50% -10%, #14233f 0, var(--bg) 42%); color: var(--text); }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.ambient { position: fixed; z-index: -1; width: 38rem; height: 38rem; border-radius: 50%; filter: blur(120px); opacity: .13; pointer-events: none; }
.ambient-one { top: 8rem; left: -18rem; background: #00bfe9; }
.ambient-two { top: 28rem; right: -20rem; background: #8155ff; }
.topbar { width: min(1180px, calc(100% - 40px)); margin: 0 auto; min-height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 750; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .12em; margin-left: 2px; }
.brand-mark { width: 30px; height: 30px; display: inline-grid; place-items: center; position: relative; }
.brand-mark::after { content: ""; width: 24px; height: 12px; border: 1px solid rgba(255,255,255,.44); border-radius: 50%; transform: rotate(-34deg); }
.brand-mark i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.brand-mark i:first-child { left: 4px; top: 5px; } .brand-mark i:last-child { right: 4px; bottom: 4px; background: var(--violet); }
.top-meta { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.lab { padding: 64px 0 36px; min-height: calc(100vh - 82px); }
.lab-intro { max-width: 720px; margin-bottom: 38px; }
.eyebrow { margin: 0 0 12px; color: var(--cyan); font-size: .74rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
h1 { margin: 0; max-width: 680px; font-size: clamp(2.3rem, 5.2vw, 4.65rem); line-height: 1.08; letter-spacing: -.055em; font-weight: 700; }
.lab-intro > p:last-child { color: var(--muted); font-size: 1.05rem; margin: 20px 0 0; }
.workspace { display: grid; grid-template-columns: 1.4fr .8fr; gap: 16px; }
.element-deck, .ratio-deck { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17,29,52,.92), rgba(9,17,31,.82)); box-shadow: 0 24px 80px rgba(0,0,0,.2); padding: 25px; }
.section-heading, .section-heading > div { display: flex; align-items: center; justify-content: space-between; gap: 11px; }
.section-heading > div > span { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line-bright); color: var(--cyan); border-radius: 50%; font-size: .7rem; }
.section-heading h2 { font-size: 1.05rem; margin: 0; letter-spacing: -.02em; }
.hint { color: var(--muted); font-size: .85rem; margin: 12px 0 20px 39px; }
.text-button, .back-button { color: var(--muted); background: none; border: 0; cursor: pointer; font-size: .82rem; padding: 6px; }
.text-button:hover, .back-button:hover { color: var(--text); }
.element-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.element-button { position: relative; aspect-ratio: 1; min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: rgba(6,12,24,.76); text-align: left; cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.element-button:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--element-color) 65%, transparent); background: color-mix(in srgb, var(--element-color) 9%, rgba(6,12,24,.9)); }
.element-button.selected { border-color: var(--element-color); box-shadow: inset 0 0 0 1px var(--element-color), 0 0 22px color-mix(in srgb, var(--element-color) 18%, transparent); }
.element-button[disabled]:not(.selected) { opacity: .28; cursor: not-allowed; transform: none; }
.atomic-number { display: block; color: var(--muted); font-size: .6rem; }
.element-mass { position: absolute; right: 7px; top: 7px; color: #677d96; font-size: .54rem; }
.element-symbol { display: block; margin-top: 4px; color: var(--element-color); font-size: clamp(1rem, 2vw, 1.45rem); font-weight: 720; }
.element-name { display: block; color: var(--muted); font-size: .62rem; }
.selection-tray { margin-top: 20px; display: grid; grid-template-columns: 1fr 34px 1fr; gap: 8px; align-items: center; }
.element-info { margin-top: 16px; border: 1px dashed rgba(145,178,215,.2); border-radius: 16px; min-height: 54px; padding: 13px 15px; color: #6d829a; font-size: .76rem; }
.element-info > p { margin: 4px 0; }
.element-info.active { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; border-style: solid; background: rgba(5,12,23,.48); padding: 10px; }
.element-info article { min-width: 0; border: 1px solid color-mix(in srgb, var(--element-color) 25%, transparent); border-radius: 13px; padding: 12px; background: color-mix(in srgb, var(--element-color) 4%, transparent); }
.element-info-name { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.element-info-name > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: color-mix(in srgb, var(--element-color) 13%, transparent); color: var(--element-color); font-size: 1rem; font-weight: 750; }
.element-info-name strong, .element-info-name small { display: block; }
.element-info-name strong { color: var(--text); font-size: .83rem; }
.element-info-name small { color: var(--muted); margin-top: 2px; font-size: .66rem; }
.element-info dl { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px 12px; margin: 0; }
.element-info dl > div { min-width: 0; }
.element-info dt { color: #61758e; font-size: .6rem; margin-bottom: 2px; }
.element-info dd { color: #b8c7d8; font-size: .68rem; margin: 0; line-height: 1.35; overflow-wrap: anywhere; }
.selection-slot { height: 56px; border: 1px dashed rgba(145,178,215,.25); border-radius: 14px; padding: 9px 13px; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.selection-slot.filled { border-style: solid; border-color: var(--line-bright); background: rgba(94,214,255,.06); color: var(--text); }
.selection-slot span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: rgba(255,255,255,.06); color: var(--cyan); font-size: .7rem; }
.selection-slot strong { font-size: .86rem; }
.bond-symbol { text-align: center; color: var(--muted); }
.ratio-deck { display: flex; flex-direction: column; }
.ratio-grid { min-height: 108px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-content: start; }
.ratio-empty { grid-column: 1/-1; min-height: 105px; border: 1px dashed rgba(145,178,215,.2); border-radius: 16px; display: grid; place-items: center; align-content: center; color: #5f7188; }
.ratio-empty span { font-size: 1.5rem; } .ratio-empty p { margin: 3px 0 0; font-size: .8rem; }
.ratio-button { min-height: 60px; border: 1px solid var(--line); border-radius: 14px; background: rgba(6,12,24,.68); cursor: pointer; padding: 8px 12px; text-align: left; transition: .18s ease; }
.ratio-button:hover { border-color: var(--line-bright); }
.ratio-button.active { border-color: var(--cyan); background: rgba(112,228,255,.09); box-shadow: inset 0 0 0 1px rgba(112,228,255,.32); }
.ratio-button strong { display: block; font-size: 1rem; }
.ratio-button small { color: var(--muted); font-size: .7rem; }
.explore-button { margin-top: auto; min-height: 56px; border: 0; border-radius: 15px; background: linear-gradient(110deg, var(--cyan), #9f9cff); color: #05111e; font-weight: 750; cursor: pointer; padding: 0 19px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 12px 32px rgba(90,207,255,.2); }
.explore-button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.explore-button:disabled { filter: grayscale(1); opacity: .25; cursor: not-allowed; box-shadow: none; }
.scope-note { color: #667b94; font-size: .68rem; line-height: 1.55; margin: 10px 4px 0; }
.quick-start { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 18px 4px; color: var(--muted); font-size: .78rem; }
.quick-start > span { margin-right: 5px; }
.quick-start button { border: 1px solid var(--line); border-radius: 999px; background: rgba(15,27,47,.7); padding: 6px 11px; color: #bdcadd; cursor: pointer; font-size: .76rem; }
.quick-start button:hover { border-color: var(--line-bright); color: var(--text); }

.result { padding: 40px 0 70px; animation: reveal .45s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(18px); } }
.result-topline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.fact-tag { border: 1px solid rgba(171,243,111,.4); background: rgba(171,243,111,.08); color: var(--lime); border-radius: 999px; padding: 7px 12px; font-size: .74rem; }
.fact-tag.none { border-color: rgba(255,202,107,.45); background: rgba(255,202,107,.08); color: var(--amber); }
.result-hero { display: grid; grid-template-columns: 1fr .82fr; align-items: center; min-height: 360px; border: 1px solid var(--line); border-radius: 28px; overflow: hidden; background: linear-gradient(135deg, rgba(18,34,59,.92), rgba(8,15,28,.92)); }
.formula-wrap { padding: 46px; }
.formula-wrap h2 { margin: 0; font-size: clamp(4.5rem, 11vw, 8.5rem); line-height: .9; letter-spacing: -.07em; background: linear-gradient(105deg, #fff 20%, var(--cyan) 85%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-name { font-size: 1.35rem; font-weight: 650; margin: 24px 0 8px; }
.result-summary { color: var(--muted); line-height: 1.75; max-width: 540px; margin: 0; }
.structure-visual { min-height: 360px; position: relative; display: grid; place-items: center; background-image: linear-gradient(rgba(125,174,215,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(125,174,215,.06) 1px, transparent 1px); background-size: 32px 32px; border-left: 1px solid var(--line); overflow: hidden; cursor: grab; touch-action: none; user-select: none; }
.structure-visual.dragging { cursor: grabbing; }
.structure-visual::after { content: "交互式 3D · 非比例模型"; position: absolute; top: 16px; right: 18px; color: #61758d; font-size: .67rem; }
.structure-canvas { position: absolute; inset: 0; display: block; pointer-events: none; }
.structure-model { display: grid; place-items: center; transition: transform .14s ease; transform-origin: center; will-change: transform; }
.structure-visual.dragging .structure-model { transition: none; }
.structure-controls { position: absolute; z-index: 5; left: 14px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 5px; padding: 5px; border: 1px solid rgba(142,179,219,.17); border-radius: 12px; background: rgba(5,11,22,.82); backdrop-filter: blur(10px); }
.structure-controls button { min-width: 34px; height: 34px; border: 0; border-radius: 8px; background: rgba(255,255,255,.055); color: #b9c9da; cursor: pointer; font-size: .84rem; }
.structure-controls button:hover { background: rgba(112,228,255,.13); color: var(--cyan); }
.structure-controls button:last-child { padding: 0 10px; }
.structure-gesture-hint { position: absolute; right: 17px; bottom: 18px; color: #5e728a; font-size: .66rem; pointer-events: none; }
.atom-scene { position: relative; width: 250px; height: 220px; filter: drop-shadow(0 18px 30px rgba(0,0,0,.3)); }
.atom { position: absolute; display: grid; place-items: center; border-radius: 50%; font-weight: 750; color: #07101b; box-shadow: inset -9px -12px 18px rgba(0,0,0,.2), 0 0 28px color-mix(in srgb, var(--atom) 28%, transparent); background: radial-gradient(circle at 35% 30%, #fff 0 5%, var(--atom) 38%, color-mix(in srgb, var(--atom) 70%, #081324) 100%); z-index: 2; }
.atom.large { width: 78px; height: 78px; font-size: 1.25rem; }
.atom.small { width: 48px; height: 48px; font-size: .85rem; }
.bond { position: absolute; height: 8px; background: linear-gradient(90deg, rgba(255,255,255,.3), rgba(138,225,255,.9)); border-radius: 8px; transform-origin: 0 50%; z-index: 1; }
.lattice-scene { width: 230px; height: 230px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; transform: rotate(-8deg); }
.lattice-dot { aspect-ratio: 1; border-radius: 50%; background: var(--dot); box-shadow: inset -7px -8px 12px rgba(0,0,0,.2), 0 0 16px color-mix(in srgb, var(--dot) 24%, transparent); display: grid; place-items: center; color: #07101b; font-size: .66rem; font-weight: 800; }
.single-atom-scene { position: relative; width: 220px; height: 220px; display: grid; place-items: center; }
.single-atom-scene .atom { position: relative; left: auto; top: auto; width: 94px; height: 94px; font-size: 1.4rem; }
.single-atom-scene > i { position: absolute; width: 170px; height: 72px; border: 1px solid rgba(169,140,255,.42); border-radius: 50%; transform: rotate(28deg); }
.single-atom-scene > i:last-child { transform: rotate(-28deg); }
.carbon-sheet { position: relative; width: 242px; display: grid; grid-template-columns: repeat(6, 32px); gap: 8px; transform: skewY(-8deg) rotate(-4deg); }
.carbon-sheet::before, .carbon-sheet.stacked::after { content: ""; position: absolute; inset: -8px 5px 12px -8px; background: repeating-linear-gradient(30deg, transparent 0 17px, rgba(112,228,255,.22) 18px 20px, transparent 21px 34px), repeating-linear-gradient(-30deg, transparent 0 17px, rgba(112,228,255,.22) 18px 20px, transparent 21px 34px); z-index: -1; }
.carbon-sheet.stacked::after { transform: translate(13px, 28px); opacity: .45; }
.carbon-sheet i { width: 15px; height: 15px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(112,228,255,.35); }
.carbon-sheet.stacked i:nth-child(even) { transform: translateY(20px); }
.diamond-net { width: 220px; height: 220px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; align-content: center; transform: rotate(45deg); position: relative; }
.diamond-net::before, .diamond-net::after { content: ""; position: absolute; inset: 33px 18px; border: 2px solid rgba(112,228,255,.22); transform: rotate(45deg); }
.diamond-net::after { transform: rotate(-45deg); }
.diamond-net i { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #fff, var(--cyan)); box-shadow: 0 0 14px rgba(112,228,255,.3); }
.fullerene { width: 190px; height: 190px; position: relative; border: 1px solid rgba(169,140,255,.25); border-radius: 50%; box-shadow: inset 0 0 45px rgba(169,140,255,.08); }
.fullerene::before, .fullerene::after { content: ""; position: absolute; inset: 30px 8px; border: 1px solid rgba(169,140,255,.25); border-radius: 50%; }
.fullerene::after { transform: rotate(90deg); }
.fullerene i { position: absolute; left: calc(50% - 7px); top: calc(50% - 7px); width: 14px; height: 14px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 10px rgba(169,140,255,.5); transform: rotate(calc(var(--i) * 18deg)) translateX(82px); }
.metal-grid { width: 220px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; transform: rotate(-7deg); }
.metal-grid span { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 34% 28%, #fff 0 6%, var(--dot) 42%, #48596b 100%); color: #07101b; font-size: .58rem; font-weight: 800; box-shadow: 0 7px 14px rgba(0,0,0,.25); }
.no-structure { width: 220px; height: 220px; position: relative; display: grid; place-items: center; }
.no-structure .atom { position: absolute; width: 62px; height: 62px; }
.no-structure .atom:first-child { top: 42px; left: 24px; } .no-structure .atom:nth-child(2) { right: 24px; bottom: 42px; }
.no-structure .gap { width: 120px; border-top: 2px dashed rgba(255,255,255,.18); transform: rotate(30deg); }
.evidence-banner { margin: 14px 0; padding: 15px 18px; border-left: 3px solid var(--cyan); background: rgba(112,228,255,.06); color: #b8c8da; font-size: .82rem; line-height: 1.6; }
.evidence-banner.none { border-left-color: var(--amber); background: rgba(255,202,107,.06); }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-card, .why-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 25px; }
.card-title > span { color: #687f99; font-size: .63rem; letter-spacing: .16em; }
.card-title h3, .why-heading h3 { margin: 5px 0 0; font-size: 1.1rem; }
.info-card > p, .info-card li { color: #acbdd0; line-height: 1.75; font-size: .9rem; }
.info-card ul { margin: 15px 0 0; padding-left: 18px; }
.info-card li::marker { color: var(--cyan); }
.why-card { margin-top: 14px; background: linear-gradient(135deg, rgba(21,35,61,.94), rgba(13,23,42,.86)); }
.why-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.why-heading > div:first-child { display: flex; align-items: center; gap: 14px; }
.why-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #07101b; font-size: 1.3rem; font-weight: 800; }
.level-tabs { display: flex; background: rgba(3,9,18,.55); padding: 4px; border-radius: 12px; }
.level-tabs button { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: .8rem; }
.level-tabs button[aria-selected="true"] { background: #263a58; color: var(--text); box-shadow: 0 3px 10px rgba(0,0,0,.24); }
.explanation { max-width: 900px; color: #c8d5e4; line-height: 1.9; padding: 22px 0 2px; font-size: .95rem; }
.explanation p { margin: 0; }
.alternatives { margin-top: 16px; padding: 16px 18px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
.alternatives button { border: 1px solid var(--line); background: rgba(17,29,52,.75); border-radius: 12px; padding: 8px 12px; cursor: pointer; }
.alternatives button:hover { border-color: var(--line-bright); }
.continue-button { margin: 28px auto 0; display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid var(--line-bright); border-radius: 999px; padding: 13px 20px; color: var(--cyan); cursor: pointer; }
.continue-button:hover { background: rgba(112,228,255,.08); }
footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 34px; display: flex; justify-content: space-between; gap: 20px; color: #5f738c; border-top: 1px solid var(--line); font-size: .72rem; }

@media (max-width: 820px) {
  .workspace, .result-hero, .result-grid { grid-template-columns: 1fr; }
  .element-grid { grid-template-columns: repeat(4, 1fr); }
  .element-info.active { grid-template-columns: 1fr; }
  .ratio-deck { min-height: 330px; }
  .structure-visual { border-left: 0; border-top: 1px solid var(--line); min-height: 310px; }
  .why-heading { align-items: flex-start; flex-direction: column; }
  .formula-wrap { padding: 34px 28px; }
}
@media (max-width: 540px) {
  .topbar, main, footer { width: min(100% - 24px, 1180px); }
  .top-meta { display: none; }
  .lab { padding-top: 42px; }
  h1 { font-size: 2.45rem; }
  .element-deck, .ratio-deck, .info-card, .why-card { padding: 19px; border-radius: 18px; }
  .element-grid { gap: 6px; }
  .element-button { border-radius: 11px; }
  .hint { margin-left: 0; }
  .result-hero { border-radius: 20px; }
  .formula-wrap h2 { font-size: 4.1rem; }
  .level-tabs { width: 100%; }
  .level-tabs button { flex: 1; }
  .structure-gesture-hint { display: none; }
  .structure-controls { right: 14px; justify-content: center; }
  footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
