/* V1.0 Visual UI */

.visual-panel {
  border: 1px solid #35506a;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 20% 15%, rgba(70, 150, 255, 0.18), transparent 28%),
    radial-gradient(circle at 85% 70%, rgba(88, 255, 196, 0.12), transparent 32%),
    #0d1218;
  padding: 14px;
  margin-bottom: 22px;
  overflow: hidden;
}

.visual-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.visual-title-row strong {
  color: var(--bio-blue-pale);
  font-size: 18px;
}

.visual-title-row small {
  color: #8ba6bd;
}

.visual-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.hud-card {
  border: 1px solid #2f4357;
  border-radius: 12px;
  background: rgba(16, 28, 39, 0.84);
  padding: 10px;
}

.hud-card span {
  display: block;
  color: #8ba6bd;
  font-size: 12px;
}

.hud-card strong {
  display: block;
  margin-top: 3px;
  color: #f3f8ff;
  font-size: 22px;
}

.cell-map {
  position: relative;
  width: 100%;
  min-height: 520px;
  border: 1px solid #263a4e;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04) 0 25%, transparent 25% 50%, rgba(255,255,255,0.03) 50% 75%, transparent 75% 100%),
    radial-gradient(circle at 44% 43%, rgba(55, 117, 255, 0.08), transparent 42%),
    var(--bio-bg-deepest);
  background-size: 24px 24px, auto, auto;
  overflow: hidden;
}

.cell-zone {
  position: absolute;
  border: 1px solid rgba(130, 190, 255, 0.42);
  border-radius: var(--radius-xl);
  background: rgba(23, 42, 58, 0.56);
  box-shadow: inset 0 0 22px rgba(95, 168, 255, 0.08);
}

.cell-zone.mitochondrial_inner_membrane {
  border-color: rgba(255, 198, 89, 0.72);
  background: rgba(68, 48, 18, 0.42);
}

.cell-zone.mitochondrial_matrix {
  border-color: rgba(255, 220, 135, 0.65);
  background: rgba(85, 64, 25, 0.45);
}

.cell-zone.thylakoid_membrane {
  border-color: rgba(72, 230, 139, 0.62);
  background: rgba(23, 77, 41, 0.42);
}

.cell-zone.stroma {
  border-color: rgba(96, 255, 181, 0.42);
  background: rgba(17, 55, 38, 0.36);
}

.cell-zone-label {
  position: absolute;
  left: 12px;
  top: 10px;
  color: var(--bio-blue-pale);
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 2px #000;
}

.cell-zone-subtitle {
  position: absolute;
  left: 12px;
  top: 31px;
  color: #91aabe;
  font-size: 11px;
}

.visual-particle {
  position: absolute;
  z-index: 10;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  color: #071018;
  background: var(--bio-blue-soft);
  box-shadow: 0 0 12px rgba(142, 212, 255, 0.95);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.visual-particle.ATP { background: var(--bio-gold-soft); box-shadow: 0 0 15px rgba(255, 226, 122, 0.9); }
.visual-particle.NADH { background: #9fffbf; box-shadow: 0 0 15px rgba(159, 255, 191, 0.9); }
.visual-particle.FADH2 { background: #c7a6ff; box-shadow: 0 0 15px rgba(199, 166, 255, 0.9); }
.visual-particle.oxygen { background: #9cc9ff; box-shadow: 0 0 15px rgba(156, 201, 255, 0.9); }
.visual-particle.pyruvate { background: #ffb982; box-shadow: 0 0 15px rgba(255, 185, 130, 0.9); }
.visual-particle.glucose { background: #ff8fa3; box-shadow: 0 0 15px rgba(255, 143, 163, 0.9); }
.visual-particle.protonGradient { background: #ff8cff; box-shadow: 0 0 15px rgba(255, 140, 255, 0.9); }

.visual-burst {
  position: absolute;
  z-index: 9;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  border: 2px solid rgba(160, 220, 255, 0.9);
  transform: translate(-50%, -50%) scale(0.25);
  opacity: 0.95;
  pointer-events: none;
}

.visual-tooltip {
  position: fixed;
  z-index: 999;
  max-width: 340px;
  border: 1px solid #5c7894;
  border-radius: var(--radius-md);
  background: rgba(10, 18, 27, 0.96);
  color: #f3f8ff;
  padding: 12px 14px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.45);
}

.visual-tooltip strong {
  display: block;
  color: #ffdf7e;
  margin-bottom: 6px;
}

.visual-tooltip small {
  color: #9fb4c8;
}

@keyframes recommendedPulse {
  0% {
    box-shadow: 0 0 0 rgba(100, 180, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 24px rgba(100, 180, 255, 0.95);
  }
  100% {
    box-shadow: 0 0 0 rgba(100, 180, 255, 0.2);
  }
}

.reaction-button.recommended {
  animation: recommendedPulse 1.15s infinite;
}


/* V1.1 ghost flow and learning UX */
.ghost-flow-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ghost-flow-path {
  stroke: rgba(126, 202, 255, 0.86);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 8 10;
  fill: none;
  filter: drop-shadow(0 0 8px rgba(126, 202, 255, 0.95));
  animation: ghostDash 1.1s linear infinite;
}

.ghost-flow-dot {
  fill: rgba(142, 212, 255, 0.95);
  filter: drop-shadow(0 0 6px rgba(142, 212, 255, 0.95));
}

.ghost-flow-label {
  fill: var(--bio-blue-pale);
  font-size: 12px;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(3, 10, 18, 0.88);
  stroke-width: 3px;
}

@keyframes ghostDash {
  to {
    stroke-dashoffset: -36;
  }
}

.learning-hint-box {
  border: 1px solid #4f6f8e;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(20, 42, 63, 0.92), rgba(17, 24, 32, 0.92));
  padding: 12px;
  min-height: 92px;
  margin-bottom: 22px;
}

.learning-hint-box strong {
  display: block;
  color: var(--bio-blue-soft);
  margin-bottom: 6px;
}

.learning-hint-box p {
  margin: 0;
  color: #d5e6f7;
  line-height: 1.45;
}

.learning-hint-box small {
  display: block;
  margin-top: 8px;
  color: #91aabe;
}

.visual-tooltip {
  line-height: 1.45;
}

.visual-tooltip .tip-action {
  margin-top: 8px;
  color: var(--bio-blue-soft);
  font-weight: 800;
}

.reaction-button.recommended {
  animation: recommendedPulse 1s infinite;
  background: linear-gradient(135deg, #173b61, #1b2c43);
}

.reaction-button.ready:hover {
  transform: translateX(3px);
}

.reaction-button.unavailable:hover {
  opacity: 0.75;
}


/* V1.1.1 self-loop ghost flow */
.ghost-flow-path.self-loop {
  stroke: rgba(255, 226, 122, 0.9);
  filter: drop-shadow(0 0 10px rgba(255, 226, 122, 0.95));
}

.ghost-flow-loop-center {
  fill: rgba(255, 226, 122, 0.95);
  filter: drop-shadow(0 0 8px rgba(255, 226, 122, 0.95));
}

.ghost-flow-label.self-loop {
  fill: var(--bio-gold-soft);
}

/* V1.1.1 safer tooltip anchoring */
.visual-tooltip.anchor-button {
  position: fixed;
  transform: translateY(-4px);
}


/* V1.2 reflective guardrails */
.reflection-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(2, 8, 14, 0.68);
  backdrop-filter: blur(5px);
}

.reflection-card {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid rgba(142, 212, 255, 0.65);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 20% 0%, rgba(142, 212, 255, 0.22), transparent 32%),
    #0c1520;
  color: #edf7ff;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55), 0 0 30px rgba(142, 212, 255, 0.22);
}

.reflection-card .reflection-kicker {
  display: inline-block;
  color: var(--bio-gold-soft);
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 8px;
}

.reflection-card strong {
  display: block;
  font-size: 21px;
  line-height: 1.25;
  margin-bottom: 10px;
}

.reflection-card p {
  color: #d8e8f7;
  line-height: 1.55;
  margin: 0 0 10px;
}

.reflection-card small {
  display: block;
  color: #91caff;
  line-height: 1.45;
  margin-bottom: 16px;
}

.reflection-card button {
  width: 100%;
  border: 1px solid rgba(142, 212, 255, 0.8);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #163b5d;
  color: #f5fbff;
  font-weight: 900;
}

.atp-synthase-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  z-index: 3;
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 226, 122, 0.88);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--bio-gold-soft);
  font-size: 12px;
  font-weight: 1000;
  background: radial-gradient(circle, rgba(255,226,122,0.18), rgba(18,15,4,0.8));
  box-shadow: 0 0 18px rgba(255, 226, 122, 0.34);
  transform: translate(-50%, -50%);
}

.cell-zone.mitochondrial_inner_membrane {
  transition: box-shadow 240ms ease, background 240ms ease;
}


/* V1.2.1 top-safe self-loop + environment preview */
.ghost-flow-env-ring {
  fill: rgba(142, 212, 255, 0.06);
  stroke: rgba(142, 212, 255, 0.92);
  stroke-width: 3;
  stroke-dasharray: 6 9;
  filter: drop-shadow(0 0 12px rgba(142, 212, 255, 0.9));
  animation: ghostDash 1.1s linear infinite;
}

.ghost-flow-label.environment {
  fill: var(--bio-blue-soft);
}

button.touch-preview-active {
  outline: 2px solid rgba(255, 226, 122, 0.95);
  box-shadow: 0 0 0 4px rgba(255, 226, 122, 0.16), 0 0 22px rgba(255, 226, 122, 0.36);
}

button.touch-preview-active::after {
  content: " 한 번 더 누르면 실행";
  font-size: 11px;
  opacity: 0.9;
}


/* V1.2.2 one-screen visual adjustments */
@media (min-width: 981px) {
  .cell-map.one-screen-map {
    min-height: 0;
  }

  .visual-tooltip {
    max-width: min(360px, calc(100vw - 24px));
  }

  .reflection-card {
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
  }
}


/* V1.3 MotionPath particles and Apple-like glass */
.motion-path-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.motion-trace {
  fill: none;
  stroke: rgba(142, 212, 255, 0.38);
  stroke-width: 1.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(142, 212, 255, 0.55));
}

.visual-particle.motion-path-particle {
  z-index: 12;
  will-change: left, top, opacity, transform;
}

.visual-particle.proton-pump-particle {
  z-index: 13;
  color: #1a0720;
  font-size: 9px;
  box-shadow: 0 0 20px rgba(255, 140, 255, 0.95), 0 0 34px rgba(255, 140, 255, 0.38);
}

.proton-pump-channel {
  position: absolute;
  z-index: 6;
  width: 14px;
  height: 72px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 226, 122, 0.74);
  background: linear-gradient(to top, rgba(255, 140, 255, 0.1), rgba(255, 226, 122, 0.26));
  box-shadow: 0 0 18px rgba(255, 226, 122, 0.34);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.visual-panel,
.panel,
.hud-card,
.learning-hint-box,
.next-step-box,
.reflection-card {
  backdrop-filter: blur(18px);
}

.cell-zone {
  background: rgba(23, 42, 58, 0.44);
  backdrop-filter: blur(10px);
  border-color: rgba(180, 220, 255, 0.26);
}

.ghost-flow-path {
  stroke-width: 1.8;
  filter: drop-shadow(0 0 5px rgba(126, 202, 255, 0.72));
}

.ghost-flow-path.self-loop {
  stroke-width: 1.8;
  filter: drop-shadow(0 0 6px rgba(255, 226, 122, 0.75));
}

.reaction-button.recommended,
.environment-button.recommended {
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), box-shadow 180ms cubic-bezier(.2,.8,.2,1);
}

.reaction-button.recommended:active,
.environment-button.recommended:active,
button.touch-preview-active {
  transform: translateX(2px) scale(0.985);
}


/* V1.3.1 hidden overlay safety */
.reflection-overlay[hidden],
.visual-tooltip[hidden],
[hidden] {
  display: none !important;
  pointer-events: none !important;
}

/* V1.4 visual premium refinements are included in prototype.css for cascade priority. */


/* V1.5 Visual Cell Map 2.0 */
.cell-map-v2 {
  isolation: isolate;
  --oxygen-intensity: 0;
  --gradient-intensity: 0;
}

.cell-map-scaffold {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bio-map-grid {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 38%, rgba(255, 224, 114, calc(0.04 + var(--oxygen-intensity) * 0.08)), transparent 28%),
    radial-gradient(circle at 74% 75%, rgba(157, 255, 190, 0.07), transparent 32%),
    radial-gradient(circle at 24% 42%, rgba(161, 207, 255, 0.06), transparent 34%),
    linear-gradient(120deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 32px),
    linear-gradient(30deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 36px);
}

.bio-organelle-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.organelle {
  vector-effect: non-scaling-stroke;
}

.cytosol-field {
  fill: rgba(56, 102, 156, 0.12);
  stroke: rgba(161, 207, 255, 0.24);
  stroke-width: 0.45;
  filter: url(#bioGlow);
}

.organelle-outline {
  fill: rgba(15, 28, 40, 0.30);
  stroke-width: 0.7;
  filter: url(#bioGlow);
}

.mitochondrion-outline {
  fill: url(#mitoMembrane);
  stroke: rgba(255, 224, 114, 0.36);
}

.chloroplast-outline {
  fill: url(#chloroMembrane);
  stroke: rgba(157, 255, 190, 0.32);
}

.organelle-core {
  fill: rgba(255, 255, 255, 0.035);
  stroke-width: 0.35;
}

.matrix-core {
  stroke: rgba(255, 224, 114, 0.28);
}

.stroma-core {
  stroke: rgba(157, 255, 190, 0.24);
}

.mitochondrion-cristae {
  fill: none;
  stroke: rgba(255, 224, 114, 0.44);
  stroke-width: 0.75;
  stroke-linecap: round;
}

.thylakoid-stack {
  fill: none;
  stroke: rgba(157, 255, 190, 0.50);
  stroke-width: 0.85;
  stroke-linecap: round;
}

.sugar-route-hint {
  fill: none;
  stroke: rgba(255, 224, 114, 0.26);
  stroke-width: 0.55;
  stroke-dasharray: 1.4 1.8;
}

.atp-synthase-svg-group {
  transform-box: fill-box;
  transform-origin: center;
}

.atp-synthase-ring,
.atp-synthase-head {
  fill: rgba(255, 224, 114, 0.18);
  stroke: rgba(255, 224, 114, 0.74);
  stroke-width: 0.45;
}

.atp-synthase-stalk {
  fill: rgba(255, 224, 114, 0.50);
}

.bio-organelle-layer.gradient-charged .mitochondrion-outline {
  stroke: rgba(255, 153, 255, 0.58);
  filter: drop-shadow(0 0 6px rgba(255, 153, 255, 0.42));
}

.cell-map-v2 .cell-zone {
  z-index: 3;
  border-style: solid;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.055), rgba(255,255,255,0.010)),
    rgba(15, 25, 37, 0.24);
  backdrop-filter: blur(3px);
  cursor: pointer;
  text-align: left;
}

.cell-map-v2 .cell-zone:hover,
.cell-map-v2 .cell-zone:focus-visible,
.cell-map-v2 .cell-zone.selected-zone {
  border-color: rgba(161, 207, 255, 0.86);
  box-shadow:
    0 0 0 2px rgba(161, 207, 255, 0.14),
    0 0 28px rgba(161, 207, 255, 0.24),
    inset 0 1px 0 rgba(255,255,255,0.10);
  outline: none;
}

.cell-map-v2 .cell-zone.selected-zone::after {
  content: "선택";
  position: absolute;
  right: 8px;
  bottom: 7px;
  border-radius: var(--radius-pill);
  padding: 2px 7px;
  background: rgba(161, 207, 255, 0.18);
  border: 1px solid rgba(161, 207, 255, 0.36);
  color: #dff0ff;
  font-size: 10px;
  font-weight: 900;
}

.reaction-button.map-related {
  border-color: rgba(255, 224, 114, 0.9) !important;
  box-shadow:
    0 0 0 1px rgba(255, 224, 114, 0.28),
    0 0 24px rgba(255, 224, 114, 0.30) !important;
}

.context-guide-bar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 20;
  width: min(92%, 640px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid rgba(161, 207, 255, 0.22);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.085), rgba(255,255,255,0.022)),
    rgba(8, 15, 24, 0.82);
  box-shadow: 0 18px 44px rgba(0,0,0,0.30), inset 0 1px 0 var(--overlay-03);
  backdrop-filter: blur(20px) saturate(1.28);
  transform: translateX(-50%);
}

.context-guide-bar[hidden] {
  display: none !important;
}

.context-guide-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: rgba(161, 207, 255, 0.18);
  border: 1px solid rgba(161, 207, 255, 0.32);
  color: #dff0ff;
  font-weight: 900;
}

