:root {
  --deep: #0b3d4c;
  --mid: #14708c;
  --surface: #eef5f5;
  --panel: #ffffff;
  --ink: #12242a;
  --muted: #5c7680;
  --accent: #d97a3c;
  --line: #d7e3e3;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--panel);
  color: var(--ink);
}

#dashboard {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ---------- Sidebar ---------- */

#sidebar {
  flex: 1 1 50%;
  background: var(--deep);
  color: #eef5f5;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px 12px;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.cfl-logo {
  height: clamp(54.4px, calc(10.462px + 6.2769vw), 136px);
  width: auto;
  background: #ffffff;
  padding: 4px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.brand h1 {
  font-size: clamp(1.632rem, calc(0.3138rem + 3.0129vw), 4.08rem);
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.brand h1 span {
  display: block;
  font-size: clamp(0.816rem, calc(0.1569rem + 1.5065vw), 2.04rem);
  font-weight: 400;
  color: #9fc8d6;
  margin-top: 3px;
}

.stat-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  min-height: 0;
}

.stat-tile {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #1c6a82;
  border-radius: 10px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}

.stat-label {
  font-size: clamp(0.749rem, calc(0.144rem + 1.3824vw), 1.872rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9fc8d6;
  margin-top: 8px;
  margin-bottom: 5px;
}

.stat-value {
  font-size: clamp(2.112rem, calc(0.4062rem + 3.8991vw), 5.28rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
}

.stat-value-sm {
  font-size: clamp(1.536rem, calc(0.2954rem + 2.8357vw), 3.84rem);
}

.stat-unit {
  font-size: clamp(1.008rem, calc(0.1938rem + 1.8609vw), 2.52rem);
  font-weight: 500;
  color: #cfe8ee;
  margin-left: 6px;
}

.stat-fahrenheit {
  font-size: clamp(1.008rem, calc(0.1938rem + 1.8609vw), 2.52rem);
  font-weight: 400;
  color: #9fc8d6;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.buoy-thumb {
  width: 100%;
  max-height: 40vh;
  object-fit: cover;
  object-position: center 40%;
  border-radius: 8px;
  display: block;
}

.status {
  font-size: clamp(0.672rem, calc(0.1292rem + 1.2406vw), 1.68rem);
  color: #9fc8d6;
  min-height: 1em;
}

/* ---------- Main content ---------- */

#main {
  flex: 1 1 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.chart-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px 6px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.profile-panel {
  flex: 1;
}

.chart-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  padding: 16px 0;
}

.chart-title {
  font-size: clamp(1.683rem, calc(0.612rem + 2.448vw), 3.06rem);
  font-weight: 600;
  color: var(--deep);
}

.chart-sub {
  font-size: clamp(0.924rem, calc(0.336rem + 1.344vw), 1.68rem);
  color: var(--muted);
  white-space: nowrap;
}

.chart-value {
  font-size: clamp(1.03rem, calc(0.3744rem + 1.4976vw), 1.872rem);
  font-weight: 700;
  color: var(--mid);
  white-space: nowrap;
}

.chart-body {
  flex: 1;
  min-height: 0;
  position: relative;
}

svg.chart {
  display: block;
  width: 100%;
  height: 100%;
}

.axis path,
.axis line {
  stroke: #b9c9c9;
}

.axis text {
  fill: var(--muted);
  font-size: clamp(19.8px, calc(7.2px + 1.8vw), 36px);
}

.axis-title {
  fill: var(--deep);
  font-size: clamp(19.8px, calc(7.2px + 1.8vw), 36px);
  font-weight: 600;
}

.legend-line {
  fill: none;
  stroke-width: 5;
}

.profile-dot {
  stroke: #ffffff;
  stroke-width: 0.6;
}

/* ---------- Mobile (phone) layout ----------
   Desktop styles above are untouched above this breakpoint; this
   block only overrides layout/sizing on narrow screens so the
   dashboard stacks and scrolls instead of trying to fit one 27"
   frame into a phone viewport. */

@media (max-width: 700px) {
  html, body {
    height: auto;
    overflow: auto;
  }

  #dashboard {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    width: 100%;
  }

  #sidebar {
    flex: none;
    width: 100%;
    padding: 14px;
    gap: 10px;
    overflow: visible;
  }

  .brand {
    margin-bottom: 2px;
  }

  .cfl-logo {
    height: 40px;
  }

  .brand h1 {
    font-size: 1.3rem;
  }

  .brand h1 span {
    font-size: 0.75rem;
  }

  .stat-grid {
    flex: none;
    gap: 8px;
  }

  .stat-tile {
    padding: 8px 10px;
  }

  .stat-label {
    font-size: 0.68rem;
    margin-top: 2px;
    margin-bottom: 3px;
  }

  .stat-value {
    font-size: 1.7rem;
  }

  .stat-value-sm {
    font-size: 1.25rem;
  }

  .stat-unit {
    font-size: 0.85rem;
    margin-left: 4px;
  }

  .stat-fahrenheit {
    font-size: 0.85rem;
  }

  .sidebar-footer {
    margin-top: 10px;
  }

  .buoy-thumb {
    max-height: 18vh;
  }

  .status {
    font-size: 0.75rem;
  }

  #main {
    flex: none;
    width: 100%;
    height: 65vh;
    padding: 14px;
  }

  .chart-title-row {
    padding: 6px 0;
  }

  .chart-title {
    font-size: 1.15rem;
  }

  .chart-sub {
    font-size: 0.7rem;
    white-space: normal;
  }

  .chart-value {
    font-size: 0.78rem;
  }

  .axis text {
    font-size: 11px;
  }

  .axis-title {
    font-size: 12px;
  }

  .legend-line {
    stroke-width: 2;
  }
}
