:root {
  --blur: 28px;
  --r-card: 24px;
  --r-pill: 100px;
  --bg: #eef1f8;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-h: rgba(255, 255, 255, 0.85);
  --border: rgba(255, 255, 255, 0.85);
  --border-m: rgba(0, 0, 0, 0.07);
  --t1: #12131a;
  --t2: #4a506e;
  --t3: #9097b8;
  --accent: #007aff;
  --accent2: #5e5ce6;
  --gold: #ff9f0a;
  --green: #34c759;
  --red: #ff3b30;
  --sh-s: 0 2px 12px rgba(0, 0, 0, 0.06);
  --sh-m: 0 8px 36px rgba(0, 0, 0, 0.12);
  --sh-l: 0 20px 60px rgba(0, 0, 0, 0.18);
  --font-display: "Josefin Sans", sans-serif;
  --font-body: "Roboto Mono", monospace;
  --font-mono: "Roboto Mono", monospace;
}

[data-theme="dark"] {
  --bg: #000000;
  --surface: rgba(18, 18, 24, 0.85);
  --surface-h: rgba(28, 28, 38, 0.95);
  --border: rgba(255, 255, 255, 0.15);
  --border-m: rgba(255, 255, 255, 0.12);
  --t1: #ffffff;
  --t2: #a8b0d3;
  --t3: #6b7394;
  --sh-s: 0 4px 24px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --sh-m: 0 12px 48px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --sh-l: 0 24px 80px rgba(0, 0, 0, 0.95);
  --accent: #0a84ff;
  --accent2: #7b61ff;
  --gold: #ffb340;
  --green: #30d158;
  --red: #ff453a;
  --glow-blue: rgba(10, 132, 255, 0.4);
  --glow-purple: rgba(123, 97, 255, 0.4);
  --glow-gold: rgba(255, 179, 64, 0.4);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}

html {
  scroll-behavior: auto !important  /* disable smooth scroll on load */
}

body {
  font-family: var(--font-body);
  font-optical-sizing: auto;
  font-variation-settings: "wdth" 100;
  background: var(--bg);
  color: var(--t1);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .4s cubic-bezier(.4, 0, .2, 1), color .4s cubic-bezier(.4, 0, .2, 1);
  padding-top: 124px
}

/* ── MARQUEE ── */
.loc-detail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px
}

.loc-detail-row span {
  font-size: .65rem;
  color: var(--t3);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border-m);
  border-radius: 8px;
  padding: 2px 7px
}

.marquee-box {
  overflow: hidden;
  white-space: nowrap;
  background: var(--bg);
  border: 1px solid var(--border-m);
  border-radius: 10px;
  padding: 5px 10px;
  margin-top: 8px;
  position: relative
}

.marquee-box::before,
.marquee-box::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  z-index: 2;
  pointer-events: none
}

.marquee-box::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg), transparent)
}

.marquee-box::after {
  right: 0;
  background: linear-gradient(-90deg, var(--bg), transparent)
}

.marquee-track {
  display: inline-flex;
  gap: 40px;
  animation: marqueeRoll 20s linear infinite
}

.marquee-track:hover {
  animation-play-state: paused
}

.marquee-item {
  display: inline-block;
  font-size: .68rem;
  font-weight: 500;
  color: var(--t2);
  white-space: nowrap
}

@keyframes marqueeRoll {
  0% {
    transform: translateX(0)
  }

  100% {
    transform: translateX(-50%)
  }
}

/* ── BLOBS ── */
.liquid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .55;
  animation: floatA 18s ease-in-out infinite
}

[data-theme="dark"] .blob {
  opacity: .25;
  filter: blur(140px);
  mix-blend-mode: screen
}

