:root {
  color-scheme: dark;
  --bg: #0b0e0d;
  --surface: #111614;
  --surface-2: #171d1b;
  --surface-3: #202724;
  --line: #303a36;
  --line-strong: #46524e;
  --text: #eef3ef;
  --muted: #9da8a3;
  --dim: #6d7873;
  --cyan: #67d8ca;
  --cyan-soft: rgba(103, 216, 202, 0.13);
  --orange: #ec9655;
  --orange-soft: rgba(236, 150, 85, 0.14);
  --green: #75c991;
  --red: #e27668;
  --header-height: 62px;
  --dock-height: 0px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.app-shell {
  display: grid;
  grid-template-rows: var(--header-height) minmax(0, 1fr) var(--dock-height);
  width: 100%;
  height: 100dvh;
  min-height: 0;
  background: var(--bg);
}

.app-header {
  position: relative;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 15, 14, 0.96);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand-mark {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--cyan);
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-copy small {
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(340px, 38vw);
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.mode-button {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.mode-button.is-active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--cyan);
}

.header-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.status-item {
  display: inline-flex;
  min-width: 62px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border-left: 1px solid var(--line);
  color: var(--orange);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.status-item svg {
  width: 15px;
  height: 15px;
}

.timer-status {
  color: var(--cyan);
}

.timer-status.is-urgent {
  color: var(--red);
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
}

.mobile-panel-button,
.mobile-dock,
.panel-close {
  display: none;
}

.workspace {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: 282px minmax(0, 1fr) 322px;
  overflow: hidden;
}

.sidebar {
  position: relative;
  z-index: 15;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  background: var(--surface);
}

.mission-panel {
  padding: 24px 20px;
  border-right: 1px solid var(--line);
}

.evidence-panel {
  display: flex;
  flex-direction: column;
  padding: 24px 20px 18px;
  border-left: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h1,
.panel-heading h2,
.dialog-header h2 {
  margin: 5px 0 0;
  font-size: 22px;
  font-weight: 640;
  letter-spacing: 0;
}

.panel-heading h2,
.dialog-header h2 {
  font-size: 19px;
}

.eyebrow {
  display: block;
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-weight: 650;
  text-transform: uppercase;
}

.mission-copy {
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.sample-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-block: 1px solid var(--line);
}

.sample-meta > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  padding: 13px 0;
}

.sample-meta > div + div {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.sample-meta span,
.section-label,
.attempts-left span,
.report-sample-line span {
  color: var(--dim);
  font-size: 10px;
}

.sample-meta strong {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
}

.mission-section {
  margin-top: 22px;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.progress-track {
  height: 3px;
  overflow: hidden;
  background: var(--surface-3);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cyan);
  transition: width 280ms ease;
}

.objective-list {
  display: grid;
  gap: 1px;
  margin-top: 10px;
  background: var(--line);
}

.objective-item {
  display: grid;
  min-height: 44px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.objective-item small {
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.objective-item.is-complete {
  color: var(--text);
}

.science-note {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.science-note-icon {
  color: var(--orange);
}

.science-note strong {
  font-size: 11px;
  font-weight: 650;
}

.science-note p {
  margin: 5px 0 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.65;
}

.stage {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.scene-container,
.scene-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.sample-identity {
  position: absolute;
  top: 22px;
  left: 22px;
  max-width: min(310px, calc(100% - 44px));
  pointer-events: none;
}

.sim-chip {
  display: inline-flex;
  height: 23px;
  align-items: center;
  gap: 6px;
  padding: 0 7px;
  border: 1px solid rgba(103, 216, 202, 0.38);
  color: var(--cyan);
  background: rgba(11, 14, 13, 0.65);
  font-size: 9px;
}

.sim-chip svg {
  width: 12px;
  height: 12px;
}

.sample-identity h2 {
  margin: 9px 0 3px;
  font-size: clamp(18px, 2.1vw, 28px);
  font-weight: 610;
  letter-spacing: 0;
  text-shadow: 0 2px 18px #000;
}

.sample-identity p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.view-hud {
  position: absolute;
  right: 22px;
  bottom: 116px;
  display: flex;
  align-items: center;
  gap: 1px;
  border: 1px solid rgba(70, 82, 78, 0.55);
  background: rgba(11, 14, 13, 0.66);
  pointer-events: none;
}

.view-hud span {
  display: inline-flex;
  height: 29px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.view-hud span + span {
  border-left: 1px solid var(--line);
}

.view-hud svg {
  width: 13px;
  height: 13px;
  color: var(--cyan);
}

.readout-panel {
  position: absolute;
  top: 22px;
  right: 22px;
  display: none;
  width: min(390px, calc(100% - 44px));
  padding: 14px 15px 15px;
  border: 1px solid var(--line-strong);
  background: rgba(17, 22, 20, 0.94);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(14px);
}

.readout-panel.is-visible {
  display: block;
  animation: readout-in 180ms ease-out;
}

@keyframes readout-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.readout-header {
  display: flex;
  height: 25px;
  align-items: flex-start;
  justify-content: space-between;
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  text-transform: uppercase;
}

.readout-header .icon-button {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
  border: 0;
}

.readout-header svg {
  width: 14px;
  height: 14px;
}

.readout-panel > strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 640;
}

.readout-value {
  margin-top: 7px;
  color: var(--orange);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
}

.readout-panel p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.readout-reference {
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.readout-reference[hidden] {
  display: none;
}

.readout-reference img {
  display: block;
  width: 100%;
  max-height: 148px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
}

.readout-reference img.is-error {
  display: none;
}

.magnetic-meter {
  position: absolute;
  top: 50%;
  right: 28px;
  display: none;
  width: 126px;
  padding: 10px;
  transform: translateY(-50%);
  border: 1px solid rgba(103, 216, 202, 0.32);
  background: rgba(11, 14, 13, 0.78);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.magnetic-meter.is-visible {
  display: grid;
  gap: 7px;
}

.magnetic-meter > span {
  color: var(--dim);
  font-size: 8px;
}

.magnetic-meter > b {
  color: var(--cyan);
  font-size: 17px;
}

.meter-track {
  height: 3px;
  background: var(--surface-3);
}

.meter-track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cyan);
  transition: width 700ms ease;
}

.waveform-canvas {
  position: absolute;
  bottom: 127px;
  left: 50%;
  display: none;
  width: min(480px, calc(100% - 52px));
  height: 76px;
  transform: translateX(-50%);
  opacity: 0.88;
  pointer-events: none;
}

.waveform-canvas.is-visible {
  display: block;
}

.tool-rail-shell {
  position: absolute;
  bottom: 18px;
  left: 50%;
  display: flex;
  width: min-content;
  max-width: calc(100% - 32px);
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
}

.tool-group-label {
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.tool-rail {
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 1px;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  background: var(--line);
  box-shadow: 0 13px 38px rgba(0, 0, 0, 0.4);
  scrollbar-width: none;
}

.tool-rail::-webkit-scrollbar {
  display: none;
}

.tool-button {
  position: relative;
  display: grid;
  width: 78px;
  height: 68px;
  flex: 0 0 78px;
  grid-template-rows: 26px 14px;
  place-items: center;
  gap: 2px;
  padding: 7px 4px 5px;
  border: 0;
  border-radius: 0;
  background: rgba(17, 22, 20, 0.94);
  color: var(--muted);
  cursor: pointer;
}

.tool-button:hover,
.tool-button.is-active {
  background: var(--surface-3);
  color: var(--text);
}

.tool-button.is-active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--cyan);
  content: "";
}

.tool-button.is-destructive:not(.is-active)::after {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 4px;
  height: 4px;
  background: var(--orange);
  content: "";
}

.tool-button:disabled {
  color: var(--dim);
  cursor: not-allowed;
  opacity: 0.46;
}

.tool-button svg {
  width: 21px;
  height: 21px;
}

.tool-button > span {
  overflow: hidden;
  max-width: 100%;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tool-button.is-locked:not(:disabled) {
  color: var(--text);
}

.tool-button.is-busy {
  cursor: wait;
  opacity: 0.62;
}

.stage-toast {
  position: absolute;
  top: 90px;
  left: 50%;
  z-index: 20;
  padding: 8px 11px;
  transform: translate(-50%, -8px);
  border: 1px solid var(--line-strong);
  background: rgba(17, 22, 20, 0.95);
  color: var(--text);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.stage-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.evidence-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 9px;
}

.evidence-summary b {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.evidence-list {
  min-height: 150px;
  flex: 1;
  overflow-y: auto;
}

.empty-evidence {
  display: grid;
  min-height: 210px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--dim);
  text-align: center;
}

.empty-evidence svg {
  width: 28px;
  height: 28px;
}

.empty-evidence p {
  max-width: 190px;
  margin: 0;
  font-size: 10px;
  line-height: 1.6;
}

.evidence-item {
  position: relative;
  padding: 13px 0 13px 22px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.evidence-item:hover,
.evidence-item:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.evidence-item:focus-visible {
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.evidence-item::before {
  position: absolute;
  top: 18px;
  left: 4px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--cyan);
  background: var(--surface);
  content: "";
}

.evidence-item::after {
  position: absolute;
  top: 25px;
  bottom: -18px;
  left: 7px;
  width: 1px;
  background: var(--line-strong);
  content: "";
}

.evidence-item:last-child::after {
  display: none;
}

.evidence-item.is-strong::before {
  background: var(--cyan);
}

.evidence-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.evidence-item header span {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
}

.evidence-item header small {
  color: var(--dim);
  font-size: 8px;
}

.evidence-item strong {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 620;
  line-height: 1.45;
}

.evidence-item p {
  display: -webkit-box;
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.evidence-open-hint {
  display: inline-block;
  margin-top: 7px;
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
}

.evidence-footer {
  margin-top: 12px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.attempts-left {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.attempts-left b {
  color: var(--orange);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
}

.primary-command,
.secondary-command {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid var(--cyan);
  border-radius: 0;
  background: var(--cyan);
  color: #08110f;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.primary-command:hover {
  background: #87e8dc;
}

.primary-command:disabled {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--dim);
  cursor: not-allowed;
}

.secondary-command {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.evidence-footer .primary-command,
.mission-panel > .primary-command {
  width: 100%;
}

.mission-panel > .primary-command {
  margin-top: 20px;
}

.identify-only {
  display: none;
}

.mode-identify .identify-only {
  display: flex;
}

.mode-identify .timer-status {
  display: inline-flex;
}

.mode-explore .timer-status {
  display: none;
}

dialog {
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(8px);
}

.report-dialog,
.result-dialog,
.evidence-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--surface);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55);
}

.evidence-dialog {
  overflow: hidden;
}

.evidence-dialog-content {
  max-height: min(760px, calc(100dvh - 28px));
  overflow-y: auto;
  padding: 22px;
}

.evidence-dialog-value {
  margin-top: 20px;
  padding: 12px 0;
  border-block: 1px solid var(--line);
  color: var(--orange);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.evidence-dialog-detail {
  max-height: min(360px, 42vh);
  margin: 16px 0 0;
  overflow-y: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.evidence-dialog-reference {
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.evidence-dialog-reference[hidden] {
  display: none;
}

.evidence-dialog-reference img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
}

.report-dialog form {
  padding: 22px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.report-sample-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 12px 0;
  border-block: 1px solid var(--line);
}

.report-sample-line strong {
  font-size: 12px;
}

fieldset {
  min-width: 0;
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.classification-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.classification-option {
  position: relative;
  min-height: 50px;
  background: var(--surface-2);
  cursor: pointer;
}

.classification-option input {
  position: absolute;
  opacity: 0;
}

.classification-option span {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 50px;
  place-items: center;
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.classification-option input:checked + span {
  background: var(--cyan-soft);
  box-shadow: inset 0 -2px 0 var(--cyan);
  color: var(--text);
}

.classification-option input:focus-visible + span {
  outline: 2px solid var(--cyan);
  outline-offset: -3px;
}

.report-check {
  display: grid;
  min-height: 48px;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  line-height: 1.55;
}

.report-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--cyan);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.result-dialog {
  width: min(470px, calc(100vw - 28px));
}

.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 28px 26px;
  text-align: center;
}

.result-mark {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 17px;
  place-items: center;
  border: 1px solid var(--green);
  color: var(--green);
}

.result-mark.is-error {
  border-color: var(--red);
  color: var(--red);
}

.result-mark svg {
  width: 25px;
  height: 25px;
}

.result-content h2 {
  margin: 7px 0 0;
  font-size: 22px;
  font-weight: 650;
}

.result-content > p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.score-line {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 14px;
  padding: 13px 0;
  border-block: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.score-line strong {
  color: var(--orange);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 19px;
}

.result-content .primary-command {
  width: 100%;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 250px minmax(0, 1fr) 285px;
  }

  .tool-button {
    width: 68px;
    flex-basis: 68px;
  }

  .readout-panel {
    width: min(340px, calc(100% - 44px));
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 56px;
    --dock-height: 54px;
  }

  .app-shell {
    min-height: 0;
  }

  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 0 10px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .brand-copy strong {
    font-size: 13px;
  }

  .brand-copy small {
    display: none;
  }

  .mode-switch {
    position: absolute;
    top: 9px;
    left: 50%;
    width: min(300px, 44vw);
    transform: translateX(-50%);
  }

  .header-status {
    gap: 1px;
  }

  .status-item {
    min-width: 52px;
    padding: 0 7px;
  }

  .mobile-panel-button {
    display: none;
  }

  .workspace {
    display: block;
  }

  .stage {
    width: 100%;
    height: 100%;
  }

  .sidebar {
    position: absolute;
    z-index: 35;
    top: 0;
    bottom: 0;
    display: none;
    width: min(360px, 100%);
    box-shadow: 18px 0 50px rgba(0, 0, 0, 0.42);
  }

  .mission-panel {
    left: 0;
  }

  .evidence-panel {
    right: 0;
  }

  .sidebar.is-open {
    display: flex;
    flex-direction: column;
  }

  .panel-close {
    display: inline-grid;
  }

  .mobile-dock {
    position: relative;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-dock button {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
    font-size: 10px;
  }

  .mobile-dock button + button {
    border-left: 1px solid var(--line);
  }

  .mobile-dock button.is-active {
    color: var(--cyan);
    box-shadow: inset 0 2px 0 var(--cyan);
  }

  .tool-rail-shell {
    bottom: 12px;
  }

  .view-hud {
    bottom: 104px;
  }

  .waveform-canvas {
    bottom: 113px;
  }
}

@media (max-width: 620px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .brand-copy {
    display: none;
  }

  .mode-switch {
    left: 48px;
    width: min(250px, calc(100vw - 160px));
    transform: none;
  }

  .mode-button {
    font-size: 10px;
  }

  .status-item {
    min-width: 46px;
    padding: 0 5px;
    font-size: 10px;
  }

  .status-item svg {
    width: 13px;
    height: 13px;
  }

  .sample-identity {
    top: 14px;
    left: 14px;
  }

  .sample-identity h2 {
    margin-top: 7px;
    font-size: 18px;
  }

  .sample-identity p {
    max-width: 190px;
    line-height: 1.4;
  }

  .readout-panel {
    top: auto;
    right: 12px;
    bottom: 96px;
    width: calc(100% - 24px);
    max-height: 176px;
    overflow-y: auto;
    padding: 11px 12px;
  }

  .readout-panel p {
    font-size: 10px;
  }

  .readout-value {
    font-size: 10px;
  }

  .view-hud {
    top: 14px;
    right: 12px;
    bottom: auto;
  }

  .view-hud span:first-child {
    display: none;
  }

  .magnetic-meter {
    top: 82px;
    right: 12px;
    transform: none;
  }

  .tool-rail-shell {
    bottom: 10px;
    max-width: calc(100% - 18px);
  }

  .tool-group-label {
    display: none;
  }

  .tool-button {
    width: 68px;
    height: 64px;
    flex-basis: 68px;
  }

  .waveform-canvas {
    bottom: 94px;
    height: 64px;
  }

  .classification-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-dialog form {
    padding: 18px;
  }
}

@media (max-width: 390px) {
  .brand {
    display: none;
  }

  .mode-switch {
    left: 8px;
    width: calc(100vw - 78px);
  }

  .mode-button {
    padding: 0 3px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mode-explore .header-status .status-item:first-child {
    display: inline-flex;
  }

  .mode-identify .header-status .status-item:first-child {
    display: inline-flex;
  }

  .sample-identity p {
    max-width: 155px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Standalone identification game */
.standalone .app-header {
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
}

.game-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.game-title strong {
  font-size: 12px;
  font-weight: 650;
}

.game-title span {
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
}

@media (max-width: 900px) {
  .standalone .app-header {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .standalone .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .standalone .brand-copy,
  .standalone .game-title span {
    display: none;
  }

  .standalone .game-title {
    position: absolute;
    left: 48%;
    transform: translateX(-50%);
  }
}

@media (max-width: 390px) {
  .standalone .brand {
    display: flex;
  }

  .standalone .game-title {
    display: none;
  }
}
