:root {
  --page: #f7fafb;
  --surface: #ffffff;
  --canvas: #edf3f4;
  --ink: #15323a;
  --muted: #647b85;
  --line: #d5e1e5;
  --teal: #087f80;
  --teal-dark: #066b6d;
  --teal-wash: #e2f2f0;
  --shadow: 0 16px 40px rgba(25, 64, 73, .07);
}
* { box-sizing: border-box; }
html { background: var(--page); }
body { margin: 0; color: var(--ink); font-family: "Segoe UI", "Microsoft YaHei", sans-serif; }
button, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal-dark); }
.app-shell { max-width: 1480px; margin: 0 auto; padding: 24px clamp(18px, 3vw, 44px) 24px; }
.masthead { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-kicker { color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: .13em; margin: 0 0 6px; }
.masthead h1 { font-size: clamp(30px, 3vw, 42px); line-height: 1.12; margin: 0 0 7px; }
.lead { margin: 0; color: var(--muted); font-size: 15px; }
.release-note { align-self: center; background: var(--teal-wash); color: var(--teal-dark); padding: 11px 15px; border-radius: 9px; white-space: nowrap; font-size: 13px; }
.release-note strong { font-size: 17px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 16px; }
.catalogue { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 8px; box-shadow: var(--shadow); }
.catalogue-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 8px; }
.sidebar-heading { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.sidebar-heading h2 { margin: 0; font-size: 16px; }
.sidebar-heading span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.filter-control { display: flex; align-items: center; gap: 8px; }
.filter-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.formula-filter { width: 210px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.formula-filter:focus { border-color: var(--teal); outline: 2px solid #c4e6e3; outline-offset: 1px; }
.formula-list { display: flex; gap: 6px; min-width: 0; overflow-x: scroll; overflow-y: hidden; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #9bbfc1 #edf3f4; padding-bottom: 7px; }
.formula-list::-webkit-scrollbar { height: 8px; }
.formula-list::-webkit-scrollbar-track { background: #edf3f4; border-radius: 8px; }
.formula-list::-webkit-scrollbar-thumb { background: #9bbfc1; border-radius: 8px; }
.formula-button { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; min-height: 40px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink); text-align: left; white-space: nowrap; }
.formula-button:hover { background: var(--page); }
.formula-button[aria-current="true"] { border-color: #b5d9d7; background: var(--teal-wash); color: var(--teal-dark); }
.formula-symbol { font-weight: 700; font-size: 16px; }
.formula-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.filter-empty { color: var(--muted); font-size: 12px; margin: 8px 3px; }
.content { min-width: 0; }
.content-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 17px; }
.content-heading h2 { font-size: clamp(24px, 2.5vw, 31px); margin: 0; line-height: 1.15; }
.content-description { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 8px 0 0; max-width: 65ch; }
.toolbar { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.toolbar label { color: var(--muted); font-size: 12px; }
.toolbar select, .toolbar button, .card-action { border: 1px solid #a9cbcb; border-radius: 7px; color: var(--teal-dark); background: var(--teal-wash); padding: 8px 10px; min-height: 36px; font-size: 12px; font-weight: 600; }
.toolbar select { background: var(--surface); }
.toolbar button:hover, .card-action:hover { background: #d3eae7; }
.control-help { margin-bottom: 15px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.phase-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; align-items: start; }
.phase-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); min-width: 0; }
.phase-card.is-expanded { grid-column: 1 / -1; }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 15px 16px 13px; }
.card-heading h3 { font-size: 17px; margin: 0 0 6px; line-height: 1.3; }
.record-type { display: inline-block; background: var(--teal-wash); color: var(--teal-dark); padding: 4px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.record-type.is-pressure { background: #fff0e0; color: #9b5b14; }
.record-type.is-polytype { background: #eaeafd; color: #5959a0; }
.record-type.is-prototype { background: #e8eef9; color: #3b5690; }
.card-subtitle { font-size: 12px; color: var(--muted); margin: 0; }
.element-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.element-legend[hidden] { display: none; }
.element-legend span { display: inline-flex; align-items: center; gap: 5px; }
.element-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); }
.view-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; }
.view-switch { display: inline-flex; max-width: 100%; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 8px; background: #f5f9f9; }
.view-button { min-height: 30px; padding: 5px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.view-button:hover { color: var(--teal-dark); background: #eaf4f3; }
.view-button[aria-pressed="true"] { background: var(--teal-wash); color: var(--teal-dark); }
.coordination-control { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.coordination-control[hidden] { display: none; }
.center-element { min-height: 30px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); }
.stage { height: 270px; background: var(--canvas); position: relative; overflow: hidden; }
.phase-card.is-expanded .stage { height: 480px; }
.crystal-host { width: 100%; height: 100%; background: var(--canvas); }
.crystal-host canvas { width: 100%; height: 100%; display: block; outline: none; }
.axis-gizmo { width: 86px; height: 86px; position: absolute; left: 12px; bottom: 12px; border-radius: 50%; background: rgba(255,255,255,.88); border: 1px solid #c3d4dc; pointer-events: none; z-index: 2; }
.axis-gizmo line { stroke-width: 2.4; }
.axis-gizmo text { font-size: 15px; font-weight: 700; text-anchor: middle; dominant-baseline: middle; }
.axis-x { stroke: #dc2626; fill: #dc2626; }
.axis-y { stroke: #16a34a; fill: #16a34a; }
.axis-z { stroke: #2563eb; fill: #2563eb; }
.stage-message { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; background: var(--canvas); color: var(--muted); font-size: 13px; }
.stage-message[hidden] { display: none; }
.card-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cell-info { color: var(--muted); font-size: 12px; line-height: 1.4; }
.card-actions { display: flex; gap: 7px; }
.card-action { background: var(--surface); color: var(--teal-dark); }
.card-source { padding: 12px 16px 15px; display: grid; gap: 5px; font-size: 12px; line-height: 1.45; }
.card-source p { margin: 0; color: var(--muted); }
.card-source strong { color: var(--ink); font-weight: 600; }
.source-link { font-weight: 600; text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.data-note { color: var(--muted); margin: 17px 0 0; font-size: 12px; line-height: 1.6; }
.pending-card { grid-column: 1 / -1; padding: 22px; border: 1px dashed #b7cbd1; border-radius: 10px; background: var(--surface); color: var(--ink); }
.pending-card p { margin: 8px 0 0; color: var(--muted); line-height: 1.6; font-size: 13px; }
.site-footer { display: flex; justify-content: space-between; gap: 15px; padding-top: 23px; margin-top: 28px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .sidebar-heading span { display: none; }
}
@media (max-width: 640px) {
  .app-shell { padding-top: 18px; }
  .masthead { align-items: start; }
  .release-note { white-space: normal; text-align: right; }
  .catalogue-top { flex-wrap: wrap; gap: 8px; }
  .filter-control { width: 100%; }
  .formula-filter { flex: 1; min-width: 0; }
  .content-heading { display: block; }
  .toolbar { margin-top: 14px; flex-wrap: wrap; }
  .phase-grid { grid-template-columns: 1fr; }
  .phase-card.is-expanded { grid-column: auto; }
  .phase-card.is-expanded .stage { height: 360px; }
  .site-footer { display: block; }
  .site-footer span { display: block; margin-top: 5px; }
}
