/* Great Tides overrides for the shared Great Apps framework. */
:root {
  --bg: #061a2b;
  --bg-surface: #0a2540;
  --bg-hover: #0e3a5c;
  --bg-active: #12496e;
  --text: #eaf4f9;
  --text-muted: #9fb6c6;
  --accent: #2dd4bf;
  --accent-dim: #0f766e;
  --border: rgba(255, 255, 255, 0.12);
  --radius: 10px;
  --deep: var(--bg);
  --ocean: var(--bg-surface);
  --ocean-2: var(--bg-hover);
  --teal: #16b8a6;
  --teal-2: #2dd4bf;
  --foam: #e8f6f8;
  --sky: #7dd3fc;
  --muted: var(--text-muted);
  --card: rgba(255, 255, 255, 0.06);
  --card-brd: var(--border);
  --good: #22c55e;
  --fair: #eab308;
  --warn: #f97316;
  --bad: #ef4444;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --card-radius: 18px;
}

html {
  background-color: var(--bg);
  overflow-x: hidden;
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(90% 360px at 50% -40px, rgba(45, 212, 191, 0.20), transparent 70%),
    linear-gradient(180deg, #0f4a6e 0px, #0a2540 340px, #061a2b 760px);
  background-repeat: no-repeat;
  background-color: var(--bg);
  line-height: 1.45;
}

.bg-waves {
  position: fixed; inset: auto 0 0 0; height: 42vh; z-index: 0; opacity: 0.25; pointer-events: none;
}
.bg-waves svg { width: 100%; height: 100%; display: block; }
.bg-waves path { fill: var(--teal); animation: sway 12s ease-in-out infinite alternate; }
@keyframes sway { from { transform: translateX(-3%); } to { transform: translateX(3%); } }

.view {
  z-index: 1;
}

.conditions-list {
  position: relative;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}

.conditions-list > * {
  width: 100%;
  max-width: 960px;
  margin-right: auto;
  margin-left: auto;
}

/* Loading */
.loading { display: grid; place-items: center; gap: 16px; min-height: 60vh; color: var(--muted); }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.15); border-top-color: var(--teal-2);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Great Apps shell */
.list-header {
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.08), transparent 55%),
    var(--bg-surface);
}

.header-row {
  gap: 16px;
}

.header-row h1 {
  font-size: 1.35rem;
  font-weight: 500;
}

.header-accent {
  color: var(--accent);
}

.header-copy {
  min-width: 0;
}

.header-subtitle {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.icon-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.beach-picker {
  flex-wrap: nowrap;
}

.beach-picker select {
  min-width: 0;
  flex: 1;
}

.favorite-btn {
  flex: 0 0 40px;
  width: 40px;
  color: var(--accent);
  font-size: 1.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.day-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--card-brd);
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--text);
  background: var(--card);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--card-brd); border-radius: var(--card-radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin-bottom: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }

/* Hero */
.hero { position: relative; overflow: hidden; }
.hero .surf-flag { position: absolute; top: 0; right: 0; height: 100%; width: 6px; }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.surf-cat { font-size: 44px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.surf-clean { font-size: 15px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.surf-blurb { margin-top: 10px; color: var(--foam); font-size: 14px; max-width: 44ch; }
.surf-size { text-align: right; }
.surf-size .big { font-size: 40px; font-weight: 800; line-height: 1; }
.surf-size .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.score-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.1); margin-top: 16px; overflow: hidden; }
.score-bar > div { height: 100%; border-radius: 999px; transition: width .6s ease; }

