:root {
  color-scheme: dark;
  --bg: #06111d;
  --panel: rgba(8, 21, 35, 0.86);
  --card: rgba(13, 35, 55, 0.78);
  --chart: rgba(3, 13, 24, 0.76);
  --line: rgba(144, 222, 255, 0.18);
  --line-strong: rgba(99, 240, 255, 0.34);
  --text: #f2fbff;
  --muted: #91aabd;
  --muted-2: #688293;
  --cyan: #63f0ff;
  --blue: #168cff;
  --low: #49e5ff;
  --high: #8fb6ff;
  --high-dot: #42d66b;
  --low-dot: #ff4d5f;
  --shadow: rgba(0, 0, 0, 0.46);
  --radius: 28px;
  --radius-sm: 18px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(73, 229, 255, 0.20), transparent 30rem),
    radial-gradient(circle at 10% 80%, rgba(22, 140, 255, 0.12), transparent 22rem),
    linear-gradient(180deg, #071522 0%, #04101b 100%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  min-height: 100vh;
  padding: max(14px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.ambient::before {
  content: "";
  position: absolute;
  inset: 10% -22% auto;
  height: 36rem;
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(99, 240, 255, 0.06) 45% 46%, transparent 47% 100%),
    linear-gradient(150deg, transparent 0 56%, rgba(22, 140, 255, 0.07) 57% 58%, transparent 59% 100%);
  opacity: 0.75;
}

.content-stack {
  width: min(100% - 24px, 430px);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.dashboard-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(16, 44, 70, 0.70), rgba(4, 13, 24, 0.94)),
    var(--panel);
  box-shadow:
    0 24px 70px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
}

.dashboard-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 78% 10%, rgba(22, 140, 255, 0.18), transparent 14rem);
  pointer-events: none;
}

.dashboard-card > * { position: relative; }

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.brand,
.location,
.station-label,
.status-label,
.next-tide,
.dashboard-footer,
.tide-event-card p,
.tide-event-card span,
.section-head span,
.hourly-card span {
  margin: 0;
}

.brand {
  color: var(--cyan);
  font-size: clamp(34px, 9vw, 42px);
  font-weight: 900;
  line-height: 0.96;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(99, 240, 255, 0.30);
}

.location {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.station-label {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-header time {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
}

.tide-status {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.status-label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.status-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.status-row strong {
  color: var(--text);
  font-size: clamp(34px, 10vw, 44px);
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: 0;
}

.direction-icon {
  width: clamp(28px, 8vw, 34px);
  height: clamp(28px, 8vw, 34px);
  color: var(--cyan);
  filter: drop-shadow(0 0 10px rgba(99, 240, 255, 0.36));
}

.height-readout {
  min-width: 94px;
  text-align: right;
}

.height-readout span {
  display: block;
  color: var(--cyan);
  font-size: clamp(34px, 10vw, 44px);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0;
}

.next-tide {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 16px;
  font-weight: 850;
}

.next-tide strong,
.tide-event-card.low p { color: var(--low); }

.tide-event-card.high p { color: var(--high); }

.dashboard-lower {
  margin-top: 12px;
}

.chart-panel {
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(144, 222, 255, 0.14);
  border-radius: 20px;
  background: rgba(4, 13, 24, 0.58);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tide-chart {
  display: block;
  width: 100%;
  height: 164px;
  overflow: hidden;
}

.grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.time-grid-line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.axis-label,
.time-label {
  fill: rgba(190, 215, 226, 0.62);
  font-size: 10px;
  font-weight: 800;
}

.tide-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 5;
  stroke-linecap: round;
}

.current-line {
  stroke: rgba(242, 251, 255, 0.36);
  stroke-width: 2;
  stroke-dasharray: 8 8;
}

.now-label {
  fill: rgba(242, 251, 255, 0.82);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.current-dot {
  fill: #ffffff;
  stroke: var(--cyan);
  stroke-width: 4;
  filter: drop-shadow(0 0 10px rgba(99, 240, 255, 0.66));
}

.event-dot {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.16));
}

.high-dot { fill: var(--high-dot); }
.low-dot { fill: var(--low-dot); }

.event-label {
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.high-label { fill: #67e58a; }
.low-label { fill: #ff7180; }

.tide-events {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tide-event-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(20, 56, 84, 0.74), rgba(7, 19, 32, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.tide-event-card p {
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.16em;
}

.tide-event-card strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: clamp(21px, 5.8vw, 27px);
  line-height: 1;
}

.tide-event-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.dashboard-footer {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 800;
}

.hourly-section {
  min-width: 0;
  overflow: hidden;
}

.hourly-section .section-head {
  padding: 0 4px;
}

.hourly-section h2 {
  font-size: clamp(24px, 7vw, 30px);
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

.hourly-section .section-head span {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 850;
}

.hourly-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 118px;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 2px 4px 8px;
  scrollbar-width: none;
}

.hourly-scroll::-webkit-scrollbar { display: none; }

.hourly-scroll:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 18px;
}

.hourly-card {
  position: relative;
  scroll-snap-align: start;
  min-height: 132px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  text-align: center;
  background: linear-gradient(180deg, rgba(18, 52, 78, 0.88), rgba(7, 18, 31, 0.86));
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hourly-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}

.hourly-card time,
.hourly-card strong,
.hourly-card span {
  position: relative;
  display: block;
}

.hourly-card time {
  color: var(--text);
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
}

.weather-icon {
  position: relative;
  width: 38px;
  height: 38px;
  margin: 10px auto 4px;
  color: var(--cyan);
  filter: drop-shadow(0 0 10px rgba(99, 240, 255, 0.30));
}

.hourly-card strong {
  color: var(--text);
  font-size: 32px;
  font-weight: 860;
  line-height: 1;
}

.hourly-card span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
}

@media (max-width: 370px) {
  .content-stack {
    width: min(100% - 18px, 430px);
  }

  .dashboard-card {
    padding: 15px;
    border-radius: 24px;
  }

  .status-row strong,
  .height-readout span {
    font-size: 34px;
  }

  .height-readout {
    min-width: 82px;
  }

  .tide-chart {
    height: 150px;
  }
}

@media (min-width: 760px) {
  .page-shell {
    padding-block: 34px 44px;
  }

  .content-stack {
    width: min(100% - 48px, 760px);
    gap: 18px;
  }

  .dashboard-card {
    padding: 24px;
  }

  .brand {
    font-size: 42px;
  }

  .location {
    font-size: 15px;
  }

  .station-label {
    font-size: 11px;
  }

  .dashboard-header time {
    font-size: 16px;
  }

  .status-row strong,
  .height-readout span {
    font-size: 50px;
  }

  .direction-icon {
    width: 38px;
    height: 38px;
  }

  .height-readout {
    min-width: 110px;
  }

  .next-tide {
    font-size: 18px;
  }

  .tide-chart {
    height: 190px;
  }

  .hourly-scroll {
    grid-auto-columns: 112px;
    gap: 10px;
  }

  .hourly-card {
    min-height: 136px;
  }
}
