* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Rajdhani", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.viz-root {
  color-scheme: dark;
  --page-plane:     #05070d;
  --surface-1:      #0d1220;
  --text-primary:   #eaf6ff;
  --text-secondary: #8fb4c9;
  --text-muted:     #4d6577;
  --gridline:       #16222c;
  --baseline:       #24404d;
  --border:         rgba(226, 234, 255, 0.26);
  --accent:         #E6EDFF;
  --accent-soft:    rgba(226, 234, 255, 0.35);
  --glow:           rgba(198, 216, 255, 0.45);
  --elapsed-wash:   rgba(226, 234, 255, 0.05);
  --well-mouth:     #090e1a;
  --well-deep:      #000000;
  --well-ring:      rgba(206, 220, 255, 0.30);
  --well-ring-turn: rgba(226, 234, 255, 0.58);
  /* mother-of-pearl: cool blue through white into a faint violet */
  --nacre-1:        #bcd4ff;
  --nacre-2:        #ffffff;
  --nacre-3:        #ecd6ff;

  background: var(--page-plane);
  color: var(--text-primary);
  min-height: 100vh;
}

@media (prefers-color-scheme: light) {
  :root:where(:not([data-theme="dark"])) .viz-root {
    color-scheme: light;
    --page-plane:     #f4f7f8;
    --surface-1:      #ffffff;
    --text-primary:   #0a1f2b;
    --text-secondary: #33586a;
    --text-muted:     #6d8996;
    --gridline:       #dbe6ea;
    --baseline:       #a9c2cc;
    --border:         rgba(89, 104, 140, 0.32);
    --accent:         #59688C;
    --accent-soft:    rgba(89, 104, 140, 0.25);
    --glow:           rgba(89, 104, 140, 0.0);
    --elapsed-wash:   rgba(89, 104, 140, 0.05);
    --well-mouth:     #eaf2f4;
    --well-deep:      #ffffff;
    --well-ring:      rgba(89, 104, 140, 0.30);
    --well-ring-turn: rgba(89, 104, 140, 0.55);
    --nacre-1:        #7c8db5;
    --nacre-2:        #4d5b7d;
    --nacre-3:        #8a7ea6;
  }
}
:root[data-theme="light"] .viz-root {
  color-scheme: light;
  --page-plane:     #f4f7f8;
  --surface-1:      #ffffff;
  --text-primary:   #0a1f2b;
  --text-secondary: #33586a;
  --text-muted:     #6d8996;
  --gridline:       #dbe6ea;
  --baseline:       #a9c2cc;
  --border:         rgba(89, 104, 140, 0.32);
  --accent:         #59688C;
  --accent-soft:    rgba(89, 104, 140, 0.25);
  --glow:           rgba(89, 104, 140, 0.0);
  --elapsed-wash:   rgba(89, 104, 140, 0.05);
  --well-mouth:     #eaf2f4;
  --well-deep:      #ffffff;
  --well-ring:      rgba(89, 104, 140, 0.30);
  --well-ring-turn: rgba(89, 104, 140, 0.55);
  --nacre-1:        #7c8db5;
  --nacre-2:        #4d5b7d;
  --nacre-3:        #8a7ea6;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
}

.topbar h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-shadow: 0 0 12px var(--glow);
  margin: 0;
}

.topbar-date {
  font-family: "Share Tech Mono", monospace;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-shadow: 0 0 10px var(--glow);
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}


.btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 3px;
  font-family: "Rajdhani", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #041014;
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--glow);
}

.btn-primary:hover {
  box-shadow: 0 0 22px var(--glow);
}

.btn-ghost {
  color: var(--text-secondary);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}

.signin-card {
  margin-top: 15vh;
  text-align: center;
  color: var(--text-secondary);
  max-width: 320px;
}

.signin-card p {
  margin-bottom: 20px;
}

.signin-alt {
  margin-top: 14px;
  font-size: 13px;
}

.signin-alt a {
  color: var(--text-secondary);
}

.demo-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "Share Tech Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px 4px 10px;
}

.demo-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px 1px var(--glow);
  animation: led-pulse 1.8s ease-in-out infinite;
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.dial-wrap {
  position: relative;
  width: 100%;
  max-width: 620px;
}

