:root {
  color-scheme: dark;
  --background: #191b17;
  --surface: #22251f;
  --well: #11130f;
  --line: #3d4136;
  --ink: #f2eee2;
  --muted: #b7b8a9;
  --accent: #deb67b;
  --accent-ink: #21190e;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --ui: "Inter", "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-family: var(--ui);
  background: var(--background);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button { font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .42; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-underline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.skip { position: fixed; z-index: 5; top: 12px; left: 12px; transform: translateY(-200%); padding: 10px 14px; background: var(--well); }
.skip:focus { transform: none; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
.shell { width: min(1440px, calc(100% - 88px)); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); background: #1d1f1a; }
.topbar-inner { min-height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand, .top-actions { display: flex; align-items: center; gap: 14px; }
.brand { font-weight: 700; letter-spacing: .055em; }
.brand-mark { display: grid; gap: 3px; width: 28px; height: 28px; place-content: center; }
.brand-mark i { width: 20px; height: 4px; background: var(--accent); transform: skewX(-31deg) rotate(-12deg); }
.brand-mark i:nth-child(2) { width: 16px; opacity: .8; }
.brand-mark i:nth-child(3) { width: 11px; opacity: .6; }
.button { border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--ink); min-height: 38px; padding: 7px 11px; font-size: 13px; line-height: 1.25; }
.button:hover:not(:disabled) { background: #35392f; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button.quiet { color: var(--muted); }
.button.outline { border-color: #575a4b; }
.button.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 700; }
.button.primary:hover:not(:disabled) { background: #efd29e; }
.button.primary.saved { color: var(--accent); background: #2f3024; border-color: #796343; }
.notebook-action { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.book-icon { display: inline-block; width: 13px; height: 15px; border: 1px solid currentColor; border-left-width: 3px; border-radius: 2px; }
.count { font: 12px var(--mono); color: var(--accent); padding: 3px 5px; background: #313025; border-radius: 3px; }
.sample { display: flex; justify-content: space-between; align-items: end; column-gap: 24px; padding: 38px 0 29px; }
.sample-id { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 13px; letter-spacing: .06em; }
.sample-id strong { font: 600 14px var(--mono); }
.sample-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #9270482e; margin-right: 3px; }
.sample h1 { margin: 9px 0 7px; font-size: clamp(36px, 4vw, 60px); line-height: 1.14; letter-spacing: .02em; }
.sample-main p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.sample-meta { display: flex; gap: clamp(16px, 3vw, 45px); padding: 0 0 4px; }
.sample-meta div { padding-left: 14px; border-left: 1px solid #62614d; white-space: nowrap; }
.sample-meta dt { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.sample-meta dd { color: var(--ink); font-size: 14px; }
.workbench { display: grid; grid-template-columns: minmax(150px, .78fr) minmax(0, 2.85fr) minmax(220px, 1.16fr); gap: 14px; align-items: stretch; }
.surface { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; min-width: 0; }
.steps { padding: 19px 11px 14px; }
.steps h2 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 8px 17px; }
.steps ol { list-style: none; display: grid; gap: 7px; margin: 0; padding: 0; }
.step { display: grid; grid-template-columns: 29px minmax(0, 1fr); align-items: center; gap: 8px; text-align: left; width: 100%; min-height: 60px; padding: 9px 8px; border-color: transparent; }
.step[aria-current="step"] { background: #353327; border-color: #716046; }
.step-num { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid #555847; border-radius: 5px; color: var(--muted); font: 12px var(--mono); }
.step[aria-current="step"] .step-num { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.step[data-recorded="true"]:not([aria-current]) .step-num { color: #c0cf9f; border-color: #647354; }
.step-name { display: block; overflow-wrap: anywhere; font-size: 14px; font-weight: 650; }
.step-hint { display: block; color: var(--muted); margin-top: 5px; font-size: 11px; }
.viewer { display: flex; flex-direction: column; overflow: hidden; }
.viewer-head, .viewer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-inline: 17px; }
.viewer-head { min-height: 80px; padding-block: 12px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .055em; line-height: 1.45; }
.viewer h2, .observations h2 { font-size: 20px; line-height: 1.35; margin-top: 5px; }
.viewer-body { flex: 1; min-height: 390px; background: var(--well); border-block: 1px solid var(--line); display: grid; }
.photo-stage {
  display: grid;
  place-items: center;
  position: relative;
  min-height: 390px;
  height: clamp(390px, 48vh, 570px);
  overflow: hidden;
  padding: 18px;
  background-color: #141610;
  background-image: radial-gradient(#575b4357 1px, transparent 1px);
  background-size: 22px 22px;
}
.photo-stage.zoomed { cursor: grab; touch-action: none; }
.photo-stage.dragging { cursor: grabbing; }
.photo-frame { position: relative; width: var(--photo-width, 270px); height: var(--photo-height, 360px); transform-origin: center; box-shadow: 0 8px 34px #0008; isolation: isolate; }
.photo-frame img { display: block; width: 100%; height: 100%; user-select: none; pointer-events: none; }
.hotspots { position: absolute; inset: 0; pointer-events: none; }
.hotspot {
  position: absolute;
  top: var(--y);
  left: var(--x);
  transform: translate(-50%, -50%) scale(var(--inverse-zoom, 1));
  width: 31px;
  height: 31px;
  border: 1px solid #fae9cc;
  box-shadow: 0 0 0 3px #241c128c;
  border-radius: 50%;
  color: #fff1d1;
  background: #292516df;
  pointer-events: auto;
  font: 600 13px var(--mono);
}
.hotspot:hover, .hotspot[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.hotspot[aria-pressed="true"] { box-shadow: 0 0 0 3px #2c251b89, 0 0 0 6px #ddae6d85; }
.photo-stage:has(.hotspot:focus-visible) .hotspot:focus-visible { outline-color: #fff2d2; }
.viewer-foot { min-height: 57px; padding-block: 6px; }
.viewer-foot p { flex: 1; font-size: 12px; line-height: 1.5; color: var(--muted); }
.viewer-foot > button { white-space: nowrap; padding-inline: 5px; }
.zoom-controls, .view-switch { display: flex; align-items: center; border: 1px solid #484c40; border-radius: 5px; background: #1b1e18; width: max-content; }
.button.icon { width: 35px; min-height: 34px; padding: 3px; font-size: 20px; }
.zoom-label { min-height: 34px; width: 57px; padding: 5px 2px; font: 12px var(--mono); }
.view-switch .small { min-height: 33px; padding: 5px 7px; font-size: 12px; white-space: nowrap; }
.view-switch .small[aria-pressed="true"] { color: var(--accent); background: #363327; }
.observations { padding: 20px 17px 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 20px; }
.observations h2 { margin-bottom: 22px; }
.finding { border-top: 1px solid var(--line); padding-top: 15px; margin-top: 15px; }
.finding h3 { color: var(--ink); font-size: 13px; margin-bottom: 7px; }
.finding p { color: #cccec0; font-size: 14px; line-height: 1.75; }
.observation-actions { display: grid; gap: 4px; }
.observation-actions .button { min-height: 42px; }
.next { justify-self: stretch; text-align: left; display: flex; justify-content: space-between; align-items: center; }
.status { min-height: 16px; font-size: 11px; color: var(--accent); line-height: 1.45; }
.footer { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.footer .button { flex-shrink: 0; }
.composition { align-self: center; padding: 19px clamp(16px, 4vw, 47px); width: 100%; }
.composition-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; gap: 7px; margin-bottom: 17px; }
.assay-list { display: grid; gap: 10px; }
.assay { display: grid; grid-template-columns: 45px minmax(0, 1fr) 50px; text-align: left; align-items: center; gap: 10px; width: 100%; padding: 12px 10px; background: #22251d; border: 1px solid #44483b; }
.assay[aria-pressed="true"] { border-color: var(--accent); background: #393325; }
.assay .symbol, .assay .amount { font: 13px var(--mono); }
.assay .amount { text-align: right; color: var(--accent); }
.track { height: 9px; background: #43483b; border-radius: 2px; overflow: hidden; }
.track i { display: block; width: var(--share); height: 100%; background: linear-gradient(90deg, #8d9b73, #b4c19c); }
.assay[aria-pressed="true"] .track i { background: var(--accent); }
.chart-axis { display: flex; justify-content: space-between; padding: 9px 61px 0 65px; color: var(--muted); font: 10px var(--mono); }
.composition-note { color: var(--muted); font-size: 12px; margin-top: 26px; line-height: 1.55; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid #62634f; border-radius: 9px; padding: 0; width: min(650px, calc(100% - 28px)); max-height: min(90dvh, 850px); }
dialog::backdrop { background: #070907b5; backdrop-filter: blur(3px); }
.dialog-head, .dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 17px 21px; }
.dialog-head { position: sticky; top: 0; z-index: 1; background: var(--surface); border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 25px; margin-top: 3px; }
.dialog-foot { border-top: 1px solid var(--line); }
.dialog-content { padding: 18px 21px 22px; }
.dialog-content p, .dialog-foot p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.record-list { list-style: none; display: grid; gap: 12px; padding: 0; margin: 0; }
.record-list li { padding: 14px; border: 1px solid var(--line); border-radius: 6px; }
.record-list li h3 { margin-bottom: 7px; font-size: 15px; }
.record-list li p + p { margin-top: 5px; }
.record-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 8px; }
.record-source { color: var(--accent); font-size: 11px; }
.source-dialog { width: min(900px, calc(100% - 28px)); }
.source-links { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 16px; font-size: 13px; }
.source-figure { margin-top: 12px; }
.source-figure img { display: block; width: 100%; border-radius: 4px; }
.source-figure figcaption { font-size: 12px; color: var(--muted); padding-top: 8px; line-height: 1.5; }

@media (max-width: 1120px) {
  .shell { width: calc(100% - 44px); }
  .workbench { grid-template-columns: minmax(0, 1fr) 255px; }
  .steps { grid-column: 1 / -1; padding: 8px; }
  .steps h2 { display: none; }
  .steps ol { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .step { min-height: 47px; }
}
@media (max-width: 700px) {
  .shell { width: calc(100% - 26px); }
  .topbar-inner { min-height: 59px; gap: 5px; }
  .brand, .top-actions { gap: 7px; }
  .brand { font-size: 14px; letter-spacing: 0; }
  .brand-mark { width: 22px; }
  .source-action, .book-icon { display: none; }
  .notebook-action { padding-inline: 7px; }
  .sample { flex-direction: column; align-items: start; padding: 25px 0 18px; gap: 15px; }
  .sample h1 { margin-top: 6px; font-size: 38px; }
  .sample-main p { font-size: 13px; }
  .sample-meta { gap: 12px; }
  .sample-meta div { padding-left: 8px; white-space: normal; }
  .sample-meta dt { font-size: 10px; margin-bottom: 4px; }
  .sample-meta dd { font-size: 12px; }
  .workbench { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .steps { padding: 5px; }
  .steps ol { gap: 3px; }
  .step { grid-template-columns: 1fr; gap: 5px; text-align: center; justify-items: center; min-height: 63px; padding: 5px 2px; }
  .step-name { font-size: 12px; }
  .step-hint { display: none; }
  .step-num { width: 21px; height: 21px; font-size: 10px; }
  .viewer-head, .viewer-foot { padding-inline: 9px; gap: 6px; }
  .viewer-head { min-height: 66px; }
  .viewer h2, .observations h2 { font-size: 18px; }
  .eyebrow { font-size: 11px; }
  .viewer-body, .photo-stage { min-height: 0; }
  .photo-stage { height: clamp(280px, 44vh, 390px); padding: 12px; }
  .photo-stage[data-view="thin"] { height: clamp(230px, 78vw, 345px); }
  .photo-stage[data-view="profile"], .photo-stage[data-view="outcrop"] { height: clamp(205px, 68vw, 330px); }
  .composition { min-height: 290px; }
  .viewer-foot p { font-size: 10px; }
  .zoom-controls .button.icon { width: 29px; }
  .zoom-label { width: 43px; }
  .viewer-foot > button { font-size: 11px; }
  .observations { padding: 15px; gap: 17px; }
  .observations h2 { margin-bottom: 12px; }
  .finding { padding-top: 11px; margin-top: 10px; }
  .footer { align-items: start; padding-top: 12px; min-height: 60px; font-size: 10px; }
  .footer .button { padding: 0 0 0 4px; min-height: 24px; font-size: 11px; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .hotspot { transition: border-color .15s ease, background-color .15s ease, color .15s ease; }
}
