:root {
  --paper: #f8f1df;
  --paper-2: #fbf7eb;
  --panel: rgba(255, 251, 238, 0.82);
  --panel-strong: rgba(255, 251, 238, 0.95);
  --ink: #2a2520;
  --soft-ink: #766f66;
  --muted: #9b927f;
  --line: rgba(91, 78, 53, 0.12);
  --line-strong: rgba(91, 78, 53, 0.18);
  --accent: #7fb85b;
  --accent-soft: rgba(127, 184, 91, 0.16);
  --accent-2: #8d62c9;
  --rose: #d65f9c;
  --shadow: 0 20px 60px rgba(76, 56, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 12%, rgba(127, 184, 91, 0.12), rgba(127, 184, 91, 0) 24%),
    radial-gradient(circle at 86% 86%, rgba(214, 95, 156, 0.12), rgba(214, 95, 156, 0) 28%),
    linear-gradient(135deg, #f7efd9 0%, #fbf6e8 48%, #f2e6cb 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Avenir Next", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(91, 78, 53, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 78, 53, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(90deg, black, rgba(0, 0, 0, 0.1) 82%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.studio-shell {
  min-height: 100vh;
  padding: 14px 16px 16px;
}

.topbar {
  position: relative;
  z-index: 4;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-orb {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 46%, #8d62c9 0 12%, transparent 13%),
    radial-gradient(circle at 68% 32%, #efb04c 0 10%, transparent 11%),
    radial-gradient(circle at 30% 70%, #65bd91 0 14%, transparent 15%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 48%),
    conic-gradient(from 20deg, #7fb85b, #6fc5d6, #8d62c9, #d65f9c, #7fb85b);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.8),
    0 8px 22px rgba(76, 56, 31, 0.14);
}

.brand-orb::before,
.brand-orb::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
}

.brand-orb::before {
  width: 15px;
  height: 15px;
  left: 9px;
  top: 10px;
}

.brand-orb::after {
  width: 8px;
  height: 8px;
  right: 10px;
  bottom: 9px;
}

.brand strong {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
  font-weight: 600;
  line-height: 0.95;
}

.brand em {
  display: block;
  margin-top: 4px;
  color: var(--accent-2);
  font-family: "Cormorant Garamond", serif;
  font-size: 15px;
  font-style: italic;
  font-weight: 500;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions > button,
.top-search-control > button {
  min-width: 54px;
  height: 48px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #5d554c;
  cursor: pointer;
}

.top-actions > button:hover,
.top-actions > button:focus-visible,
.top-search-control > button:hover,
.top-search-control > button:focus-visible {
  background: rgba(255, 251, 238, 0.8);
  outline: none;
}

.top-actions small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  color: var(--soft-ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.shortcut-key {
  min-width: 13px;
  height: 13px;
  display: inline-grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 3px;
  font: 900 9px/1 "IBM Plex Mono", monospace;
  padding: 0 3px;
}

.nav-grid,
.nav-bars,
.nav-book,
.nav-gear {
  position: relative;
  width: 18px;
  height: 18px;
  display: block;
}

.nav-grid {
  background:
    linear-gradient(currentColor 0 0) 2px 2px / 5px 5px no-repeat,
    linear-gradient(currentColor 0 0) 11px 2px / 5px 5px no-repeat,
    linear-gradient(currentColor 0 0) 2px 11px / 5px 5px no-repeat,
    linear-gradient(currentColor 0 0) 11px 11px / 5px 5px no-repeat;
}

.nav-bars::before,
.nav-bars::after,
.nav-book::before,
.nav-book::after,
.nav-gear::before,
.nav-gear::after {
  content: "";
  position: absolute;
}

.nav-bars::before {
  left: 3px;
  top: 2px;
  width: 2px;
  height: 14px;
  background: currentColor;
  box-shadow: 6px 4px 0 currentColor, 12px 1px 0 currentColor;
}

.nav-bars::after {
  left: 3px;
  right: 1px;
  bottom: 2px;
  height: 2px;
  background: currentColor;
}

.nav-book::before {
  inset: 2px 3px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.nav-book::after {
  top: 3px;
  bottom: 3px;
  left: 50%;
  width: 1px;
  background: currentColor;
}

.nav-gear::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-gear::after {
  width: 4px;
  height: 4px;
  left: 7px;
  top: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 -8px 0 -1px currentColor, 0 8px 0 -1px currentColor, 8px 0 0 -1px currentColor, -8px 0 0 -1px currentColor;
}

.avatar-button {
  width: 50px;
  min-width: 50px;
}

.avatar-button span {
  width: 36px;
  height: 36px;
  display: block;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, #2a2520 0 8%, transparent 9%),
    radial-gradient(circle at 50% 42%, #f7d3dc 0 24%, transparent 25%),
    radial-gradient(circle at 50% 60%, #d65f9c 0 32%, transparent 33%),
    conic-gradient(#8d62c9, #d65f9c, #efb04c, #8d62c9);
  box-shadow: inset 0 0 0 4px #fff8e8, 0 6px 16px rgba(76, 56, 31, 0.16);
}

.workspace {
  position: relative;
  z-index: 1;
  height: calc(100vh - 88px);
  display: grid;
  grid-template-columns: 236px minmax(460px, 1fr) 272px;
  gap: 16px;
  padding-top: 14px;
}

.left-sidebar,
.right-sidebar,
.stage-column {
  min-width: 0;
}

.left-sidebar,
.right-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.stage-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 168px;
  gap: 14px;
  min-height: 0;
}

.panel,
.stage-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel-heading {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.panel:has(.tiny-chevron) > .panel-heading {
  cursor: pointer;
  user-select: none;
}

.panel-heading h2 {
  margin: 0;
  color: #6d604f;
  font-family: "Cormorant Garamond", serif;
  font-size: 17px;
  font-style: italic;
  font-weight: 600;
}

.tiny-chevron {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.tiny-chevron::before {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  margin: 6px auto 0;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 160ms ease, margin-top 160ms ease;
}

.panel.is-collapsed .tiny-chevron::before {
  margin-top: 8px;
  transform: rotate(-45deg);
}

.organelle-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cell-button {
  position: relative;
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px 1fr 20px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.cell-button:hover,
.cell-button:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.48);
  outline: none;
}

.cell-button[aria-current="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 36%, transparent);
}

.cell-thumb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--thumb);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72), 0 5px 14px rgba(76, 56, 31, 0.12);
}

.cell-button strong,
.cell-button span {
  display: block;
}

.cell-button strong {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.cell-button span:not(.cell-thumb):not(.star-mark) {
  margin-top: 2px;
  color: var(--soft-ink);
  font-family: "Cormorant Garamond", serif;
  font-size: 13px;
  font-style: italic;
}

.star-mark {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
}

.star-mark::before {
  content: "";
  width: 10px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 56%, 79% 91%, 50% 69%, 21% 91%, 32% 56%, 2% 35%, 39% 35%);
}

.organelle-panel {
  min-height: 162px;
}

.organelle-list {
  min-height: 0;
  display: grid;
  gap: 9px;
  overflow: auto;
  padding: 14px;
}

.organelle-chip {
  width: 100%;
  min-height: 28px;
  display: grid;
  grid-template-columns: 13px 1fr;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #4a4036;
  cursor: pointer;
  text-align: left;
}

.organelle-chip:hover,
.organelle-chip:focus-visible {
  background: rgba(255, 255, 255, 0.48);
  outline: none;
}

.organelle-chip[aria-current="true"] {
  color: var(--accent-2);
  font-weight: 700;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot) 18%, transparent);
}

.stage-card {
  position: relative;
  overflow: hidden;
  min-height: 0;
  background:
    linear-gradient(135deg, rgba(255, 251, 238, 0.98), rgba(255, 249, 232, 0.72)),
    var(--paper-2);
}

.stage-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 48% 48%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 35%),
    linear-gradient(rgba(91, 78, 53, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 78, 53, 0.03) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
  pointer-events: none;
}

.title-block {
  position: absolute;
  left: 24px;
  top: 18px;
  z-index: 3;
}

.title-block h1 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(42px, 4.1vw, 64px);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.01em;
}

.title-block p {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: "Cormorant Garamond", serif;
  font-size: 21px;
  font-style: italic;
}

.tip-note {
  width: 138px;
  margin-top: 14px;
  padding: 12px 13px;
  border-radius: 4px 18px 18px 18px;
  background: #fff1b8;
  color: #6d604f;
  box-shadow: 0 12px 24px rgba(161, 121, 35, 0.15);
  transform: rotate(-1deg);
}

.tip-note strong,
.tip-note span {
  display: block;
  font-size: 11px;
  line-height: 1.35;
}

.view-mode {
  position: absolute;
  right: 16px;
  top: 20px;
  z-index: 4;
  width: 168px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 251, 238, 0.76);
  box-shadow: 0 12px 36px rgba(76, 56, 31, 0.1);
}

.view-mode p {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: "Cormorant Garamond", serif;
  font-size: 14px;
  font-style: italic;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mode-button {
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
}

.mode-button:hover,
.mode-button:focus-visible,
.mode-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.cube-icon,
.layers-icon,
.pulse-icon,
.rotate-icon,
.target-icon,
.eye-icon,
.reset-icon,
.camera-icon,
.box-icon {
  position: relative;
  width: 18px;
  height: 18px;
  display: inline-block;
}

.cube-icon::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1.8px solid currentColor;
  transform: rotate(30deg) skewX(-10deg);
}

.layers-icon::before,
.layers-icon::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  height: 7px;
  border: 1.8px solid currentColor;
  border-radius: 2px;
  transform: skewY(-16deg);
}

.layers-icon::before {
  top: 3px;
}

.layers-icon::after {
  bottom: 3px;
}

.pulse-icon::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
}

