:root {
  color-scheme: light;
  --floating-panel-bottom-offset: 80px;
  --md-sys-color-primary: #fb5264;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-secondary-container: #ffd9dc;
  --md-sys-color-on-secondary-container: #1f3533;
  --md-sys-color-surface: #f6fbfa;
  --md-sys-color-on-surface: #171d1c;
  --md-sys-color-surface-container: #e8efee;
  --md-sys-color-outline-variant: #bec9c7;
}

html,
body,
#app,
#cesiumContainer {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: "Roboto", sans-serif;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
}

#controlPanel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--md-sys-color-outline-variant);
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 94%, white);
  font: 500 15px "Roboto", sans-serif;
}

#loadingOverlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--md-sys-color-surface) 62%, transparent);
  backdrop-filter: blur(2px);
}

#loadingOverlay[hidden] {
  display: none !important;
}

#dataWarningOverlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent);
}

#dataWarningOverlay[hidden] {
  display: none !important;
}

#fileDropOverlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--md-sys-color-surface) 88%, transparent);
  backdrop-filter: blur(2px);
}

#fileDropOverlay[hidden] {
  display: none !important;
}

#fileDropCard {
  width: min(560px, calc(100vw - 32px));
  border: 2px dashed var(--md-sys-color-primary);
  border-radius: 14px;
  padding: 18px;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 94%, white);
  color: var(--md-sys-color-on-surface);
  text-align: center;
}

#fileDropCard h2 {
  margin: 0 0 8px;
  font: 500 19px "Roboto", sans-serif;
}

#fileDropCard p {
  margin: 0;
  font: 400 14px "Roboto", sans-serif;
  line-height: 1.45;
}

#fileDropCard code {
  font-family: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
    monospace;
}

#dataWarningCard {
  width: min(480px, calc(100vw - 32px));
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 16px;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 94%, white);
  color: var(--md-sys-color-on-surface);
}

#dataWarningCard h2 {
  margin: 0 0 10px;
  font: 500 18px "Roboto", sans-serif;
}

#dataWarningCard p {
  margin: 0;
  font: 400 14px "Roboto", sans-serif;
  line-height: 1.45;
}

#dataWarningProceedBtn {
  margin-top: 14px;
  height: 38px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 10px;
  padding: 0 14px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font: 500 14px "Roboto", sans-serif;
  cursor: pointer;
}

#loadingSpinner {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 4px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 75%, white);
  border-top-color: var(--md-sys-color-primary);
  animation: loadingSpin 0.9s linear infinite;
}

@keyframes loadingSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.controlPanelRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

#controlPanelRowTop {
  justify-content: center;
}

#controlPanelRowBottom {
  justify-content: stretch;
}

#leftPanelButtons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-right: auto;
}

#timelineSlider {
  flex: 1;
  min-width: 0;
  height: 36px;
  accent-color: var(--md-sys-color-primary);
}

#currentTimestamp {
  min-width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 88%, white);
}

#currentTimestamp .timestampActual {
  font-size: 1em;
}

#currentTimestamp .timestampElapsed {
  font-size: 0.82em;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 72%, white);
}

.panelIconBtn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 999px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: 500 18px "Roboto", sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.panelIconBtn .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
}

.panelIconBtn[aria-expanded="true"] {
  background: color-mix(in srgb, var(--md-sys-color-secondary-container) 82%, white);
}

#tilesetToggleControl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

#followTrackToggleControl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

#optionsPanel {
  left: 12px;
}

#infoPanel {
  left: 12px;
}

#liveDataPanel {
  left: 12px;
  width: min(420px, calc(100vw - 24px));
}

#liveDataPanel.is-enlarged {
  left: 12px;
  right: 12px;
  width: auto;
  max-width: none;
  height: calc(
    100vh - var(--floating-panel-bottom-offset) - var(--live-data-panel-stack-offset, 0px) - 12px
  );
  max-height: calc(
    100vh - var(--floating-panel-bottom-offset) - var(--live-data-panel-stack-offset, 0px) - 12px
  );
}

#dateListPanel {
  left: auto;
  right: 12px;
  transform: none;
  width: min(240px, calc(100vw - 24px));
  max-height: min(320px, 48vh);
  overflow-y: auto;
}

#dateListItems {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dateListItem {
  height: 36px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 10px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  text-align: left;
  padding: 0 10px;
  cursor: pointer;
}

.dateListItem[aria-current="true"] {
  background: color-mix(in srgb, var(--md-sys-color-secondary-container) 82%, white);
}

#dateListEmpty {
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 84%, white);
  font: 400 13px "Roboto", sans-serif;
}

.controlSubPanel {
  position: absolute;
  z-index: 18;
  bottom: var(--floating-panel-bottom-offset);
  width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 94%, white);
  box-sizing: border-box;
}

.controlSubPanel[hidden] {
  display: none !important;
}

#optionsPanel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controlInputRow {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
}

