:root {
  --gold: #1fbe09;
  --gold-dim: #189608;
  --glass: rgba(12, 28, 48, 0.42);
  --glass-border: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.82);
  --sidebar-w: 28%;
  --stage-w: 72%;
  --font: 'DM Sans', system-ui, sans-serif;
  /* Coherent type scale for 1920×1080 LED wall */
  --text-xs: 1rem;
  --text-sm: 1.15rem;
  --text-md: 1.35rem;
  --text-lg: 1.65rem;
  --text-xl: 2.1rem;
  --text-2xl: 2.6rem;
  --text-3xl: 3.4rem;
  --text-display: 5.5rem;
  --chart-tick: 16px;
  --chart-legend: 1.2rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--font);
  color: var(--text);
}

#viewport {
  position: relative;
  width: 1920px;
  height: 1080px;
  transform-origin: top left;
  overflow: hidden;
}

.bg-video {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.bg-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  background: linear-gradient(
    105deg,
    rgba(0, 20, 40, 0.55) 0%,
    rgba(0, 30, 60, 0.45) 35%,
    rgba(0, 15, 35, 0.5) 100%
  );
}

body.bg-video-unavailable .bg-video {
  display: none;
}

body.bg-video-unavailable .bg-overlay {
  background:
    linear-gradient(
      105deg,
      rgba(0, 20, 40, 0.72) 0%,
      rgba(0, 30, 60, 0.62) 35%,
      rgba(0, 15, 35, 0.68) 100%
    ),
    url('../img/bg-poster.jpg') center / cover no-repeat;
}

/* Sidebar */
.sidebar {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sidebar-w);
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 28px 32px;
  background: transparent;
  border-right: none;
}

.school-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 380px;
  min-height: 120px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0, 20, 40, 0.12);
}

.school-logo,
.evergreen-logo {
  width: auto;
  max-width: 340px;
  height: 98px;
  object-fit: contain;
}

.school-logo {
  filter: none;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 18px 20px 12px;
  width: 100%;
  max-width: 380px;
  min-height: 120px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-url {
  margin-top: -10px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
}

.evergreen-logo {
  filter: drop-shadow(0 3px 14px rgba(0, 0, 0, 0.4));
}

.clock-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.clock-wrap > * + * {
  margin-top: 18px;
}

.clock-face {
  width: 320px;
  height: 320px;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.4));
}

.clock-digital {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  opacity: 0.95;
}

/* Main stage */
.stage {
  position: absolute;
  right: 0;
  top: 0;
  width: var(--stage-w);
  height: 100%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 48px 88px 24px;
}

.glass-panel {
  position: relative;
  width: 100%;
  height: 720px;
  max-height: 720px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 4px 24px 24px 4px;
  clip-path: polygon(3% 0, 100% 0, 100% 100%, 0 100%);
  padding: 36px 56px 28px 80px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.status-banner {
  position: absolute;
  top: 12px;
  right: 24px;
  background: rgba(220, 80, 60, 0.85);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 20;
}

.status-banner.hidden { display: none; }

/* Slides */
.slide {
  position: absolute;
  top: 36px;
  right: 56px;
  bottom: 28px;
  left: 80px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(30px);
  transition: opacity 0.9s ease, transform 0.9s ease, visibility 0.9s;
  display: flex;
  flex-direction: column;
}

.slide.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.slide-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 14px;
}

.slide-header h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: #9ecaff;
  letter-spacing: 0.02em;
}

.slide-date {
  font-size: var(--text-md);
  color: var(--text-muted);
  font-weight: 600;
}

.slide-sub {
  font-size: var(--text-md);
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.45;
}

/* Slide 1 metrics */
.metric-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-top: 24px;
}

.metric-rows > * + * {
  margin-top: 28px;
}

.metric-row {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 24px 32px;
}

.metric-row > * + * {
  margin-left: 28px;
}

