:root {
  --navy: #06263a;
  --deep: #041824;
  --teal: #0d6e7a;
  --foam: #e8f6f8;
  --gold: #e2b84a;
  --glass: rgba(6, 16, 28, 0.78);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--foam);
  background: var(--deep);
  min-height: 100vh;
}

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(2,8,16,.28) 0%, rgba(2,10,18,.4) 55%, rgba(1,6,12,.78) 100%),
    url("../images/bg-wavelets.jpg") center / cover no-repeat;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(4, 18, 30, 0.45);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: #0b3a4a;
}
.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.brand span {
  display: block;
  font-size: .7rem;
  opacity: .85;
  letter-spacing: .14em;
}

.stage {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  align-items: start;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
}

.sites {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
}
@media (max-width: 860px) {
  .sites { max-width: none; }
}
.site-btn {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  width: 100%;
  text-align: left;
  padding: 0;
  min-height: 56px;
  border-radius: 12px;
  border: 1px solid rgba(232,246,248,.14);
  background: var(--glass);
  color: var(--foam);
  cursor: pointer;
  overflow: hidden;
}
.site-btn .btn-map-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 11px 0 0 11px;
  overflow: hidden;
  background: rgba(4, 18, 30, 0.55);
}
.site-btn .btn-map {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 3px;
}
.site-btn .btn-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px 6px 8px;
}
.site-btn .name {
  font-size: .52rem;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #c5d4d8;
  opacity: .85;
  line-height: 1.2;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-btn .chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  white-space: nowrap;
  min-width: 0;
}
.chip {
  font-size: .5rem;
  font-weight: 700;
  letter-spacing: .01em;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(13,110,122,.35);
  border: 1px solid rgba(122,212,224,.25);
  flex: 0 1 auto;
}
.chip.ok { background: rgba(46,140,90,.35); border-color: rgba(90,210,130,.35); }
.chip.warn { background: rgba(180,130,20,.35); border-color: rgba(226,184,74,.45); color: var(--gold); }
.chip.rough { background: rgba(170,50,50,.4); border-color: rgba(255,120,120,.35); }
.site-btn.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
#site-select { display: none; }

.tile {
  background: var(--glass);
  border: 1px solid rgba(232,246,248,.14);
  border-radius: 16px;
  padding: 10px 10px 8px;
  box-shadow: 0 12px 28px rgba(0,0,0,.32);
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.tile-top {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  text-align: center;
  gap: 2px;
}
.tile-title { text-align: center; }
.kicker-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.tile-kicker {
  font-size: .52rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .7;
  white-space: normal;
  overflow: visible;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
}
.map-pin {
  position: relative;
  display: inline-flex;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(226,184,74,.45);
  flex: 0 0 56px;
  background: rgba(4, 18, 30, 0.55);
}
.map-pin img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 3px;
}
.site-place {
  font-size: .42rem;
  letter-spacing: .03em;
  color: #8aa0a6;
  text-transform: none;
  line-height: 1.25;
  margin-top: 1px;
}
.map-pin::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 7px;
  height: 9px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath fill='%23041424' d='M6 0C2.7 0 0 2.6 0 5.8c0 4.3 6 10.2 6 10.2s6-5.9 6-10.2C12 2.6 9.3 0 6 0z'/%3E%3Cpath fill='%23e2b84a' d='M6 1.1C3.3 1.1 1.2 3.2 1.2 5.8c0 3.4 4.8 8.4 4.8 8.4s4.8-5 4.8-8.4C10.8 3.2 8.7 1.1 6 1.1z'/%3E%3Ccircle cx='6' cy='5.7' r='1.7' fill='%23041424'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
  filter: drop-shadow(0 0 1px #041424);
}
#site-select {
  width: 100%;
  margin: 2px 0 4px;
  background: rgba(4,18,30,.85);
  color: var(--foam);
  border: 1px solid rgba(232,246,248,.2);
  border-radius: 6px;
  font-size: .62rem;
  padding: 3px 2px;
}
.gauges {
  margin: 6px 0 0;
  font-size: .5rem;
  line-height: 1.35;
  opacity: .55;
}
#day-label { font-size: .95rem; font-weight: 700; }
#day-date { font-size: .62rem; opacity: .75; }

.arrow-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(232,246,248,.2);
  background: rgba(13,110,122,.35);
  color: var(--foam);
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  justify-self: center;
}
.arrow-btn:disabled { opacity: .3; }


