@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600&family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  color-scheme: dark;
  --bg: #07131f;
  --bg-deep: #040b14;
  --ink: #e7f2ff;
  --muted: #9bb2c8;
  --accent: #4ea1ff;
  --accent-dark: #2c6bbf;
  --sun: #62c1ff;
  --card: #0d1c2b;
  --shadow: 0 18px 40px rgba(2, 10, 20, 0.45);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(78, 161, 255, 0.2) 0%, transparent 60%),
    radial-gradient(1000px 800px at 90% 10%, rgba(54, 88, 140, 0.45) 0%, transparent 55%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.app {
  position: relative;
  z-index: 2;
  padding: 32px 5vw 60px;
  max-width: none;
  margin: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  font-family: "Fraunces", "Space Grotesk", serif;
  font-size: clamp(1.6rem, 3.2vw, 2.6rem);
  margin: 0;
}

h2 {
  margin: 0;
  font-size: 1.2rem;
}

.meta {
  margin: 8px 0 0;
  color: var(--muted);
}

.ghost {
  border: 1px solid rgba(231, 242, 255, 0.2);
  background: transparent;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease, background 0.2s ease;
}

.ghost:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(78, 161, 255, 0.12);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(231, 242, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise 0.7s ease forwards;
  opacity: 0;
}

.card:nth-child(1) {
  animation-delay: 0.05s;
}

.card:nth-child(2) {
  animation-delay: 0.12s;
}

.card:nth-child(3) {
  animation-delay: 0.2s;
}

.card:nth-child(4) {
  animation-delay: 0.28s;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(78, 161, 255, 0.2);
  color: #cfe4ff;
  font-size: 0.85rem;
  font-weight: 600;
}

.current-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.value {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
}

.subvalue {
  margin: 4px 0 0;
  color: var(--muted);
}

.current-wrap {
  margin-bottom: 20px;
}

.current {
  max-width: 1040px;
  margin: 0;
}

.score-value {
  color: #f7c948;
  letter-spacing: 2px;
}

.forecast {
  gap: 14px;
}

.forecast-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.forecast-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid rgba(231, 242, 255, 0.12);
}

.legend-good {
  background: rgba(32, 120, 60, 0.35);
}

.legend-mid {
  background: rgba(34, 70, 130, 0.3);
}

.legend-low {
  background: rgba(120, 130, 140, 0.3);
}

.legend-note {
  opacity: 0.85;
}

.forecast-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.forecast-grid {
  border-collapse: collapse;
  width: max-content;
  font-size: 0.85rem;
}

.forecast-grid th,
.forecast-grid td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(231, 242, 255, 0.08);
  text-align: center;
  white-space: nowrap;
}

.forecast-grid thead th {
  font-weight: 600;
  color: var(--muted);
  background: rgba(5, 13, 22, 0.4);
}

.forecast-grid thead .cell-main {
  font-size: 0.85rem;
}

.forecast-grid thead .cell-sub {
  font-size: 0.80rem;
}

.label-cell {
  position: sticky;
  left: 0;
  text-align: left;
  background: linear-gradient(90deg, rgba(9, 20, 32, 0.98) 0%, rgba(9, 20, 32, 0.92) 70%, rgba(9, 20, 32, 0.5) 100%);
  color: var(--muted);
  font-weight: 600;
  z-index: 2;
  min-width: 120px;
}

.data-cell {
  min-width: 62px;
  border-left: 1px solid rgba(231, 242, 255, 0.04);
}

.wind-power-cell {
  border-left: none;
  background-clip: padding-box;
}

.col-score-high {
  box-shadow: inset 0 0 0 9999px rgba(32, 120, 60, 0.18);
}

.col-score-mid {
  box-shadow: inset 0 0 0 9999px rgba(34, 70, 130, 0.14);
}

.col-score-low {
  box-shadow: inset 0 0 0 9999px rgba(120, 130, 140, 0.18);
}

.cell-stack {
  display: grid;
  gap: 2px;
  justify-items: center;
}

.cell-main {
  font-weight: 600;
  color: var(--ink);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.cell-sub {
  color: var(--muted);
  font-size: 0.80rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.gf-value {
  font-size: 0.85rem;
  color: #dfeaff;
}

.wind-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.wind-cell .arrow {
  align-self: center;
}

.wind-cell .cell-main {
  color: #f3f7ff;
}

.score-0 .cell-main {
  color: var(--muted);
}

.score-1 .cell-main,
.score-2 .cell-main,
.score-3 .cell-main,
.score-4 .cell-main {
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: #f7c948;
}

.ki-stars {
  color: #f7c948;
  letter-spacing: 1px;
}

.ki-stars {
  font-size: 0.95rem;
}

.ki-zero {
  color: #9bb2c8;
  letter-spacing: 2px;
}

.score-1 {
  background: rgba(78, 161, 255, 0.08);
}

.score-2 {
  background: rgba(78, 161, 255, 0.16);
}

.score-3 {
  background: rgba(78, 161, 255, 0.24);
}

.score-4 {
  background: rgba(78, 161, 255, 0.3);
}

.tide-chart {
  border-top: 1px solid rgba(231, 242, 255, 0.08);
  padding-top: 12px;
  display: grid;
  gap: 8px;
}

.tide-chart-title {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
}

#tide-svg {
  width: 100%;
  height: 160px;
}

.tide-label {
  font-size: 12px;
  fill: var(--ink);
}

.tide-marker {
  fill: var(--sun);
}

.tide-curve-cell {
  padding: 0;
}

.tide-row-svg {
  width: 100%;
  height: 120px;
  display: block;
}

.arrow {
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--accent);
  border-radius: 999px;
  position: relative;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
  transform-origin: center center;
}

.arrow::after {
  content: "";
  position: absolute;
  right: -6px;
  top: -5px;
  border: 6px solid transparent;
  border-left-color: var(--accent);
}

.forecast-gusts,
.forecast-rain,
.forecast-tide {
  color: var(--muted);
}

.tide-note {
  color: var(--muted);
  font-size: 0.9rem;
}


.ambient {
  position: fixed;
  inset: auto -20% -30% -20%;
  height: 320px;
  background: radial-gradient(circle at 30% 50%, rgba(98, 193, 255, 0.4), transparent 60%),
    radial-gradient(circle at 70% 50%, rgba(44, 107, 191, 0.35), transparent 55%);
  filter: blur(40px);
  z-index: 1;
  pointer-events: none;
}

@keyframes rise {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 18px 3vw 28px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .current-stats {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    gap: 10px;
  }

  .card {
    padding: 14px 12px;
    border-radius: 16px;
  }

  h1 {
    font-size: clamp(1.2rem, 5.4vw, 2rem);
  }

  .value {
    font-size: 1.2rem;
  }

  .label {
    font-size: 0.72rem;
  }

  .label-cell {
    min-width: 64px;
    font-size: 0.65rem;
  }

  .data-cell {
    min-width: 52px;
  }

  .forecast-grid th,
  .forecast-grid td {
    padding: 4px 4px;
  }

  .forecast-grid {
    font-size: 0.7rem;
  }

  .forecast-scroll {
    margin: 0 -4vw;
    padding: 0 4vw 10px;
    -webkit-overflow-scrolling: touch;
  }

  .cell-main {
    font-size: 0.8rem;
  }

  .cell-sub {
    font-size: 0.6rem;
  }

  .ki-stars {
    font-size: 0.9rem;
  }

  .arrow {
    width: 14px;
  }

  .arrow::after {
    right: -5px;
    border-width: 5px;
  }
}