.metric-icon {
  font-size: 3.6rem;
  opacity: 0.9;
  width: 72px;
  text-align: center;
}

.metric-info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-label {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-size: var(--text-display);
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
}

.metric-value > * + * {
  margin-left: 0.45em;
}

.metric-unit {
  font-size: 2.4rem;
  font-weight: 800;
  color: rgba(31, 190, 9, 0.95);
  letter-spacing: 0.02em;
}

/* Slide 2 — live power (simplified) */
.live-badge {
  background: rgba(31, 190, 9, 0.2);
  color: var(--gold) !important;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: var(--text-sm) !important;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.live-simple {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  margin-top: 16px;
  min-height: 0;
}

.live-simple > * + * {
  margin-left: 32px;
}

.live-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 36px 32px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  min-width: 0;
}

.live-block > * + * {
  margin-top: 16px;
}

.live-block-label {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-muted);
}

.live-block-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-size: 8rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.live-block-value > * + * {
  margin-left: 0.35em;
}

.live-block-value .odometer {
  font-size: inherit;
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: inherit;
  letter-spacing: 0.04em;
}

.live-block-value .metric-unit {
  font-size: 3.6rem;
  color: rgba(255, 255, 255, 0.9);
}

.power-bar-section {
  max-width: 100%;
  margin: 0 0 24px;
  width: 100%;
}