.b1 {
  width: 650px;
  height: 650px;
  background: radial-gradient(#7dd3fc, #a78bfa);
  top: -180px;
  left: -160px;
  animation-name: floatA
}

.b2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(#fda4af, #fb923c);
  top: 30%;
  right: -150px;
  animation-name: floatB;
  animation-duration: 22s
}

.b3 {
  width: 420px;
  height: 420px;
  background: radial-gradient(#6ee7b7, #34d399);
  bottom: -80px;
  left: 25%;
  animation-name: floatC;
  animation-duration: 26s
}

@keyframes floatA {

  0%,
  100% {
    transform: translate(0, 0) scale(1)
  }

  50% {
    transform: translate(50px, -60px) scale(1.07)
  }
}

@keyframes floatB {

  0%,
  100% {
    transform: translate(0, 0)
  }

  40% {
    transform: translate(-60px, 50px) scale(1.05)
  }

  70% {
    transform: translate(30px, -30px)
  }
}

@keyframes floatC {

  0%,
  100% {
    transform: translate(0, 0)
  }

  50% {
    transform: translate(40px, -50px) scale(1.08)
  }
}

/* ── NAVBAR ── */
.navbar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: max-content;
  max-width: 920px;
  min-width: 580px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 20px;

  /* ── FROSTED GLASS ── */
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px) saturate(180%) brightness(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(180%) brightness(1.1);

  /* Pill shape */
  border-radius: 100px;

  /* Thin white border — glass edge */
  border: 1px solid rgba(255, 255, 255, 0.75);

  /* Layered shadow — floats above */
  box-shadow:
    0 2px 16px rgba(0, 0, 0, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -1px 0 rgba(0, 0, 0, 0.04) inset;

  animation: floatNavIn .5s cubic-bezier(.34, 1.2, .64, 1) both;
  transition: background .3s ease, box-shadow .3s ease, backdrop-filter .3s ease;
}

/* When scrolled — glass gets stronger */
.navbar.scrolled {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(32px) saturate(200%) brightness(1.05);
  -webkit-backdrop-filter: blur(32px) saturate(200%) brightness(1.05);
  box-shadow:
    0 4px 28px rgba(0, 0, 0, 0.10),
    0 1px 0 rgba(255, 255, 255, 1) inset;
}

/* Dark mode — dark frosted glass */
[data-theme="dark"] .navbar {
  background: rgba(14, 14, 20, 0.60);
  backdrop-filter: blur(24px) saturate(180%) brightness(0.9);
  -webkit-backdrop-filter: blur(24px) saturate(180%) brightness(0.9);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    0 2px 20px rgba(0, 0, 0, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.07) inset;
}

[data-theme="dark"] .navbar.scrolled {
  background: rgba(10, 10, 16, 0.78);
  backdrop-filter: blur(36px) saturate(200%) brightness(0.85);
  -webkit-backdrop-filter: blur(36px) saturate(200%) brightness(0.85);
  box-shadow:
    0 6px 40px rgba(0, 0, 0, 0.65),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-18px) }
  to   { opacity: 1; transform: none }
}

@keyframes floatNavIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px
}

.logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block
}

.logo-text .lt {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.05em;
  font-variation-settings: "wdth" 100;
  color: var(--t1)
}

.logo-text .ls {
  font-size: .75rem;
  color: var(--t3);
  letter-spacing: .04em;
  margin-top: 1px
}

/* nav-center: flex:1 so it fills remaining space and stays naturally centered */
.nav-center {
  flex: 1;
  text-align: center;
  pointer-events: none
}

.live-clock {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.04em;
  color: var(--t1);
  font-variant-numeric: tabular-nums
}

.live-date {
  font-size: .72rem;
  color: var(--t3);
  letter-spacing: .04em;
  margin-top: 1px
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px
}

/* ── NAV SIDE CLUSTER — LIVE badge + Location (right of screen, separate from pill) ── */
.nav-side-cluster {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 101;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  animation: floatNavIn .6s .1s cubic-bezier(.34, 1.2, .64, 1) both;
  pointer-events: none   /* let clicks pass through — badges are read-only */
}

.loc-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  font-size: .75rem;
  font-weight: 500;
  color: var(--t2);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis
}

[data-theme="dark"] .loc-pill {
  background: rgba(14, 14, 20, 0.65);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--t2)
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(52, 199, 89, .12);
  border: 1px solid rgba(52, 199, 89, .3);
  font-size: .7rem;
  font-weight: 700;
  color: var(--green)
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 1.5s ease-in-out infinite
}

@keyframes pulse-dot {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(52, 199, 89, .5)
  }

  50% {
    box-shadow: 0 0 0 5px rgba(52, 199, 89, 0)
  }
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-m);
  background: var(--surface);
  backdrop-filter: blur(10px);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .25s ease;
  box-shadow: var(--sh-s);
  color: var(--t1)
}

.icon-btn:hover {
  transform: scale(1.08);
  background: var(--surface-h);
  box-shadow: var(--sh-m)
}

/* ── LAYOUT ── */
.app {
  position: relative;
  z-index: 1;
  padding: 0 0 60px
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px
}

.section-title {
  font-family: var(--font-display);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 18px
}

/* ── VIZ SECTION ── */
.viz-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 28px 0 20px;
  animation: fadeUp .7s .1s ease both
}

@media(max-width:760px) {
  .viz-section {
    grid-template-columns: 1fr
  }
}

.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  box-shadow: var(--sh-s), inset 0 1px 0 rgba(255, 255, 255, .6);
  padding: 24px;
  transition: box-shadow .3s ease
}

[data-theme="dark"] .glass-card {
  background: rgba(18, 18, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%)
}

[data-theme="dark"] .glass-card:hover {
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 40px rgba(10, 132, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2)
}

.glass-card:hover {
  box-shadow: var(--sh-m), inset 0 1px 0 rgba(255, 255, 255, .7)
}

.card-label {
  font-family: var(--font-display);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px
}

/* ── 3D SOLAR PANEL ── */
.scene-wrap {
  perspective: 700px;
  perspective-origin: 50% 15%;
  width: 100%;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center
}

.scene-inner {
  transform-style: preserve-3d;
  transform: rotateX(22deg);
  width: 280px;
  height: 200px;
  position: relative
}

