:root {
  color-scheme: dark;

  --background: #020914;
  --panel: rgba(5, 18, 34, 0.84);
  --panel-strong: rgba(5, 15, 30, 0.95);
  --border: rgba(107, 182, 255, 0.18);

  --text: #f1f7ff;
  --muted: #8da1b8;

  --blue: #2f9fff;
  --cyan: #35ddff;
  --purple: #8c55ff;
  --green: #55e6ad;

  --sidebar-width: 280px;
  --right-panel-width: 290px;
  --timeline-height: 170px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;

  background:
    radial-gradient(
      circle at 50% 35%,
      #071c35,
      var(--background) 70%
    );

  color: var(--text);

  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

#cell-canvas {
  position: fixed;
  inset: 0;

  width: 100vw;
  height: 100vh;
}

#cell-canvas canvas {
  display: block;
}

.app-shell {
  position: fixed;
  inset: 0;

  pointer-events: none;
}

.glass-panel {
  background:
    linear-gradient(
      145deg,
      rgba(12, 31, 53, 0.9),
      rgba(4, 13, 27, 0.82)
    );

  border: 1px solid var(--border);

  box-shadow:
    0 20px 55px rgba(0, 0, 0, 0.32),
    inset 0 1px rgba(255, 255, 255, 0.035);

  backdrop-filter: blur(18px);
}

/* =========================================================
   Left sidebar
   ========================================================= */

.left-sidebar {
  position: absolute;
  inset: 16px auto calc(var(--timeline-height) + 30px) 16px;

  width: var(--sidebar-width);

  padding: 18px;

  border-radius: 18px;

  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 4px 4px 22px;
}

.brand__icon {
  display: grid;
  place-items: center;

  width: 46px;
  height: 46px;

  border: 1px solid rgba(53, 221, 255, 0.42);
  border-radius: 14px;

  color: var(--cyan);

  background:
    radial-gradient(
      circle,
      rgba(53, 221, 255, 0.2),
      rgba(53, 221, 255, 0.02)
    );

  box-shadow:
    0 0 24px rgba(53, 221, 255, 0.16);
}

