:root {
  color-scheme: dark;
  --bg: #101820;
  --bg-soft: #172331;
  --panel: rgba(248, 250, 252, 0.94);
  --ink: #17202a;
  --muted: #667085;
  --text: #f8fafc;
  --accent: #15aabf;
  --accent-strong: #0b7285;
  --line: rgba(255, 255, 255, 0.16);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

html,
body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(21, 170, 191, 0.22), transparent 30rem),
    radial-gradient(circle at 78% 78%, rgba(14, 116, 144, 0.24), transparent 34rem),
    linear-gradient(135deg, #101820 0%, #172331 52%, #243241 100%);
  color: var(--text);
}

button,
input { font: inherit; }

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 24px;
  background: var(--accent);
  color: #04242b;
  cursor: pointer;
  font-weight: 900;
}

input {
  min-width: 0;
  width: 100%;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 12px 18px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus { border-color: var(--accent); }

.screen {
  height: 100dvh;
  padding: clamp(14px, 2.1vw, 34px);
  padding-bottom: 74px;
  overflow: hidden;
}

.search-view {
  height: 100%;
  display: grid;
  place-items: center;
}

.search-panel {
  width: min(760px, 100%);
  display: grid;
  gap: clamp(16px, 2.3vh, 26px);
  padding: clamp(22px, 4vh, 46px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: #8ee7f1;
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.search-panel .eyebrow { color: var(--accent-strong); }

h1 {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.search-label {
  color: var(--muted);
  font-weight: 850;
}

.search-row,
.compact-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.radar-view {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(8px, 1.4vh, 18px);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 440px);
  gap: 24px;
  align-items: end;
}

.compact-search input { background: rgba(255, 255, 255, 0.93); }

.status {
  min-height: 24px;
  color: #d8f7fb;
  font-size: clamp(0.9rem, 1.7vh, 1.12rem);
  font-weight: 750;
}

.radar-panel {
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.1vh, 14px);
  padding: clamp(10px, 1vw, 16px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.94);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.radar-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}

.radar-toolbar div {
  display: grid;
  gap: 2px;
}

.radar-toolbar div:last-child { text-align: right; }

.radar-toolbar span {
  color: var(--muted);
  font-size: clamp(0.76rem, 0.95vw, 0.95rem);
  font-weight: 850;
  text-transform: uppercase;
}

.radar-toolbar strong {
  color: #263241;
  font-size: clamp(1rem, 1.55vw, 1.7rem);
  font-weight: 950;
}

.radar-map {
  min-height: 0;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(rgba(23, 32, 42, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 42, 0.18) 1px, transparent 1px),
    linear-gradient(135deg, #dbeef5 0%, #e9f5f2 48%, #d9eef4 100%);
  background-size: 64px 64px, 64px 64px, auto;
  border: 1px solid rgba(23, 32, 42, 0.15);
}

.tile-layer {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 2560px;
  height: 1536px;
  transform: translate(-50%, -50%);
}

.tile {
  position: absolute;
  width: 512px;
  height: 512px;
  object-fit: cover;
  image-rendering: auto;
}

.base-tile {
  filter: saturate(0.72) contrast(0.96) brightness(1.04);
}

.radar-tile {
  opacity: 0.78;
  mix-blend-mode: multiply;
}

.map-label {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.map-label::before,
.map-label::after {
  content: "";
  position: absolute;
  background: #d9480f;
}

.map-label::before {
  width: 34px;
  height: 4px;
  border-radius: 999px;
}

.map-label::after {
  width: 4px;
  height: 34px;
  border-radius: 999px;
}

.map-label span {
  margin-top: 58px;
  padding: 7px 12px;
  border-radius: 8px;
  background: rgba(13, 19, 26, 0.86);
  color: #fff;
  font-size: clamp(0.84rem, 1vw, 1rem);
  font-weight: 900;
  white-space: nowrap;
}

.radar-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: #263241;
  font-size: clamp(1.2rem, 2vw, 2rem);
  font-weight: 900;
  text-align: center;
}

.legend {
  display: grid;
  grid-template-columns: auto repeat(5, minmax(28px, 1fr)) auto;
  gap: 8px;
  align-items: center;
  color: #263241;
  font-size: clamp(0.8rem, 1vw, 1rem);
  font-weight: 850;
}

.legend i {
  height: 14px;
  border-radius: 999px;
}

.legend .l1 { background: #74c0fc; }
.legend .l2 { background: #22b8cf; }
.legend .l3 { background: #40c057; }
.legend .l4 { background: #fab005; }
.legend .l5 { background: #f03e3e; }

.place-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-top: 1px solid var(--line);
  background: rgba(13, 19, 26, 0.88);
  color: #edf8fa;
  backdrop-filter: blur(12px);
  font-size: clamp(1rem, 1.45vw, 1.35rem);
  font-weight: 850;
  text-align: center;
}

.attribution {
  color: #d8f7fb;
}

[hidden] { display: none !important; }

@media (max-width: 900px) {
  body { overflow-y: auto; }
  .screen { min-height: 100dvh; height: auto; overflow: visible; }
  .radar-view { height: auto; }
  .topbar { grid-template-columns: 1fr; }
  .radar-panel { min-height: 620px; }
}

@media (max-width: 560px) {
  .screen { padding: 18px; padding-bottom: 92px; }
  .search-row,
  .compact-search { grid-template-columns: 1fr; }
  button { width: 100%; }
}