.s-ground {
  position: absolute;
  width: 280px;
  height: 280px;
  left: 0;
  bottom: -30px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(120, 180, 255, .15) 0%, transparent 70%);
  transform: rotateX(90deg);
  transform-origin: bottom center;
  backface-visibility: visible
}

.s-base {
  position: absolute;
  width: 60px;
  height: 10px;
  left: 110px;
  bottom: 0;
  background: linear-gradient(135deg, #c8cacf, #a0a2a8);
  border-radius: 4px;
  transform-style: preserve-3d
}

.s-pole {
  position: absolute;
  width: 6px;
  height: 110px;
  left: 137px;
  bottom: 10px;
  background: linear-gradient(90deg, #b0b3ba, #d0d3da, #a8abb2);
  border-radius: 3px;
  transform-style: preserve-3d
}

[data-theme="dark"] .s-pole {
  background: linear-gradient(90deg, #3a3d4a, #5a5d6a, #32353f);
  box-shadow: 0 0 20px rgba(10, 132, 255, 0.2)
}

[data-theme="dark"] .s-ground {
  background: radial-gradient(ellipse, rgba(10, 132, 255, .25) 0%, rgba(123, 97, 255, .15) 40%, transparent 70%)
}

[data-theme="dark"] .s-face {
  background: linear-gradient(135deg, #0d1f3f 0%, #061528 40%, #0d1f35 100%);
  border-color: rgba(10, 132, 255, .5);
  box-shadow: 0 0 30px rgba(10, 132, 255, 0.3), inset 0 0 20px rgba(10, 132, 255, 0.1)
}

[data-theme="dark"] .cell-grid {
  background-image: linear-gradient(rgba(10, 132, 255, .3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 132, 255, .3) 1px, transparent 1px)
}

.s-pivot {
  position: absolute;
  left: 140px;
  bottom: 135px;           /* raised from 120px → creates ~15px gap between panel and pole top */
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateY(180deg) rotateX(0deg);
  transition: transform 1.2s cubic-bezier(.34, 1.15, .64, 1)
}

.s-panel {
  position: absolute;
  width: 160px;
  height: 100px;
  left: -80px;
  top: -50px;
  transform-style: preserve-3d
}

.s-face {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: linear-gradient(135deg, #1a3a6b 0%, #0d2750 40%, #1a3560 100%);
  border: 3px solid rgba(100, 160, 220, .4);
  overflow: hidden;
  transform: translateZ(2px)
}

.cell-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(100, 180, 255, .18) 1px, transparent 1px), linear-gradient(90deg, rgba(100, 180, 255, .18) 1px, transparent 1px);
  background-size: 20px 20px
}

.cell-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .12) 0%, transparent 50%, rgba(255, 255, 255, .04) 100%)
}

.s-back {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: linear-gradient(#3a3c46, #2a2c36);
  transform: translateZ(-2px) rotateY(180deg)
}

.s-edge-t {
  position: absolute;
  width: 160px;
  height: 4px;
  left: 0;
  top: -4px;
  background: #4a6080;
  transform-origin: bottom;
  transform: rotateX(90deg);
  transform-style: preserve-3d
}

.s-edge-b {
  position: absolute;
  width: 160px;
  height: 4px;
  left: 0;
  bottom: -4px;
  background: #2a3844;
  transform-origin: top;
  transform: rotateX(-90deg);
  transform-style: preserve-3d
}

.panel-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-m)
}

.ps-item {
  text-align: center
}

.ps-val {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--t1)
}

.ps-lbl {
  font-size: .65rem;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 2px
}

/* ── SUN COMPASS ── */
.compass-svg-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px
}

#sunPathSVG {
  width: 220px;
  height: 220px
}

.c-ring {
  fill: none;
  stroke: var(--border-m);
  stroke-width: 1
}

.c-ring-mid {
  fill: none;
  stroke: var(--border-m);
  stroke-width: .5;
  stroke-dasharray: 3 3
}

.c-cross {
  stroke: var(--border-m);
  stroke-width: .8
}

.c-lbl {
  fill: var(--t3);
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-body)
}

.sun-path-line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8;
  stroke-linecap: round;
  opacity: .7
}

.panel-dir-line {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 4 3;
  opacity: .8
}

.sun-dot-glow {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  opacity: .3;
  animation: sunPulse 2s ease-in-out infinite
}

.sun-dot-inner {
  fill: var(--gold)
}

@keyframes sunPulse {

  0%,
  100% {
    r: 14;
    opacity: .3
  }

  50% {
    r: 18;
    opacity: .15
  }
}

.zenith-dot {
  fill: var(--t3);
  opacity: .5
}

.sqi {
  display: flex;
  gap: 10px;
  justify-content: center
}

.sqi-item {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-m);
  border-radius: 14px;
  padding: 10px;
  text-align: center
}

.sqi-val {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--t1)
}

.sqi-lbl {
  font-size: .62rem;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .05em
}

/* ── CONTROL SECTION ── */
.control-section {
  animation: fadeUp .7s .2s ease both;
  margin-bottom: 20px
}