.brand h1 {
  margin: 0;

  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand p {
  margin: 4px 0 0;

  color: var(--muted);
  font-size: 11px;
}

.main-navigation {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr 18px;
  align-items: center;
  gap: 8px;

  width: 100%;
  min-height: 43px;

  padding: 0 12px;

  border: 1px solid transparent;
  border-radius: 11px;

  color: #aebed1;

  background: transparent;

  text-align: left;
  cursor: pointer;

  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-item:hover {
  color: white;

  background: rgba(67, 157, 255, 0.1);

  transform: translateX(2px);
}

.nav-item.active {
  color: white;

  border-color: rgba(47, 159, 255, 0.25);

  background:
    linear-gradient(
      90deg,
      rgba(29, 143, 255, 0.29),
      rgba(37, 197, 255, 0.1)
    );

  box-shadow:
    inset 3px 0 var(--cyan),
    0 8px 22px rgba(15, 119, 230, 0.12);
}

.nav-item__icon {
  color: #b8d8f5;

  text-align: center;
}

.nav-item__arrow {
  color: var(--cyan);

  font-size: 20px;
}

.cell-status {
    margin-top: 14px;
  padding: 18px 4px 4px;

  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.section-label {
  margin: 0 0 16px;

  color: #72879e;
  font-size: 10px;
  letter-spacing: 0.13em;
}

.status-row {
  margin-bottom: 16px;
}

.status-row__header {
  display: flex;
  justify-content: space-between;

  margin-bottom: 7px;

  color: #d9e5f0;
  font-size: 11px;
}

.status-track {
  width: 100%;
  height: 4px;

  overflow: hidden;

  border-radius: 99px;

  background: rgba(255, 255, 255, 0.08);
}

.status-fill {
  height: 100%;

  border-radius: inherit;

  background:
    linear-gradient(
      90deg,
      var(--cyan),
      #72c9ff
    );

  box-shadow:
    0 0 12px rgba(53, 221, 255, 0.55);
}

.status-fill--green {
  background:
    linear-gradient(
      90deg,
      #4be5b1,
      #95ffd4
    );
}

.status-fill--purple {
  background:
    linear-gradient(
      90deg,
      #8d68ff,
      #e0b8ff
    );
}

.cell-type-card {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;

  display: grid;
  grid-template-columns: 52px 1fr 30px;
  align-items: center;
  gap: 11px;

  padding: 10px;

  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;

  background: rgba(255, 255, 255, 0.025);
}

.cell-type-card__preview {
  display: grid;
  place-items: center;

  width: 52px;
  height: 52px;

  border-radius: 10px;

  background:
    radial-gradient(
      circle,
      rgba(91, 109, 255, 0.3),
      rgba(10, 22, 43, 0.9)
    );

  font-size: 25px;
}

.cell-type-card strong,
.cell-type-card span {
  display: block;
}

.cell-type-card strong {
  font-size: 12px;
}

.cell-type-card span {
  margin-top: 4px;

  color: var(--muted);
  font-size: 10px;
}

.cell-type-card button {
  border: 0;
  background: transparent;

  color: var(--muted);

  cursor: pointer;
}

/* =========================================================
   Top scene header
   ========================================================= */

.scene-header {
  position: absolute;
  top: 24px;
  left: calc(var(--sidebar-width) + 52px);

  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  width: calc(
    100% -
    var(--sidebar-width) -
    var(--right-panel-width) -
    100px
  );

  pointer-events: none;
}

.scene-header h2 {
  margin: 0;

  font-size: 18px;
}

.scene-header p {
  margin: 5px 0 0;

  color: var(--muted);
  font-size: 12px;
}

.view-controls {
  display: flex;
  gap: 4px;

  padding: 5px;

  border-radius: 13px;

  pointer-events: auto;
}

.view-button {
  display: grid;
  place-items: center;
  gap: 2px;

  min-width: 60px;
  min-height: 48px;

  border: 1px solid transparent;
  border-radius: 9px;

  color: var(--muted);
  background: transparent;

  font-size: 10px;

  cursor: pointer;
}

.view-button span {
  font-size: 16px;
}

.view-button.active {
  color: var(--cyan);

  border-color: rgba(53, 221, 255, 0.18);

  background: rgba(53, 221, 255, 0.08);
}

/* =========================================================
   Active scene label
   ========================================================= */

.active-stage-card {
  position: absolute;
  top: 46%;
  left: calc(var(--sidebar-width) + 38%);

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 14px;

  border-radius: 12px;

  pointer-events: none;

  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.active-stage-card__number {
  display: grid;
  place-items: center;

  width: 25px;
  height: 25px;

  border-radius: 50%;

  background:
    linear-gradient(
      145deg,
      var(--blue),
      var(--purple)
    );

  box-shadow:
    0 0 16px rgba(47, 159, 255, 0.5);

  font-size: 11px;
  font-weight: 700;
}

.active-stage-card strong,
.active-stage-card span {
  display: block;
}

.active-stage-card strong {
  font-size: 12px;
}

.active-stage-card div span {
  margin-top: 3px;

  color: var(--muted);
  font-size: 9px;
}

/* =========================================================
   Right sidebar
   ========================================================= */

.right-sidebar {
  position: absolute;
  top: 96px;
  right: 16px;
  bottom: calc(var(--timeline-height) + 30px);

  width: var(--right-panel-width);

  padding: 20px;

  overflow-y: auto;

  border-radius: 18px;

  pointer-events: auto;
}

.pathway-header {
  padding-bottom: 16px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pathway-header p {
  margin: 0;

  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pathway-header span {
  display: block;

  margin-top: 7px;

  color: var(--muted);
  font-size: 10px;
}

#pathway-stage-list {
  position: relative;

  display: grid;
  gap: 2px;

  margin-top: 12px;
}

#pathway-stage-list::before {
  content: "";

  position: absolute;
  top: 23px;
  bottom: 23px;
  left: 14px;

  width: 1px;

  background:
    linear-gradient(
      var(--blue),
      rgba(47, 159, 255, 0.08)
    );
}

.pathway-stage {
  position: relative;

  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 11px;

  width: 100%;

  padding: 11px 4px;

  border: 0;

  color: #a9b7c8;
  background: transparent;

  text-align: left;

  cursor: pointer;
}

.pathway-stage__number {
  z-index: 1;

  display: grid;
  place-items: center;

  width: 29px;
  height: 29px;

  border: 1px solid rgba(95, 145, 202, 0.45);
  border-radius: 50%;

  background: #071428;

  color: #b5c6dc;

  font-size: 11px;
  font-weight: 700;

  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease;
}

.pathway-stage__content strong,
.pathway-stage__content small {
  display: block;
}

.pathway-stage__content strong {
  margin-top: 1px;

  color: #d7e2ef;
  font-size: 12px;
}

.pathway-stage__content small {
  margin-top: 5px;

  color: #7f91a5;

  font-size: 9px;
  line-height: 1.45;
}

.pathway-stage.active {
  color: white;
}

.pathway-stage.active
.pathway-stage__number {
  color: white;

  border-color: var(--cyan);

  background:
    linear-gradient(
      145deg,
      var(--blue),
      var(--purple)
    );

  box-shadow:
    0 0 18px rgba(47, 159, 255, 0.55);
}

.pathway-stage.active
.pathway-stage__content strong {
  color: white;
}

.primary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  width: 100%;
  min-height: 48px;

  margin-top: 16px;

  border: 0;
  border-radius: 11px;

  color: white;

  background:
    linear-gradient(
      100deg,
      #278de9,
      #7e45ed
    );

  box-shadow:
    0 12px 28px rgba(67, 77, 238, 0.3);

  font-size: 12px;
  font-weight: 700;

  cursor: pointer;

  transition:
    transform 160ms ease,
    filter 160ms ease;
}

.primary-action:hover {
  transform: translateY(-1px);

  filter: brightness(1.1);
}

/* =========================================================
   Timeline
   ========================================================= */

.timeline-panel {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;

  height: var(--timeline-height);

  padding: 14px 18px;

  border-radius: 18px;

  pointer-events: auto;
}

.timeline-panel__header {
  display: flex;
  justify-content: space-between;

  margin-bottom: 10px;

  color: #73869d;

  font-size: 9px;
  letter-spacing: 0.08em;
}

.timeline-stages {
  display: grid;
  grid-template-columns: repeat(6, 1fr);

  margin: 0 8px;
}

.timeline-stage {
  position: relative;

  display: grid;
  grid-template-columns: 25px 1fr;
  grid-template-rows: 17px 13px;
  column-gap: 7px;

  padding: 0;

  border: 0;

  color: var(--muted);
  background: transparent;

  text-align: left;

  cursor: pointer;
}

.timeline-stage > span {
  grid-row: 1 / 3;

  display: grid;
  place-items: center;

  width: 25px;
  height: 25px;

  border: 1px solid #455b74;
  border-radius: 50%;

  background: #071427;

  font-size: 10px;
  font-weight: 700;
}

.timeline-stage strong {
  align-self: end;

  font-size: 10px;
  font-weight: 600;
}

.timeline-stage small {
  color: #62768d;
  font-size: 8px;
}

.timeline-stage.active > span {
  color: white;

  border-color: var(--cyan);

  background:
    linear-gradient(
      145deg,
      var(--blue),
      var(--purple)
    );

  box-shadow:
    0 0 14px rgba(47, 159, 255, 0.5);
}

.timeline-stage.active strong {
  color: white;
}

.timeline-track {
  position: relative;

  height: 18px;

  margin: 8px 20px 0;
}

.timeline-track::before {
  content: "";

  position: absolute;
  top: 8px;
  right: 0;
  left: 0;

  height: 3px;

  border-radius: 999px;

  background: rgba(255, 255, 255, 0.08);
}

.timeline-progress {
  position: absolute;
  top: 8px;
  left: 0;

  width: 0;
  height: 3px;

  border-radius: 999px;

  background:
    linear-gradient(
      90deg,
      var(--cyan),
      var(--purple)
    );

  box-shadow:
    0 0 14px rgba(53, 221, 255, 0.52);
}

#timeline-slider {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 18px;

  opacity: 0;

  cursor: pointer;
}

.playback-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;

  margin-top: 5px;
}

.control-button,
.play-button {
  display: grid;
  place-items: center;

  border: 1px solid rgba(123, 178, 229, 0.22);
  border-radius: 50%;

  color: white;
  background: rgba(10, 29, 51, 0.8);

  cursor: pointer;
}

.control-button {
  width: 34px;
  height: 34px;
}

.play-button {
  width: 44px;
  height: 44px;

  border-color: rgba(70, 203, 255, 0.7);

  background:
    radial-gradient(
      circle,
      rgba(47, 159, 255, 0.45),
      rgba(13, 44, 78, 0.9)
    );

  box-shadow:
    0 0 18px rgba(53, 221, 255, 0.4);

  font-size: 16px;
}

.speed-select {
  min-width: 82px;
  height: 36px;

  padding: 0 10px;

  border: 1px solid rgba(123, 178, 229, 0.18);
  border-radius: 9px;

  color: white;
  background: #07172a;

  cursor: pointer;
}

.timeline-stage-description {
  display: grid;

  min-width: 230px;
  margin-left: 12px;
}

.timeline-stage-description strong {
  font-size: 11px;
}

.timeline-stage-description span {
  margin-top: 3px;

  color: var(--muted);
  font-size: 9px;
}

/* =========================================================
   Pathway markers (overlaid on 3D scene)
   ========================================================= */

.pathway-marker-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.pathway-marker-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pathway-marker-path {
  fill: none;
  stroke: #32cfff;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  opacity: 0.55;
  filter: drop-shadow(0 0 4px #32cfff);
}

.pathway-marker {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.pathway-marker-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(6, 20, 32, 0.85);
  border: 1.5px solid #3fb8e6;
  color: #cdeeff;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(63, 184, 230, 0.5);
  transition: all 0.25s ease;
}

.pathway-marker.active .pathway-marker-badge {
  background: #3f6bff;
  border-color: #8fb2ff;
  box-shadow: 0 0 14px rgba(63, 107, 255, 0.85);
  transform: scale(1.15);
}

.pathway-marker.completed .pathway-marker-badge {
  border-color: #3fb8e6;
  opacity: 0.75;
}

/* =========================================================
   Responsive handling
   ========================================================= */

@media (max-width: 1150px) {
  :root {
    --sidebar-width: 220px;
    --right-panel-width: 245px;
  }

  .brand h1 {
    font-size: 13px;
  }

  .pathway-stage__content small {
    display: none;
  }
}

@media (max-width: 850px) {
  .left-sidebar,
  .right-sidebar {
    display: none;
  }

  .scene-header {
    left: 20px;

    width: calc(100% - 40px);
  }

  .active-stage-card {
    left: 24px;
  }

  .timeline-stage-description {
    display: none;
  }
}

/* Hide floating active-stage label over the cell */
#active-stage-card {
  display: none !important;
}