:root {
  --bg: #07131e;
  --panel: rgba(10, 23, 35, 0.86);
  --panel-border: rgba(148, 191, 214, 0.12);
  --text: #eef6fd;
  --muted: #8ca8bc;
  --accent: #ff9158;
  --accent-soft: rgba(255, 145, 88, 0.12);
  --grid: rgba(122, 199, 239, 0.12);
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
  --surface: #0d1d2a;
  --danger: #ff7d63;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 145, 88, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(74, 136, 171, 0.16), transparent 26%),
    linear-gradient(180deg, #09131d, var(--bg));
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.page {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  margin-top: 15px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  position: relative;
  z-index: 5;
  overflow: visible;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: "Sora", "IBM Plex Sans", sans-serif;
  font-size: clamp(22px, 4vw, 32px);
  line-height: 1;
  letter-spacing: -0.03em;
  max-width: 14ch;
}

h2 {
  font-family: "Sora", "IBM Plex Sans", sans-serif;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.subtle {
  margin-top: 8px;
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  line-height: 1.4;
  font-size: 13px;
}

.subtle a,
.subtle code {
  color: inherit;
}

.subtle code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 999px;
}

.hero-update-row {
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(148, 191, 214, 0.16);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.refresh-btn:hover {
  border-color: rgba(255, 145, 88, 0.4);
  background: rgba(255, 145, 88, 0.08);
}

.refresh-btn:active {
  transform: rotate(-20deg) scale(0.96);
}

.refresh-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.refresh-btn span {
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 13px;
}

.controls {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 220px;
}

.field > span,
.toggle-text,
.legend-pill,
.stat-label,
.status,
.chart-meta,
.axis-note,
#tableMeta,
.hour-time,
.hour-price,
.hour-detail {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.dropdown {
  position: relative;
}

.dropdown-trigger,
.dropdown-option {
  width: 100%;
  border: 1px solid rgba(148, 191, 214, 0.14);
  color: var(--text);
  font: inherit;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(20, 41, 58, 0.96), rgba(11, 28, 42, 0.96));
  cursor: pointer;
}

.dropdown-trigger:hover,
.dropdown.open .dropdown-trigger {
  border-color: rgba(255, 145, 88, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 145, 88, 0.1);
}

.dropdown-caret {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}

.dropdown.open .dropdown-caret {
  transform: rotate(-135deg) translateY(-2px);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  padding: 8px;
  border-radius: 16px;
  background: rgba(8, 19, 31, 0.98);
  border: 1px solid rgba(148, 191, 214, 0.16);
  box-shadow: var(--shadow);
  z-index: 999;
}

.dropdown.open .dropdown-menu {
  display: grid;
  gap: 6px;
}

.dropdown-option {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.dropdown-option:hover,
.dropdown-option.active {
  background: linear-gradient(180deg, rgba(255, 145, 88, 0.22), rgba(255, 145, 88, 0.1));
  border-color: rgba(255, 145, 88, 0.26);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 56px;
  height: 32px;
  border-radius: 999px;
  background: #30495a;
  transition: background 0.2s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f5fbff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
  transition: transform 0.2s ease;
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(24px);
}

.toggle-text {
  font-size: 15px;
}

.stats {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 10px;
  margin-bottom: 10px;
  align-items: stretch;
}

.stat-card {
  padding: 20px 22px;
}

.stat-card-current {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 14px;
  padding-top: 18px;
  background:
    radial-gradient(circle at top, rgba(255, 145, 88, 0.08), transparent 52%),
    linear-gradient(180deg, rgba(18, 35, 56, 0.98), rgba(8, 20, 31, 0.96));
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.05;
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
}

.stat-card-current .stat-label {
  width: 100%;
}

.stat-card-summary {
  display: grid;
  align-content: start;
}

.summary-stats {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(8, 18, 29, 0.52);
  border: 1px solid rgba(148, 191, 214, 0.08);
}

.summary-row span {
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-row strong {
  margin-top: 0;
  font-size: clamp(18px, 2.4vw, 26px);
}

.current-gauge {
  --gauge-progress: 0;
  --gauge-color: rgba(148, 191, 214, 0.24);
  position: relative;
  width: min(100%, 210px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.current-gauge-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(8, 18, 29, 1) 57%, transparent 58%),
    conic-gradient(
      from -210deg,
      var(--gauge-color) calc(var(--gauge-progress) * 240deg),
      rgba(109, 133, 154, 0.22) 0 240deg,
      transparent 240deg
    );
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.22));
}

.current-gauge::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(19, 38, 58, 0.98), rgba(8, 18, 29, 0.98));
  border: 1px solid rgba(148, 191, 214, 0.1);
}

.current-gauge-center {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.current-gauge-center strong {
  margin-top: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 0.95;
}

.current-gauge-center span {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chart-panel {
  margin-top: 16px;
}

.panel + .status {
  margin-top: 18px;
}

.chart-panel {
  padding: 24px;
}

.chart-head,
.table-head,
.quarter-head,
.current-summary {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding:16px;
}

.legend-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
}

.day-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.day-btn {
  border: 1px solid rgba(148, 191, 214, 0.14);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: 13px;
}

.day-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.day-label {
  min-width: 150px;
  text-align: center;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 13px;
  color: var(--muted);
}

.chart-wrap {
  position: relative;
  margin-top: 22px;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(17, 34, 47, 0.94), rgba(9, 24, 37, 0.92)),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 55px,
      var(--grid) 55px,
      var(--grid) 56px
    );
  border: 1px solid rgba(148, 191, 214, 0.08);
}

