@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@400;600&family=JetBrains+Mono:wght@400;500;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;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

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;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

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

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

.topbar-updated {
  text-align: right;
}

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

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

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

.meta {
  margin: 4px 0 0;
  font-size: 0.85rem;
  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(120px, 1fr));
  gap: 10px;
}

.current {
  padding: 14px 16px;
}

.current-stats .label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.current-stats .value {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.1;
}

.current-stats .subvalue {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.wind-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.summary-cloud {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.summary-arrow {
  width: 12px;
  height: 2px;
  opacity: 0.85;
}

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

.summary-bar {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  max-width: 100%;
}

.summary-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 28, 42, 0.9);
  border: 1px solid rgba(231, 242, 255, 0.12);
  cursor: help;
}

.summary-tile[data-verdict="GOOD"] {
  background: rgba(26, 122, 99, 0.28);
}

.summary-tile[data-verdict="MARGINAL"] {
  background: rgba(46, 79, 118, 0.3);
}

.summary-tile[data-verdict="POOR"] {
  background: rgba(120, 60, 60, 0.3);
}

.summary-updated {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.summary-grid {
  display: grid;
  gap: 8px 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}

.summary-overall-line {
  font-weight: 600;
}

.summary-badge {
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid rgba(231, 242, 255, 0.2);
}

.summary-icon {
  margin-left: 6px;
  font-size: 1rem;
}

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

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

.summary-title {
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reason-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(8, 18, 28, 0.8);
  border: 1px solid rgba(231, 242, 255, 0.12);
  color: var(--muted);
}

.reason-chip.penalty {
  color: #ffb2b2;
  border-color: rgba(255, 178, 178, 0.35);
}

.reason-chip.boost {
  color: #b6f3c3;
  border-color: rgba(182, 243, 195, 0.35);
}

.forecast {
  gap: 14px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  animation: none;
  opacity: 1;
}

.forecast-controls {
  display: flex;
  justify-content: flex-start;
  padding: 4px 2px 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.toggle input {
  accent-color: var(--accent);
}

.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;
  max-width: 100%;
}

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

.forecast-grid th,
.forecast-grid td {
  padding: 3px 2px;
  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-line {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

.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: 88px;
  max-width: 88px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

/* When the user scrolls horizontally (common on mobile), reclaim space by
   narrowing the sticky title column without changing its text. */
.forecast-scrolled .label-cell {
  min-width: 72px;
  max-width: 72px;
}

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

.hide-night .night-col {
  display: none;
}

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


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

@media (max-width: 640px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .decision-ki {
    font-size: 1.9rem;
  }
  .forecast-scroll {
    padding-bottom: 10px;
  }

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

  .label-cell {
    min-width: 58px;
    max-width: 58px;
    font-size: 0.72rem;
    padding-left: 8px;
    padding-right: 4px;
  }

  .forecast-scrolled .label-cell {
    min-width: 46px;
    max-width: 46px;
  }

  .cell-stack {
    gap: 1px;
  }

  .forecast {
    border-radius: 0;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .forecast .card-header,
  .forecast .forecast-scroll {
    padding-left: 0;
    padding-right: 0;
  }

  .forecast .card-header {
    padding-top: 18px;
    padding-bottom: 6px;
  }

  .forecast .forecast-scroll {
    padding-bottom: 12px;
  }
}

.cell-main {
  font-weight: 500;
  color: var(--ink);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

.cell-sub {
  color: var(--muted);
  font-size: 0.74rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

.meteocons-icon {
  font-size: 2rem;
  line-height: 1;
  color: #dbe7ff;
}

.moon-phase-icon {
  width: 1.9rem;
  height: 1.9rem;
  display: inline-block;
}

.label-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.label-icon {
  font-size: 1.8rem;
  opacity: 0.85;
}

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

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

.wind-direction-cell .wind-cell {
  flex-direction: column;
  gap: 2px;
  min-height: 44px;
  padding-top: 1px;
  padding-bottom: 2px;
  justify-content: space-between;
}

.wind-direction-cell .arrow {
  width: 30px;
  height: 30px;
  color: var(--accent);
}

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

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

.wind-direction-cell .cell-main {
  font-size: 0.82rem;
  letter-spacing: 0.15px;
}

.wind-direction-cell .cell-sub {
  color: var(--muted);
}

.forecast-grid tbody .cell-main {
  font-size: 0.88rem;
  font-weight: 600;
}

.forecast-grid tbody .cell-sub {
  font-size: 0.72rem;
}

.ki-cell .cell-main {
  font-size: 0.95rem;
  font-weight: 600;
}

.ki-cell .cell-sub {
  font-size: 0.74rem;
}

.wave-cell .cell-sub,
.precipitation-cell .cell-sub,
.sky-cell .cell-sub,
.moon-cell .cell-sub {
  font-size: 0.8rem;
}

.ki-cell .cell-main,
.ki-cell .cell-sub {
  font-family: var(--mono);
  letter-spacing: -0.02em;
}

.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;
}

.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: 10px;
  fill: var(--ink);
}

.tide-label.predicted {
  fill: var(--muted);
  opacity: 0.8;
}

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

.tide-marker.predicted {
  fill: rgba(155, 178, 200, 0.7);
}

.tide-predicted-zone {
  fill: rgba(2, 6, 11, 0.55);
}

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

.tide-row-svg {
  width: 40px;
  height: 60px;
  display: block;
}

.arrow {
  width: 54px;
  height: 54px;
  color: var(--accent);
  background: transparent;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
  transform-origin: center center;
  transform-box: fill-box;
  display: inline-block;
}

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

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


.ambient {
  position: fixed;
  inset: auto 0 -30% 0;
  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;
}

.tap-tooltip {
  position: absolute;
  z-index: 1000;
  max-width: min(260px, 82vw);
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(6, 14, 22, 0.96);
  border: 1px solid rgba(231, 242, 255, 0.18);
  color: var(--ink);
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: pre-line;
  box-shadow: 0 10px 24px rgba(2, 6, 12, 0.35);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.tap-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

@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(5, minmax(0, 1fr));
    gap: 6px;
  }

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

  .current {
    padding: 12px 10px;
  }

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

  .current-stats .value {
    font-size: 1.05rem;
  }

  .current-stats .label {
    font-size: 0.62rem;
  }

  .current-stats .subvalue {
    font-size: 0.6rem;
  }

  .wind-summary {
    gap: 4px;
  }

  .summary-cloud {
    gap: 4px;
  }

  .summary-arrow {
    width: 10px;
  }

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

  .forecast-scrolled .label-cell {
    min-width: 52px;
    max-width: 52px;
  }

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

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

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

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

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

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

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

  .meteocons-icon {
    font-size: 1.7rem;
  }

  .label-icon {
    font-size: 1.4rem;
  }

  .arrow {
    width: 16px;
  }

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

.page-footer {
  margin-top: 18px;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 100%;
}

.page-footer a {
  color: #cfe4ff;
  text-decoration: none;
}

.page-footer a:hover {
  text-decoration: underline;
}