.context-guide-copy {
  min-width: 0;
}

.context-guide-copy strong {
  display: block;
  color: #f6fbff;
  font-size: 13px;
  line-height: 1.1;
}

.context-guide-copy span {
  display: block;
  margin-top: 3px;
  color: rgba(222, 238, 255, 0.78);
  font-size: 12px;
  line-height: 1.3;
}

.context-guide-close {
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: var(--radius-pill);
  font-size: 18px;
  line-height: 1;
}

.context-guide-bar[data-tone="warning"] {
  border-color: rgba(255, 224, 114, 0.40);
}

.context-guide-bar[data-tone="warning"] .context-guide-icon {
  background: rgba(255, 224, 114, 0.16);
  border-color: rgba(255, 224, 114, 0.38);
  color: var(--bio-gold);
}

.context-guide-bar[data-tone="success"] {
  border-color: rgba(157, 255, 190, 0.36);
}

.context-guide-bar[data-tone="success"] .context-guide-icon {
  background: rgba(157, 255, 190, 0.14);
  border-color: rgba(157, 255, 190, 0.34);
  color: var(--bio-mint);
}

.context-guide-bar[data-tone="compartment"] {
  border-color: rgba(161, 207, 255, 0.40);
}

@media (max-width: 980px) {
  .context-guide-bar {
    width: min(94%, 600px);
    bottom: 10px;
    padding: 9px 10px;
  }

  .context-guide-copy strong {
    font-size: 12px;
  }

  .context-guide-copy span {
    font-size: 10.8px;
  }
}


/* V1.5.2 iPhone-first map buttons. No CDN, no observer, no wide canvas. */
.visual-hud,
.compact-hud,
#visualHud {
  display: none !important;
}

.bio-organelle-layer,
.organelle,
.mitochondrion-shell,
.chloroplast-shell {
  display: none !important;
}

.cell-map-buttons {
  min-height: 460px !important;
  height: 460px !important;
  background:
    radial-gradient(circle at 28% 18%, rgba(82, 149, 255, 0.12), transparent 34%),
    radial-gradient(circle at 72% 44%, rgba(255, 224, 114, 0.10), transparent 34%),
    radial-gradient(circle at 66% 76%, rgba(127, 255, 189, 0.10), transparent 30%),
    linear-gradient(135deg, rgba(255,255,255,0.035) 0 25%, transparent 25% 50%, rgba(255,255,255,0.025) 50% 75%, transparent 75% 100%),
    var(--bio-bg-deepest) !important;
  background-size: auto, auto, auto, 24px 24px, auto !important;
}

.button-map-scaffold {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-section-label {
  position: absolute;
  z-index: 1;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(12, 22, 34, 0.70);
  border: 1px solid rgba(161, 207, 255, 0.14);
  color: rgba(221, 238, 255, 0.50);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.map-section-mito {
  left: 5%;
  top: 29%;
}

.map-section-chloro {
  left: 5%;
  top: 55%;
}

.map-button-zone {
  z-index: 3;
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 12px !important;
  border-radius: var(--radius-xl) !important;
  text-align: left;
  cursor: pointer;
  border: 1px solid rgba(126, 202, 255, 0.32) !important;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.09), rgba(255,255,255,0.025)),
    rgba(16, 30, 45, 0.72) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 12px 32px rgba(0,0,0,0.18) !important;
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.map-button-zone.mitochondrial_matrix,
.map-button-zone.mitochondrial_inner_membrane {
  border-color: rgba(255, 224, 114, 0.32) !important;
  background:
    linear-gradient(145deg, rgba(255,224,114,0.13), rgba(255,255,255,0.025)),
    rgba(41, 32, 18, 0.66) !important;
}

.map-button-zone.stroma,
.map-button-zone.thylakoid_membrane,
.map-button-zone.chloroplast_cytosol_interface {
  border-color: rgba(157, 255, 190, 0.28) !important;
  background:
    linear-gradient(145deg, rgba(157,255,190,0.11), rgba(255,255,255,0.025)),
    rgba(18, 45, 31, 0.64) !important;
}

.map-button-zone.cell_summary {
  border-color: rgba(161, 207, 255, 0.22) !important;
  background: rgba(18, 30, 44, 0.56) !important;
}

.map-zone-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: rgba(161, 207, 255, 0.10);
  color: var(--bio-blue);
}

.map-button-zone.mitochondrial_matrix .map-zone-icon,
.map-button-zone.mitochondrial_inner_membrane .map-zone-icon {
  background: rgba(255, 224, 114, 0.12);
  color: var(--bio-gold);
}

.map-button-zone.stroma .map-zone-icon,
.map-button-zone.thylakoid_membrane .map-zone-icon,
.map-button-zone.chloroplast_cytosol_interface .map-zone-icon {
  background: rgba(157, 255, 190, 0.11);
  color: var(--bio-mint);
}

.static-icon {
  width: 23px;
  height: 23px;
}

.map-zone-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.cell-map-buttons .cell-zone-label {
  position: static !important;
  opacity: 1 !important;
  transform: none !important;
  display: block;
  color: #eff7ff !important;
  font-size: 14px !important;
  font-weight: 950 !important;
  line-height: 1.15;
  text-shadow: none !important;
}

.cell-map-buttons .cell-zone-subtitle {
  position: static !important;
  opacity: 1 !important;
  transform: none !important;
  display: block;
  color: rgba(222, 238, 255, 0.62) !important;
  font-size: 10.5px !important;
  line-height: 1.25;
  text-shadow: none !important;
}

.map-button-zone:hover,
.map-button-zone:focus-visible,
.map-button-zone.selected-zone {
  outline: none;
  border-color: rgba(161, 207, 255, 0.92) !important;
  box-shadow:
    0 0 0 2px rgba(161, 207, 255, 0.14),
    0 0 28px rgba(161, 207, 255, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.10) !important;
}

.map-button-zone.env-target-zone {
  border-color: rgba(255, 224, 114, 0.94) !important;
  box-shadow:
    0 0 0 2px rgba(255, 224, 114, 0.16),
    0 0 32px rgba(255, 224, 114, 0.28),
    inset 0 1px 0 rgba(255,255,255,0.10) !important;
}

.map-button-zone.env-target-zone::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  border: 1px solid rgba(255, 224, 114, 0.28);
  animation: bioTargetPulse 1.1s ease-in-out infinite;
  pointer-events: none;
}

@keyframes bioTargetPulse {
  0%, 100% { transform: scale(0.98); opacity: 0.26; }
  50% { transform: scale(1.04); opacity: 0.72; }
}

.env-pill-dock {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px !important;
  margin-bottom: 18px !important;
}

.env-pill-group {
  position: relative;
  min-width: 0;
}

.env-pill-trigger {
  width: 100%;
  min-height: 50px;
  display: grid;
  place-items: center;
  grid-template-rows: auto auto;
  gap: 1px;
  padding: 7px 4px !important;
  border-radius: 17px !important;
  background:
    linear-gradient(145deg, var(--overlay-03), var(--overlay-01)),
    rgba(20, 36, 52, 0.72) !important;
  border-color: rgba(126, 202, 255, 0.35) !important;
}

.env-pill-icon {
  font-size: 15px;
  line-height: 1;
  font-weight: 950;
  color: var(--bio-text-soft);
}

.env-pill-text {
  color: rgba(222, 238, 255, 0.62);
  font-size: 9.5px;
  font-weight: 900;
}

.env-pill-group.active .env-pill-trigger {
  border-color: rgba(255, 224, 114, 0.86) !important;
  box-shadow:
    0 0 0 2px rgba(255, 224, 114, 0.12),
    0 0 24px rgba(255, 224, 114, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.10);
}

.env-pill-options {
  position: absolute;
  left: 50%;
  top: calc(100% + 5px);
  z-index: 40;
  display: flex;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(161, 207, 255, 0.22);
  border-radius: 16px;
  background: rgba(8, 15, 24, 0.94);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
  box-shadow: 0 18px 42px rgba(0,0,0,0.32);
}

.env-pill-options[hidden] {
  display: none !important;
}

.env-pill-option {
  min-width: 42px !important;
  min-height: 34px !important;
  padding: 6px 8px !important;
  border-radius: 12px !important;
  font-weight: 950 !important;
}

.context-resource-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.context-resource-chips[hidden] {
  display: none !important;
}

.resource-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 130px;
  padding: 4px 7px;
  border: 1px solid rgba(161, 207, 255, 0.20);
  border-radius: var(--radius-pill);
  background: rgba(161, 207, 255, 0.075);
  color: rgba(235, 247, 255, 0.88);
  font-size: 10.5px;
  line-height: 1;
}