#priceChart {
  display: block;
  width: 100%;
  height: 420px;
}

.axis-note {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.chart-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.quarter-card {
  margin-top: 10px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(32, 54, 94, 0.9), rgba(24, 42, 72, 0.92));
  border: 1px solid rgba(122, 199, 239, 0.12);
}

.quarter-chart-wrap {
  margin-top: 10px;
}

.quarter-chart-wrap svg {
  display: block;
  width: 100%;
  height: 180px;
}

.hour-list {
  margin-top: 14px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 4px;
}

.hour-list-inner {
  display: grid;
  gap: 12px;
}

.hour-row {
  display: grid;
  grid-template-columns: 78px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(8, 18, 29, 0.76);
  border: 1px solid rgba(148, 191, 214, 0.08);
  cursor: pointer;
}

.hour-row.current {
  background: linear-gradient(180deg, rgba(34, 48, 126, 0.92), rgba(24, 39, 108, 0.92));
  border-color: rgba(17, 157, 255, 0.9);
  box-shadow: inset 0 0 0 1px rgba(17, 157, 255, 0.2);
}

.hour-time,
.hour-price {
  font-size: clamp(15px, 3vw, 22px);
}

.hour-price {
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.hour-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  justify-self: end;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.1);
}

.hour-detail {
  margin: -4px 0 8px 0;
  padding: 12px;
  border-radius: 16px;
  background: rgba(22, 41, 72, 0.85);
  border: 1px solid rgba(122, 199, 239, 0.12);
  color: var(--muted);
  font-size: 12px;
}

.current-summary {
  margin-bottom: 8px;
}

.current-time,
.current-price {
  display: block;
  margin-top: 4px;
  font-size: clamp(16px, 3.6vw, 28px);
  line-height: 1;
}

.current-price-wrap {
  text-align: right;
}

.quarter-head h2 {
  font-size: 16px;
}

.quarter-head .subtle {
  margin-top: 0;
  font-size: 11px;
}

.hour-list::-webkit-scrollbar {
  width: 10px;
}

.hour-list::-webkit-scrollbar-thumb {
  background: rgba(122, 199, 239, 0.24);
  border-radius: 999px;
}

.status {
  margin: 18px 2px 0;
  color: var(--muted);
  font-size: 14px;
}

.error {
  color: var(--danger);
}

@media (max-width: 860px) {
  .hero,
  .chart-head,
  .table-head,
  .quarter-head,
  .current-summary {
    flex-direction: column;
    align-items: start;
  }

  .controls {
    width: 100%;
    min-width: 0;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .hour-row {
    grid-template-columns: 72px 10px 1fr;
    padding: 10px 12px;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100vw - 16px, 1120px);
    padding: 16px 0 28px;
  }

  .panel {
    border-radius: 18px;
  }

  .hero,
  .chart-panel,
  .panel {
    padding-left: 14px;
    padding-right: 14px;
  }

  #priceChart {
    height: 300px;
  }

  .chart-wrap {
    margin-top: 14px;
  }

  .quarter-chart-wrap svg {
    height: 180px;
  }

  .axis-note,
  .chart-meta,
  .subtle,
  #tableMeta,
  .day-label {
    font-size: 12px;
  }

  .day-nav {
    gap: 8px;
  }

  .day-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .stats {
    gap: 10px;
  }

  .stat-card strong {
    font-size: 20px;
  }

  .stat-card-current {
    grid-column: auto;
  }

  .current-gauge {
    width: min(100%, 180px);
  }

  .current-gauge-center strong {
    font-size: 34px;
  }
}