.control-card {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.80);
  border-radius: var(--r-card);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 24px;
  transition: box-shadow .3s ease
}

[data-theme="dark"] .control-card {
  background: rgba(18, 18, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%)
}

.ctrl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px
}

.ctrl-title-block .ct {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--t1)
}

.ctrl-title-block .cs {
  font-size: .78rem;
  color: var(--t3);
  margin-top: 3px
}

/* Mode pills — Apple segmented control style */
.mode-pills {
  display: flex;
  background: rgba(120, 120, 128, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 4px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.06)
}

[data-theme="dark"] .mode-pills {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05)
}

.mode-pill {
  padding: 9px 22px;
  border-radius: var(--r-pill);
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: var(--t2);
  cursor: pointer;
  transition: all .3s cubic-bezier(.34, 1.4, .64, 1);
  display: flex;
  align-items: center;
  gap: 7px
}

.mode-pill.active {
  background: rgba(255, 255, 255, 0.85);
  color: var(--t1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 1);
  backdrop-filter: blur(10px)
}

[data-theme="dark"] .mode-pill.active {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px)
}

[data-theme="dark"] .mode-pill.active.auto {
  box-shadow: 0 4px 20px rgba(48, 209, 88, 0.4),
    0 0 0 1px rgba(48, 209, 88, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 30px rgba(48, 209, 88, 0.2)
}

[data-theme="dark"] .mode-pill.active.manual {
  box-shadow: 0 4px 20px rgba(10, 132, 255, 0.4),
    0 0 0 1px rgba(10, 132, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 30px rgba(10, 132, 255, 0.2)
}

.mode-pill.active.auto {
  color: var(--green)
}

.mode-pill.active.manual {
  color: var(--accent)
}

.mode-pill:not(.active):hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.02)
}

/* Auto info box */
.auto-info-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(52, 199, 89, 0.08);
  border: 1px solid rgba(52, 199, 89, 0.25);
  border-radius: 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5)
}

.aib-icon {
  font-size: 1.8rem
}

.aib-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--green)
}

.aib-sub {
  font-size: .78rem;
  color: var(--t3);
  margin-top: 3px;
  max-width: 420px
}

/* ── SLIDERS ── */
.sliders-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

@media(max-width:600px) {
  .sliders-wrap {
    grid-template-columns: 1fr
  }
}

.slider-card {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 20px;
  padding: 18px;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform .25s ease, box-shadow .25s ease
}

.slider-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10), inset 0 1px 0 rgba(255, 255, 255, 1)
}

[data-theme="dark"] .slider-card {
  background: rgba(18, 18, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%)
}

[data-theme="dark"] .slider-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 40px rgba(10, 132, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25)
}

.slc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px
}

.slc-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--t1)
}

.slc-desc {
  font-size: .72rem;
  color: var(--t3);
  margin-top: 3px
}

.slc-badge {
  padding: 5px 14px;
  border-radius: var(--r-pill);
  background: rgba(0, 122, 255, 0.12);
  border: 1px solid rgba(0, 122, 255, 0.30);
  font-size: .85rem;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--accent);
  min-width: 56px;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.12)
}

.slc-badge.az {
  background: rgba(94, 92, 230, 0.12);
  border-color: rgba(94, 92, 230, 0.30);
  color: var(--accent2);
  box-shadow: 0 2px 8px rgba(94, 92, 230, 0.12)
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--val, 0%), rgba(0, 0, 0, 0.08) var(--val, 0%), rgba(0, 0, 0, 0.08) 100%);
  margin: 4px 0;
  transition: background .1s
}

input[type=range].az-slider {
  background: linear-gradient(90deg, var(--accent2) 0%, var(--accent2) var(--val, 50%), rgba(0, 0, 0, 0.08) var(--val, 50%), rgba(0, 0, 0, 0.08) 100%)
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff, #e8f0fe);
  border: 2.5px solid var(--accent);
  box-shadow: 0 2px 12px rgba(0, 122, 255, 0.40), 0 0 0 4px rgba(0, 122, 255, 0.08);
  transition: transform .2s ease, box-shadow .2s ease
}

input[type=range].az-slider::-webkit-slider-thumb {
  border-color: var(--accent2);
  box-shadow: 0 2px 12px rgba(94, 92, 230, .40), 0 0 0 4px rgba(94, 92, 230, 0.08)
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  box-shadow: 0 4px 18px rgba(0, 122, 255, 0.55), 0 0 0 6px rgba(0, 122, 255, 0.12)
}

.slc-ends {
  display: flex;
  justify-content: space-between;
  font-size: .65rem;
  color: var(--t3);
  margin-top: 6px
}

.dir-labels {
  display: flex;
  justify-content: space-between;
  font-size: .58rem;
  color: var(--t3);
  margin-top: 4px;
  padding: 0 2px
}

/* ── WIDGETS ── */
.widgets-section {
  animation: fadeUp .7s .3s ease both
}

.widgets-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch
}

@media(max-width:1100px) {
  .widgets-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr))
  }
}

@media(max-width:760px) {
  .widgets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }
}