.resource-chip b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-chip em {
  font-style: normal;
  color: var(--bio-blue);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.resource-chip.important {
  border-color: rgba(255, 224, 114, 0.30);
  background: rgba(255, 224, 114, 0.095);
}

.resource-chip.important em {
  color: var(--bio-gold);
}

@media (max-width: 980px) {
  html,
  body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    touch-action: pan-y !important;
  }

  body {
    padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
  }

  .topbar.compact-topbar,
  .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 1200 !important;
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    align-items: center !important;
    gap: 8px !important;
    padding: max(8px, env(safe-area-inset-top)) 10px 9px !important;
    min-height: 0 !important;
  }

  .eyebrow {
    font-size: 10.5px !important;
    margin-bottom: 2px !important;
    letter-spacing: 0.02em !important;
  }

  h1 {
    font-size: 21px !important;
    line-height: 1.08 !important;
  }

  .subtitle {
    display: none !important;
  }

  .top-actions {
    margin: 0 !important;
    gap: 6px !important;
  }

  .top-actions button {
    min-height: 38px !important;
    padding: 8px 10px !important;
    border-radius: var(--radius-md) !important;
    font-size: 13px !important;
  }

  .one-screen-shell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    gap: 10px !important;
    padding: 10px !important;
    overflow: visible !important;
  }

  .visual-workspace[data-mobile-panel="visual"] {
    grid-column: 1 !important;
    grid-row: 1 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    padding: 12px !important;
  }

  .control-panel[data-mobile-panel="controls"] {
    grid-column: 1 !important;
    grid-row: 2 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    padding: 12px !important;
  }

  .process-panel[data-mobile-panel="process"] {
    grid-column: 1 !important;
    grid-row: 3 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    padding: 12px !important;
  }

  .panel-head h2,
  .visual-title-row strong,
  h2 {
    font-size: 19px !important;
  }

  .visual-title-row small,
  .panel-head small {
    display: none !important;
  }

  .one-screen-visual {
    margin-bottom: 12px !important;
  }

  .cell-map,
  .one-screen-map,
  .cell-map-buttons {
    width: 100% !important;
    height: 500px !important;
    min-height: 500px !important;
    max-height: none !important;
    overflow: hidden !important;
    touch-action: pan-y !important;
  }

  .map-button-zone {
    border-radius: 19px !important;
    padding: 10px !important;
    gap: 8px !important;
  }

  .map-zone-icon {
    width: 30px;
    height: 30px;
    border-radius: 12px;
  }

  .static-icon {
    width: 20px;
    height: 20px;
  }

  .cell-map-buttons .cell-zone-label {
    font-size: 12.8px !important;
  }

  .cell-map-buttons .cell-zone-subtitle {
    font-size: 9.5px !important;
  }

  .context-guide-bar {
    bottom: 10px !important;
    width: min(94%, 520px) !important;
    padding: 9px 10px !important;
    border-radius: 17px !important;
  }

  .context-guide-copy strong {
    font-size: 12px !important;
  }

  .context-guide-copy span {
    font-size: 10.5px !important;
  }

  .env-pill-dock {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .button-grid.compact-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .button-grid.compact-grid button {
    min-height: 42px !important;
    padding: 8px 7px !important;
    border-radius: 15px !important;
    font-size: 12px !important;
  }

  .scroll-stack {
    max-height: 280px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .focus-strip {
    display: grid !important;
    grid-template-columns: 1fr !important;
    min-height: 0 !important;
    gap: 8px !important;
  }

  .focus-card .learning-hint-box,
  .focus-card .next-step-box {
    min-height: 82px !important;
    max-height: none !important;
  }

  .footer.compact-footer,
  .footer {
    display: none !important;
  }
}

@media (max-width: 390px) {
  .cell-map,
  .one-screen-map,
  .cell-map-buttons {
    height: 470px !important;
    min-height: 470px !important;
  }

  .cell-map-buttons .cell-zone-subtitle {
    display: none !important;
  }

  .map-zone-icon {
    width: 28px;
    height: 28px;
  }
}


/* V1.5.3 nested containment map + action sheet */
.focus-strip {
  display: none !important;
}

.visual-panel.one-screen-visual {
  margin-bottom: 0 !important;
}

.visual-workspace {
  gap: 0 !important;
}

.map-guide-host {
  margin-top: 8px;
}

.mini-guide-pill {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(161, 207, 255, 0.22);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.018)),
    rgba(9, 17, 27, 0.72);
  color: rgba(230, 242, 255, 0.86);
}

.mini-guide-pill[hidden] {
  display: none !important;
}

.mini-guide-copy {
  min-width: 0;
}

.mini-guide-copy strong {
  display: block;
  color: var(--bio-text-soft);
  font-size: 12px;
  line-height: 1.1;
}

.mini-guide-copy span {
  display: block;
  margin-top: 2px;
  color: rgba(222, 238, 255, 0.66);
  font-size: 11px;
  line-height: 1.25;
}

.mini-guide-close {
  min-width: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  border-radius: var(--radius-pill) !important;
  line-height: 1 !important;
}

.cell-map-nested {
  height: 470px !important;
  min-height: 470px !important;
  background:
    radial-gradient(circle at 50% 46%, rgba(82, 149, 255, 0.10), transparent 58%),
    linear-gradient(135deg, rgba(255,255,255,0.035) 0 25%, transparent 25% 50%, rgba(255,255,255,0.025) 50% 75%, transparent 75% 100%),
    var(--bio-bg-deepest) !important;
  background-size: auto, 24px 24px, auto !important;
}

.nested-map-scaffold {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cytosol-world {
  position: absolute;
  left: 3%;
  top: 3%;
  width: 94%;
  height: 92%;
  border: 1px solid rgba(126, 202, 255, 0.20);
  border-radius: 28px;
  background:
    radial-gradient(circle at 25% 18%, rgba(82, 149, 255, 0.10), transparent 34%),
    rgba(8, 16, 25, 0.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.cytosol-world-title {
  position: absolute;
  left: 16px;
  top: 12px;
  padding: 4px 9px;
  border: 1px solid rgba(161, 207, 255, 0.18);
  border-radius: var(--radius-pill);
  color: rgba(221, 238, 255, 0.64);
  font-size: 10px;
  font-weight: 950;
  background: rgba(11, 23, 35, 0.68);
}

.organelle-frame {
  position: absolute;
  z-index: 1;
  border: 1px dashed rgba(255, 224, 114, 0.20);
  border-radius: 28px;
  background: rgba(255, 224, 114, 0.035);
}

.organelle-frame-chloroplast {
  border-color: rgba(157, 255, 190, 0.22);
  background: rgba(157, 255, 190, 0.032);
}

.organelle-frame span {
  position: absolute;
  left: 12px;
  top: 10px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(11, 18, 26, 0.74);
  color: rgba(255, 237, 158, 0.82);
  border: 1px solid rgba(255, 224, 114, 0.18);
  font-size: 11px;
  font-weight: 950;
}

.organelle-frame small {
  position: absolute;
  right: 12px;
  top: 12px;
  color: rgba(255, 237, 158, 0.42);
  font-size: 9px;
  font-weight: 800;
}

.organelle-frame-chloroplast span {
  color: rgba(178, 255, 205, 0.86);
  border-color: rgba(157, 255, 190, 0.20);
}

.organelle-frame-chloroplast small {
  color: rgba(178, 255, 205, 0.42);
}

.cell-map-nested .map-button-zone {
  z-index: 3;
}

.cell-map-nested .map-button-zone.cytosol {
  border-color: rgba(126, 202, 255, 0.72) !important;
  background:
    linear-gradient(145deg, rgba(126,202,255,0.16), rgba(255,255,255,0.025)),
    rgba(19, 39, 59, 0.72) !important;
}

.map-action-sheet {
  margin-top: 8px;
  border: 1px solid rgba(161, 207, 255, 0.22);
  border-radius: 20px;
  padding: 10px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.018)),
    rgba(8, 15, 24, 0.78);
  box-shadow: 0 18px 42px rgba(0,0,0,0.20), inset 0 1px 0 var(--overlay-02);
}

.map-action-sheet[hidden] {
  display: none !important;
}

.map-action-sheet-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.map-action-sheet-head strong {
  display: block;
  color: var(--bio-text-soft);
  font-size: 14px;
}

.map-action-sheet-head small {
  display: block;
  margin-top: 2px;
  color: rgba(222, 238, 255, 0.60);
  font-size: 11px;
}

.map-action-sheet-close {
  min-width: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  border-radius: var(--radius-pill) !important;
  font-size: 18px !important;
}

.map-action-resource-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.map-action-list {
  display: grid;
  gap: 7px;
}

.map-action-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 50px;
  padding: 9px 10px !important;
  border-radius: 16px !important;
  text-align: left;
}

.map-action-btn.ready {
  border-color: rgba(126, 202, 255, 0.42) !important;
  background: rgba(19, 42, 62, 0.64) !important;
}

.map-action-btn.recommended {
  border-color: rgba(255, 224, 114, 0.82) !important;
  background:
    linear-gradient(145deg, rgba(255,224,114,0.16), rgba(255,255,255,0.025)),
    rgba(36, 31, 18, 0.70) !important;
}

.map-action-btn.locked {
  opacity: 0.62;
  border-color: var(--overlay-04) !important;
}

.map-action-main strong {
  display: block;
  color: #f4f9ff;
  font-size: 13px;
  line-height: 1.15;
}

.map-action-main small {
  display: block;
  margin-top: 3px;
  color: rgba(222, 238, 255, 0.58);
  font-size: 10.2px;
  line-height: 1.2;
}

.map-action-badge {
  align-self: center;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: rgba(161, 207, 255, 0.10);
  color: var(--bio-blue);
  font-size: 10px;
  font-weight: 950;
}

.map-action-btn.recommended .map-action-badge {
  background: rgba(255, 224, 114, 0.14);
  color: var(--bio-gold);
}

.map-action-empty {
  color: rgba(222, 238, 255, 0.62);
  font-size: 12px;
  padding: 8px 4px;
}

@media (min-width: 981px) {
  .one-screen-shell {
    height: auto !important;
    min-height: 0 !important;
    align-items: start !important;
  }

  .visual-workspace,
  .control-panel,
  .process-panel {
    height: auto !important;
    max-height: none !important;
  }

  .cell-map-nested {
    height: 520px !important;
    min-height: 520px !important;
  }

  .process-panel .compact-log {
    max-height: 330px !important;
  }
}

@media (max-width: 980px) {
  .focus-strip {
    display: none !important;
  }

  .map-guide-host {
    margin-top: 7px;
  }

  .cell-map,
  .one-screen-map,
  .cell-map-nested {
    height: 455px !important;
    min-height: 455px !important;
  }

  .map-action-sheet {
    margin-top: 8px;
    padding: 9px;
  }

  .map-action-btn {
    min-height: 48px;
  }
}

/* iPhone landscape: Visual Map + action/process as two-column lab mode */
@media (max-width: 980px) and (orientation: landscape) {
  .one-screen-shell {
    grid-template-columns: minmax(420px, 1.55fr) minmax(280px, 0.95fr) !important;
    grid-template-rows: auto auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 8px !important;
  }

  .visual-workspace[data-mobile-panel="visual"] {
    grid-column: 1 !important;
    grid-row: 1 / span 2 !important;
  }

  .control-panel[data-mobile-panel="controls"] {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  .process-panel[data-mobile-panel="process"] {
    grid-column: 2 !important;
    grid-row: 2 !important;
  }

  .cell-map,
  .one-screen-map,
  .cell-map-nested {
    height: 360px !important;
    min-height: 360px !important;
  }

  .map-action-sheet {
    max-height: 172px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .process-panel .compact-log {
    max-height: 130px !important;
  }
}


/* V1.5.4 true nested popup map */
html,
body {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: auto !important;
  min-height: 100% !important;
}

.one-screen-shell {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

.visual-workspace,
.control-panel,
.process-panel,
.panel {
  max-height: none !important;
}

.focus-strip {
  display: none !important;
}

.map-action-sheet {
  display: none !important;
}

.cell-map-true-nested {
  height: 500px !important;
  min-height: 500px !important;
  position: relative !important;
}

.true-nested-map-scaffold {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cytosol-world {
  position: absolute;
  left: 4%;
  top: 5%;
  width: 92%;
  height: 90%;
  border: 1px solid rgba(126, 202, 255, 0.30);
  border-radius: 30px;
  background:
    radial-gradient(circle at 22% 16%, rgba(82, 149, 255, 0.14), transparent 34%),
    radial-gradient(circle at 62% 70%, rgba(126, 202, 255, 0.06), transparent 45%),
    rgba(8, 16, 25, 0.33);
  box-shadow:
    inset 0 1px 0 var(--overlay-02),
    inset 0 0 44px rgba(126, 202, 255, 0.045);
}

.cytosol-world-title {
  position: absolute;
  left: 14px;
  top: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  color: rgba(221, 238, 255, 0.78);
  border: 1px solid rgba(161, 207, 255, 0.20);
  background: rgba(11, 23, 35, 0.70);
  font-size: 11px;
  font-weight: 950;
}

.cytosol-world-subtitle {
  position: absolute;
  right: 14px;
  top: 15px;
  color: rgba(221, 238, 255, 0.38);
  font-size: 9px;
  font-weight: 850;
}

.plant-cell-wall {
  position: absolute;
  left: 2.5%;
  top: 3%;
  width: 95%;
  height: 92%;
  border: 2px solid rgba(157, 255, 190, 0.20);
  border-radius: 34px;
  background: rgba(157, 255, 190, 0.025);
  box-shadow: inset 0 0 28px rgba(157, 255, 190, 0.045);
}

.plant-cell-wall span {
  position: absolute;
  right: 16px;
  bottom: 12px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(10, 26, 18, 0.64);
  border: 1px solid rgba(157, 255, 190, 0.16);
  color: rgba(178, 255, 205, 0.58);
  font-size: 10px;
  font-weight: 950;
}

.organelle-frame {
  position: absolute;
  z-index: 1;
  border: 1px dashed rgba(255, 224, 114, 0.30);
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 224, 114, 0.07), transparent 62%),
    rgba(255, 224, 114, 0.035);
}

.organelle-frame-chloroplast {
  border-color: rgba(157, 255, 190, 0.30);
  background:
    radial-gradient(circle at 50% 44%, rgba(157, 255, 190, 0.07), transparent 62%),
    rgba(157, 255, 190, 0.032);
}

.organelle-frame span {
  position: absolute;
  left: 14px;
  top: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(11, 18, 26, 0.74);
  color: rgba(255, 237, 158, 0.88);
  border: 1px solid rgba(255, 224, 114, 0.22);
  font-size: 12px;
  font-weight: 950;
}

.organelle-frame small {
  position: absolute;
  right: 14px;
  top: 16px;
  color: rgba(255, 237, 158, 0.42);
  font-size: 9px;
  font-weight: 800;
}

.organelle-frame-chloroplast span {
  color: rgba(178, 255, 205, 0.90);
  border-color: rgba(157, 255, 190, 0.22);
}

.organelle-frame-chloroplast small {
  color: rgba(178, 255, 205, 0.42);
}

.cell-map-true-nested .map-button-zone {
  z-index: 3;
  min-height: 0 !important;
}

.cell-map-true-nested .map-button-zone.cytosol {
  border-radius: 20px !important;
  padding: 9px 12px !important;
  border-color: rgba(126, 202, 255, 0.58) !important;
  background:
    linear-gradient(145deg, rgba(126,202,255,0.13), rgba(255,255,255,0.024)),
    rgba(19, 39, 59, 0.60) !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane {
  border-radius: 20px !important;
  padding: 12px !important;
}

.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  border-radius: var(--radius-lg) !important;
  padding: 9px 12px !important;
}

.cell-map-true-nested .map-zone-icon {
  width: 30px;
  height: 30px;
  border-radius: 13px;
}

.cell-map-true-nested .cell-zone-label {
  font-size: 13.2px !important;
}

.cell-map-true-nested .cell-zone-subtitle {
  font-size: 9.8px !important;
}

.map-reaction-popup {
  position: absolute;
  z-index: 80;
  border: 1px solid rgba(161, 207, 255, 0.28);
  border-radius: var(--radius-lg);
  padding: 9px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.07), rgba(255,255,255,0.022)),
    rgba(8, 15, 24, 0.93);
  box-shadow:
    0 18px 44px rgba(0,0,0,0.42),
    inset 0 1px 0 rgba(255,255,255,0.07);
  backdrop-filter: blur(18px) saturate(1.18);
}