/* Stat grid */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 620px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--card-brd); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 25px; font-weight: 800; letter-spacing: -0.5px; }
.stat .v small { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat .x { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #06121b; }

/* direction arrow */
.dir { display: inline-flex; align-items: center; gap: 6px; }
.arrow { width: 18px; height: 18px; display: inline-block; }
.arrow path { fill: currentColor; }

/* two-column cards */
.cols { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 720px) { .cols.two { grid-template-columns: 1fr 1fr; } }

/* Swim / lists */
.rating-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.rating-badge { font-size: 22px; font-weight: 900; padding: 8px 16px; border-radius: 14px; color: #06121b; }
.reasons { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.reasons li { font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }
.reasons li .ic { flex: 0 0 auto; }
.reasons .good .ic { color: var(--good); }
.reasons .warn .ic { color: var(--warn); }

/* Water quality banner */
.wq { display: flex; gap: 12px; align-items: flex-start; }
.wq .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; flex: 0 0 auto; box-shadow: 0 0 12px currentColor; }
.wq .lbl { font-weight: 800; font-size: 16px; }
.wq .detail { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* Sun & tide */
.suntide { display: grid; grid-template-columns: 1fr; gap: 16px; }
.sunrow { display: flex; justify-content: space-around; text-align: center; }
.sunrow .s .t { font-size: 20px; font-weight: 800; }
.sunrow .s .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.tide-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; margin-top: 14px; }
.tide-trend { font-weight: 800; font-size: 16px; }
.tide-next { color: var(--muted); font-size: 13px; }
.tide-curve { width: 100%; height: 96px; display: block; }
.tide-curve .fill { fill: rgba(45,212,191,.18); }
.tide-curve .line { fill: none; stroke: var(--teal-2); stroke-width: 2.5; }
.tide-curve .now { stroke: #fff; stroke-width: 1.5; stroke-dasharray: 3 3; }
.tide-curve .nowdot { fill: #fff; }
.tide-curve text { fill: var(--muted); font-size: 10px; }
.tide-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tide-chip { background: var(--card); border: 1px solid var(--card-brd); border-radius: 10px; padding: 6px 10px; font-size: 12.5px; }
.tide-chip b { text-transform: uppercase; letter-spacing: .5px; font-size: 10px; }
.tide-chip.high b { color: var(--teal-2); }
.tide-chip.low b { color: var(--sky); }

/* Forecast */
.hstrip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.hcell { flex: 0 0 auto; width: 74px; text-align: center; background: var(--card); border: 1px solid var(--card-brd); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; gap: 5px; }
.hcell .hr { font-size: 12px; color: var(--muted); font-weight: 600; }
.hcell .ic { font-size: 22px; }
.hcell .tp { font-weight: 800; font-size: 16px; }
.hcell .wv { font-size: 12px; color: var(--teal-2); font-weight: 700; }
.hcell .wd { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; justify-content: center; }
.hcell .pp { font-size: 11px; color: var(--sky); }

.daily { display: flex; flex-direction: column; gap: 8px; }
.drow { display: grid; grid-template-columns: 52px 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
.drow:last-child { border-bottom: none; }
.drow .dname { font-weight: 700; }
.drow .dic { font-size: 22px; text-align: center; }
.drow .dwave { color: var(--teal-2); font-weight: 700; font-size: 13px; }
.drow .dwind { color: var(--muted); font-size: 12px; }
.drow .dtemp { font-weight: 700; font-size: 14px; text-align: right; }
.drow .dtemp small { color: var(--muted); font-weight: 600; }

/* Data notes and footer */
.data-notes {
  color: var(--text-muted);
  font-size: 11.5px;
  text-align: center;
  line-height: 1.7;
}

.disclaimer { display: block; margin-top: 8px; font-style: italic; opacity: .8; }

.errbar { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4); color: #fecaca; padding: 10px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 14px; }

.inline-action {
  border: 0;
  padding: 2px 4px;
  color: var(--sky);
  background: none;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* Settings */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.62);
}

.settings-panel {
  display: flex;
  width: min(440px, 94vw);
  height: 100%;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.3);
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
}

.settings-head h2 {
  font-size: 1.15rem;
  font-weight: 650;
}

.settings-eyebrow {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-scroll {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

.setting-block h3 {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.setting-note,
.setting-status {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.setting-status {
  min-height: 1.15em;
}

.setting-status-warning,
.sync-error {
  color: #ff9cae;
}

.customize-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  list-style: none;
}

.customize-row {
  display: flex;
  min-height: 58px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--bg);
}

.visibility-control {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  cursor: pointer;
}

.visibility-control input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  accent-color: var(--accent);
}

.visibility-control span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.visibility-control strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visibility-control small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-panel {
  margin-top: 12px;
}

.sync-signin {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 14px;
  color: #061a2b;
  background: linear-gradient(135deg, #5eead4, var(--accent));
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.sync-actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.sync-alt {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-muted);
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.sync-alt:hover {
  border-color: var(--accent);
  color: var(--text);
}

.sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: var(--bg);
}

.sync-state {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-off {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 9px;
  color: var(--text-muted);
  background: transparent;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.sync-off[aria-disabled="true"] {
  opacity: 0.55;
  cursor: default;
}

.sync-message {
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
}

.icon-btn:focus-visible,
.beach-picker select:focus-visible,
.inline-action:focus-visible,
.visibility-control input:focus-visible,
.sync-signin:focus-visible,
.sync-alt:focus-visible,
.sync-off:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 620px) {
  .settings-panel {
    width: 100%;
    border-left: 0;
  }

  .status-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