@media(max-width:480px) {
  .widgets-grid {
    grid-template-columns: 1fr
  }
}

/* All widgets: same size, same glass effect */
.widget {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  padding: 18px 20px;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform .35s cubic-bezier(.34, 1.36, .64, 1), box-shadow .35s ease;
  animation: fadeUp .5s ease both;
  display: flex;
  flex-direction: column;
  justify-content: space-between;   /* equal-height: push sub-content to bottom */
  min-height: 200px;                /* all widgets same minimum height */
  overflow: hidden;
}

[data-theme="dark"] .widget {
  background: rgba(18, 18, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%)
}

.widget:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9)
}

[data-theme="dark"] .widget:hover {
  box-shadow: 0 12px 56px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 50px rgba(10, 132, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-6px)
}

.widget:nth-child(1) {
  animation-delay: .05s
}

.widget:nth-child(2) {
  animation-delay: .1s
}

.widget:nth-child(3) {
  animation-delay: .15s
}

.widget:nth-child(4) {
  animation-delay: .2s
}

.widget:nth-child(5) {
  animation-delay: .25s
}

.widget:nth-child(6) {
  animation-delay: .3s
}

.widget:nth-child(7) {
  animation-delay: .35s
}

.widget:nth-child(8) {
  animation-delay: .4s
}

/* Remove the old .hi accent — all widgets now look the same */
.widget.hi {
  background: rgba(255, 255, 255, 0.45);
  border-color: rgba(255, 255, 255, 0.72);
}

[data-theme="dark"] .widget.hi {
  background: rgba(18, 18, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* LDR + Serial Monitor span 2 columns each */
.widget.ldr-widget    { grid-column: span 2; }
.widget.serial-widget { grid-column: span 2; min-height: auto; }

.w-icon {
  font-size: 1.5rem;
  margin-bottom: 8px
}

.w-title {
  font-family: var(--font-display);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 10px
}

.w-main {
  font-family: var(--font-body);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -.05em;
  color: var(--t1);
  line-height: 1
}

.w-sub {
  font-size: .72rem;
  color: var(--t3);
  margin-top: 5px;
  min-height: 16px
}

.w-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap
}

.w-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1px solid var(--border-m);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: .72rem;
  font-weight: 500;
  color: var(--t2)
}

.w-chip span:first-child {
  font-size: .85rem
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: .65rem;
  font-weight: 600;
  color: var(--green);
  background: rgba(52, 199, 89, .1);
  border: 1px solid rgba(52, 199, 89, .2);
  padding: 3px 10px;
  border-radius: var(--r-pill)
}

.lp-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 1.5s ease-in-out infinite
}

/* day progress */
.day-bar-wrap {
  margin: 12px 0 8px
}

.day-bar {
  position: relative;
  height: 6px;
  background: var(--border-m);
  border-radius: 3px
}

.day-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff9f0a, #ff6b00);
  transition: width 1s ease
}

.day-sun-icon {
  position: absolute;
  top: -7px;
  font-size: 16px;
  transform: translateX(-50%);
  transition: left 1s ease
}

/* power gauge */
.pwr-gauge {
  height: 8px;
  background: var(--border-m);
  border-radius: 4px;
  margin: 12px 0 6px;
  overflow: hidden
}

.pwr-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #34c759, #30d158);
  transition: width 1s ease;
  position: relative
}

.pwr-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .4))
}

/* env bars */
.env-bar-row {
  margin-top: 10px
}

.ebr-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px
}

.ebr-lbl {
  font-size: .65rem;
  color: var(--t3);
  width: 70px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .04em
}

.ebr-track {
  flex: 1;
  height: 5px;
  background: var(--border-m);
  border-radius: 3px;
  overflow: hidden
}

.ebr-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #007aff, #5ac8fa);
  transition: width 1s ease
}

.ebr-fill.humid {
  background: linear-gradient(90deg, #5e5ce6, #bf5fff)
}

.ebr-fill.cloud {
  background: linear-gradient(90deg, #8e8e93, #c7c7cc)
}

.ebr-val {
  font-size: .7rem;
  font-weight: 600;
  color: var(--t2);
  width: 32px;
  text-align: right
}

/* energy ring */
.energy-ring-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0
}

.energy-ring {
  position: relative;
  width: 90px;
  height: 90px
}

.energy-ring svg {
  transform: rotate(-90deg)
}

.er-bg {
  fill: none;
  stroke: var(--border-m);
  stroke-width: 7
}

.er-fill {
  fill: none;
  stroke: url(#energyGrad);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s ease
}

.er-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center
}

.er-pct {
  font-size: .95rem;
  font-weight: 800;
  color: var(--t1)
}

.er-lbl {
  font-size: .55rem;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .05em
}

/* ── TOAST ── */
#toastContainer {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 400;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(18, 19, 26, .9);
  color: #fff;
  font-size: .83rem;
  font-weight: 500;
  box-shadow: 0 8px 28px rgba(0, 0, .25);
  backdrop-filter: blur(20px);
  animation: toastIn .4s cubic-bezier(.34, 1.4, .64, 1) both;
  max-width: 300px
}