.map-reaction-popup[hidden] {
  display: none !important;
}

.map-popup-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
}

.map-popup-head strong {
  display: block;
  color: #f0f8ff;
  font-size: 13px;
  line-height: 1.15;
}

.map-popup-head small {
  display: block;
  margin-top: 2px;
  color: rgba(222, 238, 255, 0.56);
  font-size: 10px;
}

.map-popup-close {
  min-width: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  border-radius: var(--radius-pill) !important;
  font-size: 17px !important;
}

.map-popup-list {
  display: grid;
  gap: 6px;
}

.map-popup-action {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 9px !important;
  border-radius: var(--radius-md) !important;
  text-align: left;
}

.map-popup-action.ready {
  border-color: rgba(126, 202, 255, 0.42) !important;
  background: rgba(18, 40, 60, 0.66) !important;
}

.map-popup-action.recommended {
  border-color: rgba(255, 224, 114, 0.84) !important;
  background:
    linear-gradient(145deg, rgba(255,224,114,0.16), rgba(255,255,255,0.025)),
    rgba(36, 31, 18, 0.76) !important;
}

.map-popup-action.locked {
  opacity: 0.66;
}

.map-popup-action-copy strong {
  display: block;
  color: #f5fbff;
  font-size: 12px;
  line-height: 1.1;
}

.map-popup-action-copy small {
  display: block;
  margin-top: 2px;
  color: rgba(222, 238, 255, 0.56);
  font-size: 9.5px;
  line-height: 1.18;
}

.map-popup-badge {
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  background: rgba(161, 207, 255, 0.10);
  color: var(--bio-blue);
  font-size: 9px;
  font-weight: 950;
}

.map-popup-action.recommended .map-popup-badge {
  background: rgba(255, 224, 114, 0.14);
  color: var(--bio-gold);
}

.map-popup-empty {
  color: rgba(222, 238, 255, 0.66);
  font-size: 11px;
  padding: 4px 2px 2px;
}

/* PC wheel recovery */
@media (min-width: 981px) {
  html,
  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .one-screen-shell {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    align-items: start !important;
  }

  .visual-workspace,
  .control-panel,
  .process-panel {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .cell-map-true-nested {
    height: 540px !important;
    min-height: 540px !important;
  }

  .process-panel .compact-log,
  .scroll-stack {
    max-height: 360px !important;
    overflow-y: auto !important;
  }
}

@media (max-width: 980px) {
  html,
  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    touch-action: pan-y !important;
  }

  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 500px !important;
    min-height: 500px !important;
    max-height: none !important;
  }

  .cytosol-world-subtitle,
  .organelle-frame small {
    display: none !important;
  }

  .map-reaction-popup {
    max-height: 214px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 390px) {
  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 480px !important;
    min-height: 480px !important;
  }

  .cell-map-true-nested .cell-zone-subtitle {
    display: none !important;
  }
}

/* iPhone landscape: two-column lab mode */
@media (max-width: 980px) and (orientation: landscape) {
  .one-screen-shell {
    grid-template-columns: minmax(420px, 1.55fr) minmax(280px, 0.95fr) !important;
    grid-template-rows: auto auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 8px !important;
  }

  .visual-workspace[data-mobile-panel="visual"] {
    grid-column: 1 !important;
    grid-row: 1 / span 2 !important;
  }

  .control-panel[data-mobile-panel="controls"] {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  .process-panel[data-mobile-panel="process"] {
    grid-column: 2 !important;
    grid-row: 2 !important;
  }

  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 350px !important;
    min-height: 350px !important;
  }

  .map-reaction-popup {
    max-height: 168px;
  }

  .process-panel .compact-log {
    max-height: 130px !important;
  }
}


/* V1.5.5 popup reaction fix + compact iPhone map + natural motion */
.map-action-sheet {
  display: none !important;
}

#mapActionSheet.map-reaction-popup {
  display: block !important;
}

#mapActionSheet.map-reaction-popup[hidden],
.map-reaction-popup[hidden] {
  display: none !important;
}

.cell-map-true-nested {
  height: 430px !important;
  min-height: 430px !important;
}

.cytosol-world {
  top: 4% !important;
  height: 91% !important;
}

.cytosol-world-subtitle {
  display: none !important;
}

.cell-map-true-nested .map-button-zone.role-cytosol-reaction,
.cell-map-true-nested .map-button-zone.cytosol {
  min-height: 0 !important;
  padding: 7px 10px !important;
  border-radius: var(--radius-pill) !important;
  background:
    linear-gradient(145deg, rgba(126,202,255,0.13), rgba(255,255,255,0.022)),
    rgba(19, 39, 59, 0.52) !important;
}

.cell-map-true-nested .map-button-zone.cytosol .map-zone-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
}

.cell-map-true-nested .map-button-zone.cytosol .cell-zone-label {
  font-size: 12px !important;
}

.cell-map-true-nested .map-button-zone.cytosol .cell-zone-subtitle {
  font-size: 9px !important;
}

