:root {
  --bg-0: #020b24;
  --bg-1: #07183c;
  --bg-2: #002358;
  --glass: rgba(8, 19, 48, 0.72);
  --card: rgba(10, 24, 58, 0.88);
  --line: rgba(110, 169, 255, 0.34);
  --text: #dbe9ff;
  --muted: #8fb1e8;
  --accent: #25b5ff;
  --accent-2: #47f1ff;
  --ok: #8cf6c8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at 10% 20%, #133c89 0%, transparent 32%),
    radial-gradient(circle at 85% 10%, #005ed2 0%, transparent 34%),
    linear-gradient(140deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
  overflow-x: hidden;
}

h1, h2, h3, p {
  margin: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.bg-glow {
  position: fixed;
  width: 42vw;
  height: 42vw;
  filter: blur(60px);
  opacity: 0.26;
  z-index: 0;
  pointer-events: none;
}

.bg-glow-a {
  background: #147fff;
  left: -12vw;
  top: 25vh;
}

.bg-glow-b {
  background: #00d9ff;
  right: -16vw;
  top: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 24px;
  display: grid;
  grid-template-columns: 260px minmax(560px, 1fr) minmax(320px, 42vw);
  gap: 16px;
}

.tab-rail,
.detail-panel,
.viz-panel {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 20px;
  backdrop-filter: blur(14px);
}

.tab-rail {
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rail-head h1 {
  font-size: 1.4rem;
}

.eyebrow {
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.73rem;
  margin-bottom: 6px;
}

.tab-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.tab-btn {
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(9, 21, 53, 0.65);
  color: var(--text);
  cursor: pointer;
  transition: 160ms ease;
  font-family: inherit;
}

.tab-btn:hover {
  border-color: rgba(71, 241, 255, 0.45);
}

.tab-btn[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(37, 181, 255, 0.35), inset 0 0 20px rgba(37, 181, 255, 0.1);
  background: rgba(16, 37, 81, 0.9);
}

.tab-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.tab-hours {
  margin-top: 5px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
}

.detail-panel {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.detail-badge {
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  margin-bottom: 8px;
}

#detailTitle {
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.15;
}

.detail-subtitle {
  margin-top: 8px;
  color: var(--muted);
  max-width: 72ch;
}

.description {
  line-height: 1.5;
  color: #cfe2ff;
}

.hours-grid,
.split-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hours-card,
.info-card,
.stage-item,
.task-item {
  background: var(--card);
  border: 1px solid rgba(115, 175, 255, 0.25);
  border-radius: 14px;
  padding: 12px;
}

.hours-label {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 5px;
}

.hours-value {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.info-card p {
  color: #d4e4ff;
  font-size: 0.9rem;
  line-height: 1.45;
}

.stage-list,
.task-list {
  display: grid;
  gap: 8px;
}

.stage-item strong,
.task-item strong {
  color: var(--ok);
  font-size: 0.88rem;
}

.stage-item p,
.task-item p {
  margin-top: 4px;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.45;
}

.task-time {
  margin-top: 6px;
  font-family: "IBM Plex Mono", monospace;
  color: #8ef4ff;
  font-size: 0.8rem;
}

.detail-foot {
  color: var(--muted);
  font-size: 0.78rem;
}

.viz-panel {
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.viz-hint {
  color: var(--muted);
  font-size: 0.84rem;
}

.viz-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.viz-btn {
  border: 1px solid rgba(115, 175, 255, 0.35);
  background: rgba(8, 24, 58, 0.85);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.viz-btn:hover {
  border-color: var(--accent-2);
}

.zoom-label {
  margin-left: auto;
  color: #8ef4ff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.viz-viewport {
  width: 100%;
  height: calc(100vh - 136px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(108, 169, 255, 0.35);
  background: rgba(4, 10, 30, 0.7);
  cursor: grab;
}

.viz-viewport.dragging {
  cursor: grabbing;
}

.viz-canvas {
  position: relative;
}

#vizImage {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 220px 1fr;
  }

  .viz-panel {
    grid-column: 1 / -1;
  }

  .viz-viewport {
    height: 60vh;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .tab-rail {
    max-height: 38vh;
  }

  .hours-grid,
  .split-info {
    grid-template-columns: 1fr;
  }

  .zoom-label {
    width: 100%;
    margin-left: 0;
  }
}