[data-theme="dark"] .toast {
  background: rgba(18, 18, 24, 0.95);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%)
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.92)
  }

  to {
    opacity: 1;
    transform: none
  }
}

.toast.out {
  animation: toastOut .3s ease both
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px) scale(.95)
  }
}

/* ── UTIL ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: var(--border-m);
  border-radius: 4px;
  transition: background .3s
}

::-webkit-scrollbar-thumb:hover {
  background: var(--t3)
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1)
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 10px rgba(10, 132, 255, 0.3)
}

/* ═══════════════════════════════════════════════════════════════
   SECTION A — ALERT BAR
   .alert-bar   sticky ribbon just below the navbar
   .alert-pill  individual badge per alert
═══════════════════════════════════════════════════════════════ */

.alert-bar {
  /* Floating format */
  position: fixed;
  top: 96px; /* 20 + 68 + 8 gap */
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 40px);
  z-index: 90;
  padding: 6px 24px;
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  background: rgba(240, 242, 248, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  animation: slideDownNav .5s .1s ease both;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: var(--r-pill); /* match navbar float style */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  min-height: 40px;
  transition: min-height .3s ease, padding .3s ease
}

/* Collapsed state — only the toggle chevron shows */
.alert-bar--collapsed {
  padding: 4px 24px;
  min-height: 28px
}

/* hide completely when no pills are inside */
.alert-bar:empty {
  display: none
}

[data-theme="dark"] .alert-bar {
  background: rgba(10, 10, 15, 0.80);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6)
}

/* ── Collapse / expand chevron button ── */
.alert-toggle {
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 600;
  color: var(--t3);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-m);
  background: var(--surface);
  transition: all .2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap
}

.alert-toggle:hover {
  background: var(--surface-h);
  color: var(--t1);
  transform: scale(1.04)
}

[data-theme="dark"] .alert-toggle {
  border-color: rgba(255,255,255,.15);
  color: var(--t3)
}

/* ── individual alert badge ── */
.alert-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: opacity .2s ease, transform .2s ease
}

/* severity colour variants */
.alert-pill.ok {
  background: rgba(52, 199, 89, 0.15);
  border-color: rgba(52, 199, 89, 0.40);
  color: var(--green)
}

.alert-pill.warn {
  background: rgba(255, 159, 10, 0.15);
  border-color: rgba(255, 159, 10, 0.40);
  color: var(--gold)
}

.alert-pill.danger {
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.40);
  color: var(--red)
}

.alert-pill.info {
  background: rgba(0, 122, 255, 0.15);
  border-color: rgba(0, 122, 255, 0.40);
  color: var(--accent)
}

/* dismiss × button inside a pill */
.alert-dismiss {
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  margin-left: 6px;
  opacity: .6;
  font-size: .85rem;
  line-height: 1;
  padding: 0;
  transition: opacity .15s ease
}

.alert-dismiss:hover {
  opacity: 1
}


/* ═══════════════════════════════════════════════════════════════
   SECTION B — WEBSOCKET PANEL
   .ws-panel    top-level container (mirrors .control-card glass)
   .ws-ip-input input for the ESP32 IP address
   .ws-connect-btn  connect / disconnect toggle
   .ws-status-dot   animated connection indicator
   .ws-info-text    small mono status label
═══════════════════════════════════════════════════════════════ */

.ws-panel {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.80);
  border-radius: var(--r-card);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 16px 24px;                 /* more compact than original 24px */
  transition: box-shadow .3s ease;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px
}

[data-theme="dark"] .ws-panel {
  background: rgba(18, 18, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%)
}

/* IP address text field */
.ws-ip-input {
  height: 42px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-m);
  background: var(--bg);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: .85rem;
  color: var(--t1);
  outline: none;
  width: 200px;
  transition: border-color .2s ease, box-shadow .2s ease
}

.ws-ip-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15)
}

/* connect / disconnect toggle button */
.ws-connect-btn {
  height: 42px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #34c759, #30d158);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  border: none;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease
}

.ws-connect-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.40)
}

/* disconnected state — button turns red */
.ws-connect-btn.disconnected {
  background: linear-gradient(135deg, #ff3b30, #ff453a)
}

.ws-connect-btn.disconnected:hover {
  box-shadow: 0 4px 16px rgba(255, 59, 48, 0.40)
}

/* animated status dot */
.ws-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0
}

.ws-status-dot.connected {
  background: var(--green);
  animation: pulse-dot 1.5s ease-in-out infinite   /* reuses .live-dot keyframe */
}

.ws-status-dot.disconnected {
  background: var(--red);
  animation: none
}

.ws-status-dot.reconnecting {
  background: var(--gold);
  animation: pulse-dot .7s ease-in-out infinite
}

/* small mono status label */
.ws-info-text {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: .75rem;
  color: var(--t3)
}