.organelle-frame {
  border-radius: 24px !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane {
  border-radius: var(--radius-xl) !important;
  padding: 9px 10px !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-label,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-label,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-label,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-label {
  font-size: 14px !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-subtitle {
  font-size: 9.4px !important;
}

.mini-guide-compact,
.mini-guide-pill {
  padding: 7px 9px !important;
  border-radius: var(--radius-md) !important;
}

.mini-guide-compact .mini-guide-copy,
.mini-guide-pill .mini-guide-copy {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
  align-items: center;
}

.mini-guide-compact .mini-guide-copy strong,
.mini-guide-pill .mini-guide-copy strong {
  font-size: 11px !important;
  white-space: nowrap;
}

.mini-guide-compact .mini-guide-copy span,
.mini-guide-pill .mini-guide-copy span {
  margin-top: 0 !important;
  font-size: 10px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-guide-pill .context-resource-chips {
  grid-column: 1 / -1;
  gap: 4px;
  margin-top: 4px;
}

.mini-guide-pill .resource-chip:nth-child(n+4) {
  display: none !important;
}

.map-reaction-popup {
  pointer-events: auto;
  max-height: 230px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.map-popup-action-copy em {
  display: block;
  margin-top: 3px;
  color: rgba(157, 255, 190, 0.70);
  font-style: normal;
  font-size: 9.4px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reaction-pulse-zone {
  animation: reactionPulseSoft 980ms cubic-bezier(.2,.8,.2,1);
}

@keyframes reactionPulseSoft {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.25) saturate(1.15); }
  100% { filter: brightness(1); }
}

.particle.production,
.visual-particle.production {
  will-change: transform, opacity, filter;
}

@media (max-width: 980px) {
  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 430px !important;
    min-height: 430px !important;
  }

  .map-reaction-popup {
    max-height: 198px;
  }

  .map-popup-head strong {
    font-size: 12.2px !important;
  }

  .map-popup-action {
    min-height: 43px !important;
    padding: 7px 8px !important;
  }

  .map-popup-action-copy strong {
    font-size: 11.5px !important;
  }
}

@media (max-width: 390px) {
  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 405px !important;
    min-height: 405px !important;
  }

  .map-zone-icon {
    width: 28px !important;
    height: 28px !important;
  }
}


/* V1.5.6 mobile vertical map + visible movement + low-jank particles */
.cell-map-true-nested {
  height: 470px !important;
  min-height: 470px !important;
}

.organelle-frame {
  top: 28% !important;
  height: 66% !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  padding: 9px 12px !important;
  border-radius: 19px !important;
  text-align: left !important;
  overflow: visible !important;
}

.cell-map-true-nested .map-zone-copy {
  min-width: 0 !important;
  overflow: visible !important;
}

.cell-map-true-nested .cell-zone-label,
.cell-map-true-nested .cell-zone-subtitle {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: keep-all !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-label,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-label,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-label,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-label {
  font-size: 13px !important;
  line-height: 1.12 !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-subtitle {
  display: block !important;
  font-size: 9.3px !important;
  line-height: 1.15 !important;
  max-width: none !important;
}

#mapActionSheet.map-reaction-popup {
  max-height: 176px !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  transform: translateZ(0);
}

.map-popup-action {
  min-height: 40px !important;
  padding: 7px 8px !important;
}

.map-popup-action-copy strong {
  font-size: 11.2px !important;
}

.map-popup-action-copy small,
.map-popup-action-copy em {
  font-size: 9.1px !important;
}

.particle.production,
.visual-particle.production,
.molecule-particle {
  will-change: transform, opacity !important;
  filter: none !important;
}

.reaction-pulse-zone {
  animation: reactionPulseSimple 720ms cubic-bezier(.2,.8,.2,1) !important;
}

@keyframes reactionPulseSimple {
  0% { transform: translateZ(0) scale(1); }
  45% { transform: translateZ(0) scale(1.018); }
  100% { transform: translateZ(0) scale(1); }
}

@media (max-width: 980px) {
  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 470px !important;
    min-height: 470px !important;
  }

  .organelle-frame span {
    font-size: 11px !important;
  }
}

@media (max-width: 390px) {
  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 450px !important;
    min-height: 450px !important;
  }

  .cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-subtitle,
  .cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-subtitle,
  .cell-map-true-nested .map-button-zone.stroma .cell-zone-subtitle,
  .cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-subtitle {
    display: block !important;
    font-size: 8.8px !important;
  }
}


/* V1.5.7 popup close UX + reaction formula + undo */
.map-popup-action {
  position: relative;
}

.map-popup-action.ready {
  border-color: rgba(126, 202, 255, 0.52) !important;
  background:
    linear-gradient(145deg, rgba(126,202,255,0.11), var(--overlay-01)),
    rgba(18, 40, 60, 0.70) !important;
}

.map-popup-action.recommended {
  border-color: rgba(255, 224, 114, 0.92) !important;
  background:
    linear-gradient(145deg, rgba(255,224,114,0.18), rgba(255,255,255,0.026)),
    rgba(42, 34, 17, 0.80) !important;
}

.map-popup-action.locked {
  border-color: rgba(161, 207, 255, 0.15) !important;
  background: rgba(18, 26, 36, 0.72) !important;
  opacity: 0.72;
}

.map-popup-action.blocked {
  border-color: rgba(255, 122, 122, 0.42) !important;
  background:
    linear-gradient(145deg, rgba(255,122,122,0.10), rgba(255,255,255,0.018)),
    rgba(41, 20, 22, 0.70) !important;
  opacity: 0.82;
}

.map-popup-action .reaction-formula {
  color: rgba(157, 255, 190, 0.82) !important;
  font-variant-numeric: tabular-nums;
}

.map-popup-action.locked .reaction-formula,
.map-popup-action.blocked .reaction-formula {
  color: rgba(222, 238, 255, 0.42) !important;
}

.map-popup-action.blocked .map-popup-badge {
  background: rgba(255, 122, 122, 0.15);
  color: #ff9a9a;
}

.map-popup-action.locked .map-popup-badge {
  background: rgba(161, 207, 255, 0.08);
  color: rgba(222, 238, 255, 0.58);
}

.button-shake {
  animation: buttonShakeSoft 420ms ease;
}

@keyframes buttonShakeSoft {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  45% { transform: translateX(3px); }
  70% { transform: translateX(-2px); }
}

.mini-guide-pill[data-tone="success"] {
  border-color: rgba(157, 255, 190, 0.34);
  background:
    linear-gradient(145deg, rgba(157,255,190,0.11), rgba(255,255,255,0.018)),
    rgba(10, 28, 20, 0.72);
}

.mini-guide-pill[data-tone="warning"] {
  border-color: rgba(255, 224, 114, 0.38);
  background:
    linear-gradient(145deg, rgba(255,224,114,0.11), rgba(255,255,255,0.018)),
    rgba(35, 28, 14, 0.74);
}

.mini-guide-pill[data-tone="fail"],
.mini-guide-pill[data-tone="error"] {
  border-color: rgba(255, 122, 122, 0.38);
  background:
    linear-gradient(145deg, rgba(255,122,122,0.12), rgba(255,255,255,0.018)),
    rgba(38, 18, 20, 0.74);
}

.undo-toast {
  margin-top: 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(157, 255, 190, 0.30);
  border-radius: 15px;
  background:
    linear-gradient(145deg, rgba(157,255,190,0.10), rgba(255,255,255,0.018)),
    rgba(8, 18, 16, 0.82);
  color: rgba(236, 255, 243, 0.92);
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
}

.undo-toast[hidden] {
  display: none !important;
}

.undo-toast span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.undo-toast button {
  min-height: 30px !important;
  padding: 5px 9px !important;
  border-radius: var(--radius-pill) !important;
  font-size: 11px !important;
  border-color: rgba(157, 255, 190, 0.38) !important;
}

@media (max-width: 980px) {
  .map-popup-action .reaction-formula {
    max-width: 190px;
  }

  .undo-toast {
    margin-top: 6px;
    padding: 7px 9px;
  }
}


/* V1.5.9 preview header + compact zone cards + CI guard UI */
.visual-title-row {
  align-items: center !important;
}

.formula-preview-slot {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  max-width: min(64%, 560px);
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid rgba(126, 202, 255, 0.16);
  border-radius: 999px;
  background: rgba(10, 20, 31, 0.54);
  color: rgba(222, 238, 255, 0.66) !important;
  font-size: 11px !important;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.formula-preview-slot[data-tone="preview"] {
  border-color: rgba(157, 255, 190, 0.32);
  color: rgba(204, 255, 222, 0.86) !important;
  background: rgba(9, 25, 19, 0.58);
}

.formula-preview-slot[data-tone="recommended"] {
  border-color: rgba(255, 224, 114, 0.42);
  color: rgba(255, 237, 158, 0.90) !important;
  background: rgba(35, 28, 14, 0.58);
}

.formula-preview-slot[data-tone="running"] {
  border-color: rgba(126, 202, 255, 0.42);
  color: rgba(196, 226, 255, 0.92) !important;
  background: rgba(11, 26, 40, 0.62);
}

.formula-preview-slot[data-tone="success"] {
  border-color: rgba(157, 255, 190, 0.42);
  color: rgba(202, 255, 220, 0.92) !important;
  background: rgba(9, 30, 21, 0.66);
}

.cell-map-true-nested {
  height: 430px !important;
  min-height: 430px !important;
}

.cytosol-world {
  top: 4.5% !important;
  height: 89.5% !important;
}

.organelle-frame {
  top: 36% !important;
  height: 54% !important;
}

.cell-map-true-nested .map-button-zone.cytosol {
  height: auto !important;
  max-height: 34px !important;
  padding: 4px 9px !important;
  opacity: 0.88;
}

.cell-map-true-nested .map-button-zone.cytosol .map-zone-icon {
  width: 20px !important;
  height: 20px !important;
}

.cell-map-true-nested .map-button-zone.cytosol .cell-zone-label {
  font-size: 10.8px !important;
}

.cell-map-true-nested .map-button-zone.cytosol .cell-zone-subtitle {
  display: none !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  min-height: 0 !important;
  max-height: 54px !important;
  padding: 7px 10px !important;
  border-radius: 16px !important;
  gap: 8px !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix .map-zone-icon,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .map-zone-icon,
.cell-map-true-nested .map-button-zone.stroma .map-zone-icon,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .map-zone-icon {
  width: 28px !important;
  height: 28px !important;
  flex: 0 0 28px !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-label,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-label,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-label,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-label {
  font-size: 11.7px !important;
  line-height: 1.05 !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-subtitle {
  font-size: 8.2px !important;
  line-height: 1.05 !important;
  max-height: 1.2em !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.map-reaction-popup,
#mapActionSheet.map-reaction-popup {
  max-height: 150px !important;
  width: min(248px, calc(100% - 24px)) !important;
}

.map-popup-head {
  margin-bottom: 5px !important;
}

.map-popup-head strong {
  font-size: 11.6px !important;
}

.map-popup-head small {
  font-size: 9px !important;
}

.map-popup-action {
  min-height: 36px !important;
  padding: 6px 8px !important;
}

.map-popup-action-copy strong {
  font-size: 10.6px !important;
}

.map-popup-action-copy small {
  font-size: 8.8px !important;
}

/* Formula now lives in the title row. The old bottom map preview stays disabled. */
.reaction-map-preview {
  display: none !important;
}

@media (max-width: 980px) {
  .visual-title-row {
    gap: 8px !important;
  }

  .visual-title-row strong {
    flex: 0 0 auto;
  }

  .formula-preview-slot {
    max-width: 56%;
    min-height: 24px;
    padding: 3px 8px;
    font-size: 9.8px !important;
  }

  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 430px !important;
    min-height: 430px !important;
  }
}

@media (max-width: 390px) {
  .formula-preview-slot {
    max-width: 52%;
    font-size: 9.2px !important;
  }

  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 415px !important;
    min-height: 415px !important;
  }
}


/* V1.5.8 map preview cleanup */
.cell-map-true-nested {
  height: 455px !important;
  min-height: 455px !important;
}

.cytosol-world {
  top: 4.5% !important;
  height: 90.5% !important;
  border-radius: 28px !important;
}

.cytosol-world-title {
  top: 9px !important;
  left: 14px !important;
}

.organelle-frame {
  top: 35% !important;
  height: 58% !important;
  border-radius: 24px !important;
}

.organelle-frame span {
  top: 11px !important;
  left: 14px !important;
}

.cell-map-true-nested .map-button-zone.cytosol {
  box-sizing: border-box !important;
  border-radius: 999px !important;
  padding: 5px 10px !important;
  min-height: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.cell-map-true-nested .map-button-zone.cytosol .cell-zone-label {
  font-size: 11.5px !important;
  line-height: 1.05 !important;
}

.cell-map-true-nested .map-button-zone.cytosol .cell-zone-subtitle {
  font-size: 8.6px !important;
  line-height: 1.05 !important;
}

.cell-map-true-nested .map-button-zone.cytosol .map-zone-icon {
  width: 23px !important;
  height: 23px !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  box-sizing: border-box !important;
  border-radius: 18px !important;
  padding: 8px 11px !important;
  overflow: hidden !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-label,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-label,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-label,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-label {
  font-size: 12.6px !important;
  line-height: 1.08 !important;
}

.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-subtitle {
  font-size: 8.8px !important;
  line-height: 1.12 !important;
  max-height: 2.25em;
}

.map-reaction-popup,
#mapActionSheet.map-reaction-popup {
  overflow-x: hidden !important;
  max-width: calc(100% - 24px) !important;
  max-height: 168px !important;
  overscroll-behavior-x: none !important;
  scrollbar-gutter: auto !important;
}

.map-reaction-popup *,
#mapActionSheet.map-reaction-popup * {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.map-popup-list {
  overflow-x: hidden !important;
}

.map-popup-action {
  grid-template-columns: minmax(0, 1fr) auto !important;
  overflow: hidden !important;
}

.map-popup-action-copy {
  min-width: 0 !important;
  overflow: hidden !important;
}

.map-popup-action-copy strong,
.map-popup-action-copy small {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.map-popup-action .reaction-formula {
  display: none !important;
}

.map-popup-action.preview-active {
  border-color: rgba(157, 255, 190, 0.78) !important;
  background:
    linear-gradient(145deg, rgba(157,255,190,0.12), rgba(255,255,255,0.018)),
    rgba(12, 36, 27, 0.78) !important;
}

.map-popup-action.preview-active .map-popup-badge {
  background: rgba(157, 255, 190, 0.15);
  color: #b8ffd0;
}

.reaction-map-preview {
  position: absolute;
  z-index: 74;
  left: 50%;
  bottom: 12px;
  width: min(86%, 420px);
  transform: translateX(-50%);
  border: 1px solid rgba(157, 255, 190, 0.30);
  border-radius: 15px;
  padding: 8px 10px;
  background:
    linear-gradient(145deg, rgba(157,255,190,0.10), rgba(255,255,255,0.018)),
    rgba(8, 18, 16, 0.84);
  color: rgba(236, 255, 243, 0.94);
  pointer-events: none;
  box-shadow: 0 14px 32px rgba(0,0,0,0.30);
}

.reaction-map-preview[hidden] {
  display: none !important;
}

.reaction-map-preview .reaction-preview-kicker {
  margin-bottom: 2px;
  color: rgba(157, 255, 190, 0.74);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.reaction-map-preview strong {
  display: block;
  color: #f3fff7;
  font-size: 11.5px;
  line-height: 1.1;
}

.reaction-map-preview span {
  display: block;
  margin-top: 3px;
  color: rgba(215, 255, 229, 0.82);
  font-size: 10px;
  line-height: 1.25;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.preview-zone {
  outline: 2px solid rgba(157, 255, 190, 0.42);
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 455px !important;
    min-height: 455px !important;
  }

  .map-reaction-popup,
  #mapActionSheet.map-reaction-popup {
    max-height: 158px !important;
  }

  .reaction-map-preview {
    bottom: 10px;
    padding: 7px 9px;
  }

  .reaction-map-preview span {
    font-size: 9.4px;
  }
}

@media (max-width: 390px) {
  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    height: 435px !important;
    min-height: 435px !important;
  }

  .reaction-map-preview {
    width: 88%;
  }
}




/* V1.5.16 stable primary map restore + equal zones */
.cell-map-true-nested {
  height: 420px !important;
  min-height: 420px !important;
}

.cytosol-world {
  top: 4.2% !important;
  height: 90% !important;
  border-color: rgba(126, 202, 255, 0.18) !important;
  background:
    radial-gradient(circle at 50% 35%, rgba(126,202,255,0.07), transparent 44%),
    rgba(10, 19, 30, 0.33) !important;
}

.organelle-frame {
  top: 34% !important;
  height: 55% !important;
  border-color: rgba(255, 224, 114, 0.26) !important;
  background:
    radial-gradient(ellipse at 52% 42%, rgba(255,224,114,0.075), transparent 44%),
    linear-gradient(135deg, rgba(255,224,114,0.035), rgba(255,255,255,0.012)) !important;
}

.organelle-frame::after {
  content: "";
  position: absolute;
  inset: 17% 10%;
  opacity: 0.14;
  pointer-events: none;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      160deg,
      transparent 0 13px,
      rgba(255,224,114,0.12) 13px 15px,
      transparent 15px 29px
    );
  mask-image: radial-gradient(ellipse at center, black 0 58%, transparent 76%);
}

.cell-map-true-nested .map-button-zone.cytosol,
.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  min-height: 0 !important;
  max-height: 54px !important;
  padding: 7px 10px !important;
  border-radius: 16px !important;
  gap: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  text-align: left !important;
  box-sizing: border-box !important;
}

.cell-map-true-nested .map-button-zone.cytosol {
  opacity: 1 !important;
  border-color: rgba(126, 202, 255, 0.46) !important;
  background:
    linear-gradient(145deg, rgba(126,202,255,0.115), rgba(255,255,255,0.018)),
    rgba(18, 38, 58, 0.72) !important;
}

.cell-map-true-nested .map-button-zone.cytosol .map-zone-icon,
.cell-map-true-nested .map-button-zone.mitochondrial_matrix .map-zone-icon,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .map-zone-icon,
.cell-map-true-nested .map-button-zone.stroma .map-zone-icon,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .map-zone-icon,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface .map-zone-icon {
  width: 28px !important;
  height: 28px !important;
  flex: 0 0 28px !important;
}

.cell-map-true-nested .map-button-zone.cytosol .cell-zone-label,
.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-label,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-label,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-label,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-label,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface .cell-zone-label {
  display: block !important;
  font-size: 11.7px !important;
  line-height: 1.05 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cell-map-true-nested .map-button-zone.cytosol .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.mitochondrial_matrix .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.stroma .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.thylakoid_membrane .cell-zone-subtitle,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface .cell-zone-subtitle {
  display: block !important;
  font-size: 8.2px !important;
  line-height: 1.05 !important;
  max-height: 1.2em !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cell-map-true-nested .map-reaction-popup {
  max-height: 205px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.cell-map-true-nested .reaction-map-preview {
  display: none !important;
}

/* Preview is formula/highlight only. Executed animation still uses particleRenderer. */
.cell-map-true-nested .preview-zone {
  box-shadow:
    inset 0 0 0 1px rgba(157, 255, 190, 0.30),
    0 0 0 2px rgba(157, 255, 190, 0.10) !important;
}

@media (max-width: 980px) {
  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    min-height: 420px !important;
  }
}

@media (max-width: 390px) {
  .cell-map,
  .one-screen-map,
  .cell-map-true-nested {
    min-height: 405px !important;
  }
}


/* V1.5.17 interaction polish: no yellow ghost ring, clearer zone buttons, balanced plant cell */
.cell-map-true-nested .ghost-flow-layer,
.cell-map-true-nested .ghost-flow-path,
.cell-map-true-nested .ghost-flow-marker {
  display: none !important;
  opacity: 0 !important;
}

.cell-map-true-nested .map-button-zone.cytosol,
.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  min-height: 58px !important;
  max-height: 66px !important;
  padding: 10px 14px !important;
  border-radius: 18px !important;
  gap: 12px !important;
  align-items: center !important;
}

.cell-map-true-nested .map-button-zone .map-zone-copy {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: flex-start !important;
  text-align: left !important;
}

.cell-map-true-nested .map-button-zone .cell-zone-label {
  font-size: 13.2px !important;
  line-height: 1.08 !important;
  letter-spacing: -0.02em !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cell-map-true-nested .map-button-zone .cell-zone-subtitle {
  margin-top: 2px !important;
  font-size: 9.5px !important;
  line-height: 1.12 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cell-map-true-nested .map-button-zone .map-zone-icon {
  width: 32px !important;
  height: 32px !important;
  flex: 0 0 32px !important;
}

.cell-map-true-nested .preview-zone {
  outline: none !important;
  box-shadow:
    inset 0 0 0 1px rgba(161, 207, 255, 0.62),
    0 0 0 2px rgba(161, 207, 255, 0.13),
    0 14px 32px rgba(0, 0, 0, 0.20) !important;
}

.cell-map-true-nested .preview-source-zone {
  border-color: rgba(161, 207, 255, 0.70) !important;
}

.cell-map-true-nested .preview-target-zone {
  border-color: rgba(157, 255, 190, 0.64) !important;
}

.reaction-button.panel-preview-active,
.reaction-button.panel-preview-active:not(:disabled) {
  border-color: rgba(161, 207, 255, 0.82) !important;
  background:
    linear-gradient(145deg, rgba(161,207,255,0.18), rgba(255,255,255,0.03)),
    rgba(22, 42, 65, 0.82) !important;
  box-shadow:
    inset 0 0 0 1px rgba(161,207,255,0.20),
    0 0 0 2px rgba(161,207,255,0.12) !important;
}

.reaction-button.panel-preview-active::after {
  content: "예측됨";
  float: right;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  color: rgba(220, 240, 255, 0.92);
  background: rgba(161, 207, 255, 0.16);
  font-size: 10px;
  font-weight: 950;
}

.cell-map-true-nested[data-map-mode="photosynthesis"] .cytosol-world {
  top: 3.6% !important;
  height: 92.6% !important;
}

.cell-map-true-nested[data-map-mode="photosynthesis"] .organelle-frame {
  top: 32% !important;
  height: 62% !important;
}

.cell-map-true-nested[data-map-mode="photosynthesis"] .plant-cell-wall {
  left: 1.8% !important;
  top: 2.0% !important;
  width: 96.4% !important;
  height: 95.2% !important;
  border-radius: 32px !important;
}

.cell-map-true-nested[data-map-mode="photosynthesis"] .plant-cell-wall span {
  left: 50% !important;
  right: auto !important;
  top: 8px !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  z-index: 5 !important;
  color: rgba(178, 255, 205, 0.72) !important;
  background: rgba(8, 22, 17, 0.78) !important;
}

.cell-map-true-nested[data-map-mode="photosynthesis"] .organelle-frame span {
  top: 13px !important;
  left: 14px !important;
}

.cell-map-true-nested[data-map-mode="photosynthesis"] .organelle-frame small {
  top: 15px !important;
  right: 14px !important;
  font-size: 8px !important;
}

@media (max-width: 980px) {
  .cell-map-true-nested .map-button-zone .cell-zone-label {
    font-size: 12.8px !important;
  }

  .cell-map-true-nested .map-button-zone .cell-zone-subtitle {
    font-size: 9px !important;
  }
}

@media (max-width: 390px) {
  .cell-map-true-nested .map-button-zone.cytosol,
  .cell-map-true-nested .map-button-zone.mitochondrial_matrix,
  .cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
  .cell-map-true-nested .map-button-zone.stroma,
  .cell-map-true-nested .map-button-zone.thylakoid_membrane,
  .cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
    padding: 8px 10px !important;
    gap: 9px !important;
  }

  .cell-map-true-nested .map-button-zone .cell-zone-label {
    font-size: 12.2px !important;
  }

  .cell-map-true-nested .map-button-zone .cell-zone-subtitle {
    font-size: 8.5px !important;
  }
}


/* V1.5.22.3 layout lock + preview flow arrows */
.cell-map,
.one-screen-map,
.cell-map-true-nested {
  min-height: var(--map-canvas-height, 420px) !important;
}

.cell-map-true-nested .map-button-zone.cytosol,
.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  min-height: var(--map-zone-height) !important;
  max-height: calc(var(--map-zone-height) + 8px) !important;
  padding: 10px 14px !important;
  border-radius: var(--map-zone-radius) !important;
}

.cell-map-true-nested .map-button-zone .map-zone-icon {
  width: var(--map-zone-icon) !important;
  height: var(--map-zone-icon) !important;
  flex: 0 0 var(--map-zone-icon) !important;
}

.cell-map-true-nested .map-button-zone .cell-zone-label {
  font-size: var(--map-zone-title-size) !important;
}

.cell-map-true-nested .map-button-zone .cell-zone-subtitle {
  font-size: var(--map-zone-subtitle-size) !important;
}

.preview-flow-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 42;
}

.preview-flow-layer[hidden] {
  display: none !important;
}

.preview-flow-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.preview-flow-path {
  fill: none;
  stroke: var(--map-preview-flow);
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 6 8;
  filter: drop-shadow(0 0 7px rgba(161, 207, 255, 0.34));
  animation: previewFlowDash 1.8s linear infinite;
}

.preview-flow-path-internal {
  stroke-width: 2;
  stroke-dasharray: 5 7;
}

.preview-flow-arrow-head {
  fill: var(--map-preview-flow);
}

.preview-flow-label {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: 178px;
  padding: 5px 9px;
  border-radius: 999px;
  color: rgba(224, 242, 255, 0.95);
  background: rgba(13, 28, 44, 0.78);
  border: 1px solid rgba(161, 207, 255, 0.34);
  box-shadow: 0 10px 26px rgba(0,0,0,0.24);
  font-size: 10.2px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-flow-label-internal {
  transform: none;
  background: rgba(13, 28, 44, 0.66);
}

@keyframes previewFlowDash {
  to {
    stroke-dashoffset: -28;
  }
}

.map-layout-locked-note {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .preview-flow-path {
    animation: none !important;
  }
}


/* V1.5.22.3 preview flow stabilization */
.cell-map-true-nested .map-button-zone.cytosol,
.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  min-height: var(--map-zone-height) !important;
  max-height: calc(var(--map-zone-height) + 8px) !important;
  padding: 11px 16px !important;
  gap: 13px !important;
  align-items: center !important;
  justify-content: center !important;
}

.cell-map-true-nested .map-button-zone .map-zone-copy {
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

.cell-map-true-nested .map-button-zone .cell-zone-label,
.cell-map-true-nested .map-button-zone .cell-zone-subtitle {
  text-align: center !important;
  width: 100% !important;
}

.cell-map-true-nested .organelle-frame span,
.cell-map-true-nested .organelle-frame small {
  writing-mode: horizontal-tb !important;
  transform: none !important;
  white-space: nowrap !important;
}

.cell-map-true-nested .organelle-frame span {
  top: 14px !important;
  left: 16px !important;
  right: auto !important;
  bottom: auto !important;
  max-width: 44% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cell-map-true-nested .organelle-frame small {
  top: 16px !important;
  right: 16px !important;
  left: auto !important;
  bottom: auto !important;
  max-width: 42% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cell-map-true-nested[data-map-mode="photosynthesis"] .plant-cell-wall span {
  top: 8px !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  max-width: 42% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  z-index: 8 !important;
}

.preview-flow-label,
.preview-flow-label-internal {
  display: none !important;
}

.preview-flow-path {
  stroke-width: 1.85 !important;
  stroke-dasharray: 4 7 !important;
  opacity: 0.84 !important;
  filter: drop-shadow(0 0 5px rgba(161, 207, 255, 0.24)) !important;
}

.preview-flow-arrow-head {
  opacity: 0.88 !important;
}

.product-burst-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 58;
}

.product-burst-group {
  position: absolute;
  width: 1px;
  height: 1px;
  transform: translate(-50%, -50%);
}

.product-burst-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(161, 207, 255, 0.92);
  box-shadow: 0 0 12px rgba(161, 207, 255, 0.42);
  animation: productBurstDot 820ms cubic-bezier(.18,.84,.24,1) forwards;
}

.product-burst-tag {
  position: absolute;
  left: 0;
  top: -22px;
  transform: translateX(-50%);
  max-width: 110px;
  padding: 4px 8px;
  border-radius: 999px;
  color: rgba(235, 247, 255, 0.96);
  background: rgba(13, 28, 44, 0.72);
  border: 1px solid rgba(161, 207, 255, 0.30);
  font-size: 10px;
  font-weight: 950;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: productBurstTag 920ms cubic-bezier(.18,.84,.24,1) forwards;
}

@keyframes productBurstDot {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--burst-x) - 50%), calc(var(--burst-y) - 50%)) scale(1.08);
  }
}