#dial {
  width: 100%;
  height: auto;
  display: block;
}

.well-backdrop {
  fill: url(#wellGradient);
}

.depth-ring {
  fill: none;
  stroke: var(--well-ring);
  stroke-width: 1;
}

.hour-spoke {
  stroke: var(--well-ring);
  stroke-width: 1;
  opacity: 0.6;
}

.depth-ring-turn {
  stroke: var(--well-ring-turn);
  stroke-width: 1.75;
  filter: drop-shadow(0 0 3px var(--glow));
}

.depth-label {
  font-family: "Share Tech Mono", monospace;
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
  dominant-baseline: middle;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.depth-label-turn {
  fill: var(--accent);
  font-weight: 700;
  opacity: 0.9;
}

.rim-circle {
  fill: none;
  stroke: url(#nacreGradient);
  stroke-width: 1.75;
  filter: drop-shadow(0 0 4px var(--glow));
}

.clock-numeral {
  font-family: "Share Tech Mono", monospace;
  font-size: 15px;
  font-weight: 400;
  fill: var(--text-secondary);
  text-anchor: middle;
  dominant-baseline: middle;
  font-variant-numeric: tabular-nums;
}

/* The rim carries the band's colour at full saturation while the face is
   lightened for legibility — reads as a lit edge without costing a filter
   per band, which would be too heavy for this many bands on a Pi. */
/* Only the bands are interactive. Everything drawn over them — the hands
   especially — would otherwise swallow clicks meant for the event beneath. */
#hands-layer,
#markers-layer,
.depth-guides,
.clock-numerals,
.minute-ticks,
.rim-circle,
.well-backdrop {
  pointer-events: none;
}

.event-band {
  cursor: pointer;
  stroke-width: 1.75;
  stroke-linejoin: round;
}

/* No outline or shadow — the text is a deep shade of its own band, which
   carries the contrast on its own. `fill` is set per band in JS. */
.event-label {
  font-family: "Rajdhani", system-ui, sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
  font-weight: 700;
  letter-spacing: 0.01em;
  pointer-events: none;
}

/* All-day events and tasks: a thin line following the ring's circumference
   rather than a wedge, since they have no hour to sit at. */
/* One lane per kind: a thin line round the ring, broken wherever a title is
   written into it. The line is neutral because it is shared by every item on
   it; the titles keep their own colours. */
.day-marker {
  fill: none;
  stroke: var(--well-ring-turn);
  stroke-width: 1.75;
  stroke-linecap: round;
}

.day-marker-task {
  stroke-dasharray: 4 4;
}

.day-marker-label {
  font-family: "Rajdhani", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

/* Both hands are pearl now, so colour can no longer tell them apart — weight
   and length do it instead, as on a real watch face. The hour hand is short,
   heavy and lit; the minute hand long, fine and unlit, so its tip stays a
   precise pointer against the minute scale. */
.hour-hand {
  stroke: url(#nacreGradient);
  stroke-width: 5.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 7px var(--glow));
}

.minute-hand {
  stroke: var(--accent);
  stroke-width: 1.75;
  stroke-linecap: round;
  opacity: 0.95;
}

.minute-tick {
  stroke: var(--text-secondary);
  stroke-width: 1.25;
  opacity: 0.75;
}

.minute-tick-major {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}

.vanishing-point {
  fill: var(--accent);
  stroke: var(--accent);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 8px var(--glow));
  animation: led-pulse 2.4s ease-in-out infinite;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  margin-top: 20px;
  max-width: 480px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: "Rajdhani", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 5px 0.5px currentColor;
}

.toolbar {
  margin-top: 18px;
}

.capture-mode .topbar,
.capture-mode .toolbar,
.capture-mode .status-line,
.capture-mode .demo-badge {
  display: none;
}

.capture-mode .stage {
  padding-top: 6vh;
}

.status-line {
  font-family: "Share Tech Mono", monospace;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.03em;
  margin-top: 8px;
  min-height: 1.2em;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font-family: "Rajdhani", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 0 18px var(--glow), 0 4px 16px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -110%);
  white-space: nowrap;
  z-index: 10;
}

.tooltip .tt-time {
  font-family: "Share Tech Mono", monospace;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