/* ═══════════════════════════════════════════════════════════════
   SECTION C — LDR WIDGET ADDITIONS
   .ldr-grid    2×2 compass grid of sensor readings
   .ldr-item    individual cell
   .ldr-label   tiny uppercase caption
   .ldr-value   numeric reading
   .ldr-bar     mini progress bar track
   .ldr-bar-fill animated fill
═══════════════════════════════════════════════════════════════ */

.ldr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px
}

.ldr-item {
  background: var(--bg);
  border: 1px solid var(--border-m);
  border-radius: 12px;
  padding: 8px 12px
}

.ldr-label {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--t3)
}

.ldr-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--t1);
  margin: 4px 0
}

.ldr-bar {
  height: 5px;
  background: var(--border-m);
  border-radius: 3px;
  overflow: hidden
}

.ldr-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff9f0a, #ff6b00);
  transition: width .5s ease
}


/* ═══════════════════════════════════════════════════════════════
   SECTION D — SERIAL MONITOR
   .serial-monitor   always-dark terminal pane
   .serial-line      one log line (green mono text)
   .serial-time      dim timestamp prefix
   .serial-clear-btn ghost clear button
═══════════════════════════════════════════════════════════════ */

.serial-monitor {
  background: #0a0a0f;
  border: 1px solid rgba(48, 209, 88, 0.20);
  border-radius: 16px;
  padding: 14px;
  height: 180px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: .04em;
  font-size: .7rem
}

/* custom narrow scrollbar — green tinted */
.serial-monitor::-webkit-scrollbar {
  width: 4px
}

.serial-monitor::-webkit-scrollbar-track {
  background: transparent
}

.serial-monitor::-webkit-scrollbar-thumb {
  background: rgba(48, 209, 88, 0.40);
  border-radius: 2px
}

.serial-monitor::-webkit-scrollbar-thumb:hover {
  background: rgba(48, 209, 88, 0.65)
}

/* individual log line */
.serial-line {
  color: #30d158;
  display: block;
  margin-bottom: 3px;
  word-break: break-all
}

/* dim timestamp prefix on each line */
.serial-time {
  color: rgba(48, 209, 88, 0.50);
  margin-right: 8px
}

/* ghost "Clear" button below the monitor */
.serial-clear-btn {
  display: block;
  margin-top: 8px;
  padding: 4px 14px;
  border-radius: var(--r-pill);
  background: rgba(48, 209, 88, 0.10);
  border: 1px solid rgba(48, 209, 88, 0.25);
  color: #30d158;
  font-size: .7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, box-shadow .2s ease
}

.serial-clear-btn:hover {
  background: rgba(48, 209, 88, 0.20);
  box-shadow: 0 0 12px rgba(48, 209, 88, 0.25)
}


/* ═══════════════════════════════════════════════════════════════
   SECTION E — HISTORICAL CHARTS
   .chart-section       wrapper with fadeUp entrance
   .chart-section-title matches .section-title
   .charts-grid         3-column responsive grid
   .chart-card          glassmorphism card (mirrors .glass-card)
   .chart-card-label    matches .card-label
   .chart-canvas-wrap   fixed-height canvas host
═══════════════════════════════════════════════════════════════ */

.chart-section {
  margin-top: 24px;
  animation: fadeUp .7s .4s ease both   /* reuses existing fadeUp keyframe */
}

/* ── section heading — mirrors .section-title exactly ── */
.chart-section-title {
  font-family: var(--font-display);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 18px
}

/* ── responsive 3-up grid ── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px
}

@media (max-width: 800px) {
  .charts-grid {
    grid-template-columns: 1fr
  }
}

/* ── each chart card ── */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  box-shadow: var(--sh-s), inset 0 1px 0 rgba(255, 255, 255, .6);
  padding: 24px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: box-shadow .3s ease
}

.chart-card:hover {
  box-shadow: var(--sh-m), inset 0 1px 0 rgba(255, 255, 255, .7)
}

[data-theme="dark"] .chart-card {
  background: rgba(18, 18, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%)
}

[data-theme="dark"] .chart-card:hover {
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 40px rgba(10, 132, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2)
}

/* ── chart label — mirrors .card-label exactly ── */
.chart-card-label {
  font-family: var(--font-display);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px
}

/* ── canvas wrapper — fills remaining card space ── */
.chart-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 220px;
  min-width: 0;
  width: 100%;
}

/* ──────────────────────────────────────────
   PROFILE OVERLAY PORTAL
   ────────────────────────────────────────── */
.glass-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeInOverlay .3s cubic-bezier(.16,1,.3,1) forwards;
}

[data-theme="dark"] .glass-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.profile-modal {
  width: 90%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--sh-l);
  padding: 32px 32px 40px;
  position: relative;
  transform: scale(0.95) translateY(10px);
  opacity: 0;
  animation: scaleUpModal .4s cubic-bezier(.16,1,.3,1) forwards;
}

@keyframes fadeInOverlay { to { opacity: 1; } }
@keyframes scaleUpModal { to { opacity: 1; transform: scale(1) translateY(0); } }

