* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body.experience-electric-power-body {
  overflow: hidden;
  background: var(--lab-bg);
  color: var(--lab-ink);
  font-family: var(--font-family), 'Noto Sans KR', sans-serif;
  letter-spacing: 0;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 50;
  transform: translateY(-140%);
  padding: 8px 12px;
  border-radius: var(--lab-radius);
  background: #ffffff;
  color: #111111;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.ep-flow {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--lab-bg);
}

.ep-stage {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 26%),
    var(--lab-bg);
}

.ep-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.ep-stage canvas:active {
  cursor: grabbing;
}

.ep-loading,
.ep-toast {
  position: absolute;
  z-index: 12;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--lab-line-strong);
  border-radius: var(--lab-radius);
  background: var(--lab-panel);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(var(--lab-blur));
  transform: translateX(-50%);
}

.ep-loading {
  top: 50%;
  transform: translate(-50%, -50%);
}

.ep-toast {
  bottom: 42px;
}

.ep-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fca830;
  border-radius: 50%;
  animation: ep-spin 0.82s linear infinite;
}

@keyframes ep-spin {
  to {
    transform: rotate(360deg);
  }
}

.ep-map-tooltip {
  position: absolute;
  z-index: 14;
  display: grid;
  gap: 2px;
  max-width: 260px;
  padding: 8px 11px;
  border: 1px solid var(--lab-line-strong);
  border-radius: var(--lab-radius);
  background: var(--lab-panel-strong);
  backdrop-filter: blur(var(--lab-blur));
  pointer-events: none;
}

.ep-map-tooltip strong {
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
}

.ep-map-tooltip span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 700;
}

.ep-map-tooltip em {
  color: rgba(252, 168, 48, 0.82);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.ep-topbar,
.ep-panel,
.ep-view-controls {
  position: fixed;
  z-index: 10;
}

.ep-topbar {
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: 40px minmax(136px, 1fr) auto;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.ep-topbar > * {
  pointer-events: auto;
}

.ep-icon-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--lab-line-strong);
  border-radius: var(--lab-radius);
  background: var(--lab-panel);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(var(--lab-blur));
  transition:
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.ep-icon-button:hover,
.ep-icon-button:focus-visible {
  border-color: rgba(252, 168, 48, 0.52);
  background: var(--lab-panel-strong);
  color: #ffffff;
  outline: none;
}

.ep-icon-button .material-symbols-outlined {
  font-size: 21px;
}

.ep-icon-button--small {
  width: 30px;
  height: 30px;
  border-radius: var(--lab-radius-sm);
  background: var(--lab-surface-raised);
  backdrop-filter: none;
}

.ep-icon-button--small .material-symbols-outlined {
  font-size: 18px;
}

.ep-icon-button:disabled {
  opacity: 0.38;
  cursor: default;
}

.ep-brand {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 6px 12px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-panel);
  backdrop-filter: blur(var(--lab-blur));
  width: fit-content;
}

.ep-brand strong {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
}

.ep-brand span {
  font-size: 11px;
  font-weight: 700;
  color: var(--lab-muted);
  white-space: nowrap;
}

.ep-summary {
  display: flex;
  gap: 8px;
  margin: 0;
  justify-self: end;
}

.ep-summary > div {
  display: grid;
  gap: 1px;
  min-width: 78px;
  padding: 6px 11px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-panel);
  backdrop-filter: blur(var(--lab-blur));
  text-align: right;
}

.ep-summary > div:first-child {
  min-width: 112px;
  border-color: rgba(252, 168, 48, 0.34);
  background: rgba(24, 21, 15, 0.8);
}

.ep-summary > div:last-child {
  border-color: rgba(255, 216, 86, 0.28);
  background: rgba(24, 22, 12, 0.78);
}

.ep-summary dt {
  font-size: 10px;
  font-weight: 800;
  color: var(--lab-muted);
}

.ep-summary dd {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

.ep-summary > div:first-child dd {
  color: #ffe9bd;
}

.ep-summary > div:last-child dd {
  color: #fff1a8;
}

.ep-view-controls {
  left: 14px;
  top: 50%;
  display: grid;
  gap: 10px;
  transform: translateY(-50%);
}

.ep-control-group {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--lab-line-strong);
  border-radius: var(--lab-radius);
  background: var(--lab-surface-hover);
}

.ep-control-group .ep-icon-button {
  border: 0;
  border-radius: 0;
  backdrop-filter: blur(var(--lab-blur));
}

.ep-compass-rose {
  position: relative;
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  transform: rotate(var(--ep-bearing, 0deg));
}

.ep-compass-needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 9px solid #fc5f4e;
  transform: translate(-50%, -100%);
}

.ep-compass-n {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.72);
}

.ep-panel {
  top: max(70px, calc(env(safe-area-inset-top) + 62px));
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 10px;
  width: min(328px, calc(100vw - 28px));
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-right: 2px;
  transition: transform 200ms ease, opacity 200ms ease;
}

body.is-panel-collapsed .ep-panel {
  transform: translateX(calc(100% + 22px));
  opacity: 0;
  pointer-events: none;
}

.ep-panel-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius-lg);
  background: var(--lab-panel);
  backdrop-filter: blur(var(--lab-blur));
}

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

.ep-section-head h1,
.ep-section-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

.ep-section-head .material-symbols-outlined {
  font-size: 17px;
  color: rgba(252, 168, 48, 0.9);
}

.ep-section-head output {
  font-size: 11px;
  font-weight: 800;
  color: var(--lab-muted);
}

