.climb-3d-launch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 14px 0 2px;
  padding: 12px;
  border: 1px solid #b9cee9;
  border-radius: 7px;
  background: linear-gradient(135deg, #f5f9ff, #edf5ff);
}

.climb-3d-launch strong,
.climb-3d-launch span {
  display: block;
}

.climb-3d-launch strong {
  color: #1a3558;
  font-size: 12px;
}

.climb-3d-launch span {
  margin-top: 3px;
  color: #526981;
  font-size: 10px;
  line-height: 1.4;
}

.climb-3d-launch-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #1e5fc9;
  border-radius: 5px;
  color: #fff;
  background: #2865d8;
  box-shadow: 0 2px 5px rgba(22, 65, 125, .2);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.climb-3d-launch-button:hover { background: #1f56bd; }

.climb-3d-dialog[hidden] { display: none !important; }

.climb-3d-dialog {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  color: #edf4ff;
  background: #08111e;
  isolation: isolate;
}

.climb-3d-head {
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 11px 14px 11px 18px;
  border-bottom: 1px solid rgba(186, 207, 234, .2);
  background: rgba(12, 26, 44, .98);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .2);
}

.climb-3d-heading { min-width: 0; }

.climb-3d-kicker {
  margin: 0 0 3px;
  color: #83a8d7;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.climb-3d-head h2 {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 17px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.climb-3d-head p {
  margin: 4px 0 0;
  overflow: hidden;
  color: #aebed2;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.climb-3d-options {
  display: flex;
  align-items: end;
  gap: 8px;
}

.climb-3d-option {
  display: grid;
  gap: 3px;
  color: #b9c8dc;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.climb-3d-option select {
  min-width: 104px;
  height: 34px;
  padding: 0 28px 0 9px;
  border: 1px solid #536980;
  border-radius: 5px;
  color: #f5f8fd;
  background: #172a42;
  font-size: 11px;
  text-transform: none;
}

.climb-3d-close {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #667c94;
  border-radius: 5px;
  color: #fff;
  background: #172a42;
  font-size: 19px;
  line-height: 1;
}

.climb-3d-close:hover { background: #213a59; }

.climb-3d-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(73, 111, 147, .42), transparent 52%),
    linear-gradient(#17283b, #0b1522);
  touch-action: none;
}

.climb-3d-canvas-host,
.climb-3d-canvas-host canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.climb-3d-canvas-host canvas {
  display: block;
  outline: 0;
}

.climb-3d-preset-bar {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(187, 207, 232, .38);
  border-radius: 7px;
  background: rgba(10, 24, 40, .88);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .22);
  backdrop-filter: blur(8px);
}

.climb-3d-preset {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #d8e4f3;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
}

.climb-3d-preset:hover,
.climb-3d-preset[aria-pressed="true"] {
  border-color: #6994c7;
  color: #fff;
  background: #245eaa;
}

.climb-3d-help {
  position: absolute;
  z-index: 3;
  right: 12px;
  top: 12px;
  max-width: min(330px, calc(100% - 320px));
  margin: 0;
  padding: 7px 9px;
  border: 1px solid rgba(187, 207, 232, .32);
  border-radius: 5px;
  color: #d9e6f4;
  background: rgba(10, 24, 40, .76);
  font-size: 10px;
  line-height: 1.4;
  backdrop-filter: blur(7px);
}

.climb-3d-status-card,
.climb-3d-error-card {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 50%;
  width: min(430px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  border: 1px solid rgba(176, 202, 232, .42);
  border-radius: 9px;
  background: rgba(11, 25, 42, .95);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .38);
  text-align: center;
  backdrop-filter: blur(12px);
}

.climb-3d-status-card[hidden],
.climb-3d-error-card[hidden] { display: none !important; }

.climb-3d-status-card { padding: 20px; }

.climb-3d-status-card strong {
  display: block;
  color: #fff;
  font-size: 15px;
}

.climb-3d-status-card p {
  min-height: 16px;
  margin: 7px 0 0;
  color: #b8c8dc;
  font-size: 11px;
  line-height: 1.45;
}

.climb-3d-progress {
  height: 5px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #273b54;
}

.climb-3d-progress span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: #4f91ef;
  transition: width 180ms ease;
}

.climb-3d-error-card { padding: 22px; }

