/* ===== RESET & BASE ===== */
:root {
  --bg: #0a1628;
  --bg2: #0d2137;
  --bg3: #071828;
  --accent: #4dd0e1;
  --accent2: #1565a8;
  --text: #e8f4fd;
  --text2: #90caf9;
  --text3: #546e7a;
  --border: rgba(77,208,225,0.12);
  --r5: #43a047; --r4: #1976d2; --r3: #fb8c00; --r2: #e53935; --r1: #546e7a;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100%; overflow-x: hidden;
  padding-bottom: calc(64px + var(--safe-bottom));
}

/* ===== ROTATING PHOTO BACKDROP ===== */
.surf-bg {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background: #061020;
}
.surf-bg-layer {
  position: absolute; inset: 0;
  background-position: center; background-size: cover;
  opacity: 0; transform: scale(1.04);
  transition: opacity 1.4s ease, transform 8s ease;
  will-change: opacity, transform;
}
.surf-bg-layer.active { opacity: .68; transform: scale(1); }
.surf-bg::after {
  content: ''; position: absolute; inset: 0; z-index: 2;
  background:
    linear-gradient(180deg, rgba(6,16,32,.16) 0%, rgba(6,16,32,.42) 36%, rgba(6,16,32,.9) 100%),
    radial-gradient(circle at 40% 0%, rgba(77,208,225,.1), transparent 42%);
}
.surf-bg-credit {
  position: absolute; right: 12px; bottom: calc(76px + var(--safe-bottom));
  z-index: 3; color: rgba(232,244,253,.68);
  font-size: 9px; letter-spacing: .2px; text-shadow: 0 1px 8px rgba(0,0,0,.7);
  pointer-events: none; max-width: min(70vw, 280px); text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===== INSTALL BANNER ===== */
#install-banner {
  display: none; align-items: center; gap: 10px;
  background: linear-gradient(90deg, #0d3b6e, #1565a8);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
#install-banner.show { display: flex; }
#install-banner p { flex: 1; font-size: 12px; color: var(--text2); line-height: 1.4; }
#install-banner p strong { color: #fff; display: block; }
.btn-install {
  flex-shrink: 0; padding: 7px 14px; background: var(--accent); color: var(--bg);
  border: none; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.btn-dismiss {
  flex-shrink: 0; background: none; border: none; color: var(--text3);
  font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1;
}

/* ===== HERO ===== */
.hero {
  background:
    linear-gradient(180deg, rgba(2,10,18,.42) 0%, rgba(2,10,18,.24) 54%, rgba(10,22,40,.82) 100%),
    linear-gradient(120deg, rgba(77,208,225,.08), rgba(21,101,168,.02));
  backdrop-filter: blur(.5px);
  padding: 14px 16px 44px; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 40px;
  background: linear-gradient(180deg, transparent, rgba(10,22,40,.9));
}
.hero-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.logo { font-size: 16px; font-weight: 800; color: var(--accent); flex-shrink: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.logo span { color: #fff; }
.hero-actions { display: flex; gap: 8px; flex-shrink: 0; }
.hero-btn {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(3,12,22,.34);
  border: 1px solid rgba(255,255,255,.2); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
}

.beach-selector {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  background: rgba(3,12,22,.34); border: 1px solid rgba(255,255,255,.18);
  border-radius: 20px; padding: 6px 12px; margin-bottom: 12px;
  width: fit-content;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.beach-selector-name { font-size: 16px; font-weight: 700; color: #fff; }
.beach-selector-sub { font-size: 11px; color: var(--text2); }
.beach-selector-arrow { font-size: 12px; color: var(--text3); margin-left: 4px; }

.hero-now {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(3,12,22,.36); border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px; padding: 11px 12px;
  box-shadow: 0 12px 26px rgba(0,0,0,.18);
}
.hero-now-info { min-width: 0; }
.hero-now-label {
  font-size: 9px; color: #64b5f6; text-transform: uppercase; letter-spacing: 1px;
  font-weight: 800; margin-bottom: 4px;
}
.hero-now-text {
  color: #fff; font-size: 13px; font-weight: 700; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero-now-rating {
  flex-shrink: 0; color: var(--accent); font-size: 12px; font-weight: 900;
  background: rgba(77,208,225,.1); border: 1px solid rgba(77,208,225,.2);
  border-radius: 999px; padding: 8px 10px; max-width: 116px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* loading spinner */
.loading-overlay {
  display: none; position: fixed; inset: 0; background: rgba(10,22,40,.85);
  z-index: 100; align-items: center; justify-content: center; flex-direction: column; gap: 12px;
}
.loading-overlay.show { display: flex; }
.spinner {
  width: 40px; height: 40px; border: 3px solid rgba(77,208,225,.2);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: var(--text2); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #061020; border-top: 1px solid var(--border);
  display: flex; padding-bottom: var(--safe-bottom); z-index: 50;
}
.nav-item {
  flex: 1; padding: 10px 4px 8px; border: none; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; color: var(--text3); transition: color .2s;
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 20px; line-height: 1; }
.nav-label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* ===== PAGES ===== */
.page { display: none; padding: 14px 14px 8px; animation: fadeIn .2s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.sec-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--accent); font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}

/* ===== DAY TABS ===== */
.day-tabs {
  display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none;
  margin-bottom: 12px; padding-bottom: 2px;
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex-shrink: 0; padding: 7px 13px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text3); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.day-tab.active { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.day-tab .day-h { font-size: 10px; color: inherit; opacity: .7; }

/* ===== OPTION 3 – WAVE CARDS ===== */
.cards-scroll {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 2px 4px; margin-bottom: 10px;
}
.cards-scroll::-webkit-scrollbar { display: none; }
.wc {
  flex-shrink: 0; width: 72px; border-radius: 14px;
  background: linear-gradient(180deg, var(--wave-card-bg, rgba(7,24,40,.92)), rgba(7,24,40,.88));
  border: 2px solid var(--wave-card-border, rgba(255,255,255,.08));
  padding: 10px 8px 8px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.wc.active {
  border-color: var(--wave-color, var(--accent));
  background: linear-gradient(180deg, var(--wave-card-bg, rgba(10,36,68,.95)), #0a2444);
}
.wc-time { font-size: 10px; color: var(--text2); font-weight: 600; margin-bottom: 6px; }
.wc-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 58px; }
.wc-b {
  border-radius: 3px 3px 0 0; width: 9px; min-height: 4px;
  background: var(--wave-color, var(--accent));
  box-shadow: 0 0 10px var(--wave-color-mid, rgba(77,208,225,.7));
}
.wc-b-soft,
.wc-b-main,
.wc-b-mid {
  background: linear-gradient(180deg, var(--wave-color, var(--accent)), var(--wave-color-mid, var(--accent)));
}
.wc-num {
  font-size: 17px; font-weight: 800; line-height: 1; margin-top: 5px;
  color: var(--wave-color, var(--accent));
}
.wc-unit { font-size: 9px; color: var(--text3); }
.wc-per { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* Detail panel */
.detail-panel {
  background: var(--bg3); border-radius: 14px; border: 1px solid var(--border);
  padding: 14px; display: flex; gap: 0; margin-bottom: 14px;
}
.dp-col { flex: 1; text-align: center; padding: 0 4px; }
.dp-sep { width: 1px; background: rgba(255,255,255,.06); margin: 0 2px; }
.dp-lbl { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.dp-val { font-size: 17px; font-weight: 800; color: var(--text); line-height: 1; }
.dp-sub { font-size: 10px; color: #64b5f6; margin-top: 3px; }
.mini-compass {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid rgba(77,208,225,.35); background: var(--bg);
  position: relative; margin: 4px auto 4px;
}
.mc-needle {
  width: 3px; height: 12px;
  background: linear-gradient(to top, #ef5350 50%, #fff 50%);
  border-radius: 2px; transform-origin: bottom center;
  position: absolute; bottom: 50%; left: 50%; margin-left: -1.5px;
}

/* ===== WIND PAGE ===== */
.wind-card {
  background: var(--bg2); border-radius: 14px; border: 1px solid var(--border);
  overflow: hidden; margin-bottom: 14px;
}
.wind-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.04);
}
.wind-row:last-child { border-bottom: none; }
.wind-time { font-size: 11px; color: var(--text2); font-weight: 600; min-width: 36px; }
.wind-bar-wrap { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.wind-bar-bg { height: 6px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; }
.wind-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.wind-spd { font-size: 13px; font-weight: 700; color: var(--text2); min-width: 52px; text-align: right; }
.wind-dir-wrap { display: flex; align-items: center; gap: 4px; min-width: 52px; }
.wind-arrow { font-size: 16px; display: inline-block; }
.wind-dir-lbl { font-size: 10px; color: var(--text3); }
.wind-quality { font-size: 10px; font-weight: 700; min-width: 68px; text-align: right; }

.wind-info-card {
  background: var(--bg2); border-radius: 14px; border: 1px solid var(--border);
  padding: 14px; font-size: 12px; color: var(--text2); line-height: 1.7; margin-bottom: 14px;
}
.source-card {
  background: rgba(77,208,225,.06); border: 1px solid rgba(77,208,225,.14);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 14px;
  font-size: 11px; color: var(--text2); line-height: 1.5;
}
.source-card strong { color: #fff; }
.classic-card {
  background: linear-gradient(135deg, rgba(77,208,225,.12), rgba(21,101,168,.15));
  border: 1px solid rgba(77,208,225,.18); border-radius: 14px;
  padding: 12px; margin-bottom: 14px;
}
.classic-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.classic-title { font-size: 12px; font-weight: 800; color: #fff; }
.classic-action {
  border: 1px solid rgba(77,208,225,.28); background: rgba(77,208,225,.12);
  color: var(--accent); border-radius: 999px; padding: 7px 10px;
  font-size: 10px; font-weight: 800; cursor: pointer;
}
.classic-list { display: grid; gap: 7px; }
.classic-item {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  background: rgba(7,24,40,.72); border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px; padding: 9px 10px; cursor: pointer;
}
.classic-name { font-size: 12px; font-weight: 800; color: #fff; }
.classic-meta { font-size: 10px; color: var(--text2); margin-top: 2px; }
.classic-score { text-align: right; font-size: 11px; font-weight: 800; color: var(--accent); }
.classic-pro { opacity: .55; position: relative; }
.classic-pro::after {
  content: 'PRO'; position: absolute; right: 9px; top: 8px;
  font-size: 9px; font-weight: 900; color: #ffd54f;
}

/* ===== TIDE PAGE ===== */
.tide-chart-card {
  background: var(--bg2); border-radius: 14px; border: 1px solid var(--border);
  padding: 14px; margin-bottom: 14px;
}
.tide-chart-title { font-size: 11px; color: #64b5f6; font-weight: 600; margin-bottom: 10px; }
.tide-chart-box { position: relative; height: 140px; }
.tide-chart-box canvas { width: 100% !important; height: 140px !important; display: block; }
.tide-times {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; margin-top: 12px; width: 100%; overflow: hidden;
}
.tide-time-card {
  min-width: 0; background: var(--bg3); border-radius: 10px; padding: 10px 8px;
  text-align: center; overflow: hidden;
}
.tide-type {
  font-size: 9px; color: #64b5f6; text-transform: uppercase; letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tide-t { font-size: 15px; font-weight: 700; color: #fff; margin: 2px 0; white-space: nowrap; }
.tide-h { font-size: 12px; color: var(--accent); }

.tide-day-section { margin-bottom: 12px; }
.tide-day-section .tide-times { margin-top: 0; }
.tide-day-label {
  font-size: 11px; color: var(--accent); font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px;
}

/* ===== BEACHES PAGE ===== */
.search-box { position: relative; margin-bottom: 14px; }
.beach-input {
  width: 100%; padding: 11px 14px 11px 38px;
  background: var(--bg2); border: 1px solid rgba(77,208,225,.2);
  border-radius: 12px; color: var(--text); font-size: 13px; outline: none;
}
.beach-input::placeholder { color: var(--text3); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--text3); }

.state-sec,
.city-sec { margin-bottom: 18px; }
.state-hdr,
.city-hdr {
  font-size: 11px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px;
  padding: 4px 8px; background: rgba(77,208,225,.06); border-radius: 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.city-hdr {
  padding: 10px 12px; border: 1px solid rgba(77,208,225,.12);
  border-radius: 12px; text-transform: none; letter-spacing: 0;
}
.city-name { color: #fff; font-size: 14px; font-weight: 900; }
.city-meta {
  color: var(--text2); font-size: 10px; font-weight: 600;
  margin-top: 2px; text-transform: uppercase; letter-spacing: .8px;
}
.state-count { font-size: 10px; color: var(--text3); font-weight: 400; }
.beach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.beach-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; cursor: pointer; transition: all .15s; position: relative;
}
.beach-card:active, .beach-card.sel { border-color: var(--accent); background: #0d3b6e; }
.bc-name { font-size: 12px; font-weight: 600; color: var(--text); padding-right: 18px; }
.bc-city { font-size: 10px; color: var(--text3); margin-top: 1px; }
.bc-stars { font-size: 10px; margin-top: 4px; }
.bc-fav {
  position: absolute; top: 6px; right: 8px;
  background: none; border: none; padding: 2px; cursor: pointer;
  font-size: 13px; color: var(--text3); line-height: 1;
  transition: color .15s, transform .15s;
}
.bc-fav:active { transform: scale(1.3); }
.bc-fav.active { color: #ffd54f; }
.fav-hdr { border-color: rgba(255,213,79,.2); background: rgba(255,213,79,.04); }
.fav-hdr .city-name { color: #ffd54f; }
.bs { color: #ffd54f; }
.be { color: #1c2e3a; }

/* ===== OFFLINE TOAST ===== */
#offline-toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: #263238; border: 1px solid #546e7a; border-radius: 10px;
  padding: 8px 16px; font-size: 12px; color: var(--text2);
  z-index: 200; opacity: 0; transition: opacity .3s; pointer-events: none;
  white-space: nowrap;
}
#offline-toast.show { opacity: 1; }

/* ===== MISC ===== */
.empty { text-align: center; color: var(--text3); padding: 40px 20px; font-size: 13px; }

/* ===== PICO (ficha da onda) ===== */
.pico-hero {
  background: linear-gradient(135deg, rgba(77,208,225,.14), rgba(21,101,168,.08));
  border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; margin: 12px;
}
.pico-hero-name { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.pico-hero-sub { font-size: 12px; color: var(--text2); margin-bottom: 10px; }
.pico-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pico-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
  padding: 4px 8px; border-radius: 6px; text-transform: uppercase;
  background: rgba(77,208,225,.14); color: var(--accent); border: 1px solid var(--border);
}
.pico-tag.warn { background: rgba(239,108,0,.14); color: #ffb74d; border-color: rgba(239,108,0,.3); }
.pico-desc {
  margin: 0 12px 14px; font-size: 13px; line-height: 1.55; color: var(--text2);
}
.pico-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 12px;
}
.pico-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; text-align: center;
}
.pico-card-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }
.pico-card-val { font-size: 18px; font-weight: 800; color: var(--accent); margin: 6px 0 2px; }
.pico-card-sub { font-size: 10px; color: var(--text3); }
.pico-rows {
  margin: 0 12px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.pico-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border);
}
.pico-row:last-child { border-bottom: none; }
.pico-row span:first-child { color: var(--text3); }
.pico-row span:last-child { color: var(--text); font-weight: 600; }
.pico-hazards {
  margin: 0 12px 14px; display: flex; flex-direction: column; gap: 6px;
}
.pico-hazard {
  background: rgba(239,83,80,.1); border: 1px solid rgba(239,83,80,.25);
  border-radius: 10px; padding: 10px 12px; font-size: 12px; color: #ffb4b0;
}