.controlInputRow label {
  color: var(--md-sys-color-on-surface);
}

.controlInputRow output {
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 84%, white);
  min-width: 36px;
  text-align: right;
}

.controlInputRow input[type="range"] {
  grid-column: 1 / 2;
  width: 100%;
  accent-color: var(--md-sys-color-primary);
}

.controlInputRow input[type="color"] {
  grid-column: 2 / 3;
  width: 36px;
  height: 28px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px;
  padding: 0;
  background: var(--md-sys-color-surface);
}

#tilesetToggleLabel {
  font: inherit;
  color: var(--md-sys-color-on-surface);
  text-align: left;
}

#mapLayerSelect {
  min-width: 150px;
  height: 34px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 10px;
  padding: 0 8px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
}

#mapLayerSelect:disabled {
  opacity: 0.85;
}

#mapLayerSelect:focus {
  outline: 2px solid color-mix(in srgb, var(--md-sys-color-primary) 55%, white);
  outline-offset: 1px;
}

#followTrackToggleLabel {
  font: inherit;
  color: var(--md-sys-color-on-surface);
  text-align: left;
}

#toggleFollowTrackSwitch {
  --md-switch-selected-track-color: var(--md-sys-color-primary);
  --md-switch-selected-handle-color: var(--md-sys-color-on-primary);
  --md-switch-selected-focus-handle-color: var(--md-sys-color-on-primary);
  --md-switch-selected-hover-handle-color: var(--md-sys-color-on-primary);
  --md-switch-selected-pressed-handle-color: var(--md-sys-color-on-primary);
}

#tilesetToggleControl[aria-disabled="true"] {
  opacity: 0.85;
}

#hikeDateSelector {
  height: 44px;
  min-width: 150px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  padding: 0 10px;
  font: inherit;
}

#hikeDateSelector:focus {
  outline: 2px solid color-mix(in srgb, var(--md-sys-color-primary) 55%, white);
  outline-offset: 1px;
}

#hikeInfoRows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hikeInfoRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hikeInfoLabel {
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 75%, white);
}

.hikeInfoValue {
  color: var(--md-sys-color-on-surface);
}

#hikeInfoMessage {
  margin-top: 8px;
  font: 400 13px "Roboto", sans-serif;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 88%, white);
}

#liveDataPanel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#liveDataPanelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#liveDataPanelResizeBtn {
  width: 30px;
  height: 30px;
  min-width: 30px;
}

#liveDataPanelResizeBtn .material-symbols-outlined {
  font-size: 18px;
}

#liveDataPanelTitle {
  font: 500 14px "Roboto", sans-serif;
  color: var(--md-sys-color-on-surface);
}

.liveDataGraph {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#liveDataPanel.is-enlarged .liveDataGraph {
  flex: 1;
  min-height: 0;
}

.liveDataGraphCanvasWrap {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
}

#liveDataPanel.is-enlarged .liveDataGraphCanvasWrap {
  height: 100%;
  min-height: 120px;
}

.liveDataGraphTitle {
  font: 500 12px "Roboto", sans-serif;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 82%, white);
}

#liveDataPanelMessage {
  font: 400 12px "Roboto", sans-serif;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 84%, white);
}

#liveElevationChart,
#liveSpeedChart {
  width: 100%;
  height: 100%;
  display: block;
}

#aboutPanel {
  position: absolute;
  right: 12px;
  bottom: var(--floating-panel-bottom-offset);
  z-index: 20;
  width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 94%, white);
  color: var(--md-sys-color-on-surface);
  box-sizing: border-box;
}

#aboutPanel h2 {
  margin: 0 0 8px;
  font: 500 16px "Roboto", sans-serif;
}

#aboutPanel p {
  margin: 0;
  font: 400 13px "Roboto", sans-serif;
}

#aboutPanel p + p {
  margin-top: 6px;
}

@media (max-width: 1024px) {
  #controlPanel {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  #controlPanelRowTop {
    justify-content: space-between;
  }

  #leftPanelButtons,
  #hikeDateSelector {
    min-width: 0;
    width: auto;
    max-width: none;
  }

  .controlSubPanel {
    width: min(320px, calc(100vw - 20px));
    left: 10px;
  }

  #liveDataPanel {
    left: 10px;
    width: min(360px, calc(100vw - 20px));
  }

  #liveDataPanel.is-enlarged {
    left: 10px;
    right: 10px;
    width: auto;
    height: calc(
      100vh - var(--floating-panel-bottom-offset) - var(--live-data-panel-stack-offset, 0px) - 10px
    );
    max-height: calc(
      100vh - var(--floating-panel-bottom-offset) - var(--live-data-panel-stack-offset, 0px) - 10px
    );
  }

  #liveDataPanel.is-enlarged .liveDataGraphCanvasWrap {
    height: 100%;
    min-height: 110px;
  }

  #dateListPanel {
    left: auto;
    right: 10px;
    transform: none;
    width: min(240px, calc(100vw - 20px));
  }
}

