:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1b1f23;
  background: #e8e7df;
  font-size: 15px;
  --surface: rgba(250, 246, 236, 0.97);
  --ink: #1b1f23;
  --muted: #4a5560;
  --accent: #1f3a5f;
  --line: #e3dccb;
  --shadow: 0 2px 12px #1b1f2324;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
}
button,
input,
select {
  font: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
}
button:hover {
  background: #eee9df;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #416b9c;
  outline-offset: 2px;
}
button[aria-pressed="true"],
.field-grid button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
input {
  accent-color: var(--accent);
}
#map {
  position: absolute;
  inset: 0;
}
.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.top {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 16px;
  width: 340px;
  border-radius: 20px;
  padding: 10px 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.brand strong {
  font-size: 19px;
}
.brand-mark {
  font-size: 25px;
  color: var(--accent);
}
.badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #5f6b76;
  border: 1px solid #ccc3b0;
  border-radius: 4px;
  padding: 2px 4px;
}
.text-button {
  border: 0;
  background: transparent;
}
.brand .text-button {
  margin-left: auto;
  min-height: 32px;
}
.top form {
  display: flex;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
}
input[type="search"] {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  font-size: 16px;
}
.top form button {
  border: 0;
}
.forecast-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 0 2px;
  text-align: left;
}
.forecast-strip #place {
  font-weight: 600;
}
.forecast-strip #forecast-summary {
  font-size: 12px;
  color: var(--muted);
  grid-column: 1;
  line-height: 1.4;
}
.forecast-strip > span:last-child {
  grid-column: 2;
  grid-row: 1/3;
}
.status-row {
  position: absolute;
  top: 188px;
  left: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 340px;
}
.status-chip {
  font-size: 12px;
  min-height: 34px;
  box-shadow: var(--shadow);
  background: var(--surface);
  padding: 6px 12px;
}
.status-chip.warn {
  color: #b3261e;
  border-color: #b3261e;
}
.rail {
  position: absolute;
  right: 16px;
  bottom: 260px;
  display: grid;
  gap: 8px;
}
.rail button {
  width: 48px;
  height: 48px;
  font-size: 24px;
  border-radius: 14px;
}
.dock {
  position: absolute;
  bottom: max(34px, calc(env(safe-area-inset-bottom) + 24px));
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 32px));
  border-radius: 20px;
  padding: 12px 16px;
}
.dock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.segments {
  display: flex;
  background: #eae6dc;
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.segments button {
  border: 0;
  background: transparent;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
}
.segments button[aria-pressed="true"] {
  background: #fff;
  box-shadow: 0 1px 4px #0002;
  color: var(--accent);
  font-weight: 650;
}
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px;
  background: #fff;
  min-height: 36px;
  font-size: 13px;
  max-width: 120px;
}
.time-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  min-height: 64px;
}
.time-row > div {
  flex: 1;
  min-width: 0;
}
.time-row strong {
  display: block;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
.time-row small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.play {
  border-radius: 50%;
  height: 44px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.timeline-wrap {
  position: relative;
  height: 38px;
  display: flex;
  align-items: center;
}
.timeline-wrap input {
  width: 100%;
  height: 36px;
  background: transparent;
  position: relative;
  z-index: 2;
  margin: 0;
}
#frame-ticks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  pointer-events: none;
}
#frame-ticks i {
  position: absolute;
  height: 5px;
  width: 3px;
  background: #c6bdab;
  border-radius: 2px;
}
#frame-ticks i.ready {
  background: #1f3a5f;
}
#frame-ticks i.failed {
  background: #b3261e;
}
.timeline-labels {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#buffer-status {
  font-size: 10px;
}
#limitation {
  font-size: 10px;
  line-height: 1.4;
  color: #5f6b76;
  margin: 8px 0 0;
}
.legend {
  position: absolute;
  left: 16px;
  bottom: 260px;
  padding: 10px 12px;
  border-radius: 14px;
  max-width: 270px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.legend strong {
  font-size: 13px;
}
.legend span {
  font-size: 11px;
  color: var(--muted);
}
.legend small {
  font-size: 10px;
  color: var(--muted);
}
#scale-button {
  min-height: 44px;
  font-size: 12px;
  text-align: left;
}
.source-scale-scroll {
  overflow: auto;
  max-height: 55dvh;
  background: white;
}
.maplibregl-ctrl-bottom-right,
.maplibregl-ctrl-bottom-left {
  bottom: 0 !important;
}
.maplibregl-ctrl-attrib {
  font-size: 10px !important;
  max-width: 100%;
  background: #ffffffe6 !important;
}
dialog {
  position: absolute;
  margin: 0;
  inset: 16px 16px 32px auto;
  width: 380px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 48px);
  height: fit-content;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  color: var(--ink);
}
dialog::backdrop {
  background: #17223622;
}
.sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sheet-heading h1 {
  font-size: 22px;
  margin: 0;
}
#sheet-content {
  overflow: auto;
  max-height: calc(100dvh - 155px);
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.field-grid button {
  text-align: left;
  font-size: 14px;
  min-height: 70px;
}
.field-grid small {
  display: block;
  font-size: 10px;
  margin-top: 6px;
  opacity: 0.85;
}
.setting {
  display: block;
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}
.setting output {
  float: right;
}
.setting input[type="range"] {
  display: block;
  width: 100%;
  height: 36px;
}
.setting small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin: 5px 0;
}
.check input {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
.wide {
  width: 100%;
  margin-top: 16px;
}
.muted,
.details p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.details h2 {
  font-size: 16px;
  margin: 18px 0 8px;
}
.details a {
  color: #234f84;
}
.forecast-hour {
  display: grid;
  grid-template-columns: 70px 48px 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.forecast-hour span:last-child {
  color: var(--muted);
  font-size: 12px;
}
.results button {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 6px;
  font-size: 13px;
}
.results {
  max-height: 260px;
  overflow: auto;
}
#history-controls {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}
#history-controls[hidden] {
  display: none;
}
#history-controls input {
  min-width: 0;
  flex: 1;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}
