:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #101413;
  color: #f5f0e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 15%, rgba(39, 118, 96, 0.32), transparent 34%),
    linear-gradient(135deg, #151b1a 0%, #1f2520 48%, #101413 100%);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.shell {
  width: 100vw;
  height: 100vh;
  padding: 18px;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(245, 240, 232, 0.16);
  border-radius: 8px;
  background: #111513;
}

#campus {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.topbar,
.legend,
.style-switcher,
.info,
.videos {
  position: absolute;
  z-index: 2;
  backdrop-filter: blur(18px);
  background: rgba(18, 23, 21, 0.72);
  border: 1px solid rgba(245, 240, 232, 0.14);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.3);
}

.topbar {
  top: 18px;
  left: 18px;
  right: 18px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #9fc6b4;
  font-size: 12px;
  line-height: 1.2;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 3.6vw, 42px);
  line-height: 1;
  font-weight: 760;
  letter-spacing: 0;
}

.toolset {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
}

.toolset button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(245, 240, 232, 0.1);
  border: 1px solid rgba(245, 240, 232, 0.12);
  color: #f7f1e5;
  font-size: 21px;
}

.toolset .text-tool-button,
.toolset .calibration-button {
  width: auto;
  min-width: 82px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
}

.toolset button:hover,
.toolset button.is-active {
  background: #e6bd5a;
  color: #16201a;
}

.legend {
  left: 18px;
  top: 112px;
  width: min(220px, calc(100vw - 36px));
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
}

.style-switcher {
  left: 18px;
  top: 338px;
  width: min(220px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
}

.style-option {
  min-height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(245, 240, 232, 0.08);
  border: 1px solid rgba(245, 240, 232, 0.1);
  color: #eee6da;
  font-size: 14px;
}

.style-option:hover,
.style-option.is-active {
  background: #e6bd5a;
  color: #16201a;
}

.legend-row {
  min-height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  background: transparent;
  text-align: left;
  color: #eee6da;
  font-size: 14px;
}

.legend-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.dot.gate {
  background: #39a7d7;
}

.dot.academic {
  background: #d8c59f;
}

.dot.sports {
  background: #2f77d0;
}

.dot.north {
  background: #8e9693;
}

.info {
  left: 18px;
  bottom: 18px;
  width: min(360px, calc(100vw - 36px));
  padding: 16px;
  border-radius: 8px;
}

.info-kicker {
  margin: 0 0 6px;
  color: #e6bd5a;
  font-size: 12px;
  line-height: 1.2;
}

.info h2 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.15;
}

.info p:last-child {
  margin: 0;
  color: rgba(245, 240, 232, 0.78);
  font-size: 14px;
  line-height: 1.5;
}

.videos {
  right: 18px;
  bottom: 18px;
  width: min(465px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
}

.videos video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: #0b0f0d;
}

#geo-status {
  position: absolute;
  z-index: 3;
  top: 112px;
  right: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.2;
  color: #f5f0e8;
  background: rgba(18, 23, 21, 0.88);
  border: 1px solid rgba(245, 240, 232, 0.18);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#geo-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9fc6b4;
}

#geo-status[data-kind="ok"]::before {
  background: #6ee2a8;
  box-shadow: 0 0 12px #6ee2a8;
}

#geo-status[data-kind="warn"]::before {
  background: #e6bd5a;
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .shell {
    height: 100dvh;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .stage {
    border: 0;
    border-radius: 0;
  }

  .topbar {
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 26px;
  }

  .toolset {
    width: 100%;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
  }

  .toolset::-webkit-scrollbar {
    display: none;
  }

  .toolset button {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .toolset .text-tool-button,
  .toolset .calibration-button {
    flex: 0 0 auto;
    min-width: 78px;
    padding: 0 12px;
    font-size: 13px;
  }

  .toolset .text-tool-button {
    order: -2;
  }

  .toolset .calibration-button {
    order: -1;
  }

  .legend {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: calc(62px + env(safe-area-inset-bottom));
    width: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
  }

  .style-switcher {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 6px;
    border-radius: 8px;
  }

  .legend-row {
    min-height: 34px;
    justify-content: center;
    gap: 6px;
    padding: 0 6px;
    font-size: 12px;
  }

  .style-option {
    min-height: 34px;
    font-size: 13px;
  }

  .info {
    left: 8px;
    right: 8px;
    bottom: calc(108px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    padding: 12px;
    border-radius: 8px;
  }

  .info h2 {
    margin-bottom: 6px;
    font-size: 21px;
  }

  .info p:last-child {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .videos {
    display: none;
  }

  #geo-status {
    top: 112px;
    left: 8px;
    right: 8px;
    justify-content: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 9px;
  }

  h1 {
    font-size: 23px;
  }

  .toolset button {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }

  .toolset .text-tool-button,
  .toolset .calibration-button {
    min-width: 72px;
    padding: 0 10px;
  }

  .legend-row {
    font-size: 11px;
  }

  .dot {
    width: 9px;
    height: 9px;
  }
}