.pm-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 32px; height: 32px;
  border-radius: 16px;
  background: rgba(120, 120, 128, 0.1);
  border: none;
  font-size: 1rem;
  color: var(--t2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.pm-close:hover { background: rgba(120, 120, 128, 0.2); color: var(--t1); }

.pm-header { text-align: center; margin-bottom: 24px; }
.pm-avatar {
  width: 80px; height: 80px;
  border-radius: 40px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #007aff, #5e5ce6);
  color: #fff;
  font-size: 2rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.3);
}
.pm-avatar-edit {
  position: absolute;
  bottom: 0px; right: 0px;
  width: 28px; height: 28px;
  background: var(--bg);
  border-radius: 14px;
  border: 2px solid var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.pm-header h2 { font-size: 1.35rem; font-weight: 700; color: var(--t1); margin-bottom: 4px; }
.pm-header p { font-size: 0.9rem; color: var(--t3); }

.pm-section {
  background: rgba(120, 120, 128, 0.05);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border-m);
}
.pm-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--t2);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pm-input-wrap {
  position: relative;
  background: var(--bg);
  border-radius: 14px;
  border: 1px solid var(--border-m);
  transition: all 0.3s;
  margin-bottom: 12px;
}
.pm-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
.pm-input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--t1);
  outline: none;
}
.pm-input::placeholder { color: var(--t3); }

.pm-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff9f0a, #ff6b00);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 159, 10, 0.3);
  transition: all 0.3s;
}
.pm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(255, 159, 10, 0.4);
}
.pm-btn:disabled {
  opacity: 0.6;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.pm-btn-sec {
  background: transparent;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--accent);
  background: rgba(0, 122, 255, 0.08); /* blue tint */
  transition: all 0.3s;
}
.pm-btn-sec:hover { background: rgba(0, 122, 255, 0.15); }

.pm-msg-error {
  color: var(--red);
  background: rgba(255, 59, 48, 0.1);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}
.pm-msg-success {
  color: var(--green);
  background: rgba(52, 199, 89, 0.1);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}
.aib-badge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.pm-linked-value {
  font-size: .72rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 200px;
  min-width: 0;
}

/* ──────────────────────────────────────────
   TABLET RESPONSIVENESS
   ────────────────────────────────────────── */
@media (max-width: 1366px) {
  .nav-side-cluster {
    display: none !important;
  }
}

/* ──────────────────────────────────────────
   MOBILE RESPONSIVENESS AND POLISH
   ────────────────────────────────────────── */

/* Navbar and overall layout for tablets/phones */
@media (max-width: 768px) {
  body {
    padding-top: 68px; /* Reduced to perfectly match navbar height */
  }
  .navbar {
    top: 12px;
    min-width: unset;
    width: calc(100% - 24px);
    max-width: calc(100% - 24px);
    padding: 10px 16px;
    gap: 10px;
  }
  .nav-logo .logo-text {
    display: none;
  }
  .nav-center {
    text-align: left;
  }
  .live-clock {
    font-size: 1.15rem;
  }
  .nav-right {
    gap: 8px;
  }
  /* Side cluster hidden on mobile — saves space */
  .nav-side-cluster {
    display: none;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  .logo-icon {
    width: 36px;
    height: 36px;
  }

  .alert-bar {
    display: none !important; /* Removed as requested */
  }

  .scene-wrap {
    transform: scale(0.85); /* shrink 3D panel */
  }
  .panel-stats {
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
  }
  .ps-item {
    width: 45%;
  }

  .ctrl-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .mode-pills {
    width: 100%;
    margin-top: 8px;
    justify-content: space-between;
  }
  .mode-pill {
    flex: 1;
    justify-content: center;
  }
  .auto-info-box {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
  }
  .aib-badge-wrap {
    margin-left: 0;
    align-items: flex-start;
    margin-top: 4px;
  }
  .pm-linked-value {
    max-width: 120px;
  }
  .profile-modal {
    padding: 20px 16px 24px;
    border-radius: 20px;
  }
}

/* iPad & Tablet overrides to fix wrapping gaps */
@media (max-width: 1100px) and (min-width: 481px) {
  .widget.ldr-widget, 
  .widget.serial-widget {
    grid-column: 1 / -1 !important;
  }
}

/* Specific overrides for small phones */
@media (max-width: 480px) {
  .widget.ldr-widget, 
  .widget.serial-widget {
    grid-column: span 1 !important; /* Prevents overflow when grid is 1 column */
  }
  .widget {
    padding: 14px 16px;
    min-height: auto;
  }
  .scene-wrap {
    transform: scale(0.7); /* make 3D model fit tiny screens */
    height: 180px;
  }
  .compass-svg-wrap svg {
    width: 180px;
    height: 180px;
  }
  .live-clock {
    font-size: 1.1rem;
  }
  main {
    padding: 0 14px;
  }
  .ws-panel {
    flex-direction: column;
    align-items: stretch;
  }
  .ws-ip-input {
    width: 100%;
  }
  .ws-connect-btn {
    width: 100%;
  }
}
