:root {
  color-scheme: dark;
  --bg: #080d13;
  --panel: #121b25;
  --panel-2: #162231;
  --panel-3: #0d151e;
  --line: #2b3b4e;
  --line-soft: #202d3b;
  --text: #f4f7fa;
  --muted: #aab7c5;
  --faint: #718093;
  --cyan: #57c9f5;
  --mint: #53d9c6;
  --green: #50d78a;
  --yellow: #f6ca55;
  --orange: #ffad57;
  --rose: #ff7184;
  --purple: #b68cff;
  --weekend: #ff8493;
  --shadow: 0 12px 42px rgba(0, 0, 0, 0.18);
  --radius: 20px;
  --gap: 16px;
  --screen-pad: 26px;
  --transition: 160ms ease;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #030609;
}

body {
  min-height: 100vh;
  color: var(--text);
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.screen {
  width: min(100vw, calc(100vh * 9 / 16));
  min-height: 100vh;
  aspect-ratio: 9 / 16;
  padding: var(--screen-pad);
  display: grid;
  grid-template-rows: 170px minmax(0, 1fr) 226px 394px 24px;
  gap: var(--gap);
  background:
    radial-gradient(circle at 14% 0%, rgba(75, 180, 215, 0.055), transparent 28%),
    linear-gradient(180deg, #091018 0%, var(--bg) 38%, #080c12 100%);
  overflow: hidden;
  transition: opacity 800ms ease;
}

.screen.is-dimmed {
  opacity: var(--dim-opacity, 0.62);
}

.panel {
  background: linear-gradient(180deg, rgba(21, 32, 44, 0.98), rgba(17, 27, 38, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 20px;
  min-height: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 2px 14px;
}

.identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-row {
  height: 22px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 0 12px rgba(246, 202, 85, 0.35);
  flex: 0 0 auto;
}

.status-dot.ok {
  background: var(--mint);
  box-shadow: 0 0 12px rgba(83, 217, 198, 0.38);
}

.status-dot.error {
  background: var(--rose);
  box-shadow: 0 0 12px rgba(255, 113, 132, 0.38);
}

.eyebrow,
.live-label,
.source-tag,
.now-label,
.price-basis,
.footer-status,
.calendar-heading-meta,
.electricity-heading-meta,
.mode-badge {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 10px;
  margin-left: 8px;
  border: 1px solid rgba(87, 201, 245, 0.55);
  color: #c8efff;
  background: rgba(34, 124, 160, 0.2);
  font-size: 8px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.mode-badge.live {
  border-color: rgba(83, 217, 198, 0.52);
  color: #c9fff6;
  background: rgba(47, 139, 125, 0.18);
}

.mode-badge.demo {
  border-color: rgba(246, 202, 85, 0.54);
  color: #ffedb2;
  background: rgba(145, 115, 34, 0.18);
}

.clock {
  display: block;
  font-size: 64px;
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 760;
  margin-top: 2px;
}

.full-date {
  margin: 7px 0 0;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 690;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.day-meta {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.03em;
}

.weather-card {
  min-width: 0;
  min-height: 0;
  padding: 15px 18px 12px;
  display: grid;
  grid-template-rows: 20px 1fr 38px;
  gap: 4px;
}

.weather-heading,
.weather-temp-row {
  display: flex;
  align-items: center;
}

.weather-heading {
  justify-content: space-between;
  gap: 12px;
}

.source-tag,
.live-label {
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.weather-primary {
  min-height: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
}

.weather-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  color: var(--cyan);
}

.weather-icon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.weather-temp-row {
  gap: 14px;
  min-width: 0;
}

.weather-temperature {
  font-size: 39px;
  line-height: 1;
  font-weight: 720;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.weather-condition {
  min-width: 0;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 720;
  text-align: right;
  margin-left: auto;
}

.weather-details {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-forecast {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  border-top: 1px solid var(--line-soft);
  padding-top: 7px;
}

.forecast-day {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 7px;
  align-items: center;
  min-width: 0;
}

.forecast-day:not(:first-child) {
  border-left: 1px solid var(--line-soft);
  padding-left: 8px;
}

.forecast-day-name {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.forecast-mini-icon {
  width: 19px;
  height: 19px;
  color: var(--cyan);
}

.forecast-mini-icon svg {
  width: 100%;
  height: 100%;
}

.forecast-temperatures {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.forecast-temperatures strong {
  color: var(--text);
  font-weight: 720;
}

.calendar-card,
.upcoming-card,
.electricity-card {
  min-height: 0;
  overflow: hidden;
}

.calendar-card {
  padding: 18px 20px 20px;
  display: grid;
  grid-template-rows: 38px 24px 30px minmax(0, 1fr);
  gap: 7px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.section-title-wrap h1,
.section-title-wrap h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.section-icon {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--mint);
}

.calendar-icon::before {
  content: "▦";
  font-size: 29px;
  line-height: 1;
}

.list-icon::before {
  content: "☷";
  font-size: 30px;
  transform: rotate(180deg);
  line-height: 1;
}

.bolt-icon::before {
  content: "ϟ";
  color: var(--yellow);
  font-size: 34px;
  line-height: 1;
}

.calendar-heading-meta,
.electricity-heading-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.calendar-legend {
  min-height: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 19px;
  overflow: hidden;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 720;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--legend-color, var(--mint));
  box-shadow: 0 0 9px color-mix(in srgb, var(--legend-color, var(--mint)) 55%, transparent);
}

.weekday-row {
  display: grid;
  grid-template-columns: 78px repeat(7, minmax(0, 1fr));
  gap: 3px;
  align-items: end;
}

.weekday-label {
  color: var(--muted);
  text-align: center;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  padding-bottom: 3px;
}

.weekday-label.weekend {
  color: var(--weekend);
}

.calendar-grid {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.calendar-week {
  min-height: 0;
  display: grid;
  grid-template-columns: 78px repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.week-label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 4px;
}

.week-number {
  color: var(--mint);
  font-size: 14px;
  font-weight: 790;
  text-transform: uppercase;
}

.week-date-range {
  color: var(--faint);
  margin-top: 8px;
  font-size: 8px;
  line-height: 1.35;
  font-weight: 700;
  text-transform: uppercase;
}

.day-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: rgba(25, 37, 51, 0.84);
  border: 1px solid #29394a;
  border-radius: 9px;
  padding: 8px 6px 6px;
  overflow: hidden;
}

.day-cell.weekend {
  background: rgba(27, 37, 51, 0.72);
}

.day-cell.today {
  border-color: var(--mint);
  box-shadow: inset 0 0 0 1px rgba(83, 217, 198, 0.22), 0 0 15px rgba(83, 217, 198, 0.08);
  background: rgba(22, 48, 55, 0.76);
}

.day-cell.outside-current-month {
  opacity: 0.82;
}

.day-head {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.day-number {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.day-cell.weekend .day-number {
  color: var(--weekend);
}

.today-label {
  border: 1px solid var(--mint);
  border-radius: 4px;
  padding: 2px 4px;
  color: #bffff6;
  font-size: 6px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.day-events {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.event-chip {
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--event-color, var(--mint)) 88%, white 8%);
  border-left-width: 4px;
  background: color-mix(in srgb, var(--event-color, var(--mint)) 19%, #101824);
  border-radius: 5px;
  padding: 4px 4px 4px 5px;
  color: var(--text);
  font-size: 9px;
  line-height: 1.08;
  overflow: hidden;
}

.event-time {
  display: block;
  color: #e8f0f8;
  font-size: 8px;
  font-weight: 790;
  white-space: nowrap;
}

.event-title {
  display: -webkit-box;
  margin-top: 1px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.more-events {
  margin: 2px 0 0 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}

.upcoming-card {
  padding: 17px 20px 15px;
  display: grid;
  grid-template-rows: 35px minmax(0, 1fr);
  gap: 4px;
}

.upcoming-heading .section-icon {
  color: var(--purple);
}

.upcoming-list {
  min-height: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.upcoming-item {
  min-height: 0;
  display: grid;
  grid-template-columns: 11px 95px 72px minmax(0, 1fr) 110px;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line-soft);
}

.upcoming-item:first-child {
  border-top-color: transparent;
}

.upcoming-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--event-color, var(--mint));
  box-shadow: 0 0 8px color-mix(in srgb, var(--event-color, var(--mint)) 55%, transparent);
}

.upcoming-day {
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.upcoming-time {
  font-size: 14px;
  font-weight: 780;
}

.upcoming-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 690;
}

.upcoming-countdown {
  text-align: right;
  color: var(--faint);
  font-size: 9px;
  white-space: nowrap;
}

.empty-upcoming {
  display: grid;
  place-items: center;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
}

.electricity-card {
  padding: 17px 20px 16px;
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr);
  gap: 8px;
}

.electricity-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 20px;
}

.price-summary {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.now-label {
  margin: 2px 0 3px;
  color: var(--muted);
  font-size: 9px;
}

.current-price-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 67px;
}

.current-price {
  font-size: 58px;
  line-height: 1;
  font-weight: 770;
  letter-spacing: -0.055em;
}

.price-unit {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.interval-pill {
  align-self: flex-start;
  min-width: 117px;
  padding: 5px 8px;
  border: 1px solid var(--yellow);
  border-radius: 5px;
  color: var(--yellow);
  background: rgba(137, 103, 12, 0.12);
  text-align: center;
  font-size: 9px;
  font-weight: 780;
}

.price-stats {
  display: grid;
  gap: 3px;
  margin: 11px 0 0;
}

.price-stats > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: baseline;
  min-width: 0;
}

.price-stats dt,
.price-stats dd {
  margin: 0;
  font-size: 9px;
  line-height: 1.35;
  white-space: nowrap;
}

.price-stats dt {
  color: var(--faint);
  font-weight: 760;
}

.price-stats > div:nth-child(1) dt {
  color: var(--cyan);
}

.price-stats > div:nth-child(2) dt {
  color: var(--mint);
}

.price-stats > div:nth-child(3) dt {
  color: var(--rose);
}

.price-stats > div:nth-child(4) dt {
  color: var(--purple);
}

.price-stats dd {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-basis {
  margin: auto 0 0;
  color: var(--faint);
  font-size: 7px;
  letter-spacing: 0.07em;
  line-height: 1.4;
}

.price-chart-wrap {
  min-width: 0;
  min-height: 0;
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 23px;
}

.price-chart {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: visible;
}

.chart-grid-line {
  stroke: #2a3848;
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-zero-line {
  stroke: #758498;
  stroke-width: 1;
  stroke-dasharray: 4 5;
}

.chart-bar {
  shape-rendering: crispEdges;
}

.chart-current-outline {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 2.5;
  rx: 2;
  vector-effect: non-scaling-stroke;
}

.chart-axis-label,
.chart-value-label {
  fill: #758498;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
}

.chart-value-label {
  font-size: 9px;
}

.chart-caption {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  color: var(--faint);
  font-size: 8px;
  font-weight: 720;
}

.chart-caption span:first-child {
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.footer-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.07em;
  overflow: hidden;
}

.footer-status span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-state {
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 12px;
}

.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 9, 0.82);
  backdrop-filter: blur(10px);
}

.pin-overlay[hidden] {
  display: none;
}

.pin-dialog {
  width: min(450px, 100%);
  padding: 30px;
}

.pin-dialog h2 {
  margin: 8px 0 12px;
  font-size: 28px;
}

.pin-dialog p:not(.eyebrow):not(.pin-error) {
  color: var(--muted);
  line-height: 1.5;
}

.pin-dialog label {
  display: block;
  margin: 20px 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pin-dialog input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 14px;
  background: var(--panel-3);
  color: var(--text);
  font-size: 20px;
  outline: none;
}

.pin-dialog input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(87, 201, 245, 0.12);
}

.pin-dialog button {
  width: 100%;
  height: 50px;
  margin-top: 12px;
  border: 0;
  border-radius: 9px;
  background: var(--mint);
  color: #07110f;
  font-weight: 800;
}

.pin-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--rose);
  font-size: 12px;
}

@media (max-width: 760px) {
  :root {
    --screen-pad: 18px;
    --gap: 12px;
    --radius: 15px;
  }

  .screen {
    width: 100vw;
    min-height: calc(100vw * 16 / 9);
    grid-template-rows: 148px minmax(0, 1fr) 204px 360px 20px;
  }

  .clock {
    font-size: 52px;
  }

  .full-date {
    font-size: 14px;
  }

  .weather-card {
    padding-inline: 13px;
  }

  .weather-primary {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 8px;
  }

  .weather-icon {
    width: 56px;
    height: 56px;
  }

  .weather-temperature {
    font-size: 32px;
  }

  .weather-condition {
    font-size: 10px;
  }

  .weather-forecast {
    display: none;
  }

  .weather-card {
    grid-template-rows: 20px 1fr;
  }

  .calendar-card,
  .upcoming-card,
  .electricity-card {
    padding-inline: 14px;
  }

  .calendar-card {
    grid-template-rows: 34px 21px 27px minmax(0, 1fr);
  }

  .section-title-wrap h1,
  .section-title-wrap h2 {
    font-size: 16px;
  }

  .calendar-heading-meta,
  .electricity-heading-meta {
    font-size: 8px;
  }

  .weekday-row,
  .calendar-week {
    grid-template-columns: 58px repeat(7, minmax(0, 1fr));
  }

  .day-cell {
    padding: 6px 4px 4px;
  }

  .event-chip {
    padding-inline: 3px;
    font-size: 8px;
  }

  .upcoming-item {
    grid-template-columns: 8px 77px 58px minmax(0, 1fr) 82px;
    gap: 6px;
  }

  .electricity-body {
    grid-template-columns: 185px minmax(0, 1fr);
    gap: 12px;
  }

  .current-price {
    font-size: 48px;
  }
}

@media (orientation: landscape) and (min-width: 800px) {
  .screen {
    width: min(100vw, calc(100vh * 9 / 16));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body {
    background: white;
  }

  .screen {
    width: 1080px;
    height: 1920px;
  }
}