@keyframes productBurstTag {
  0% {
    opacity: 0;
    transform: translate(-50%, 4px) scale(0.96);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.98);
  }
}

@media (max-width: 390px) {
  .cell-map-true-nested .map-button-zone.cytosol,
  .cell-map-true-nested .map-button-zone.mitochondrial_matrix,
  .cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
  .cell-map-true-nested .map-button-zone.stroma,
  .cell-map-true-nested .map-button-zone.thylakoid_membrane,
  .cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
    padding: 9px 11px !important;
    gap: 10px !important;
  }
}


/* V1.5.22.3 headless preview flow + vertical alignment */
.cell-map-true-nested .map-button-zone.cytosol,
.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  min-height: var(--map-zone-height) !important;
  max-height: calc(var(--map-zone-height) + 8px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding-top: 11px !important;
  padding-bottom: 11px !important;
  box-sizing: border-box !important;
}

.cell-map-true-nested .map-button-zone .map-zone-copy {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  transform: translateY(0) !important;
}

.cell-map-true-nested .map-button-zone .cell-zone-label {
  line-height: 1.08 !important;
  margin: 0 !important;
}

.cell-map-true-nested .map-button-zone .cell-zone-subtitle {
  line-height: 1.12 !important;
  margin-top: 3px !important;
}

.preview-flow-svg marker,
.preview-flow-arrow-head {
  display: none !important;
}

.preview-flow-path {
  stroke-width: 1.65 !important;
  stroke-linecap: round !important;
  stroke-dasharray: 4 8 !important;
  opacity: 0.74 !important;
  filter: drop-shadow(0 0 3px rgba(161, 207, 255, 0.18)) !important;
}

.preview-flow-end-dot {
  fill: rgba(161, 207, 255, 0.82);
  filter: drop-shadow(0 0 7px rgba(161, 207, 255, 0.32));
  animation: previewEndDotPulse 1.35s ease-in-out infinite;
}

.preview-flow-travel-dot {
  fill: rgba(190, 225, 255, 0.88);
  filter: drop-shadow(0 0 7px rgba(161, 207, 255, 0.34));
  opacity: 0.88;
}

@keyframes previewEndDotPulse {
  0%, 100% {
    opacity: 0.55;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.cell-map-true-nested[data-map-mode="respiration"] .organelle-frame,
.cell-map-true-nested[data-map-mode="noOxygen"] .organelle-frame {
  top: 34% !important;
  height: 58% !important;
}

.cell-map-true-nested[data-map-mode="photosynthesis"] .organelle-frame {
  top: 30% !important;
  height: 66% !important;
}

.cell-map-true-nested .organelle-frame span {
  top: 14px !important;
  left: 16px !important;
}

.cell-map-true-nested .organelle-frame small {
  top: 16px !important;
  right: 16px !important;
}

@media (max-width: 390px) {
  .preview-flow-path {
    stroke-width: 1.45 !important;
    opacity: 0.70 !important;
  }

  .preview-flow-travel-dot {
    r: 2.2;
  }
}


/* V1.5.22.3 environment dock dismissal hardening */
.env-pill-group:not(.active) .env-pill-options {
  display: none !important;
}

.env-pill-group:not(.active) .env-pill-trigger,
.env-pill-group:not(.active) .env-pill-option {
  outline: none !important;
  box-shadow: none;
}

.env-pill-trigger[aria-expanded="false"] + .env-pill-options {
  display: none !important;
}


/* V1.5.22.3 internal preview polish + centered icon/text group */
.cell-map-true-nested .map-button-zone.cytosol,
.cell-map-true-nested .map-button-zone.mitochondrial_matrix,
.cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
.cell-map-true-nested .map-button-zone.stroma,
.cell-map-true-nested .map-button-zone.thylakoid_membrane,
.cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
  justify-content: center !important;
  align-items: center !important;
  gap: 14px !important;
}

.cell-map-true-nested .map-button-zone .map-zone-icon {
  margin: 0 !important;
  transform: none !important;
}

.cell-map-true-nested .map-button-zone .map-zone-copy {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: calc(100% - 58px) !important;
  align-items: flex-start !important;
  justify-content: center !important;
  text-align: left !important;
}

.cell-map-true-nested .map-button-zone .cell-zone-label,
.cell-map-true-nested .map-button-zone .cell-zone-subtitle {
  width: auto !important;
  max-width: 100% !important;
  text-align: left !important;
}

.preview-internal-pulse {
  position: absolute;
  width: 72px;
  height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  opacity: 0.92;
}

.preview-internal-pulse span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(190, 225, 255, 0.90);
  box-shadow: 0 0 10px rgba(161, 207, 255, 0.38);
  animation: internalPreviewPulse 980ms cubic-bezier(.18,.84,.24,1) infinite;
}

.preview-internal-pulse span:nth-child(2) {
  animation-delay: 120ms;
}

.preview-internal-pulse span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes internalPreviewPulse {
  0% {
    opacity: 0;
    transform: translateX(-8px) scale(0.65);
  }
  36% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(12px) scale(0.72);
  }
}

@media (max-width: 390px) {
  .cell-map-true-nested .map-button-zone.cytosol,
  .cell-map-true-nested .map-button-zone.mitochondrial_matrix,
  .cell-map-true-nested .map-button-zone.mitochondrial_inner_membrane,
  .cell-map-true-nested .map-button-zone.stroma,
  .cell-map-true-nested .map-button-zone.thylakoid_membrane,
  .cell-map-true-nested .map-button-zone.chloroplast_cytosol_interface {
    gap: 10px !important;
  }

  .cell-map-true-nested .map-button-zone .map-zone-copy {
    max-width: calc(100% - 48px) !important;
  }

  .preview-internal-pulse {
    width: 56px;
  }
}


/* V1.5.22.3 reaction queue skeleton */
.reaction-button.queue-waiting {
  opacity: 0.72 !important;
  cursor: wait !important;
}

.reaction-button.queue-waiting::after {
  content: "대기";
  float: right;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 950;
  color: rgba(224, 242, 255, 0.92);
  background: rgba(161, 207, 255, 0.16);
  border: 1px solid rgba(161, 207, 255, 0.22);
}

.cell-map[data-queue-phase="running"],
.cell-map-true-nested[data-queue-phase="running"] {
  box-shadow:
    inset 0 0 0 1px rgba(161, 207, 255, 0.20),
    0 0 28px rgba(161, 207, 255, 0.07) !important;
}


/* V1.5.22.3 popup preview rail fix */
.preview-flow-travel-dot,
.preview-flow-end-dot {
  display: none !important;
  animation: none !important;
}

