:root {
  --bg: #0b1f33;
  --bg-soft: #10283f;
  --panel: #12293f;
  --border: #1f3d5c;
  --text: #e8f1fa;
  --muted: #8fb0cc;
  --accent: #38bdf8;
  --high: #2f855a;
  --low: #c05621;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #16354f 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

.header {
  background: rgba(7, 18, 30, 0.85);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 0.5rem; }
.brand__title { margin: 0; font-size: 1.4rem; letter-spacing: 0.02em; }

.selector { display: flex; align-items: center; gap: 0.5rem; }
.selector label { color: var(--muted); font-size: 0.9rem; }

select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1.2rem 3rem; }

.tide-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.4rem;
  align-items: start;
  min-width: 0;
}
.tide-layout > * { min-width: 0; }
.tide-main { display: flex; flex-direction: column; min-width: 0; }

.gauge-panel {
  position: sticky;
  top: 5.5rem;
  align-self: start;
  min-height: calc(100vh - 7rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.gauge__arrow {
  font-size: 1.3rem;
  color: var(--muted);
  opacity: 0.35;
  transition: opacity 0.3s ease;
  line-height: 1;
}
.gauge__arrow.is-active { opacity: 1; }
.gauge__arrow--top.is-active { color: var(--high); }
.gauge__arrow--bottom.is-active { color: var(--low); }

.gauge__bar {
  position: relative;
  width: 64px;
  height: min(52vh, 420px);
  background: rgba(7, 18, 30, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.gauge__scale {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.gauge__tick {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(143, 176, 204, 0.18);
}

.gauge__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(56, 189, 248, 0.55), rgba(56, 189, 248, 0.12));
  transition: height 0.9s ease-out;
  border-top: 2px solid var(--accent);
}

.gauge__level {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(50%);
  z-index: 2;
}
.gauge__level-line {
  display: block;
  height: 2px;
  background: var(--muted);
  opacity: 0.6;
}
.gauge__level-label {
  position: absolute;
  right: -0.4rem;
  transform: translateX(100%);
  top: 50%;
  margin-top: -0.6em;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--muted);
}
.gauge__level--high .gauge__level-line { background: var(--high); }
.gauge__level--low .gauge__level-line { background: var(--low); }

.gauge__current {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(50%);
  z-index: 3;
}
.gauge__current-line {
  display: block;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.gauge__current-value {
  position: absolute;
  right: -0.4rem;
  transform: translateX(100%);
  top: 50%;
  margin-top: -0.7em;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.gauge__meta {
  text-align: center;
  margin-top: 0.4rem;
}
.gauge__cycle-pct {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.gauge__next { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }
.gauge__next strong { color: var(--accent); }
.gauge__times {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.gauge__times span:first-child { color: var(--high); }
.gauge__times span:last-child { color: var(--low); }

.hero-card {
  background: linear-gradient(135deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.location h2 { margin: 0 0 0.2rem; font-size: 1.6rem; }

.current { margin-top: 1rem; }
.current__height {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.current__height .unit { font-size: 1.1rem; color: var(--muted); }
.current__direction { font-size: 1.1rem; margin: 0.4rem 0; font-weight: 600; }
.current__direction.is-rising { color: var(--high); }
.current__direction.is-falling { color: var(--low); }
.current__next { color: var(--muted); }

.hero-card__badges { display: flex; flex-direction: column; gap: 0.7rem; align-items: flex-end; }

.badge {
  background: rgba(7, 18, 30, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  text-align: center;
  min-width: 130px;
}
.badge__label { display: block; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.badge__value { font-size: 1.4rem; font-weight: 700; color: var(--accent); }

.panel {
  background: rgba(18, 41, 63, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-top: 1.4rem;
}
.panel__head { display: flex; justify-content: space-between; align-items: baseline; }
.panel h3 { margin: 0 0 1rem; }

.chart-wrap { position: relative; height: 320px; }

.tide-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tide-table th, .tide-table td { padding: 0.5rem 0.7rem; text-align: left; border-bottom: 1px solid var(--border); }
.tide-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

.day-header td {
  background: rgba(7, 18, 30, 0.5);
  color: var(--accent);
  font-weight: 600;
  text-transform: capitalize;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}
.tag--high { background: var(--high); }
.tag--low { background: var(--low); }

.muted { color: var(--muted); }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border);
}
.footer a { color: var(--accent); }

@media (max-width: 700px) {
  .hero-card { flex-direction: column; }
  .hero-card__badges { align-items: stretch; flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 820px) {
  .tide-layout { grid-template-columns: 1fr; }
  .gauge-panel {
    position: static;
    min-height: 0;
  }
  .gauge { flex-direction: row; justify-content: flex-start; gap: 0.8rem; }
  .gauge__bar { height: 150px; width: 48px; }
  .gauge__meta { margin-top: 0; text-align: left; }
  .gauge__times { flex-direction: column; }
  .gauge__arrow--top { transform: rotate(-90deg); }
  .gauge__arrow--bottom { transform: rotate(-90deg); }
  .gauge__level-label, .gauge__current-value { right: auto; left: -0.4rem; transform: translateX(-100%); }
  .tide-table { table-layout: fixed; }
  .tide-table th, .tide-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tide-table th:nth-child(1) { width: 22%; }
  .tide-table th:nth-child(2) { width: 10%; }
  .tide-table th:nth-child(3) { width: 12%; }
  .tide-table th:nth-child(4) { width: 14%; }
  .tide-table th:nth-child(5) { width: 10%; }
}