.climb-3d-error-card h3 { margin: 0; color: #fff; font-size: 16px; }
.climb-3d-error-card p { margin: 8px 0 16px; color: #c0ccdc; font-size: 11px; line-height: 1.5; }

.climb-3d-error-actions { display: flex; justify-content: center; gap: 8px; }

.climb-3d-error-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #667d97;
  border-radius: 5px;
  color: #fff;
  background: #1b314b;
  font-size: 11px;
  font-weight: 700;
}

.climb-3d-error-actions .primary { border-color: #2f76dc; background: #2865d8; }

.climb-3d-attribution {
  position: absolute;
  z-index: 4;
  right: 8px;
  bottom: 8px;
  max-width: min(68%, 720px);
  padding: 4px 7px;
  border-radius: 3px;
  color: #d8e3ef;
  background: rgba(5, 13, 23, .76);
  font-size: 8px;
  line-height: 1.35;
  text-align: right;
}

.climb-3d-foot {
  z-index: 5;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 9px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(186, 207, 234, .2);
  background: #0c1a2c;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, .2);
}

.climb-3d-dashboard-head {
  display: grid;
  grid-template-columns: auto minmax(360px, 1fr) minmax(330px, auto) auto;
  align-items: stretch;
  gap: 9px;
  min-width: 0;
}

.climb-3d-play,
.climb-3d-follow {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #617895;
  border-radius: 5px;
  color: #eef5ff;
  background: #172c46;
  font-size: 11px;
  font-weight: 700;
}

.climb-3d-play:hover,
.climb-3d-follow:hover,
.climb-3d-follow[aria-pressed="true"] { border-color: #5591df; background: #245eaa; }

.climb-3d-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  margin: 0;
}

.climb-3d-summary > div {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid rgba(126, 157, 194, .32);
  border-radius: 5px;
  background: #12253c;
}

.climb-3d-summary dt {
  overflow: hidden;
  color: #91a7c1;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .035em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.climb-3d-summary dd {
  min-width: 0;
  margin: 2px 0 0;
  overflow: hidden;
  color: #f6f9fd;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.climb-3d-legend {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid rgba(126, 157, 194, .32);
  border-radius: 5px;
  background: #12253c;
}

.climb-3d-legend > strong {
  color: #c8d7e9;
  font-size: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.climb-3d-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
}

.climb-3d-legend-items span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #e3ebf5;
  font-size: 8px;
  white-space: nowrap;
}

.climb-3d-legend-items i {
  width: 16px;
  height: 5px;
  border-radius: 99px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14);
}