.preview-flow-path-static,
.preview-flow-path {
  stroke-width: 1.45 !important;
  stroke-dasharray: 5 9 !important;
  opacity: 0.58 !important;
  filter: none !important;
  animation: none !important;
}

.map-popup-action-copy {
  min-width: 0 !important;
}

.map-popup-formula {
  display: block;
  margin-top: 4px;
  color: rgba(157, 255, 190, 0.78);
  font-size: 10.2px;
  line-height: 1.24;
  font-weight: 800;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  opacity: 0.82;
}

.map-popup-action.preview-active .map-popup-formula,
.map-popup-formula.visible-preview {
  color: rgba(174, 255, 201, 0.95);
  opacity: 1;
}

.map-popup-status {
  display: block;
  margin-top: 2px;
}

.map-popup-action.preview-active {
  background:
    linear-gradient(145deg, rgba(161, 207, 255, 0.16), rgba(255, 255, 255, 0.03)),
    rgba(22, 35, 52, 0.88) !important;
}


/* V1.5.22.3 portrait action sheet + queue lock */
.reaction-button.queue-locked,
.map-popup-action.queue-locked {
  cursor: wait !important;
}

.reaction-queue-locked .reaction-button:not(.preview-active),
.reaction-queue-locked .map-popup-action:not(.preview-active) {
  opacity: 0.72;
}

.map-reaction-popup[data-placement="portrait-sheet"] {
  position: absolute !important;
  max-height: min(46%, 320px) !important;
  overflow: hidden !important;
  z-index: 92 !important;
  border-radius: 22px !important;
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.48),
    inset 0 0 0 1px rgba(161, 207, 255, 0.14) !important;
}

.map-reaction-popup[data-placement="portrait-sheet"] .map-popup-list {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
  max-height: 216px !important;
  overflow-y: auto !important;
  padding-right: 3px !important;
}

.map-reaction-popup[data-placement="portrait-sheet"] .map-popup-action {
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  align-items: center !important;
  min-height: 66px !important;
  padding: 12px 12px !important;
  text-align: left !important;
}

.map-reaction-popup[data-placement="portrait-sheet"] .map-popup-action-copy {
  display: grid !important;
  gap: 3px !important;
  min-width: 0 !important;
}

.map-reaction-popup[data-placement="portrait-sheet"] .map-popup-formula {
  display: block !important;
  opacity: 1 !important;
  font-size: 10.8px !important;
  line-height: 1.28 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.map-reaction-popup[data-placement="portrait-sheet"] .map-popup-head {
  padding-bottom: 9px !important;
}

.map-reaction-popup[data-placement="portrait-sheet"] .map-popup-head small::after {
  content: " · 한 번 누르면 예측, 한 번 더 누르면 실행";
}

@media (max-width: 640px) and (orientation: portrait) {
  .map-reaction-popup {
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    top: auto !important;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
  }

  .map-popup-formula {
    display: block !important;
    opacity: 1 !important;
  }

  .map-popup-action {
    min-height: 66px !important;
  }
}


/* V1.5.22.3 ghost preview particles + pathway guide */
.preview-ghost-particle-layer {
  position: absolute;
  inset: 0;
  z-index: 62;
  pointer-events: none;
  overflow: hidden;
}

.preview-ghost-particle-layer.ghost-preview-resting {
  opacity: 0.86;
}

.preview-ghost-dot {
  position: absolute;
  min-width: 8px;
  height: 8px;
  padding: 0 4px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgba(165, 216, 255, 0.34);
  border: 1px solid rgba(190, 225, 255, 0.34);
  color: rgba(229, 246, 255, 0.74);
  font-size: 8.5px;
  font-weight: 950;
  line-height: 10px;
  text-align: center;
  box-shadow: 0 0 10px rgba(161, 207, 255, 0.16);
  will-change: transform, opacity;
}

.preview-ghost-dot-transport {
  animation: previewGhostTransport 760ms cubic-bezier(.18,.84,.24,1) forwards;
}

.preview-ghost-dot-internal {
  background: rgba(255, 224, 114, 0.24);
  border-color: rgba(255, 224, 114, 0.28);
  box-shadow: 0 0 10px rgba(255, 224, 114, 0.14);
  animation: previewGhostInternal 760ms cubic-bezier(.18,.84,.24,1) forwards;
}

.preview-ghost-membrane-sweep {
  position: absolute;
  height: 2px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, rgba(165, 216, 255, 0.52), transparent);
  box-shadow: 0 0 10px rgba(161, 207, 255, 0.18);
  animation: previewGhostSweep 780ms cubic-bezier(.18,.84,.24,1) forwards;
}

.preview-ghost-tag {
  position: absolute;
  min-width: 34px;
  padding: 3px 7px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  color: rgba(229, 246, 255, 0.78);
  background: rgba(13, 28, 44, 0.46);
  border: 1px solid rgba(161, 207, 255, 0.20);
  font-size: 9px;
  font-weight: 950;
  animation: previewGhostTag 780ms cubic-bezier(.18,.84,.24,1) forwards;
}

@keyframes previewGhostTransport {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
  14% {
    opacity: 0.72;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--ghost-dx) - 50%), calc(var(--ghost-dy) - 50%)) scale(0.82);
  }
}

@keyframes previewGhostInternal {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
  28% {
    opacity: 0.66;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--ghost-dx) - 50%), calc(var(--ghost-dy) - 50%)) scale(0.78);
  }
}

@keyframes previewGhostSweep {
  0% {
    opacity: 0;
    transform: translate(-18%, -50%) scaleX(0.25);
  }
  35% {
    opacity: 0.64;
  }
  100% {
    opacity: 0;
    transform: translate(18%, -50%) scaleX(1);
  }
}

@keyframes previewGhostTag {
  0% {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.94);
  }
  30% {
    opacity: 0.86;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -66%) scale(0.96);
  }
}

.map-popup-why {
  display: block;
  margin-top: 4px;
  color: rgba(218, 229, 240, 0.68);
  font-size: 10px;
  line-height: 1.26;
  font-weight: 750;
  white-space: normal;
  overflow-wrap: anywhere;
}

.map-popup-action.preview-active .map-popup-why,
.map-popup-action:focus-visible .map-popup-why {
  color: rgba(224, 242, 255, 0.92);
}

@media (max-width: 640px) and (orientation: portrait) {
  .preview-ghost-dot {
    min-width: 7px;
    height: 7px;
    font-size: 7.8px;
    line-height: 9px;
  }

  .map-popup-why {
    font-size: 10.2px !important;
    line-height: 1.28 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .preview-ghost-dot,
  .preview-ghost-membrane-sweep,
  .preview-ghost-tag {
    animation-duration: 1ms !important;
  }
}


/* V1.5.22.3 no preview rail + compact popup */
.preview-flow-layer,
.preview-flow-svg,
.preview-flow-path,
.preview-flow-path-static {
  display: none !important;
  opacity: 0 !important;
}

.map-popup-why {
  display: none !important;
}

.map-popup-action-copy {
  gap: 2px !important;
}

.map-popup-action {
  min-height: 56px !important;
}

.map-popup-formula {
  margin-top: 3px !important;
  font-size: 10.4px !important;
  line-height: 1.22 !important;
  max-height: 2.45em !important;
  overflow: hidden !important;
}

.map-reaction-popup[data-placement="portrait-sheet"] .map-popup-action {
  min-height: 58px !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

.map-reaction-popup[data-placement="portrait-sheet"] .map-popup-list {
  max-height: 206px !important;
}

.map-reaction-popup[data-placement="portrait-sheet"] .map-popup-formula {
  font-size: 10.4px !important;
}


/* V1.5.22.3 exact reactants/products + formation animation */
.map-popup-rp-grid {
  display: grid;
  gap: 4px;
  margin-top: 5px;
}

.map-popup-rp-line {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 6px;
  align-items: start;
  font-size: 10.2px;
  line-height: 1.24;
  color: rgba(220, 234, 246, 0.78);
}

.map-popup-rp-line b {
  border-radius: 999px;
  padding: 2px 5px;
  font-size: 9.2px;
  line-height: 1;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(236, 246, 255, 0.86);
}

.map-popup-rp-line.needs b {
  background: rgba(161, 207, 255, 0.16);
  color: rgba(199, 226, 255, 0.95);
}

.map-popup-rp-line.makes b {
  background: rgba(145, 255, 183, 0.14);
  color: rgba(184, 255, 210, 0.95);
}

.map-popup-rp-line.missing {
  color: rgba(255, 197, 197, 0.94);
}

.map-popup-rp-line.missing b {
  background: rgba(255, 98, 98, 0.18);
  color: rgba(255, 213, 213, 0.96);
}

.map-popup-rp-line span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.map-popup-action.preview-active .map-popup-rp-grid,
.map-popup-rp-grid.visible-preview {
  opacity: 1;
}

.map-popup-formula {
  display: none !important;
}

.reaction-formation-layer {
  position: absolute;
  inset: 0;
  z-index: 76;
  pointer-events: none;
  overflow: hidden;
}

.reaction-formation-core {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.86);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: -0.02em;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.84) 0 8%, rgba(155, 218, 255, 0.32) 18%, rgba(72, 145, 255, 0.10) 56%, transparent 72%);
  border: 1px solid rgba(205, 235, 255, 0.24);
  box-shadow:
    0 0 22px rgba(161, 207, 255, 0.30),
    inset 0 0 16px rgba(255, 255, 255, 0.16);
  animation: reactionFormationCore 980ms cubic-bezier(.18,.92,.22,1) forwards;
}

.reaction-formation-core-transport {
  background:
    radial-gradient(circle, rgba(210, 255, 227, 0.88) 0 8%, rgba(126, 255, 183, 0.30) 18%, rgba(72, 255, 176, 0.10) 56%, transparent 72%);
}

.reaction-formation-core-membrane {
  background:
    radial-gradient(circle, rgba(255, 240, 168, 0.90) 0 8%, rgba(255, 210, 88, 0.32) 18%, rgba(255, 210, 88, 0.10) 56%, transparent 72%);
}

.reaction-formation-dot {
  position: absolute;
  min-width: 13px;
  height: 13px;
  padding: 0 5px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  font-size: 8px;
  line-height: 11px;
  font-weight: 950;
  white-space: nowrap;
  will-change: transform, opacity;
}

.reaction-formation-reactant {
  color: rgba(222, 240, 255, 0.80);
  background: rgba(149, 202, 255, 0.22);
  border: 1px solid rgba(190, 225, 255, 0.24);
  box-shadow: 0 0 9px rgba(161, 207, 255, 0.15);
  animation: reactionReactantCollapse 560ms cubic-bezier(.22,.78,.22,1) forwards;
}

.reaction-formation-reactant-route {
  animation: reactionReactantRoute 640ms cubic-bezier(.18,.84,.24,1) forwards;
}

.reaction-formation-product {
  color: rgba(219, 255, 232, 0.95);
  background: rgba(84, 255, 155, 0.22);
  border: 1px solid rgba(155, 255, 190, 0.26);
  box-shadow: 0 0 12px rgba(109, 255, 171, 0.18);
  animation: reactionProductEmerge 660ms cubic-bezier(.16,.86,.18,1) forwards;
}

.reaction-formation-membrane-sweep {
  position: absolute;
  height: 4px;
  border-radius: 999px;
  transform: translateY(-50%);
  background:
    linear-gradient(90deg, transparent, rgba(255, 232, 128, 0.72), rgba(151, 255, 190, 0.52), transparent);
  box-shadow:
    0 0 16px rgba(255, 224, 112, 0.26),
    0 0 24px rgba(161, 207, 255, 0.18);
  animation: reactionMembraneSweep 940ms cubic-bezier(.18,.84,.24,1) forwards;
}

@keyframes reactionFormationCore {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.28);
  }
  32% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
  70% {
    opacity: 0.76;
    transform: translate(-50%, -50%) scale(0.92);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.32);
  }
}

@keyframes reactionReactantCollapse {
  0% {
    opacity: 0;
    transform: translate(calc(var(--from-x) - 50%), calc(var(--from-y) - 50%)) scale(0.94);
  }
  22% {
    opacity: 0.88;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.42);
  }
}

@keyframes reactionReactantRoute {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.88);
  }
  24% {
    opacity: 0.82;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--move-x) - 50%), calc(var(--move-y) - 50%)) scale(0.46);
  }
}

@keyframes reactionProductEmerge {
  0%, 38% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.38);
  }
  58% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--to-x) - 50%), calc(var(--to-y) - 50%)) scale(1);
  }
}

