:root {
  --ocean: #1f7a8c;
  --deep-ocean: #0b3d4a;
  --fog: #dbe3e8;
  --fog-dark: #81919d;
  --sand: #f3dfbd;
  --sun: #f7c948;
  --card: rgba(255,255,255,.82);
  --text: #17313a;
  --shadow: 0 18px 45px rgba(11,61,74,.16);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(247,201,72,.38), transparent 18rem),
    linear-gradient(180deg, #c8dce6 0%, #e9eef0 42%, var(--sand) 100%);
}

.hero { padding: 22px; }
.topbar, .dashboard, main, footer { max-width: 1180px; margin: 0 auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 58px; height: 58px; border-radius: 18px;
  display: grid; place-items: center; font-size: 32px;
  background: rgba(255,255,255,.72); box-shadow: var(--shadow);
}
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4.5rem); letter-spacing: -0.07em; }
p { line-height: 1.5; }
.brand p { margin: 4px 0 0; color: var(--deep-ocean); }

.dashboard {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  margin-top: 32px;
}
.gauge-card, .map-card, .cam-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.gauge-card { padding: 24px; text-align: center; }
.gauge {
  width: 210px; height: 210px; border-radius: 50%;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  background: conic-gradient(var(--fog-dark) 62%, rgba(255,255,255,.7) 0);
  position: relative;
}
.gauge::after {
  content: ""; position: absolute; inset: 18px;
  border-radius: 50%; background: linear-gradient(180deg, #fff, #eef4f6);
}
.gauge span, .gauge small { position: relative; z-index: 1; }
.gauge span { font-size: 4rem; font-weight: 850; letter-spacing: -0.08em; }
.gauge small { margin-left: 4px; font-weight: 700; color: var(--fog-dark); }
.gauge-card h2 { margin-bottom: 4px; }
.gauge-card p { margin: 0; color: #536974; }

.map-card { padding: 24px; overflow: hidden; }
.map-card h2 { margin: 0 0 20px; }
.coastline, .mountains {
  border-radius: 24px; padding: 26px; min-height: 130px;
  display: flex; align-items: center; justify-content: space-around; gap: 12px; flex-wrap: wrap;
}
.coastline {
  background: linear-gradient(170deg, rgba(31,122,140,.72), rgba(31,122,140,.16) 48%, rgba(243,223,189,.95) 49%);
}
.mountains {
  margin-top: 14px;
  background: linear-gradient(160deg, rgba(96,122,87,.35), rgba(219,227,232,.75));
}
.map-point {
  border: 0; cursor: pointer; padding: 12px 14px; border-radius: 999px;
  background: white; color: var(--deep-ocean); font-weight: 750;
  box-shadow: 0 8px 22px rgba(11,61,74,.14);
}
.map-point.valley { background: #edf7e8; }

.controls {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 10px 22px 22px;
}
button, a { font: inherit; }
.filter, .ghost-btn, .primary-btn, .icon-btn {
  border: 0; cursor: pointer; border-radius: 999px; font-weight: 760;
}
.filter, .ghost-btn {
  padding: 11px 16px; background: rgba(255,255,255,.68); color: var(--deep-ocean);
}
.filter.active, .primary-btn { background: var(--deep-ocean); color: white; }
.primary-btn { display: inline-block; text-decoration: none; padding: 12px 18px; }
.icon-btn { width: 42px; height: 42px; background: #edf2f4; }

.cams-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
  padding: 0 22px 34px;
}
.cam-card { overflow: hidden; }
.thumb {
  height: 170px; display: flex; align-items: flex-end; justify-content: space-between;
  padding: 14px; color: white;
  background: linear-gradient(135deg, #7f98a5, #1f7a8c);
  position: relative;
}
.thumb::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 28% 25%, rgba(255,255,255,.65), transparent 85px), linear-gradient(transparent, rgba(11,61,74,.72));
}
.thumb span { position: relative; z-index: 1; font-weight: 800; }
.favorite {
  position: relative; z-index: 1; border: 0; border-radius: 50%; width: 42px; height: 42px;
  background: rgba(255,255,255,.9); cursor: pointer; font-size: 20px;
}
.favorite.on { background: var(--sun); }
.cam-body { padding: 18px; }
.cam-body h3 { margin: 0 0 6px; }
.cam-body p { margin: 0 0 12px; color: #536974; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tag { font-size: .78rem; padding: 6px 9px; border-radius: 999px; background: #edf2f4; font-weight: 800; color: #48616d; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card-actions button, .card-actions a {
  padding: 10px 13px; border-radius: 999px; text-decoration: none; font-weight: 780;
}
.preview-btn { border: 0; background: var(--ocean); color: white; cursor: pointer; }
.open-link { background: #edf2f4; color: var(--deep-ocean); }

#camDialog {
  width: min(880px, calc(100vw - 24px)); border: 0; border-radius: 28px; padding: 20px;
  box-shadow: 0 30px 90px rgba(0,0,0,.35);
}
#camDialog::backdrop { background: rgba(11,31,38,.55); backdrop-filter: blur(4px); }
.dialog-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dialog-header h2 { margin: 0; }
.dialog-header p { margin-top: 4px; color: #536974; }
#dialogFrameWrap {
  margin: 18px 0; aspect-ratio: 16/9; border-radius: 18px; overflow: hidden;
  background: linear-gradient(135deg, #dbe3e8, #81919d); display: grid; place-items: center;
}
#dialogFrameWrap iframe { width: 100%; height: 100%; border: 0; }
.note { font-size: .92rem; color: #627783; }
footer { padding: 0 22px 30px; color: #627783; }

@media (max-width: 880px) {
  .dashboard { grid-template-columns: 1fr; }
  .cams-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 620px) {
  .cams-grid { grid-template-columns: 1fr; }
  .hero { padding: 16px; }
  .gauge { width: 180px; height: 180px; }
}


/* iPhone / PWA polish */
html { -webkit-text-size-adjust: 100%; }
body { padding-bottom: env(safe-area-inset-bottom); }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.topbar { padding-top: env(safe-area-inset-top); }
.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(232, 239, 242, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
}
.controls::-webkit-scrollbar { display: none; }
.filter { white-space: nowrap; min-height: 44px; }
.card-actions button, .card-actions a, .ghost-btn, .map-point { min-height: 44px; }
@supports (-webkit-touch-callout: none) {
  .gauge-card, .map-card, .cam-card { -webkit-backdrop-filter: blur(14px); }
}
@media (max-width: 620px) {
  .brand { align-items: flex-start; }
  .logo { width: 48px; height: 48px; font-size: 26px; border-radius: 14px; }
  h1 { font-size: 2.5rem; }
  .brand p { font-size: .95rem; }
  .dashboard { margin-top: 20px; }
  .gauge-card, .map-card, .cam-card { border-radius: 22px; }
  .map-card, .gauge-card { padding: 18px; }
  .coastline, .mountains { padding: 16px; justify-content: flex-start; }
  .thumb { height: 135px; }
  #camDialog { width: calc(100vw - 16px); max-height: 88vh; overflow: auto; border-radius: 22px; }
}
