:root {
  --bg: #0b1014;
  --bg2: #121a21;
  --panel: #16212b;
  --panel2: #1b2935;
  --line: #243440;
  --fg: #e6edf3;
  --muted: #7d93a3;
  --dim: #51616e;
  --accent: #36c5d0;
  --poor: #e5534b;
  --fair: #e0a23b;
  --good: #4cc38a;
  --epic: #36c5d0;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --r: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #16242e 0%, var(--bg) 55%) fixed;
  color: var(--fg);
  font-family: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
  padding: 18px 26px; border-bottom: 1px solid var(--line);
  background: rgba(11,16,20,.6); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.brand .prompt { font-weight: 700; font-size: 20px; color: var(--accent); }
.brand .sub { color: var(--muted); margin-left: 12px; font-size: 13px; }
.status { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.clock { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.updated { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
#refresh {
  background: var(--panel2); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; width: 30px; height: 30px; font-size: 16px; cursor: pointer;
  transition: transform .3s, background .2s;
}
#refresh:hover { background: var(--accent); color: #04141a; }
#refresh.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sources { display: flex; gap: 6px; align-items: center; }
.dot { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.dot.ok::before { background: var(--good); }
.dot.stale::before { background: var(--fair); }
.dot.down::before { background: var(--poor); }

/* ---------- layout ---------- */
main { max-width: 1320px; margin: 0 auto; padding: 26px; }
.section { margin-bottom: 34px; }
.section-title {
  font-size: 14px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin: 0 0 18px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.section-title .hint { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--dim); }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(390px, 1fr)); margin-bottom: 16px; }

/* ---------- domain sections (distinct surf vs dive) ---------- */
.domain { border-left: 3px solid var(--line); padding-left: 18px; border-radius: 2px; }
.surf-domain { border-left-color: #3aa0e0; }
.dive-domain { border-left-color: #3ec79a; }
.dtitle { display: inline-flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700;
  letter-spacing: 1px; color: var(--fg); }
.surf-domain .dtitle { color: #8fd2ff; }
.dive-domain .dtitle { color: #84e3b8; }
.dicon { font-size: 18px; }
.surf-domain .section-title { border-bottom-color: #25455c; }
.dive-domain .section-title { border-bottom-color: #1f5544; }
/* faint type tint + themed top edge on cards */
.card.surf { background: linear-gradient(180deg, #15222e 0%, var(--bg2) 70%); }
.card.dive { background: linear-gradient(180deg, #14241f 0%, var(--bg2) 70%); }
.card.surf .badge.surf { background: #16344a; }
.card.dive .badge.dive { background: #143a2c; }

/* ---------- condition card ---------- */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg2) 100%);
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--score-c, var(--dim)); }
.card.stale-card { opacity: .92; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.spot-name { font-weight: 700; font-size: 17px; }
.badge {
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.badge.surf { color: #7fd3ff; border-color: #28506b; }
.badge.dive { color: #7be0b0; border-color: #245a45; }

/* hero: score ring + trend chart */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin: 14px 0 10px; }
.ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ring {
  --pct: 0; width: 72px; height: 72px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--score-c) calc(var(--pct) * 1%), var(--line) 0);
  display: grid; place-items: center; position: relative;
}
.ring::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg2); }
.ring .val { position: relative; font-size: 22px; font-weight: 700; }
.ring-meta { text-align: center; }
.ring-meta .label { font-size: 15px; font-weight: 700; }
.ring-meta .sub { font-size: 10px; color: var(--dim); }

.chart-wrap { min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: center; font-size: 10px;
  text-transform: uppercase; letter-spacing: 1px; color: var(--dim); margin-bottom: 2px; }
.trend-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  border: 1px solid; border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.trend-badge small { opacity: .8; font-weight: 400; }
.chart { width: 100%; height: 92px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.chart .past { fill: rgba(0,0,0,.22); }
.chart .planband { fill: rgba(255,255,255,.05); }
.chart .planedge { stroke: var(--score-c, #fff); stroke-width: 1; stroke-opacity: .45; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.chart .nowline { stroke: var(--fg); stroke-width: 1; stroke-dasharray: 2 2; opacity: .5; vector-effect: non-scaling-stroke; }
.chart-axis { position: relative; height: 13px; font-size: 9px; color: var(--dim);
  display: flex; justify-content: space-between; }
.chart-axis .ax-now { position: absolute; transform: translateX(-50%); color: var(--muted); }
.chart-axis .ax-plan { position: absolute; left: 50%; transform: translateX(-50%); color: var(--accent); opacity: .8; }
.chart-empty { height: 92px; display: grid; place-items: center; font-size: 11px; color: var(--dim);
  border: 1px dashed var(--line); border-radius: 8px; }
.chart-cap { font-size: 10px; line-height: 1.35; color: var(--dim); margin-top: 4px; }

/* ---------- swell graphic (surf) ---------- */
.swell-graphic { margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: radial-gradient(120% 100% at 50% 0%, #112634 0%, #0c1820 100%); overflow: hidden; }
.swell-graphic.empty { padding: 16px; text-align: center; color: var(--dim); font-size: 11px; }
.swell-graphic svg { width: 100%; height: 64px; display: block; }
.swell-graphic .wave { animation: swell-scroll var(--dur, 4s) linear infinite; will-change: transform; }
@keyframes swell-scroll { from { transform: translateX(0); } to { transform: translateX(calc(-1 * var(--seg, 50px))); } }
.swell-tags { display: flex; justify-content: space-around; gap: 8px; padding: 6px 10px;
  border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.swell-tags b { color: #bfe6ff; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .swell-graphic .wave { animation: none; } }

/* ---------- per-metric explainer (fishing) ---------- */
.metric .why { font-size: 10px; line-height: 1.3; color: var(--dim); font-style: italic; margin-top: 1px; }
.dive .metric .why { color: #5f8f7c; }

/* ---------- planning banner (the hero: when to go in 2–18h) ---------- */
.plan { margin: 12px 0; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); border-left: 4px solid var(--pc, var(--dim));
  background: linear-gradient(100deg, color-mix(in srgb, var(--pc, #2a3a45) 14%, var(--panel2)) 0%, var(--panel2) 60%); }
.plan.skip, .plan.none { --pc: var(--dim); background: var(--panel2); }
.plan-rec { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.plan-icon { color: var(--pc, var(--muted)); }
.plan-main { font-size: 18px; font-weight: 700; margin-top: 3px; display: flex; align-items: baseline;
  gap: 9px; flex-wrap: wrap; }
.plan-main b { color: var(--fg); }
.plan-verdict { font-size: 13px; }
.plan-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.plan.skip .plan-main { color: var(--muted); font-size: 15px; }

/* ---------- demoted 'right now' block ---------- */
.now-block { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px 4px; margin: 12px 0 4px; }
.now-tag { font-size: 9px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--dim); }
.now-block .surf-verdict, .now-block .dive-verdict { margin-top: 4px; }
.now-block .sv-ft { font-size: 26px; }
.now-block .dv-ft { font-size: 24px; }

/* ---------- beginner surf verdict + size scale ---------- */
.surf-verdict { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  margin: 14px 0 10px; }
.sv-size { display: flex; flex-direction: column; }
.sv-ft { font-size: 34px; font-weight: 700; line-height: 1; color: #bfe6ff; }
.sv-ft small { font-size: 14px; color: var(--muted); margin-left: 2px; }
.sv-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sv-call { text-align: right; }
.sv-call .verdict { display: block; font-size: 17px; font-weight: 700; }
.sv-score { font-size: 11px; color: var(--dim); }
.sv-score small { color: var(--dim); }

.size-scale { margin: 0 0 12px; }
.scale-track { position: relative; display: flex; height: 22px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); }
.scale-track .z { display: grid; place-items: center; font-size: 9px; text-transform: uppercase;
  letter-spacing: .5px; color: #0b1014cc; font-weight: 700; }
.z-flat { background: #44525c; color: #c9d4dccc; }
.z-tiny { background: #3f9e6e; }
.z-ideal { background: #57d98a; }
.z-bold { background: #e0a23b; }
.z-big { background: #e5534b; }
.scale-marker { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px solid #fff;
  transform: translateX(-1px); }
.scale-marker .mk { position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap;
  background: #0b1014cc; padding: 0 4px; border-radius: 4px; }
.scale-legend { display: flex; justify-content: space-between; font-size: 9px; color: var(--dim); margin-top: 11px; }
.surf-trend { margin-top: 4px; }

/* ---------- fishing/diving instructionals ---------- */
.dive-verdict { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  margin: 14px 0 10px; }
.dv-viz { display: flex; flex-direction: column; }
.dv-ft { font-size: 30px; font-weight: 700; line-height: 1; color: #8ee6bf; }
.dv-ft small { font-size: 13px; color: var(--muted); margin-left: 3px; }
.dv-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }
/* visibility zone colors (low swell = clear = good) */
.v-clear { background: #57d98a; }
.v-good { background: #4cc0a0; }
.v-fair { background: #e0a23b; }
.v-murky { background: #d4763b; }
.v-rough { background: #e5534b; }

.baro-strip { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  background: #14241f; }
.baro-strip.empty { color: var(--dim); font-size: 11px; text-align: center; }
.baro-head { display: flex; justify-content: space-between; font-size: 10px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--dim); margin-bottom: 6px; }
.baro-track { display: flex; gap: 4px; }
.baro-cell { flex: 1; text-align: center; font-size: 11px; font-weight: 700; padding: 4px 0;
  border-radius: 6px; background: #11201b; color: var(--dim); border: 1px solid transparent; }
.baro-cell.on.falling { background: #1d4a38; color: #7be0b0; border-color: #2c6b50; }
.baro-cell.on.steady { background: #3a3320; color: #e0c07b; border-color: #5a5030; }
.baro-cell.on.rising { background: #4a2420; color: #e5948b; border-color: #6b362f; }
.baro-cap { font-size: 10px; margin-top: 6px; color: var(--muted); }
.baro-cap.falling { color: #7be0b0; }

.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.chip { font-size: 11px; color: var(--muted); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.metric { display: flex; flex-direction: column; gap: 1px; }
.metric .k { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.metric .v { font-size: 15px; font-weight: 700; }
.metric .x { font-size: 11px; color: var(--muted); }
.metric.stale .v { color: var(--fair); }
.metric.na .v { color: var(--dim); font-weight: 400; font-style: italic; }
.tag-stale { font-size: 9px; color: var(--fair); border: 1px solid var(--fair); border-radius: 4px; padding: 0 3px; margin-left: 5px; vertical-align: middle; }

.arrow { display: inline-block; transition: transform .4s; color: var(--accent); }
.solunar-live { color: var(--good); font-weight: 700; }
.solunar-off { color: var(--muted); }

/* ---------- links ---------- */
.link-groups { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.lg { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.lg h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); }
.lg.featured { border-color: #2c4a58; box-shadow: var(--shadow); }
.link { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; text-decoration: none; color: var(--fg); }
.link:hover { background: var(--panel2); }
.link .ic { font-size: 18px; width: 22px; text-align: center; flex: none; }
.link .body { min-width: 0; }
.link .nm { font-size: 14px; font-weight: 700; }
.link .ds { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link .ext { color: var(--dim); font-size: 11px; }

/* ---------- footer ---------- */
.foot { max-width: 1320px; margin: 0 auto; padding: 18px 26px 36px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--dim); font-size: 11px; border-top: 1px solid var(--line); }

.loading { color: var(--muted); padding: 20px; }
@media (max-width: 560px) { .metrics { grid-template-columns: 1fr 1fr; } .topbar { padding: 14px; } main { padding: 16px; } }