.pulse-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 18%, transparent);
}

.switch-row,
.label-toggle {
  display: grid;
  grid-template-columns: 1fr 34px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: #6f6251;
  font-family: "Cormorant Garamond", serif;
  font-size: 14px;
  font-style: italic;
}

.switch-row input,
.label-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-row i,
.label-toggle i {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(91, 78, 53, 0.18);
  cursor: pointer;
}

.switch-row i::before,
.label-toggle i::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(76, 56, 31, 0.18);
  transition: transform 160ms ease;
}

.switch-row input:checked + i,
.label-toggle input:checked + i {
  background: var(--accent);
}

.switch-row input:checked + i::before,
.label-toggle input:checked + i::before {
  transform: translateX(14px);
}

#cellCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#cellCanvas:active {
  cursor: grabbing;
}

.model-loading {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(circle at 50% 48%, rgba(2, 14, 25, 0.36), transparent 42%);
}

.model-loading[hidden] {
  display: none;
}

.model-loading-card {
  width: min(310px, calc(100% - 44px));
  padding: 18px;
  border: 1px solid rgba(93, 229, 255, 0.34);
  border-radius: 10px;
  background: rgba(4, 13, 24, 0.9);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.36);
  color: #e8fbff;
}

.model-loading-card span {
  display: block;
  color: #7ee8ff;
  font: 800 32px/1 "IBM Plex Mono", monospace;
}

.model-loading-card strong {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.model-loading-card p {
  margin: 5px 0 14px;
  color: #9ec4d3;
  font-size: 12px;
  font-weight: 700;
}

.model-loading-card i {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(126, 232, 255, 0.14);
}

.model-loading-card b {
  display: block;
  width: var(--model-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #54ddff, var(--accent));
}

.view-transition-flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 52%, rgba(92, 237, 255, 0.24), transparent 28%),
    linear-gradient(105deg, transparent 0 38%, rgba(117, 244, 255, 0.42) 45%, rgba(255, 255, 255, 0.22) 50%, transparent 60%),
    linear-gradient(180deg, transparent 0 48%, rgba(101, 236, 255, 0.16) 49%, transparent 53%);
  mix-blend-mode: screen;
  transform: translateX(-28%) scaleX(0.88);
}

.canvas-actions,
.export-actions {
  position: absolute;
  z-index: 5;
  display: flex;
  gap: 6px;
}

.canvas-actions {
  left: 18px;
  bottom: 16px;
}

.export-actions {
  right: 16px;
  bottom: 16px;
}

.canvas-actions button,
.export-actions button {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 251, 238, 0.82);
  color: #5b5045;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.canvas-actions button:hover,
.canvas-actions button:focus-visible,
.canvas-actions button[aria-pressed="true"],
.export-actions button:hover,
.export-actions button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.rotate-icon::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1.7px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

.rotate-icon::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-top: 1.7px solid currentColor;
  border-right: 1.7px solid currentColor;
  transform: rotate(45deg);
}

.target-icon::before,
.eye-icon::before,
.reset-icon::before,
.camera-icon::before,
.box-icon::before {
  content: "";
  position: absolute;
}

.target-icon::before {
  inset: 3px;
  border: 1.7px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0);
}

.target-icon::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  left: 7px;
  top: 7px;
  border-radius: 50%;
  background: currentColor;
}

.eye-icon::before {
  left: 2px;
  top: 5px;
  width: 14px;
  height: 8px;
  border: 1.7px solid currentColor;
  border-radius: 50%;
}

.eye-icon::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  left: 7px;
  top: 7px;
  border-radius: 50%;
  background: currentColor;
}

.reset-icon::before {
  inset: 3px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}

.camera-icon::before {
  left: 2px;
  top: 5px;
  width: 14px;
  height: 10px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}

.box-icon::before {
  inset: 3px;
  border: 1.7px solid currentColor;
  transform: rotate(30deg) skewX(-12deg);
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 14px;
  min-height: 0;
}

.microscope-panel {
  overflow: hidden;
}

.info-dot {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 12px;
}

.microscope-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 1fr));
  gap: 10px;
  padding: 12px;
}

.micro-card,
.add-card {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.42);
  overflow: hidden;
}

.micro-image {
  height: 62px;
  background: var(--micro);
  background-size: cover;
}

.micro-card strong,
.add-card strong {
  display: block;
  padding: 7px 8px;
  color: #62584b;
  font-size: 11px;
}

.add-card {
  display: grid;
  place-items: center;
  color: var(--accent-2);
}

.add-card strong {
  font-size: 13px;
}

.comparison-button {
  width: 100%;
  height: 32px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 251, 238, 0.72);
  color: #5b5045;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.right-sidebar {
  min-height: 0;
}

.detail-panel,
.notes-panel,
.occurs-panel {
  background: var(--panel-strong);
}

.heart-button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.heart-button::before,
.heart-button::after {
  content: "";
  position: absolute;
}

.heart-button {
  position: relative;
}

.heart-button::before {
  width: 15px;
  height: 13px;
  left: 6px;
  top: 7px;
  background: var(--rose);
  clip-path: polygon(50% 100%, 6% 52%, 0 28%, 11% 7%, 34% 0, 50% 16%, 66% 0, 89% 7%, 100% 28%, 94% 52%);
}

.detail-head {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px 14px 8px;
}

.detail-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--detail);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.66), 0 9px 22px rgba(76, 56, 31, 0.12);
}

.detail-head h3 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 27px;
  font-weight: 600;
}

.detail-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-family: "Cormorant Garamond", serif;
  font-size: 15px;
  font-style: italic;
}

.fact-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 8px 14px 14px;
}

.fact-list div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
}

.fact-list dt {
  color: var(--muted);
  font-family: "Cormorant Garamond", serif;
  font-size: 14px;
  font-style: italic;
}

.fact-list dd {
  margin: 0;
  color: #4b4238;
  font-size: 12px;
  line-height: 1.35;
}

.label-toggle {
  margin: 0;
  padding: 0 14px 14px;
}

