/* ─── DEV TOOLBAR ─── */
.dev-toolbar {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 8px;
  z-index: 99;
  backdrop-filter: blur(10px);
}
.dev-label { font-size: 0.6rem; font-weight: 700; color: #fbbf24; letter-spacing: 0.12em; margin-right: 0.25rem; }
.dev-input {
  width: 52px; padding: 0.25rem 0.4rem; border-radius: 5px;
  border: 1px solid rgba(251,191,36,0.3); background: rgba(251,191,36,0.06);
  color: #fbbf24; font-size: 0.8rem; font-family: inherit; text-align: center;
  outline: none; font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.dev-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.dev-input:focus { border-color: #fbbf24; }
.dev-unit {
  padding: 0.25rem 0.3rem; border-radius: 5px;
  border: 1px solid rgba(251,191,36,0.3); background: rgba(251,191,36,0.06);
  color: #fbbf24; font-size: 0.72rem; font-family: inherit; outline: none; cursor: pointer;
}
.dev-arrow {
  width: 26px; height: 26px; border-radius: 5px;
  border: 1px solid rgba(251,191,36,0.3); background: rgba(251,191,36,0.06);
  color: #fbbf24; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; transition: all 0.15s;
}
.dev-arrow:hover { background: rgba(251,191,36,0.15); }
.dev-reset {
  padding: 0.25rem 0.5rem; border-radius: 5px;
  border: 1px solid rgba(56,189,248,0.3); background: rgba(56,189,248,0.06);
  color: var(--blue-2); font-size: 0.7rem; font-family: inherit;
  cursor: pointer; margin-left: 0.25rem; transition: all 0.15s;
}
.dev-reset:hover { background: rgba(56,189,248,0.15); }

/* ─── HOME — 2-block single frame ─── */
/* Grid: 2 columns × 2 rows. Row 1 = hero content, Row 2 = secondary content.
   Both columns share the same row heights so separator lines align. */
.home {
  position: relative;
  height: 100vh;
  padding-top: 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

/* ─── LEFT BLOCK ─── */
.home-left {
  grid-row: 1 / -1;
  display: grid;
  grid-template-rows: subgrid;
  padding: 2rem;
  border-right: 1px solid rgba(14,165,233,0.1);
}

.streak-section {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 1rem;
}

.home .circle-wrap {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.home .progress-ring {
  width: 260px;
  height: 260px;
}

.home .outer-hours { inset: -16px; }

.home .ring-number {
  font-size: clamp(2.5rem, 8vw, 3.5rem);
}

.home .below-circle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.home .below-circle .best-streak,
.home .below-circle .milestone {
  white-space: nowrap;
}

.below-sep { color: rgba(14,165,233,0.25); }

/* ─── Circuit Wires + Relapse Button ─── */
/* Button + wires sit in grid row 1, spanning both columns, vertically centered with counter & brain */
.home > .relapse-btn {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  z-index: 10;
  padding: 0.4rem 1.2rem;
  font-size: 0.72rem;
}

.circuit-wire {
  position: absolute;
  top: 30%;
  height: 40px;
  transform: translateY(-50%);
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}

.wire-left {
  left: 35%;
  right: calc(50% + 60px);
}

.wire-right {
  left: calc(50% + 60px);
  right: 25%;
}

.circuit-wire .wire-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.circuit-wire .wire-path {
  fill: none;
  stroke: rgba(14,165,233,0.2);
  stroke-width: 2;
  stroke-linecap: round;
}

.circuit-wire .wire-pulse {
  fill: none;
  stroke: var(--blue-2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 8 20;
  animation: wirePulse 1.5s linear infinite;
  filter: drop-shadow(0 0 4px rgba(56,189,248,0.6));
}

@keyframes wirePulse {
  0% { stroke-dashoffset: 28; }
  100% { stroke-dashoffset: 0; }
}

/* under 1 day — wire visible but gray, no animation */
.circuit-wire.dimmed .wire-pulse { display: none; }
.circuit-wire.dimmed .wire-electron { display: none; }
.circuit-wire.dimmed .wire-path { stroke: rgba(120,140,160,0.18); }

.wire-electron {
  fill: #7dd3fc;
}

/* ─── History Section ─── */
.history-section {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid rgba(14,165,233,0.08);
  padding-top: 1rem;
}

.history-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue-2);
  margin-bottom: 0.25rem;
}

.history-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  letter-spacing: 0.03em;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 0.5rem;
  min-height: 0;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-thumb { background: rgba(14,165,233,0.15); border-radius: 4px; }

.history-empty {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  padding: 2rem 0;
  opacity: 0.6;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: rgba(7,21,37,0.6);
  border: 1px solid rgba(239,68,68,0.1);
  border-radius: 10px;
  transition: border-color 0.2s;
}
.history-row:hover { border-color: rgba(239,68,68,0.25); }

.history-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(239,68,68,0.5); flex-shrink: 0; }
.history-info { flex: 1; min-width: 0; }
.history-date { font-size: 0.78rem; color: var(--text); font-weight: 500; }
.history-streak { font-size: 0.7rem; color: var(--muted); margin-top: 0.1rem; }
.history-ago { font-size: 0.68rem; color: var(--muted); flex-shrink: 0; text-align: right; }

.history-tags { display: flex; gap: 0.4rem; margin-top: 0.35rem; }
.h-tag {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.h-mb   { color: #f0a020; background: rgba(240,160,32,0.1); border: 1px solid rgba(240,160,32,0.2); }
.h-porn { color: #ef4444; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); }

/* ─── RIGHT BLOCK ─── */
.home-right {
  grid-row: 1 / -1;
  display: grid;
  grid-template-rows: subgrid;
  padding: 2rem;
}

.brain-section {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding-top: 1rem;
}

/* ─── 2D Brain ─── */
.brain-2d-container {
  width: 100%;
  max-width: 500px;
  aspect-ratio: 800 / 515;
  position: relative;
  overflow: hidden;
}

.brain-2d-base,
.brain-2d-color {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brain-2d-base {
  filter: brightness(0.45);
}

.brain-2d-color {
  pointer-events: none;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.6s ease;
}

.node-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: #a78bfa;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.node-label {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* 2D Labels */
.brain-2d-label {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.5s, color 0.5s;
  pointer-events: none;
}
.brain-2d-label.active { opacity: 1; color: var(--text); }

.lbl-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  opacity: 0.4; transition: opacity 0.5s, box-shadow 0.5s;
}
.brain-2d-label.active .lbl-dot { opacity: 1; box-shadow: 0 0 6px currentColor; }
.lbl-text { font-weight: 600; }
.lbl-day { opacity: 0.5; font-size: 0.55rem; }

.lbl-frontal    { top: 20%;  left: 2%; }
.lbl-parietal   { top: 12%;  right: 5%; }
.lbl-temporal   { bottom: 15%; left: 30%; }
.lbl-cerebellum { bottom: 8%;  right: 2%; }

/* ─── Recovery Info Cards ─── */
.recovery-info {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
  border-top: 1px solid rgba(14,165,233,0.08);
  padding-top: 1rem;
  overflow-y: auto;
}

.info-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: rgba(7,21,37,0.5);
  border: 1px solid rgba(14,165,233,0.08);
  border-radius: 10px;
  transition: border-color 0.2s;
}
.info-card:hover { border-color: rgba(14,165,233,0.2); }

.info-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }
.info-content { flex: 1; min-width: 0; }
.info-title { font-size: 0.78rem; font-weight: 600; color: var(--blue-3); margin-bottom: 0.15rem; }
.info-desc { font-size: 0.7rem; color: var(--muted); line-height: 1.5; }

/* ─── MOBILE ─── */
@media (max-width: 768px) {
  .home {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .home-left {
    border-right: none;
    border-bottom: 1px solid rgba(14,165,233,0.1);
    padding: 1.5rem 1rem;
  }

  .home-right {
    padding: 1.5rem 1rem;
  }

  .home .circle-wrap {
    width: 160px;
    height: 160px;
  }

  .home .progress-ring {
    width: 160px;
    height: 160px;
  }

  .home .ring-number {
    font-size: 2.2rem;
  }

  .home .outer-hours { display: none; }

  .brain-2d-container { max-width: 350px; }

  .history-section { max-height: 250px; }
}