@keyframes reactionMembraneSweep {
  0% {
    opacity: 0;
    transform: translate(-18%, -50%) scaleX(0.18);
  }
  36% {
    opacity: 0.92;
  }
  100% {
    opacity: 0;
    transform: translate(18%, -50%) scaleX(1.05);
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .map-popup-rp-line {
    grid-template-columns: 32px 1fr;
    font-size: 10px;
  }

  .map-reaction-popup[data-placement="portrait-sheet"] .map-popup-action {
    min-height: 76px !important;
  }

  .reaction-formation-core {
    width: 40px;
    height: 40px;
    font-size: 9px;
  }

  .reaction-formation-dot {
    min-width: 11px;
    height: 11px;
    font-size: 7.2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reaction-formation-core,
  .reaction-formation-dot,
  .reaction-formation-membrane-sweep {
    animation-duration: 1ms !important;
  }
}


/* V1.5.22.3 prettier real movement trails + slower formation choreography */
.motion-trace-hitbox {
  fill: none;
  stroke: transparent;
  stroke-width: 10;
  pointer-events: none;
}

.motion-trace-base {
  stroke: rgba(115, 194, 255, 0.22) !important;
  stroke-width: 5.4 !important;
  stroke-linecap: round !important;
  filter: none !important;
}

.motion-trace-glow {
  stroke: rgba(179, 231, 255, 0.52) !important;
  stroke-width: 2.4 !important;
  stroke-linecap: round !important;
  filter:
    drop-shadow(0 0 6px rgba(142, 212, 255, 0.34))
    drop-shadow(0 0 14px rgba(109, 255, 171, 0.16)) !important;
}

.motion-trace-comet {
  stroke: rgba(222, 249, 255, 0.92) !important;
  stroke-width: 2.8 !important;
  stroke-linecap: round !important;
  filter:
    drop-shadow(0 0 8px rgba(222, 249, 255, 0.52))
    drop-shadow(0 0 18px rgba(142, 212, 255, 0.28)) !important;
}

.reaction-formation-phase-strip,
.reaction-formation-summary {
  position: absolute;
  z-index: 82;
  transform: translate(-50%, -50%);
  pointer-events: none;
  white-space: nowrap;
}

.reaction-formation-phase-strip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  color: rgba(236, 246, 255, 0.88);
  background: rgba(8, 18, 30, 0.56);
  border: 1px solid rgba(161, 207, 255, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  font-size: 10px;
  font-weight: 950;
  opacity: 0;
  animation: formationPhaseStrip 1550ms cubic-bezier(.18,.84,.24,1) forwards;
}

.reaction-formation-phase-strip i {
  font-style: normal;
  color: rgba(161, 207, 255, 0.56);
}

.reaction-formation-summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(82%, 360px);
  padding: 6px 10px;
  border-radius: 15px;
  color: rgba(228, 243, 255, 0.91);
  background: rgba(8, 18, 30, 0.68);
  border: 1px solid rgba(161, 207, 255, 0.18);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  font-size: 10px;
  line-height: 1.15;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  animation: formationSummary 1600ms cubic-bezier(.18,.84,.24,1) forwards;
}

.reaction-formation-summary b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reaction-formation-summary i {
  flex: 0 0 auto;
  font-style: normal;
  color: rgba(139, 255, 181, 0.78);
}

.reaction-formation-route-ribbon {
  position: absolute;
  inset: 0;
  z-index: 77;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.reaction-formation-route-ribbon path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reaction-formation-route-ribbon .route-base {
  stroke: rgba(84, 169, 255, 0.20);
  stroke-width: 7;
  filter: blur(0.2px);
  stroke-dasharray: 10 11;
  animation: routeRibbonBase 1500ms cubic-bezier(.18,.84,.24,1) forwards;
}

.reaction-formation-route-ribbon .route-glow {
  stroke: rgba(195, 234, 255, 0.62);
  stroke-width: 2.2;
  filter:
    drop-shadow(0 0 7px rgba(161, 207, 255, 0.36))
    drop-shadow(0 0 16px rgba(109, 255, 171, 0.18));
  stroke-dasharray: 9 14;
  animation: routeRibbonGlow 1500ms cubic-bezier(.18,.84,.24,1) forwards;
}

.reaction-formation-route-ribbon .route-comet {
  stroke: rgba(232, 252, 255, 0.92);
  stroke-width: 3;
  filter: drop-shadow(0 0 9px rgba(232, 252, 255, 0.55));
  stroke-dasharray: 34 260;
  stroke-dashoffset: 220;
  animation: routeRibbonComet 1420ms cubic-bezier(.18,.84,.24,1) forwards;
}

.reaction-formation-core {
  animation-duration: 1450ms !important;
}

.reaction-formation-core b,
.reaction-formation-core small {
  display: block;
  line-height: 1;
}

.reaction-formation-core small {
  margin-top: 2px;
  color: rgba(199, 255, 221, 0.90);
  font-size: 8px;
}

.reaction-formation-reactant {
  animation-duration: 860ms !important;
}

.reaction-formation-reactant-route {
  animation-duration: 980ms !important;
}

.reaction-formation-product {
  animation-duration: 840ms !important;
}

.reaction-formation-dot {
  box-shadow:
    0 0 10px rgba(161, 207, 255, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.20);
}

@keyframes formationPhaseStrip {
  0%, 5% {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.96);
  }
  12%, 78% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58%) scale(0.98);
  }
}

@keyframes formationSummary {
  0%, 10% {
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.96);
  }
  22%, 82% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58%) scale(0.98);
  }
}

@keyframes routeRibbonBase {
  0% {
    opacity: 0;
    stroke-dashoffset: 42;
  }
  22%, 72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    stroke-dashoffset: -42;
  }
}

@keyframes routeRibbonGlow {
  0% {
    opacity: 0;
    stroke-dashoffset: 36;
  }
  28%, 76% {
    opacity: 0.86;
  }
  100% {
    opacity: 0;
    stroke-dashoffset: -54;
  }
}

@keyframes routeRibbonComet {
  0% {
    opacity: 0;
    stroke-dashoffset: 220;
  }
  20% {
    opacity: 0.95;
  }
  86% {
    opacity: 0.74;
  }
  100% {
    opacity: 0;
    stroke-dashoffset: -90;
  }
}

/* Override the V1.5.22.3 timing so the "what became what" flow is readable. */
@keyframes reactionReactantCollapse {
  0% {
    opacity: 0;
    transform: translate(calc(var(--from-x) - 50%), calc(var(--from-y) - 50%)) scale(0.94);
  }
  16% {
    opacity: 0.92;
  }
  78% {
    opacity: 0.86;
    transform: translate(calc(var(--from-x) * 0.18 - 50%), calc(var(--from-y) * 0.18 - 50%)) scale(0.82);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.36);
  }
}

@keyframes reactionReactantRoute {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.88);
  }
  16% {
    opacity: 0.86;
  }
  78% {
    opacity: 0.84;
    transform: translate(calc(var(--move-x) * 0.82 - 50%), calc(var(--move-y) * 0.82 - 50%)) scale(0.82);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--move-x) - 50%), calc(var(--move-y) - 50%)) scale(0.42);
  }
}

@keyframes reactionProductEmerge {
  0%, 42% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.32);
  }
  58% {
    opacity: 1;
    transform: translate(calc(var(--to-x) * 0.25 - 50%), calc(var(--to-y) * 0.25 - 50%)) scale(0.92);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--to-x) - 50%), calc(var(--to-y) - 50%)) scale(1);
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .reaction-formation-summary {
    max-width: min(90%, 310px);
    font-size: 9px;
    gap: 5px;
    padding: 5px 8px;
  }

  .reaction-formation-phase-strip {
    font-size: 9px;
    gap: 5px;
    padding: 4px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reaction-formation-phase-strip,
  .reaction-formation-summary,
  .reaction-formation-route-ribbon path {
    animation-duration: 1ms !important;
  }
}


/* V1.5.22.3 mobile large reaction sheet: engine shared, UI split by device */
html.mobile-reaction-sheet-open body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 8998;
  pointer-events: none;
  background:
    linear-gradient(to bottom, transparent 0 42%, rgba(0, 0, 0, 0.24) 100%);
}

.map-reaction-popup[data-placement="mobile-large-sheet"] {
  position: fixed !important;
  left: 14px !important;
  right: 14px !important;
  top: auto !important;
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 18px)) !important;
  width: auto !important;
  max-width: none !important;
  max-height: min(58vh, 560px) !important;
  z-index: 9000 !important;
  padding: 16px !important;
  border-radius: 26px !important;
  overflow: hidden !important;
  background:
    linear-gradient(180deg, rgba(23, 36, 52, 0.96), rgba(11, 18, 29, 0.97)),
    radial-gradient(circle at 12% 0%, rgba(80, 160, 255, 0.20), transparent 36%),
    radial-gradient(circle at 92% 100%, rgba(89, 255, 171, 0.12), transparent 38%) !important;
  border: 1px solid rgba(168, 213, 255, 0.34) !important;
  box-shadow:
    0 -14px 42px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(255, 255, 255, 0.035) inset,
    0 0 34px rgba(98, 172, 255, 0.16) !important;
  backdrop-filter: blur(22px) saturate(1.08) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-head {
  display: grid !important;
  grid-template-columns: 1fr 48px !important;
  gap: 12px !important;
  align-items: start !important;
  padding: 0 2px 13px !important;
  margin-bottom: 12px !important;
  border-bottom: 1px solid rgba(168, 213, 255, 0.14) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-head strong {
  display: block !important;
  font-size: 19px !important;
  line-height: 1.15 !important;
  letter-spacing: -0.04em !important;
  color: rgba(236, 246, 255, 0.98) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-head small {
  display: block !important;
  margin-top: 6px !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
  color: rgba(207, 224, 239, 0.78) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-close {
  width: 46px !important;
  height: 46px !important;
  border-radius: 999px !important;
  font-size: 28px !important;
  line-height: 1 !important;
  justify-self: end !important;
  background: rgba(33, 48, 67, 0.96) !important;
  border: 1px solid rgba(188, 218, 255, 0.22) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.30) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-list {
  display: grid !important;
  gap: 12px !important;
  max-height: calc(min(58vh, 560px) - 92px) !important;
  overflow-y: auto !important;
  padding: 2px 2px 5px !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action {
  display: grid !important;
  grid-template-columns: 1fr 58px !important;
  gap: 12px !important;
  align-items: start !important;
  min-height: 132px !important;
  padding: 15px 14px !important;
  border-radius: 22px !important;
  background: rgba(12, 20, 32, 0.72) !important;
  border: 1px solid rgba(168, 213, 255, 0.18) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action.ready,
.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action.recommended {
  background:
    linear-gradient(180deg, rgba(28, 61, 50, 0.72), rgba(12, 24, 26, 0.76)) !important;
  border-color: rgba(126, 255, 183, 0.24) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action.blocked,
.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action.locked {
  background:
    linear-gradient(180deg, rgba(70, 37, 35, 0.58), rgba(19, 22, 31, 0.80)) !important;
  border-color: rgba(255, 152, 128, 0.24) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action-copy {
  display: grid !important;
  gap: 7px !important;
  min-width: 0 !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action-copy > strong {
  font-size: 17px !important;
  line-height: 1.22 !important;
  letter-spacing: -0.035em !important;
  color: rgba(239, 247, 255, 0.98) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-status {
  font-size: 13px !important;
  line-height: 1.35 !important;
  color: rgba(209, 224, 239, 0.82) !important;
  white-space: normal !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-rp-grid {
  display: grid !important;
  gap: 8px !important;
  margin-top: 3px !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-rp-line {
  display: grid !important;
  grid-template-columns: 46px 1fr !important;
  gap: 8px !important;
  align-items: start !important;
  font-size: 13.5px !important;
  line-height: 1.38 !important;
  color: rgba(225, 238, 249, 0.90) !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-rp-line b {
  min-width: 40px !important;
  padding: 4px 7px !important;
  border-radius: 999px !important;
  font-size: 11.5px !important;
  line-height: 1.05 !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-rp-line span {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-badge {
  align-self: start !important;
  justify-self: end !important;
  min-width: 48px !important;
  height: 38px !important;
  padding: 0 10px !important;
  border-radius: 999px !important;
  display: inline-grid !important;
  place-items: center !important;
  font-size: 13px !important;
  font-weight: 950 !important;
}

@media (max-width: 420px) {
  .map-reaction-popup[data-placement="mobile-large-sheet"] {
    left: 10px !important;
    right: 10px !important;
    padding: 14px !important;
    border-radius: 24px !important;
    max-height: min(62vh, 560px) !important;
  }

  .map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action {
    min-height: 128px !important;
    padding: 14px 12px !important;
  }

  .map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-rp-line {
    font-size: 13px !important;
    grid-template-columns: 44px 1fr !important;
  }
}


/* V1.5.22.3 phone-only forced full-width sheet fix */
@media (max-width: 920px), (pointer: coarse), (hover: none) {
  .map-reaction-popup,
  .map-reaction-popup[data-placement],
  .map-reaction-popup[data-placement="top"],
  .map-reaction-popup[data-placement="bottom"],
  .map-reaction-popup[data-placement="portrait-sheet"],
  .map-reaction-popup[data-placement="mobile-large-sheet"] {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: max(82px, calc(env(safe-area-inset-bottom) + 14px)) !important;
    width: calc(100vw - 16px) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 16px) !important;
    box-sizing: border-box !important;
    z-index: 9000 !important;
    margin: 0 !important;
    transform-origin: bottom center !important;
  }

  .map-reaction-popup[data-placement="mobile-large-sheet"] {
    padding: 17px !important;
    max-height: min(64vh, 620px) !important;
  }

  .map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-list,
  .map-reaction-popup .map-popup-list {
    max-height: calc(min(64vh, 620px) - 96px) !important;
  }

  .map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action,
  .map-reaction-popup .map-popup-action {
    min-height: 136px !important;
  }

  .map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-action-copy > strong,
  .map-reaction-popup .map-popup-action-copy > strong {
    font-size: 18px !important;
  }

  .map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-status,
  .map-reaction-popup .map-popup-status {
    font-size: 13.5px !important;
  }

  .map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-rp-line,
  .map-reaction-popup .map-popup-rp-line {
    font-size: 14px !important;
    line-height: 1.42 !important;
  }

  .map-reaction-popup[data-placement="mobile-large-sheet"] .map-popup-head strong,
  .map-reaction-popup .map-popup-head strong {
    font-size: 20px !important;
  }
}

@supports (width: 100dvw) {
  @media (max-width: 920px), (pointer: coarse), (hover: none) {
    .map-reaction-popup,
    .map-reaction-popup[data-placement],
    .map-reaction-popup[data-placement="top"],
    .map-reaction-popup[data-placement="bottom"],
    .map-reaction-popup[data-placement="portrait-sheet"],
    .map-reaction-popup[data-placement="mobile-large-sheet"] {
      width: calc(100dvw - 16px) !important;
      max-width: calc(100dvw - 16px) !important;
    }
  }
}