.cam-wrap {
  margin: 10px 0 0;
}
.cam-wrap[hidden] { display: none; }
.cam-leave {
  margin: 6px 2px 0;
  font-size: .42rem;
  line-height: 1.35;
  color: #c4a35a;
  text-align: left;
}
.cam-card {
  display: block;
  position: relative;
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(232,246,248,.16);
  background: #041824;
  text-decoration: none;
  color: inherit;
}
.cam-card[hidden] { display: none; }
.cam-card img {
  display: block;
  width: 100%;
  height: 88px;
  object-fit: cover;
  object-position: center;
  filter: saturate(.92) contrast(1.05);
}
.cam-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 8px 6px;
  background: linear-gradient(transparent, rgba(4,18,30,.88));
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cam-kicker {
  font-size: .42rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #e2b84a;
}
#cam-label {
  font-size: .52rem;
  color: #e8f6f8;
  letter-spacing: .02em;
}
#cam-note {
  font-size: .4rem;
  color: #8aa0a6;
}
@media (min-width: 861px) {
  .cam-card img { height: 110px; }
}

.moon-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin: 2px 0 2px;
}
.moon-kicker {
  font-size: .48rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .65;
}
.moon-icon {
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.moon-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
#moon-name {
  font-size: .4rem;
  letter-spacing: .02em;
  text-transform: none;
  font-weight: 400;
  color: #8aa0a6;
  opacity: .9;
}
.wave-wrap { margin: 4px 0 4px; }
#tide-wave {
  width: 100%;
  height: 72px;
  display: block;
  background: rgba(0, 20, 32, .35);
  border-radius: 8px;
}
.wave-caption {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: .62rem;
  opacity: .8;
  text-align: center;
  margin-top: 2px;
}

.sst {
  margin: 6px 0 4px;
  text-align: center;
  font-size: .58rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}
.matrix {
  display: grid;
  grid-template-columns: 4.6rem 1fr 1fr;
  column-gap: 6px;
  row-gap: 2px;
  margin-top: 2px;
  align-items: center;
}
.matrix .mh {
  text-align: center;
  font-size: .55rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(232,246,248,.65);
}
.matrix .ml {
  font-size: .46rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .65;
}
.matrix > div:not(.mh):not(.ml) {
  font-size: .58rem;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  white-space: nowrap;
}
.wind-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.wind-arrow {
  display: inline-block;
  font-size: .7rem;
  line-height: 1;
  color: #7ad4e0;
  transform-origin: 50% 55%;
}
.tile-note {
  margin: 6px 0 0;
  font-size: .58rem;
  line-height: 1.35;
  opacity: .72;
  max-height: 3.6em;
  overflow: hidden;
}

footer {
  text-align: center;
  padding: 12px 16px 16px;
  font-size: .75rem;
  opacity: .7;
}
footer p { margin: 0; }
.disclaimer {
  max-width: 720px;
  width: calc(100% - 24px);
  margin: 4px auto 0;
  padding: 0 8px;
  font-size: .68rem;
  line-height: 1.4;
  opacity: .85;
  text-align: center;
}
.install-bar {
  max-width: 720px;
  width: calc(100% - 24px);
  margin: 10px auto 0;
  text-align: center;
}
.install-btn {
  appearance: none;
  border: 1px solid rgba(226,184,74,.55);
  background: rgba(4,18,36,.72);
  color: #e2b84a;
  font: inherit;
  font-size: .72rem;
  letter-spacing: .04em;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.install-how {
  margin: 8px 0 0;
  font-size: .62rem;
  line-height: 1.35;
  color: #8aa0a6;
}
.dd-standalone .install-bar { display: none; }

@media (min-width: 861px) {
  .stage { grid-template-columns: 1.15fr .85fr; padding: 28px; gap: 28px; }
  .tile { padding: 16px; }
  #tide-wave { height: 96px; }
  .intro h2 { font-size: 2rem; }
  .sites { max-width: 320px; }
  .site-btn { grid-template-columns: 72px minmax(0, 1fr); min-height: 72px; }
  .site-btn .btn-map-wrap { width: 72px; height: 72px; }
  .map-pin { width: 64px; height: 64px; flex-basis: 64px; }
  .chip { font-size: .55rem; padding: 2px 7px; }
}

@media (max-width: 860px) {
  .stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    min-height: 0;
    align-items: start;
  }
  .sites, .tile { min-width: 0; }
  .site-btn { grid-template-columns: 48px minmax(0, 1fr); min-height: 48px; }
  .site-btn .btn-map-wrap { width: 48px; height: 48px; }
  .map-pin { width: 48px; height: 48px; flex-basis: 48px; }
  .site-btn .btn-body { padding: 4px 6px; gap: 3px; }
  .site-btn .name { letter-spacing: .06em; }
  .chip { font-size: .46rem; padding: 1px 4px; }
  .tile {
    align-self: start;
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
    padding: 8px 6px 6px;
  }
  .disclaimer {
    margin-top: 2px;
    padding: 0 10px 4px;
  }
  footer { padding-top: 6px; }
  .tile-top { grid-template-columns: 24px minmax(0, 1fr) 24px; }
  .arrow-btn { width: 24px; height: 24px; font-size: .9rem; }
  .matrix { grid-template-columns: 4.2rem minmax(0, 1fr) minmax(0, 1fr); column-gap: 2px; }
  .intro h2 { font-size: 1.05rem; }
  .lede { font-size: .78rem; }
}