#toast {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 12px 18px;
  border-radius: 14px;
  background: #1b1f23;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 5;
}
#connection {
  background: #8d301d;
  color: white;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
noscript {
  position: absolute;
  top: 40%;
  left: 20px;
  background: white;
  padding: 20px;
}
body.sheet-open .dock {
  visibility: hidden;
}
body.sheet-open .rail {
  visibility: hidden;
}
body.satellite .legend {
  background: #242b34;
  color: #fff;
}
body.satellite .legend span,
body.satellite .legend small {
  color: #d4d9df;
}
.comparison-toggle {
  position: absolute;
  top: 274px;
  left: 16px;
  font-size: 13px;
}
body.sheet-open .comparison-toggle {
  visibility: hidden;
}
@media (max-width: 600px) {
  .comparison-toggle {
    top: 240px;
    left: 8px;
  }
  .top {
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    width: calc(100% - 16px);
    padding: 6px 12px;
  }
  .brand {
    margin-bottom: 0;
  }
  .brand strong {
    font-size: 17px;
  }
  .brand-mark {
    font-size: 21px;
  }
  .top form {
    height: 42px;
  }
  .forecast-strip {
    padding-top: 7px;
    min-height: 40px;
  }
  .status-row {
    top: 158px;
    left: 8px;
    max-width: calc(100% - 70px);
  }
  .rail {
    right: 8px;
    bottom: 267px;
  }
  .legend {
    left: 8px;
    bottom: 267px;
    max-width: 65%;
    padding: 8px 10px;
  }
  .dock {
    width: calc(100% - 16px);
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px));
    padding: 10px 12px;
    border-radius: 18px;
  }
  .segments button {
    padding: 6px 10px;
  }
  .time-row strong {
    font-size: 15px;
  }
  .time-row {
    gap: 8px;
  }
  .time-row small {
    font-size: 10px;
  }
  .dock-top select {
    font-size: 12px;
    width: 91px;
  }
  .timeline-labels {
    font-size: 10px;
  }
  dialog {
    inset: auto 8px max(28px, env(safe-area-inset-bottom)) 8px;
    width: auto;
    max-width: none;
    max-height: 78dvh;
    padding: 16px;
  }
  #sheet-content {
    max-height: calc(78dvh - 80px);
  }
  .maplibregl-ctrl-attrib-inner {
    font-size: 9px;
  }
  #history-controls button {
    padding: 4px;
    min-width: 32px;
  }
}
@media (max-height: 520px) {
  .top {
    width: 290px;
  }
  .status-row {
    top: 160px;
  }
  .dock {
    left: auto;
    right: 8px;
    transform: none;
    width: 50%;
    bottom: 25px;
  }
  .legend {
    bottom: 30px;
    max-width: 35%;
  }
  .rail {
    bottom: auto;
    top: 12px;
    right: 8px;
    display: flex;
  }
  .rail button {
    height: 42px;
    width: 42px;
  }
  .time-row {
    min-height: 45px;
  }
  .dock #limitation {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