.ep-section-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ep-rank-pager {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ep-rank-pager output {
  min-width: 44px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
}

.ep-power-readout {
  display: grid;
  gap: 2px;
}

.ep-power-readout strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 700;
  color: #ffe9bd;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.ep-power-readout span {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--lab-muted);
}

.ep-power-readout--solar strong {
  color: #fff1a8;
}

.ep-solar-section .ep-section-head .material-symbols-outlined {
  color: rgba(255, 216, 86, 0.92);
}

.ep-snapshot-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin: 0;
}

.ep-snapshot-stats > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 7px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-surface);
}

.ep-snapshot-stats dt {
  font-size: 10px;
  font-weight: 800;
  color: var(--lab-muted);
}

.ep-snapshot-stats dd {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  min-width: 0;
  white-space: nowrap;
}

.ep-snapshot-meta {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--lab-dim);
}

.ep-control-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--lab-muted);
}

.ep-segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 1px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-surface-hover);
}

.ep-segmented button {
  min-width: 0;
  padding: 8px 6px;
  border: 0;
  background: var(--lab-panel);
  color: var(--lab-muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.ep-segmented button:hover,
.ep-segmented button:focus-visible {
  color: #ffffff;
  outline: none;
}

.ep-segmented button:disabled {
  color: var(--lab-faint);
  cursor: default;
}

.ep-segmented button.is-active {
  background: rgba(252, 168, 48, 0.2);
  color: #ffd88f;
}

.ep-range-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.ep-range-control span {
  font-size: 11px;
  font-weight: 800;
  color: var(--lab-muted);
}

.ep-range-control output {
  min-width: 44px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
}

.ep-range-control input[type='range'] {
  width: 100%;
  height: 22px;
  margin: 0;
  accent-color: #fca830;
  cursor: pointer;
}

.ep-range-control.is-disabled {
  opacity: 0.46;
}

.ep-range-control.is-disabled input[type='range'] {
  cursor: default;
}

.ep-heat-scale {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.ep-heat-scale span {
  font-size: 10px;
  font-weight: 800;
  color: var(--lab-dim);
}

.ep-heat-scale i {
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    #220c37 0%,
    #681b6e 28%,
    #ce4237 55%,
    #fc9830 80%,
    #fff6d0 100%
  );
}

body.is-glow-mode .ep-heat-scale i {
  background: linear-gradient(
    90deg,
    #3a1054 0%,
    #7a1c78 22%,
    #c42c56 45%,
    #f06426 68%,
    #fdac3a 86%,
    #fffae0 100%
  );
}

body.is-solar-data-mode .ep-heat-scale i {
  background: linear-gradient(
    90deg,
    #3a2a06 0%,
    #76520a 22%,
    #be7c14 45%,
    #f1b530 70%,
    #ffe570 88%,
    #fffdda 100%
  );
}

body.is-solar-data-mode .ep-unit-field {
  display: none;
}

.ep-rank-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ep-rank-list button {
  display: grid;
  grid-template-columns: 24px 1fr 20px;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.ep-rank-list button:hover,
.ep-rank-list button:focus-visible {
  border-color: rgba(252, 168, 48, 0.5);
  background: rgba(252, 168, 48, 0.08);
  outline: none;
}

.ep-rank-list button.is-active {
  border-color: rgba(252, 168, 48, 0.72);
  background: rgba(252, 168, 48, 0.14);
}

.ep-rank-list button:disabled {
  opacity: 0.45;
  cursor: default;
}

.ep-rank-rank {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: var(--lab-radius-sm);
  background: rgba(252, 168, 48, 0.16);
  color: #ffd88f;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}

.ep-rank-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ep-rank-coords {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-city-list .ep-rank-coords {
  font-family: inherit;
}

.ep-rank-meta {
  font-size: 10px;
  font-weight: 700;
  color: var(--lab-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-rank-bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
}

.ep-rank-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: calc(var(--bar, 0) * 100%);
  border-radius: 2px;
  background: linear-gradient(90deg, #ce4237, #fc9830);
}

.ep-solar-city-list .ep-rank-rank {
  background: rgba(255, 216, 86, 0.15);
  color: #fff1a8;
}

.ep-solar-city-list .ep-rank-bar::after {
  background: linear-gradient(90deg, #f6c945, #fff1a8);
}

.ep-rank-go {
  font-size: 17px;
  color: var(--lab-faint);
}

.ep-rank-empty {
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--lab-dim);
}

.ep-source-note {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--lab-muted);
}

.ep-source-note--dim {
  color: var(--lab-dim);
}

@media (max-width: 900px) {
  .ep-summary > div {
    min-width: 62px;
    padding: 5px 8px;
  }

  .ep-summary dd {
    font-size: 12px;
  }

  .ep-panel {
    top: auto;
    left: 14px;
    right: auto;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    max-height: 46dvh;
  }

  body.is-panel-collapsed .ep-panel {
    transform: translateY(calc(100% + 22px));
  }

  .ep-view-controls {
    top: auto;
    bottom: calc(46dvh + 26px);
    transform: none;
  }

  body.is-panel-collapsed .ep-view-controls {
    bottom: 26px;
  }
}

@media (max-width: 560px) {
  .ep-topbar {
    grid-template-columns: 40px 1fr;
  }

  .ep-summary {
    display: none;
  }

  .ep-power-readout strong {
    font-size: 22px;
  }

  .ep-snapshot-stats {
    gap: 4px;
  }

  .ep-snapshot-stats > div {
    padding: 8px 6px;
  }

  .ep-snapshot-stats dt {
    font-size: 9px;
  }

  .ep-snapshot-stats dd {
    font-size: 10px;
  }
}