.climb-3d-legend-items .grade-easy { background: #2aa978; }
.climb-3d-legend-items .grade-steady { background: #e8bd31; }
.climb-3d-legend-items .grade-hard { background: #ef7d27; }
.climb-3d-legend-items .grade-severe { background: #c43e50; }
.climb-3d-legend-items .grade-extreme { background: #8b1d4d; }

.climb-3d-profile-panel {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(126, 157, 194, .32);
  border-radius: 7px;
  background: #101f32;
}

.climb-3d-profile-meta {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
  padding-left: 3px;
}

.climb-3d-profile-meta > div > strong,
.climb-3d-profile-meta > div > span { display: block; }

.climb-3d-profile-meta > div > strong { color: #fff; font-size: 11px; }
.climb-3d-profile-meta > div > span { margin-top: 2px; color: #91a7c1; font-size: 8px; line-height: 1.35; }

.climb-3d-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  color: #d9e7f8;
  font-variant-numeric: tabular-nums;
}

.climb-3d-readout > span,
.climb-3d-readout > strong {
  min-width: 0;
  padding: 4px 6px;
  border-radius: 4px;
  background: #172c46;
}

.climb-3d-readout > span { display: grid; gap: 1px; }
.climb-3d-readout small { color: #91a7c1; font-size: 7px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.climb-3d-readout strong { overflow: hidden; color: #fff; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.climb-3d-readout > strong { font-size: 11px; }
.climb-3d-readout > strong + span { color: #aebed2; font-size: 8px; }

.climb-3d-profile-frame {
  position: relative;
  min-width: 0;
  height: 118px;
  overflow: hidden;
  border: 1px solid #354d69;
  border-radius: 6px;
  background: #0b1828;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025);
}

.climb-3d-profile-frame:focus-within {
  border-color: #7eb3f6;
  box-shadow: 0 0 0 2px rgba(78, 145, 235, .36);
}

.climb-3d-profile-chart {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.climb-3d-profile-scrubber {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: ew-resize;
  opacity: .001;
  touch-action: none;
}

.climb-3d-profile-scrubber:disabled { cursor: default; }

.climb-3d-profile-axis {
  position: absolute;
  z-index: 2;
  color: #c9d7e8;
  font-size: 7px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 1px 3px #06101b;
}

.climb-3d-profile-axis.elevation-max { top: 8px; left: 5px; }
.climb-3d-profile-axis.elevation-min { bottom: 22px; left: 5px; }
.climb-3d-profile-axis.distance-start { bottom: 4px; left: 50px; }
.climb-3d-profile-axis.distance-end { right: 12px; bottom: 4px; }

.climb-3d-profile-empty {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  color: #aebed2;
  font-size: 10px;
  text-align: center;
  pointer-events: none;
}

.climb-3d-profile-empty[hidden] { display: none; }

@media (max-width: 1100px) {
  .climb-3d-dashboard-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .climb-3d-legend { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 760px) {
  .climb-3d-launch { grid-template-columns: 1fr; }
  .climb-3d-launch-button { width: 100%; min-height: 44px; }

  .climb-3d-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 10px;
  }

  .climb-3d-head p { display: none; }
  .climb-3d-options { grid-column: 1 / -1; grid-row: 2; align-items: stretch; }
  .climb-3d-option { flex: 1; }
  .climb-3d-option select { width: 100%; min-width: 0; height: 38px; }
  .climb-3d-close { grid-column: 2; grid-row: 1; width: 44px; height: 44px; }

  .climb-3d-preset-bar {
    right: 8px;
    top: 8px;
    left: 8px;
    overflow-x: auto;
  }

  .climb-3d-preset { flex: 1 0 auto; min-height: 38px; }
  .climb-3d-help { display: none; }
  .climb-3d-attribution { right: 6px; bottom: 6px; max-width: calc(100% - 12px); }

  .climb-3d-foot {
    gap: 6px;
    padding: 6px 7px calc(7px + env(safe-area-inset-bottom));
  }

  .climb-3d-dashboard-head { grid-template-columns: 1fr 1fr; gap: 5px; }
  .climb-3d-summary { grid-column: 1 / -1; grid-row: 1; gap: 3px; }
  .climb-3d-summary > div { padding: 4px 3px; text-align: center; }
  .climb-3d-summary dt { font-size: 7px; }
  .climb-3d-summary dd { font-size: 9px; }
  .climb-3d-legend { grid-column: 1 / -1; grid-row: 2; padding: 4px 6px; }
  .climb-3d-legend-items { justify-content: space-between; gap: 3px 5px; }
  .climb-3d-legend-items span { font-size: 8px; }
  .climb-3d-legend-items i { width: 12px; }
  .climb-3d-play { grid-column: 1; grid-row: 3; }
  .climb-3d-follow { grid-column: 2; grid-row: 3; }

  .climb-3d-profile-panel { grid-template-columns: 1fr; gap: 5px; padding: 5px; }
  .climb-3d-profile-meta { gap: 4px; padding: 0; }
  .climb-3d-profile-meta > div > span { display: none; }
  .climb-3d-readout { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
  .climb-3d-readout > span { padding: 3px; text-align: center; }
  .climb-3d-readout small { font-size: 7px; }
  .climb-3d-readout strong { font-size: 9px; }
  .climb-3d-profile-frame { height: 92px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .climb-3d-head { grid-template-columns: minmax(0, 1fr) auto auto; padding-block: 7px; }
  .climb-3d-options { grid-column: auto; grid-row: auto; }
  .climb-3d-head p, .climb-3d-kicker, .climb-3d-help { display: none; }
  .climb-3d-foot { grid-template-columns: minmax(0, .9fr) minmax(0, 1.6fr); gap: 5px; padding-block: 5px; }
  .climb-3d-dashboard-head { grid-template-columns: 1fr 1fr; align-content: start; gap: 4px; }
  .climb-3d-summary { display: none; }
  .climb-3d-legend { grid-column: 1 / -1; grid-row: 2; gap: 2px; padding: 3px 5px; }
  .climb-3d-legend > strong { display: none; }
  .climb-3d-legend-items { flex-wrap: nowrap; gap: 3px; }
  .climb-3d-legend-items span { gap: 2px; font-size: 7px; }
  .climb-3d-legend-items i { width: 9px; }
  .climb-3d-play { grid-column: 1; grid-row: 1; }
  .climb-3d-follow { grid-column: 2; grid-row: 1; }
  .climb-3d-profile-panel { grid-template-columns: minmax(150px, .7fr) minmax(0, 1.3fr); gap: 5px; }
  .climb-3d-profile-meta > div { display: none; }
  .climb-3d-readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .climb-3d-profile-frame { height: 62px; }
  .climb-3d-profile-axis.elevation-min { bottom: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .climb-3d-progress span { transition: none; }
}