.power-bar-label {
  display: block;
  font-size: var(--text-md);
  margin-bottom: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.power-bar-track {
  position: relative;
  height: 56px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.power-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 24px;
  transition: width 1.2s ease;
  box-shadow: 0 0 20px rgba(31, 190, 9, 0.4);
}

.power-bar-value {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-lg);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.lifetime-strip {
  display: flex;
  align-items: center;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lifetime-strip > * + * {
  margin-left: 20px;
}

.lifetime-label {
  font-size: var(--text-md);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.lifetime-counter {
  display: flex;
  align-items: baseline;
}

.lifetime-counter > * + * {
  margin-left: 10px;
}

.odometer {
  font-size: var(--text-3xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  padding: 10px 22px;
  border-radius: 10px;
  letter-spacing: 0.05em;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.odometer-unit {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-muted);
}

.lifetime-note {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.55);
  margin-left: auto;
}

.lifetime-breakdown {
  display: flex;
  flex-direction: column;
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
}

.lifetime-breakdown > * + * {
  margin-top: 6px;
}

.lifetime-breakdown strong {
  color: #fff;
  font-weight: 800;
}

.power-bar-label strong {
  color: var(--gold);
  font-weight: 800;
}

/* Charts */
.chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  margin-top: 8px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-legend {
  display: flex;
  align-items: center;
  font-size: var(--chart-legend);
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 14px;
}

.chart-legend > * + * {
  margin-left: 10px;
}

.legend-dot {
  width: 18px;
  height: 18px;
  background: var(--gold);
  border-radius: 3px;
}

/* Didactic slides — Sai che…? */
.didactic-slide {
  min-height: 0;
}

.didactic-header {
  margin-bottom: 12px;
  border-bottom: none;
  padding-bottom: 0;
}

.didactic-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  width: 100%;
}

.didactic-title-row > * + * {
  margin-left: 28px;
}

.didactic-tagline {
  font-size: var(--text-xl);
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.3;
}

.didactic-grid {
  display: grid;
  gap: 20px;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.didactic-grid.cols-2x2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.didactic-grid.cols-2x3 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.didactic-card {
  text-align: center;
  padding: 18px 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  overflow: hidden;
}

.didactic-card > * + * {
  margin-top: 6px;
}

.didactic-icon {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  max-height: 45%;
  overflow: hidden;
  font-size: 6.5rem;
  line-height: 1;
}

.didactic-val {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-size: 5rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}

.didactic-val > * + * {
  margin-left: 0.3em;
}

.didactic-val .val-unit {
  font-size: 2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.didactic-lbl {
  flex: 0 0 auto;
  font-size: var(--text-md);
  color: var(--text-muted);
  font-weight: 700;
  line-height: 1.3;
}

/* Slide 6 — 2×2: even bigger numbers */
.slide[data-slide="saiche1"] .didactic-val {
  font-size: 5.8rem;
}

.slide[data-slide="saiche1"] .didactic-val .val-unit {
  font-size: 2.2rem;
}

.slide[data-slide="saiche1"] .didactic-icon {
  font-size: 5.75rem;
}

.slide[data-slide="saiche1"] .didactic-icon.icon-tree,
.slide[data-slide="saiche1"] .didactic-icon.icon-house,
.slide[data-slide="saiche1"] .didactic-icon.icon-lamp {
  font-size: 4.6rem;
}

.slide[data-slide="saiche1"] .didactic-lbl {
  font-size: var(--text-lg);
}

/* Slide 7 — 2×3: compact but still big */
.slide[data-slide="saiche2"] .didactic-val {
  font-size: 4.2rem;
}

.slide[data-slide="saiche2"] .didactic-val .val-unit {
  font-size: 1.5rem;
}

.slide[data-slide="saiche2"] .didactic-icon {
  font-size: 5.5rem;
}

.slide[data-slide="saiche2"] .didactic-icon.icon-bike {
  font-size: 6.5rem;
}

.slide[data-slide="saiche2"] .didactic-lbl {
  font-size: var(--text-sm);
}

.didactic-val-compact {
  font-size: 3.2rem !important;
}

.slide[data-slide="saiche1"] .didactic-val-compact {
  font-size: 4.4rem !important;
}

.slide[data-slide="saiche2"] .didactic-val-compact {
  font-size: 2.8rem !important;
}

.slide[data-slide="saiche2"] .didactic-val-compact .val-unit {
  font-size: 1.2rem !important;
}

/* Weather */
.weather-credit {
  font-size: var(--text-sm) !important;
  font-style: italic;
  opacity: 0.75;
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  flex: 1;
  align-items: stretch;
  margin-top: 16px;
}

.weather-day {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.28) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 28px 24px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.weather-day > * + * {
  margin-top: 14px;
}

.weather-day.is-today {
  border-color: rgba(245, 197, 24, 0.45);
  box-shadow: 0 0 0 1px rgba(245, 197, 24, 0.2), 0 12px 32px rgba(0, 0, 0, 0.25);
}

.weather-day-title {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.weather-icon-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 88px;
}

.weather-icon {
  font-size: 4.8rem;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.weather-temp {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: #F5C518;
  font-variant-numeric: tabular-nums;
}

.weather-temp small {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-muted);
}

.weather-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.weather-stat {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
}

.weather-stat > * + * {
  margin-top: 4px;
}

.weather-stat-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.weather-stat-val {
  font-size: var(--text-md);
  font-weight: 700;
  color: #fff;
}

.weather-stat-lbl {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.weather-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

.weather-legend > * {
  margin: 0 12px 8px;
}

/* Footer */
.footer {
  position: absolute;
  bottom: 16px;
  left: var(--sidebar-w);
  right: 48px;
  z-index: 15;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-md);
  color: rgba(255, 255, 255, 0.65);
  padding: 0 24px;
  font-weight: 600;
}

.slide-indicator {
  display: flex;
  align-items: center;
  font-size: var(--text-lg);
}

.slide-dot {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  margin: 0;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.55);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  letter-spacing: 0;
}

.slide-dot.is-active {
  color: #fff;
}

.slide-dot:hover,
.slide-dot:focus {
  color: #fff;
  outline: none;
}

/* Scale viewport to fit screen */
@media (max-aspect-ratio: 16/9) {
  #viewport {
    transform: scale(calc(100vh / 1080));
  }
}

@media (min-aspect-ratio: 16/9) {
  #viewport {
    transform: scale(calc(100vw / 1920));
  }
}