.notes-panel {
  padding-bottom: 12px;
}

.notes-panel p {
  margin: 0;
  padding: 14px 14px 0;
  color: #675c50;
  font-family: "Cormorant Garamond", serif;
  font-size: 16px;
  line-height: 1.45;
}

.notes-panel .fun-fact {
  margin: 10px 14px 0;
  padding: 12px 13px;
  border-top: 1px solid var(--line);
  color: #8a5d75;
  font-size: 15px;
  font-style: italic;
}

.occurs-panel {
  overflow: hidden;
  flex: 1;
  min-height: 162px;
}

.occurs-body {
  height: calc(100% - 39px);
  min-height: 132px;
}

#occurCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 1160px) {
  body {
    overflow: auto;
  }

  .studio-shell {
    min-height: 100vh;
  }

  .workspace {
    height: auto;
    grid-template-columns: 220px minmax(460px, 1fr);
    grid-template-areas:
      "left stage"
      "right stage";
  }

  .left-sidebar {
    grid-area: left;
  }

  .stage-column {
    grid-area: stage;
    grid-template-rows: 620px auto;
  }

  .right-sidebar {
    grid-area: right;
  }

  .bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .topbar {
    height: auto;
    align-items: flex-start;
  }

  .top-actions {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .workspace {
    display: flex;
    flex-direction: column;
  }

  .left-sidebar,
  .right-sidebar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .organelle-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stage-column {
    grid-template-rows: 600px auto;
  }

  .view-mode {
    right: 12px;
    top: 12px;
  }

  .title-block {
    left: 18px;
    top: 18px;
  }

  .tip-note {
    display: none;
  }

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

@media (max-width: 560px) {
  .studio-shell {
    padding: 10px;
  }

  .brand strong {
    font-size: 23px;
  }

  .brand em {
    display: none;
  }

  .top-actions > button:not(.avatar-button),
  .top-search-control > button {
    min-width: 42px;
  }

  .top-actions small {
    display: none;
  }

  .stage-column {
    grid-template-rows: 560px auto;
  }

  .stage-card {
    border-radius: 12px;
  }

  .title-block h1 {
    font-size: 40px;
  }

  .title-block p {
    font-size: 18px;
  }

  .view-mode {
    width: 146px;
    padding: 9px;
  }

  .mode-button {
    height: 36px;
  }

  .canvas-actions {
    left: 10px;
    right: 10px;
    bottom: 54px;
    flex-wrap: wrap;
  }

  .export-actions {
    left: 10px;
    right: 10px;
    bottom: 12px;
    justify-content: flex-end;
  }

  .canvas-actions button,
  .export-actions button {
    height: 30px;
    font-size: 11px;
  }

  .organelle-list {
    grid-template-columns: 1fr;
  }

}

/* Neon reference UI */
:root {
  --paper: #06101c;
  --paper-2: #081726;
  --panel: rgba(7, 20, 34, 0.78);
  --panel-strong: rgba(9, 24, 40, 0.94);
  --ink: #edf8ff;
  --soft-ink: #9eb5c7;
  --muted: #6f8799;
  --line: rgba(82, 210, 246, 0.19);
  --line-strong: rgba(105, 226, 255, 0.34);
  --accent: #35d7ff;
  --accent-soft: rgba(53, 215, 255, 0.14);
  --accent-2: #8ffcff;
  --rose: #ef6fb3;
  --shadow: 0 22px 56px rgba(0, 0, 0, 0.38);
}

body {
  background:
    radial-gradient(circle at 52% 48%, rgba(25, 138, 196, 0.25), transparent 28%),
    radial-gradient(circle at 76% 18%, rgba(108, 76, 211, 0.2), transparent 26%),
    radial-gradient(circle at 18% 82%, rgba(22, 214, 166, 0.13), transparent 22%),
    linear-gradient(135deg, #030812 0%, #071422 46%, #02060d 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Avenir Next", sans-serif;
}

body::before {
  opacity: 0.62;
  background:
    linear-gradient(rgba(74, 206, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 206, 255, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 58% 44%, rgba(42, 223, 255, 0.13), transparent 2px),
    radial-gradient(circle at 68% 36%, rgba(142, 123, 255, 0.16), transparent 2px),
    radial-gradient(circle at 45% 62%, rgba(74, 255, 202, 0.12), transparent 2px);
  background-size: 42px 42px, 42px 42px, 180px 180px, 220px 220px, 260px 260px;
  mask-image: radial-gradient(circle at 52% 45%, black 0 58%, transparent 86%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.42;
  background:
    radial-gradient(ellipse at 49% 47%, rgba(20, 164, 228, 0.16), transparent 30%),
    linear-gradient(120deg, transparent 0 44%, rgba(67, 217, 255, 0.11) 44% 45%, transparent 45% 100%),
    linear-gradient(38deg, transparent 0 58%, rgba(121, 98, 255, 0.1) 58% 59%, transparent 59% 100%);
  mix-blend-mode: screen;
}

.studio-shell {
  padding: 10px 12px 12px;
}

.topbar {
  height: 66px;
  padding: 8px 10px 8px 12px;
  border: 1px solid rgba(87, 206, 246, 0.18);
  border-radius: 10px;
  background: rgba(5, 16, 28, 0.66);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.brand {
  color: #f2fbff;
}

.brand-orb {
  width: 44px;
  height: 44px;
  background:
    radial-gradient(circle at 50% 50%, rgba(143, 252, 255, 0.9) 0 6%, transparent 7%),
    radial-gradient(circle at 50% 50%, transparent 0 31%, #35d7ff 32% 37%, transparent 38%),
    linear-gradient(42deg, transparent 0 42%, #8ffcff 43% 47%, transparent 48% 100%),
    linear-gradient(-42deg, transparent 0 42%, #8ffcff 43% 47%, transparent 48% 100%),
    radial-gradient(circle, rgba(53, 215, 255, 0.24), rgba(78, 95, 255, 0.18));
  border: 1px solid rgba(143, 252, 255, 0.55);
  box-shadow:
    inset 0 0 22px rgba(54, 221, 255, 0.24),
    0 0 26px rgba(54, 221, 255, 0.28);
}

.brand-orb::before,
.brand-orb::after {
  background: #8ffcff;
  box-shadow: 0 0 10px rgba(143, 252, 255, 0.8);
}

.brand-orb::before {
  width: 7px;
  height: 7px;
  left: 12px;
  top: 12px;
}

.brand-orb::after {
  width: 7px;
  height: 7px;
  right: 11px;
  bottom: 11px;
}

.brand strong {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand em {
  margin-top: 3px;
  color: #83a4b9;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.top-actions {
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(87, 206, 246, 0.18);
  border-radius: 10px;
  background: rgba(3, 12, 22, 0.62);
}

.top-actions > button,
.top-search-control > button {
  min-width: 58px;
  height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #bfefff;
  background: rgba(255, 255, 255, 0.03);
}

.top-actions > button:hover,
.top-actions > button:focus-visible,
.top-actions > button[aria-pressed="true"],
.top-actions > button[aria-expanded="true"],
.top-search-control > button:hover,
.top-search-control > button:focus-visible,
.top-search-control > button[aria-pressed="true"],
.top-search-control > button[aria-expanded="true"] {
  border-color: rgba(86, 224, 255, 0.44);
  background: rgba(53, 215, 255, 0.12);
  box-shadow: 0 0 18px rgba(53, 215, 255, 0.12);
}

.top-actions small {
  color: #7f9cad;
  font-size: 9px;
  letter-spacing: 0;
}

.shortcut-key {
  color: #dff9ff;
  background: rgba(53, 215, 255, 0.1);
  border-color: rgba(126, 232, 255, 0.36);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-search,
.nav-help,
.nav-sound,
.nav-gear {
  position: relative;
  width: 19px;
  height: 19px;
  display: block;
}

.nav-search::before,
.nav-help::before,
.nav-sound::before,
.nav-gear::before,
.nav-search::after,
.nav-help::after,
.nav-sound::after,
.nav-gear::after {
  content: "";
  position: absolute;
}

.nav-search::before {
  inset: 2px 5px 5px 2px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-search::after {
  right: 2px;
  bottom: 2px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.nav-help::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-help::after {
  left: 8px;
  top: 4px;
  width: 4px;
  height: 9px;
  border: 2px solid currentColor;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 8px 0 0;
  box-shadow: 0 10px 0 -1px currentColor;
}

.nav-sound::before {
  left: 2px;
  top: 6px;
  width: 6px;
  height: 7px;
  background: currentColor;
  clip-path: polygon(0 28%, 45% 28%, 100% 0, 100% 100%, 45% 72%, 0 72%);
}

.nav-sound::after {
  right: 3px;
  top: 4px;
  width: 8px;
  height: 11px;
  border: 2px solid currentColor;
  border-left: 0;
  border-top-right-radius: 9px;
  border-bottom-right-radius: 9px;
}

.workspace {
  height: calc(100vh - 88px);
  grid-template-columns: 270px minmax(560px, 1fr) 310px;
  gap: 12px;
  padding-top: 12px;
}

.left-sidebar,
.right-sidebar {
  gap: 10px;
}

.stage-column {
  grid-template-rows: minmax(0, 1fr) 158px;
  gap: 10px;
}

.panel,
.stage-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 48px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.panel-heading {
  min-height: 43px;
  padding: 0 14px;
  border-bottom-color: rgba(82, 210, 246, 0.15);
}

.panel-heading h2 {
  color: #d9f8ff;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tiny-chevron {
  color: #6be6ff;
}

.tiny-chevron::before {
  border-color: currentColor;
}

.organelle-panel {
  flex: 0 0 190px;
  min-height: 160px;
}

.cell-button {
  min-height: 76px;
  grid-template-columns: 54px 1fr 16px;
  gap: 11px;
  padding: 8px;
  border-color: rgba(82, 210, 246, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
}

.cell-button:hover,
.cell-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(83, 221, 255, 0.34);
  background: rgba(53, 215, 255, 0.1);
}

.cell-button[aria-current="true"] {
  background: linear-gradient(90deg, rgba(37, 190, 255, 0.2), rgba(76, 87, 255, 0.08));
  border-color: rgba(87, 227, 255, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(143, 252, 255, 0.12),
    0 0 26px rgba(53, 215, 255, 0.18);
}

.cell-thumb {
  width: 50px;
  height: 50px;
  border-radius: 9px;
  background: var(--thumb);
  background-size: cover;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 0 18px rgba(53, 215, 255, 0.1);
}

.cell-button strong {
  color: #eefbff;
  font-size: 13px;
  letter-spacing: 0;
}

.cell-button span:not(.cell-thumb):not(.star-mark) {
  color: #87a4b7;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.star-mark {
  color: #32e5ff;
  opacity: 0.62;
}

.star-mark::before {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  clip-path: none;
  box-shadow: 0 0 12px rgba(50, 229, 255, 0.88);
}

.organelle-list {
  gap: 8px;
  padding: 10px;
}

.organelle-chip {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(82, 210, 246, 0.08);
  border-radius: 8px;
  color: #c7dfec;
  background: rgba(255, 255, 255, 0.03);
}

.organelle-chip:hover,
.organelle-chip:focus-visible,
.organelle-chip[aria-current="true"] {
  color: #f0fbff;
  border-color: rgba(88, 226, 255, 0.4);
  background: rgba(53, 215, 255, 0.1);
}

.stage-card {
  background:
    radial-gradient(circle at 50% 48%, rgba(47, 173, 244, 0.22), transparent 32%),
    radial-gradient(circle at 72% 30%, rgba(142, 124, 255, 0.17), transparent 28%),
    linear-gradient(135deg, rgba(5, 15, 29, 0.9), rgba(4, 10, 19, 0.82)),
    var(--paper-2);
}

.stage-card::before {
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 52% 50%, rgba(70, 212, 255, 0.08), transparent 31%),
    linear-gradient(rgba(69, 219, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 219, 255, 0.03) 1px, transparent 1px);
  background-size: auto, 38px 38px, 38px 38px;
}

.stage-card::after {
  content: "";
  position: absolute;
  inset: 12% 8% 10%;
  pointer-events: none;
  opacity: 0.58;
  background:
    radial-gradient(circle at 22% 47%, rgba(83, 226, 255, 0.14), transparent 4px),
    radial-gradient(circle at 36% 56%, rgba(132, 102, 255, 0.13), transparent 4px),
    radial-gradient(circle at 62% 41%, rgba(83, 226, 255, 0.16), transparent 4px),
    radial-gradient(circle at 75% 59%, rgba(132, 102, 255, 0.12), transparent 4px),
    linear-gradient(22deg, transparent 0 45%, rgba(74, 218, 255, 0.12) 45% 45.4%, transparent 45.5%),
    linear-gradient(-18deg, transparent 0 52%, rgba(74, 218, 255, 0.12) 52% 52.4%, transparent 52.5%);
  filter: blur(0.2px);
}

.stage-card.is-model-revealing {
  animation: stage-ready-border 760ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.stage-card.is-model-revealing #cellCanvas {
  animation: model-ready-focus 700ms cubic-bezier(0.18, 0.9, 0.18, 1);
}

.stage-card.is-model-revealing .view-transition-flash {
  animation: view-handoff-sweep 760ms cubic-bezier(0.16, 0.9, 0.18, 1);
}

.stage-card.is-model-revealing::after {
  animation: stage-ready-sweep 760ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes model-ready-focus {
  0% {
    opacity: 0.58;
    transform: scale(0.965) translateY(10px);
    filter: blur(8px) saturate(1.35) drop-shadow(0 0 4px rgba(47, 205, 255, 0));
  }
  58% {
    opacity: 1;
    transform: scale(1.012) translateY(-2px);
    filter: blur(0) saturate(1.12) drop-shadow(0 0 30px rgba(47, 205, 255, 0.2));
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes stage-ready-border {
  0% {
    border-color: rgba(76, 221, 255, 0.14);
    box-shadow: var(--shadow), inset 0 0 0 rgba(81, 229, 255, 0);
  }
  34% {
    border-color: rgba(104, 239, 255, 0.76);
    box-shadow: var(--shadow), 0 0 36px rgba(46, 211, 255, 0.2), inset 0 0 34px rgba(56, 217, 255, 0.1);
  }
  100% {
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
}

@keyframes stage-ready-sweep {
  0% {
    opacity: 0.16;
    transform: translateX(-16%) scaleX(0.9);
    filter: blur(8px);
  }
  42% {
    opacity: 0.88;
    transform: translateX(7%) scaleX(1.04);
    filter: blur(0.2px);
  }
  100% {
    opacity: 0.58;
    transform: translateX(0) scaleX(1);
    filter: blur(0.2px);
  }
}

@keyframes view-handoff-sweep {
  0% {
    opacity: 0;
    transform: translateX(-34%) scaleX(0.72);
  }
  16% {
    opacity: 0.92;
  }
  54% {
    opacity: 0.58;
    transform: translateX(8%) scaleX(1.08);
  }
  100% {
    opacity: 0;
    transform: translateX(34%) scaleX(0.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-card.is-model-revealing,
  .stage-card.is-model-revealing #cellCanvas,
  .stage-card.is-model-revealing .view-transition-flash,
  .stage-card.is-model-revealing::after {
    animation: none;
  }

  .view-transition-flash {
    display: none;
  }
}

.title-block {
  left: 22px;
  top: 18px;
  max-width: 280px;
}

.title-block h1 {
  color: #f5fcff;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: clamp(30px, 2.4vw, 42px);
  font-weight: 800;
  line-height: 1.02;
  text-shadow: 0 0 24px rgba(53, 215, 255, 0.24);
}

.title-block p {
  color: #83a9bd;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
}

.tip-note {
  display: none;
}

.studio-shell[data-help-open="true"] .tip-note {
  position: fixed;
  left: 252px;
  top: 88px;
  z-index: 26;
  width: 176px;
  display: block;
  padding: 14px 15px;
  border: 1px solid rgba(255, 235, 151, 0.46);
  border-radius: 8px;
  background: rgba(30, 24, 12, 0.94);
  color: #fff3b3;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  transform: none;
}

.view-mode {
  right: 16px;
  top: 16px;
  width: 188px;
  padding: 12px;
  border-color: rgba(87, 206, 246, 0.24);
  border-radius: 10px;
  background: rgba(5, 16, 29, 0.72);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.view-mode p {
  color: #d9f8ff;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-button {
  height: 48px;
  border-color: rgba(100, 213, 247, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #c7f2ff;
}

.mode-button:hover,
.mode-button:focus-visible,
.mode-button[aria-pressed="true"] {
  border-color: rgba(93, 229, 255, 0.78);
  background: rgba(53, 215, 255, 0.16);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(53, 215, 255, 0.18);
}

.switch-row,
.label-toggle {
  color: #a5c1d0;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.switch-row i,
.label-toggle i {
  background: rgba(116, 145, 162, 0.3);
}

.switch-row input:checked + i,
.label-toggle input:checked + i {
  background: linear-gradient(90deg, #24b2ff, #3df5dc);
  box-shadow: 0 0 14px rgba(53, 215, 255, 0.28);
}

#cellCanvas {
  z-index: 1;
  filter: drop-shadow(0 0 20px rgba(47, 205, 255, 0.12));
}

.stage-card[data-scope-mode="light"] #cellCanvas {
  filter: brightness(1.12) saturate(0.86) contrast(1.05) drop-shadow(0 0 18px rgba(229, 244, 255, 0.1));
}

.stage-card[data-scope-mode="fluorescence"] #cellCanvas {
  filter: saturate(1.6) contrast(1.16) hue-rotate(58deg) drop-shadow(0 0 26px rgba(74, 255, 174, 0.2));
}

.stage-card[data-scope-mode="electron"] #cellCanvas {
  filter: grayscale(1) contrast(1.28) brightness(1.04) drop-shadow(0 0 20px rgba(204, 231, 255, 0.12));
}

.canvas-actions,
.export-actions {
  z-index: 6;
  gap: 8px;
  border: 1px solid rgba(87, 206, 246, 0.17);
  border-radius: 10px;
  background: rgba(4, 14, 25, 0.62);
  padding: 7px;
  backdrop-filter: blur(14px);
}

.canvas-actions {
  left: auto;
  right: 236px;
  bottom: 16px;
  transform: none;
}

.export-actions {
  right: 14px;
  bottom: 16px;
}

.canvas-actions button,
.export-actions button {
  height: 34px;
  border-color: rgba(107, 225, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: #d7f7ff;
  font-size: 12px;
  font-weight: 800;
}

.canvas-actions button:hover,
.canvas-actions button:focus-visible,
.canvas-actions button[aria-pressed="true"],
.export-actions button:hover,
.export-actions button:focus-visible {
  border-color: rgba(93, 229, 255, 0.72);
  background: rgba(53, 215, 255, 0.14);
  box-shadow: 0 0 16px rgba(53, 215, 255, 0.18);
}

.bottom-grid {
  grid-template-columns: minmax(380px, 0.9fr) minmax(420px, 1.1fr);
  gap: 10px;
}

.microscope-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.micro-card,
.add-card {
  min-height: 94px;
  border-color: rgba(82, 210, 246, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
}

.micro-card:first-child {
  border-color: rgba(93, 229, 255, 0.74);
  box-shadow: 0 0 18px rgba(53, 215, 255, 0.14);
}

.micro-image {
  height: 58px;
  filter: saturate(1.12) contrast(1.04);
}

.micro-card strong,
.add-card strong {
  color: #d8f7ff;
  font-size: 10px;
}

.comparison-button {
  display: none;
}

.gallery-row {
  height: 96px;
  display: grid;
  grid-template-columns: 28px repeat(4, minmax(70px, 1fr)) 28px;
  gap: 6px;
  align-items: stretch;
}

.gallery-arrow,
.gallery-card {
  border: 1px solid rgba(82, 210, 246, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: #d8f7ff;
  cursor: pointer;
}

.gallery-arrow {
  display: grid;
  place-items: center;
  color: #7ff0ff;
  font-size: 20px;
  font-weight: 800;
}

.gallery-card {
  min-width: 0;
  display: grid;
  grid-template-rows: 58px 1fr;
  overflow: hidden;
  padding: 0;
  text-align: left;
}

.gallery-card[aria-current="true"],
.gallery-card:hover,
.gallery-card:focus-visible,
.gallery-arrow:hover,
.gallery-arrow:focus-visible {
  border-color: rgba(93, 229, 255, 0.72);
  background: rgba(53, 215, 255, 0.12);
  outline: none;
  box-shadow: 0 0 18px rgba(53, 215, 255, 0.14);
}

.gallery-thumb {
  background: var(--thumb);
  background-size: cover;
  border-bottom: 1px solid rgba(82, 210, 246, 0.13);
}

.gallery-card span:last-child {
  min-width: 0;
  padding: 6px 7px;
}

.gallery-card strong,
.gallery-card span span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card strong {
  color: #eefbff;
  font-size: 9px;
  font-weight: 800;
}

.gallery-card span span {
  margin-top: 1px;
  color: #87a4b7;
  font-size: 9px;
  font-weight: 700;
}

.heart-button {
  display: none;
}

.detail-panel,
.notes-panel,
.occurs-panel {
  overflow: hidden;
}

.detail-head {
  padding: 14px;
  border-bottom-color: rgba(82, 210, 246, 0.13);
}

.detail-icon {
  border-radius: 9px;
  box-shadow: 0 0 22px rgba(53, 215, 255, 0.13);
}

.detail-head h3 {
  color: #f2fbff;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 19px;
  font-weight: 800;
}

.detail-head p {
  color: #8baabd;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.fact-list {
  padding: 12px 14px 6px;
}

.fact-list div {
  border-bottom-color: rgba(82, 210, 246, 0.11);
}

.fact-list dt {
  color: #75eaff;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.fact-list dd {
  color: #dceff6;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
}

.label-toggle {
  padding: 0 14px 14px;
}

.notes-panel p {
  color: #a9bfcd;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

.notes-panel .fun-fact {
  border-top-color: rgba(82, 210, 246, 0.13);
  color: #ffd876;
  font-size: 12px;
  font-style: normal;
}

.occurs-panel {
  display: none;
}

#occurCanvas {
  filter: saturate(1.1) brightness(0.82);
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 250px minmax(500px, 1fr) 286px;
  }

}

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

  .stage-column {
    grid-template-rows: 620px auto;
  }
}

@media (max-width: 880px) {
  body {
    overflow: auto;
  }

  .studio-shell {
    padding: 8px;
  }

  .topbar {
    height: auto;
  }

  .workspace {
    height: auto;
  }

  .left-sidebar,
  .right-sidebar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cell-button {
    min-height: 70px;
  }

  .stage-column {
    grid-template-rows: 600px auto;
  }

  .view-mode {
    width: 164px;
  }

  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .export-actions {
    display: none;
  }

  .canvas-actions {
    left: 12px;
    right: 12px;
    transform: none;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .brand strong {
    font-size: 18px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .top-actions > button,
  .top-search-control > button {
    min-width: 42px;
  }

  .stage-column {
    grid-template-rows: 560px auto;
  }

  .title-block h1 {
    font-size: 28px;
  }

  .canvas-actions {
    left: 10px;
    right: 10px;
    transform: none;
    justify-content: center;
    flex-wrap: wrap;
  }

  .canvas-actions button {
    flex: 1 1 96px;
  }
}

/* Reference-video structure pass */
body {
  overflow: hidden;
}

.studio-shell {
  position: relative;
  padding: 80px 8px 8px;
}

.topbar {
  position: absolute;
  top: 6px;
  left: 8px;
  right: 8px;
  height: 66px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.brand {
  width: 286px;
  gap: 10px;
}

.brand strong {
  font-size: 24px;
}

.brand em {
  max-width: 210px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  width: 286px;
  height: 66px;
  margin-left: auto;
  justify-content: space-between;
  padding: 7px;
  border-color: rgba(120, 218, 255, 0.3);
  background: rgba(5, 14, 25, 0.78);
}

.top-actions > button,
.top-search-control > button {
  width: 62px;
  min-width: 0;
  height: 50px;
}

.settings-panel {
  position: fixed;
  right: 10px;
  top: 78px;
  z-index: 30;
  width: 230px;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(120, 218, 255, 0.3);
  border-radius: 10px;
  background: rgba(4, 13, 24, 0.95);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.4);
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel-header {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 3px;
  color: #dff9ff;
}

.settings-panel-header strong {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.settings-panel button {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(82, 210, 246, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: #d9f8ff;
  cursor: pointer;
  font-weight: 800;
}

.settings-panel .settings-close {
  position: relative;
  width: 28px;
  min-height: 28px;
  flex: 0 0 28px;
  justify-content: center;
  padding: 0;
  border-color: rgba(82, 210, 246, 0.22);
  border-radius: 7px;
}

.settings-panel .settings-close::before,
.settings-panel .settings-close::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.settings-panel .settings-close::before {
  transform: rotate(45deg);
}

.settings-panel .settings-close::after {
  transform: rotate(-45deg);
}

.settings-panel .settings-close:hover,
.settings-panel .settings-close:focus-visible {
  border-color: rgba(93, 229, 255, 0.72);
  background: rgba(53, 215, 255, 0.13);
  outline: none;
}

.settings-panel button[aria-pressed="true"] {
  border-color: rgba(93, 229, 255, 0.72);
  background: rgba(53, 215, 255, 0.13);
}

.settings-panel b {
  color: #7ee8ff;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace {
  height: calc(100vh - 88px);
  display: grid;
  grid-template-columns: 232px 108px minmax(0, 1fr) 252px;
  grid-template-rows: minmax(0, 1fr) 158px;
  gap: 8px;
  padding-top: 0;
}

.left-sidebar {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.organelle-panel,
.view-mode,
.export-actions,
#hideBtn,
#resetBtn {
  display: none;
}

.specimen-dropdowns {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}

.specimen-dropdown {
  min-width: 0;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(82, 210, 246, 0.24);
  border-radius: 10px;
  background: rgba(4, 17, 31, 0.82);
  color: #ecfbff;
  cursor: pointer;
  padding: 7px 12px;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 26px rgba(0, 0, 0, 0.22);
}

.specimen-dropdown:hover,
.specimen-dropdown:focus-visible,
.specimen-dropdown[aria-expanded="true"] {
  border-color: rgba(93, 229, 255, 0.68);
  background: rgba(7, 27, 46, 0.92);
  outline: none;
}

.specimen-dropdown span,
.specimen-dropdown strong {
  grid-column: 1;
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.specimen-dropdown span {
  color: #d9f8ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.specimen-dropdown strong {
  margin-top: 2px;
  color: #86aabd;
  font-size: 10px;
  font-weight: 800;
}

.specimen-dropdown i {
  grid-column: 2;
  grid-row: 1 / 3;
  justify-self: end;
  align-self: center;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #6be6ff;
  border-bottom: 1.5px solid #6be6ff;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.specimen-dropdown[aria-expanded="true"] i {
  transform: rotate(-135deg);
}

.specimen-dropdown-menu {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  gap: 7px;
  overflow: auto;
  border: 1px solid rgba(82, 210, 246, 0.2);
  border-radius: 10px;
  background: rgba(4, 14, 25, 0.97);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 22px 46px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  padding: 10px;
  scrollbar-width: thin;
}

#cellDropdownMenu {
  flex: 0 1 250px;
}

#originDropdownMenu {
  flex: 1 1 330px;
  min-height: 170px;
}

.specimen-dropdown-menu[hidden] {
  display: none !important;
}

.cell-list-empty {
  padding: 14px 10px;
  color: #8ba7b8;
  font-size: 11px;
  font-weight: 800;
}

.cell-button[hidden],
.cell-list-empty[hidden] {
  display: none !important;
}

.panel.is-collapsed .organelle-list {
  display: none;
}

.panel.is-collapsed {
  flex: 0 0 auto;
}

.cell-button {
  min-height: 91px;
  grid-template-columns: 76px 1fr;
  padding: 8px;
  gap: 10px;
}

.cell-thumb {
  width: 74px;
  height: 74px;
  border-radius: 8px;
}

.cell-thumb {
  display: block;
  background: rgba(255, 255, 255, 0.04) var(--thumb) center / contain no-repeat;
}

.cell-button strong {
  font-size: 14px;
}

.cell-button span:not(.cell-thumb):not(.star-mark) {
  font-size: 11px;
  line-height: 1.25;
}

.star-mark {
  display: none;
}

.stage-column,
.bottom-grid {
  display: contents;
}

.stage-card {
  grid-column: 2 / 4;
  grid-row: 1;
  min-height: 0;
}

.stage-card::before {
  background:
    radial-gradient(circle at 74% 16%, rgba(120, 126, 255, 0.22), transparent 6%),
    radial-gradient(circle at 78% 22%, rgba(80, 225, 255, 0.16), transparent 2px),
    radial-gradient(circle at 56% 42%, rgba(70, 212, 255, 0.1), transparent 31%),
    linear-gradient(rgba(69, 219, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69, 219, 255, 0.03) 1px, transparent 1px);
  background-size: auto, auto, auto, 38px 38px, 38px 38px;
}

.title-block {
  position: fixed;
  left: 50%;
  top: 16px;
  width: 250px;
  transform: translateX(-50%);
  text-align: left;
  z-index: 9;
}

.title-block h1 {
  font-size: 24px;
  line-height: 1.08;
}

.title-block p {
  margin-top: 2px;
  font-size: 12px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(190px, 286px) minmax(170px, 250px) 286px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.title-block {
  position: static;
  width: 100%;
  min-width: 0;
  transform: none;
  z-index: auto;
}

.global-search {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 34;
  width: min(480px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.studio-shell[data-search-open="true"] .global-search,
.global-search:focus-within {
  opacity: 1;
  pointer-events: auto;
}

.global-search-field {
  min-width: 0;
  height: 50px;
  display: grid;
  grid-template-columns: 18px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(120, 218, 255, 0.3);
  border-radius: 10px;
  background: rgba(5, 14, 25, 0.78);
  color: #ecfbff;
  padding: 0 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 30px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px);
}

.global-search-field:focus-within {
  border-color: rgba(93, 229, 255, 0.72);
  background: rgba(7, 27, 46, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 3px rgba(53, 215, 255, 0.12),
    0 14px 34px rgba(0, 0, 0, 0.32);
}

.global-search-icon {
  position: relative;
  width: 16px;
  height: 16px;
}

.global-search-icon::before {
  content: "";
  position: absolute;
  inset: 1px 5px 5px 1px;
  border: 2px solid #8ffcff;
  border-radius: 50%;
}

.global-search-icon::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: #8ffcff;
  transform: rotate(45deg);
}

.global-search-label {
  color: rgba(217, 248, 255, 0.7);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.global-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: #f3fbff;
  font: 800 13px/1 "IBM Plex Sans", sans-serif;
  outline: none;
}

.global-search input::placeholder {
  color: rgba(166, 204, 221, 0.66);
}

.search-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  max-height: min(420px, calc(100vh - 110px));
  display: grid;
  gap: 7px;
  overflow: auto;
  border: 1px solid rgba(82, 210, 246, 0.22);
  border-radius: 10px;
  background: rgba(4, 14, 25, 0.98);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 24px 48px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(18px);
  padding: 8px;
  scrollbar-width: thin;
}

.search-suggestions[hidden] {
  display: none !important;
}

.search-suggestion {
  min-width: 0;
  min-height: 58px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(82, 210, 246, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: #ecfbff;
  cursor: pointer;
  padding: 6px;
  text-align: left;
}

.search-suggestion:hover,
.search-suggestion:focus-visible,
.search-suggestion[aria-current="true"] {
  border-color: rgba(93, 229, 255, 0.66);
  background: rgba(53, 215, 255, 0.12);
  outline: none;
}

.search-suggestion-thumb {
  width: 44px;
  height: 44px;
  display: block;
  border: 1px solid rgba(185, 235, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04) var(--thumb) center / contain no-repeat;
}

.search-suggestion-copy {
  min-width: 0;
}

.search-suggestion-copy strong,
.search-suggestion-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-suggestion-copy strong {
  font-size: 13px;
  font-weight: 900;
}

.search-suggestion-copy span {
  margin-top: 2px;
  color: #8ba7b8;
  font-size: 11px;
  font-weight: 800;
}

.search-suggestion-kind {
  align-self: start;
  border: 1px solid rgba(93, 229, 255, 0.2);
  border-radius: 999px;
  color: #7ee8ff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 3px 6px;
  text-transform: uppercase;
  white-space: nowrap;
}

.search-empty {
  padding: 14px 10px;
  color: #8ba7b8;
  font-size: 11px;
  font-weight: 800;
}

.top-actions {
  position: relative;
  margin-left: 0;
  justify-self: end;
  overflow: visible;
}

.top-search-control {
  width: 62px;
  height: 50px;
  flex: 0 0 62px;
}

.canvas-actions {
  left: 50%;
  right: auto;
  bottom: 13px;
  transform: translateX(-50%);
  gap: 22px;
  padding: 8px 20px;
  border-radius: 6px;
}

.canvas-actions button {
  min-width: 74px;
  height: 34px;
  justify-content: center;
  border: 0;
  background: transparent;
}

.canvas-actions button:hover,
.canvas-actions button:focus-visible,
.canvas-actions button[aria-pressed="true"] {
  background: rgba(53, 215, 255, 0.12);
}

.zoom-icon {
  position: relative;
  width: 18px;
  height: 18px;
  display: inline-block;
}

.zoom-icon::before {
  content: "";
  position: absolute;
  inset: 2px 5px 5px 2px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
}

.zoom-icon::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 2px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.microscope-panel {
  grid-column: 1 / 3;
  grid-row: 2;
  min-height: 0;
}

.legend-panel {
  grid-column: 3;
  grid-row: 2;
  min-height: 0;
}

.right-sidebar {
  grid-column: 4;
  grid-row: 1 / 3;
  gap: 8px;
  min-height: 0;
}

.detail-panel {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  --detail-accent: var(--accent);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.detail-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--detail-accent) 24%, transparent) 0 18%, transparent 42%),
    linear-gradient(120deg, transparent 0 38%, color-mix(in srgb, var(--detail-accent) 18%, transparent) 50%, transparent 62%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.detail-panel[data-detail-mode="hover"] {
  border-color: color-mix(in srgb, var(--detail-accent) 62%, rgba(82, 210, 246, 0.2));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px color-mix(in srgb, var(--detail-accent) 18%, transparent),
    0 18px 48px rgba(0, 0, 0, 0.38);
}

.detail-panel[data-detail-mode="hover"]::before {
  opacity: 1;
}

.detail-panel[data-detail-mode="hover"] .detail-head,
.detail-panel[data-detail-mode="hover"] .fact-list {
  animation: detail-preview-in 180ms ease both;
}

@keyframes detail-preview-in {
  from {
    opacity: 0.55;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notes-panel {
  flex: 0 0 152px;
}

.detail-head {
  padding: 18px 20px 8px;
  display: block;
}

.detail-icon {
  display: none;
}

.detail-head h3 {
  font-size: 22px;
}

.detail-head p {
  font-size: 12px;
}

.fact-list {
  padding: 0 20px 12px;
}

.fact-list div {
  display: block;
  grid-template-columns: none;
}

.fact-list dd {
  margin: 0;
}

.fact-list .info-summary {
  padding: 2px 0 16px;
  border-bottom: 1px solid rgba(82, 210, 246, 0.14);
}

.fact-list .hover-summary {
  padding-left: 12px;
  border-left: 3px solid var(--detail-accent);
}

.fact-list .info-summary dd {
  color: #c1d5df;
  font-size: 12px;
  line-height: 1.45;
}

.info-group {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid rgba(82, 210, 246, 0.14);
}

.info-group dt {
  margin: 0 0 10px;
  color: #dff9ff;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.info-group dd {
  margin: 0;
}

.key-functions ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.key-functions li {
  position: relative;
  padding-left: 18px;
  color: #d1e4ed;
  font-size: 11px;
  line-height: 1.3;
}

.key-functions li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, transparent 0 45%, #ffffff 46% 53%, transparent 54%),
    #37d489;
  box-shadow: 0 0 10px rgba(55, 212, 137, 0.35);
}

.quick-facts dd {
  display: grid;
  gap: 6px;
}

.quick-facts span {
  color: #d7e8f0;
  font-size: 11px;
  line-height: 1.3;
}

.quick-facts b {
  display: inline-block;
  width: 68px;
  color: #9fb5c4;
  font-weight: 700;
}

.label-toggle {
  display: none;
}

.notes-panel p {
  padding: 14px 16px 0;
  font-size: 12px;
}

.notes-panel .fun-fact {
  margin: 10px 16px 0;
  padding: 10px 12px;
}

.microscope-strip {
  height: calc(100% - 43px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
}

.scope-mode {
  min-width: 0;
  display: grid;
  grid-template-rows: 38px 1fr;
  place-items: center;
  gap: 4px;
  border: 1px solid rgba(82, 210, 246, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: #d9f7ff;
  cursor: pointer;
}

.scope-mode[aria-pressed="true"],
.scope-mode:hover,
.scope-mode:focus-visible {
  border-color: rgba(93, 229, 255, 0.82);
  background: rgba(53, 215, 255, 0.13);
  outline: none;
}

.scope-mode strong {
  max-width: 100%;
  padding: 0 4px;
  color: #d9f7ff;
  font-size: 9px;
  line-height: 1.14;
  text-align: center;
  overflow-wrap: normal;
}

.scope-light-icon,
.scope-glow-icon,
.scope-electron-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: block;
  color: currentColor;
}

.scope-light-icon::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 2px;
  width: 6px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 3px;
  transform: rotate(28deg);
}

.scope-light-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 2px;
  width: 18px;
  height: 4px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 10px 10px;
}

.scope-glow-icon::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid #50ff83;
  box-shadow: 0 0 14px rgba(80, 255, 131, 0.75), inset 0 0 10px rgba(80, 255, 131, 0.22);
}

.scope-glow-icon::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #50ff83;
}

.scope-electron-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 10px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.scope-electron-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 2px;
  width: 18px;
  height: 3px;
  background: currentColor;
  box-shadow: 5px -5px 0 -1px currentColor;
}

.structure-legend {
  height: calc(100% - 43px);
  display: grid;
  grid-template-columns: minmax(148px, 0.8fr) minmax(0, 1.2fr);
  gap: 8px;
  padding: 8px;
}

.legend-focus {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--legend) 42%, rgba(82, 210, 246, 0.14));
  border-radius: 7px;
  padding: 8px;
  background:
    radial-gradient(circle at 12px 12px, color-mix(in srgb, var(--legend) 38%, transparent), transparent 32px),
    rgba(255, 255, 255, 0.035);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.legend-focus[data-legend-mode="hover"] {
  border-color: color-mix(in srgb, var(--legend) 76%, rgba(93, 229, 255, 0.48));
  background:
    radial-gradient(circle at 12px 12px, color-mix(in srgb, var(--legend) 48%, transparent), transparent 34px),
    color-mix(in srgb, var(--legend) 14%, rgba(255, 255, 255, 0.04));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--legend) 18%, transparent);
}

.legend-focus span,
.legend-item b {
  color: #7f9cad;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legend-focus strong {
  color: #f4fdff;
  font-size: 14px;
  line-height: 1.05;
}

.legend-focus p {
  margin: 0;
  color: #a9c3d2;
  font-size: 10px;
  line-height: 1.25;
}

.legend-items {
  min-height: 0;
  display: grid;
  gap: 6px;
  overflow: auto;
  scrollbar-width: thin;
}

.legend-item {
  min-width: 0;
  min-height: 28px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(82, 210, 246, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  color: #d9f7ff;
  cursor: pointer;
  text-align: left;
}

.legend-item:hover,
.legend-item:focus-visible,
.legend-item[aria-current="true"] {
  border-color: color-mix(in srgb, var(--legend) 72%, rgba(93, 229, 255, 0.48));
  background: color-mix(in srgb, var(--legend) 16%, rgba(53, 215, 255, 0.08));
  outline: none;
}

.legend-item[data-legend-mode="hover"][aria-current="true"] {
  box-shadow: inset 3px 0 0 var(--legend);
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--legend);
  box-shadow: 0 0 12px color-mix(in srgb, var(--legend) 58%, transparent);
}

.legend-item span {
  min-width: 0;
}

.legend-item strong,
.legend-item em {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-item strong {
  color: #eefbff;
  font-size: 10px;
  line-height: 1.1;
}

.legend-item em {
  margin-top: 1px;
  color: #87a4b7;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}

.gallery-row {
  height: 100%;
  min-height: 96px;
  grid-template-columns: 30px repeat(4, minmax(0, 1fr)) 30px;
  gap: 8px;
  padding: 0;
}

.gallery-card {
  position: relative;
  display: block;
  min-height: 0;
  overflow: hidden;
}

.gallery-thumb {
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 50% 50%, rgba(70, 220, 255, 0.1), transparent 58%),
    rgba(255, 255, 255, 0.035) var(--thumb) center / contain no-repeat;
  transform: scale(1.01);
  transition: transform 180ms ease, filter 180ms ease;
}

.gallery-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 32px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(2, 9, 18, 0.34));
}

.gallery-card:hover .gallery-thumb,
.gallery-card:focus-visible .gallery-thumb,
.gallery-card[aria-current="true"] .gallery-thumb {
  transform: scale(1.055);
  filter: saturate(1.08) contrast(1.04);
}

.gallery-card > span:last-child {
  position: absolute;
  z-index: 2;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.gallery-card strong {
  display: block;
  font-size: 10px;
  line-height: 1.1;
  color: #f4fdff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}

.gallery-card span span {
  display: block;
  margin-top: 2px;
  color: #a9c3d2;
  font-size: 8px;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(93, 229, 255, 0.48);
  border-radius: 999px;
  background: rgba(4, 13, 24, 0.94);
  color: #e8fbff;
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.36);
}

.app-toast[data-visible="true"] {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .studio-shell {
    padding: 8px;
  }

  .topbar {
    position: relative;
    inset: auto;
    height: auto;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .brand {
    width: 100%;
    min-width: 0;
  }

  .brand strong {
    font-size: 22px;
  }

  .brand em {
    max-width: none;
  }

  .title-block {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    transform: none;
    z-index: auto;
    order: 2;
  }

  .global-search {
    left: 0;
    right: auto;
    top: calc(100% + 8px);
    width: calc(100vw - 30px);
  }

  .search-suggestions {
    position: relative;
    top: auto;
    max-height: 320px;
    margin-top: 6px;
  }

  .search-suggestion {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .search-suggestion-kind {
    justify-self: start;
    grid-column: 2;
  }

  .top-actions {
    width: 100%;
    height: auto;
    margin-left: 0;
    order: 3;
    overflow: visible;
  }

  .workspace {
    height: auto;
    display: flex;
    flex-direction: column;
  }

  .organelle-panel {
    display: none;
  }

  .left-sidebar,
  .right-sidebar,
  .stage-column,
  .bottom-grid {
    display: flex;
  }

  .stage-column,
  .bottom-grid,
  .right-sidebar {
    flex-direction: column;
  }

  .stage-card {
    min-height: 560px;
  }

  .canvas-actions {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    justify-content: center;
    gap: 6px;
    padding: 8px;
  }

  .canvas-actions button {
    flex: 1 1 0;
    min-width: 0;
    height: 40px;
  }
}

@media (max-width: 980px) {
  .workspace {
    gap: 10px;
  }

  .stage-column {
    display: contents;
  }

  .stage-card {
    order: 1;
  }

  .left-sidebar {
    order: 2;
  }

  .bottom-grid {
    order: 3;
  }

  .right-sidebar {
    order: 4;
  }

  .stage-card {
    height: clamp(430px, 62svh, 560px);
    min-height: 0;
    border-radius: 12px;
  }

  .studio-shell[data-help-open="true"] .tip-note {
    position: static;
    z-index: auto;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    transform: none;
  }

  .tip-note strong,
  .tip-note span {
    display: inline;
    font-size: 10px;
    line-height: 1.2;
  }

  .stage-card::before {
    inset: 8px;
  }

  #cellCanvas {
    touch-action: none;
  }

  .canvas-actions {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    transform: none;
    padding: 6px;
    border: 1px solid rgba(93, 229, 255, 0.24);
    border-radius: 10px;
    background: rgba(3, 12, 22, 0.74);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(16px);
  }

  .canvas-actions button {
    min-width: 0;
    height: 48px;
    gap: 5px;
    padding: 0 7px;
    border-radius: 8px;
    color: #e5fbff;
    font-size: 10px;
    line-height: 1;
    touch-action: manipulation;
  }

  .canvas-actions button span {
    flex: 0 0 auto;
  }

  .specimen-dropdowns {
    height: auto;
    overflow: visible;
  }

  .specimen-dropdown-menu {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    scroll-snap-type: x proximity;
  }

  #cellDropdownMenu,
  #originDropdownMenu {
    flex: none;
    min-height: 0;
    max-height: none;
  }

  .cell-button {
    flex: 0 0 min(188px, 72vw);
    min-height: 74px;
    grid-template-columns: 56px minmax(0, 1fr);
    scroll-snap-align: start;
  }

  .cell-thumb {
    width: 54px;
    height: 54px;
  }

  .microscope-panel,
  .legend-panel,
  .detail-panel,
  .notes-panel,
  .occurs-panel {
    min-height: auto;
  }

  .microscope-strip {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scope-mode {
    min-height: 82px;
  }

  .structure-legend {
    height: auto;
    grid-template-columns: 1fr;
  }

  .legend-items {
    max-height: 170px;
  }
}

@media (max-width: 560px) {
  .studio-shell {
    padding: 6px;
  }

  .topbar {
    gap: 6px;
    margin-bottom: 8px;
  }

  .top-actions {
    gap: 4px;
    padding: 5px;
  }

  .top-actions > button,
  .top-search-control,
  .top-search-control > button {
    width: 52px;
    min-width: 0;
    flex-basis: 52px;
  }

  .top-actions > button,
  .top-search-control > button {
    height: 46px;
  }

  .stage-card {
    height: clamp(410px, 58svh, 500px);
  }

  .canvas-actions {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 5px;
  }

  .canvas-actions button {
    height: 46px;
    flex-direction: column;
    gap: 3px;
    padding: 0 4px;
    font-size: 9px;
  }

  .cell-button {
    flex-basis: min(174px, 78vw);
  }
}
