/* ===== Theme colors (change these to restyle the whole app) ===== */
:root {
  --bg: #0b0f14;
  --card: #151b23;
  --card-2: #1d2530;
  --line: #273140;
  --text: #e8eef5;
  --muted: #8b98a8;
  --accent: #38bdf8;
  --good: #34d399;
  --ok: #fbbf24;
  --bad: #f87171;

  --radius: 16px;
  --tab-height: 60px;
  --header-height: 52px;

  /* iPhone safe areas (notch / Dynamic Island on top, home bar on bottom) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button { font-family: inherit; cursor: pointer; }
button, a, .tab, .chip { -webkit-user-select: none; user-select: none; }

/* ===== Header ===== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  height: calc(var(--header-height) + var(--safe-top));
  padding: var(--safe-top) calc(16px + var(--safe-right)) 0 calc(16px + var(--safe-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.header-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 12px;
  background: var(--card-2);
  color: var(--text);
  font-size: 20px;
}
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Main content area ===== */
.view {
  padding:
    calc(var(--header-height) + var(--safe-top) + 12px)
    calc(16px + var(--safe-right))
    calc(var(--tab-height) + var(--safe-bottom) + 24px)
    calc(16px + var(--safe-left));
  max-width: 640px;
  margin: 0 auto;
}

/* ===== Bottom tab bar ===== */
.tab-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: rgba(11, 15, 20, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  height: var(--tab-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}
.tab svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--accent); }

/* ===== Cards & common pieces ===== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card h3 { margin: 0 0 8px; font-size: 18px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.good { color: var(--good); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 0;
  border-radius: 14px;
  background: var(--card-2);
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}
.btn.primary { background: var(--accent); color: #04121c; }
.btn:active, .icon-btn:active, .chip:active { opacity: 0.7; }

.notice {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--card-2);
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 14px;
}
.notice.warn { color: var(--ok); }
.notice.error { color: var(--bad); }

.placeholder {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}
.placeholder .big { font-size: 48px; margin-bottom: 8px; }

/* Rows of label / value pairs */
.rows { display: grid; gap: 10px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row .label { color: var(--muted); font-size: 15px; }
.row .value { font-weight: 600; text-align: right; }

/* Horizontal scrolling chips (spot picker, etc.) */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px 14px;
  padding: 0 16px 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #04121c; }

.skeleton { height: 120px; border-radius: var(--radius); background: var(--card); margin-bottom: 14px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ===== Surf ===== */
.surf-hero { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.surf-hero .waves { font-size: 44px; font-weight: 800; line-height: 1; }
.surf-hero .unit { font-size: 20px; color: var(--muted); font-weight: 600; }

.arrow { display: inline-block; width: 1em; text-align: center; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--card-2);
}
.badge.good { background: rgba(52, 211, 153, 0.15); }
.badge.ok { background: rgba(251, 191, 36, 0.15); }
.badge.bad { background: rgba(248, 113, 113, 0.15); }

.tide-chart { width: 100%; height: auto; display: block; margin: 4px 0 10px; }
.tide-chart .curve { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.tide-chart .area { fill: rgba(56, 189, 248, 0.12); stroke: none; }
.tide-chart .now-line { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 3 3; }
.tide-chart .now-dot { fill: var(--text); }
.tide-chart text { fill: var(--muted); font-size: 11px; }

.tide-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.tide-item { background: var(--card-2); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.tide-item b { display: block; font-size: 15px; }

.day-winds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.day-wind { background: var(--card-2); border-radius: 10px; padding: 8px; text-align: center; font-size: 14px; }
.day-wind .t { color: var(--muted); font-size: 12px; }
.day-tides { margin-top: 10px; font-size: 14px; color: var(--muted); }
