#rotator {
  width: 100%;
  display: flex;
  flex-direction: column;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; overflow-x: hidden; overscroll-behavior-x: none; }
body {
  background: #c8d0d8;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  color: #111;
  min-height: 100vh;
  height: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(8px, env(safe-area-inset-top))
           max(8px, env(safe-area-inset-right))
           max(8px, env(safe-area-inset-bottom))
           max(8px, env(safe-area-inset-left));
}
#search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  width: 100%;
}
#city-input {
  flex: 1;
  padding: 8px 12px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  border: 2px solid #888;
  background: #f5f5f0;
  outline: none;
}
#city-input:focus { border-color: #003c8f; }
#model-select {
  padding: 8px 10px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  border: 2px solid #888;
  background: #f5f5f0;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
}
#model-select:focus { border-color: #003c8f; }

#forecast-container {
  background: #e4e9ef;
  border: 1px solid #a8b0b8;
  width: 100%;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.22);
}
#header {
  background: #d8dfe8;
  border-bottom: 1px solid #a8b0b8;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
#city-name { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
#subtitle  { font-size: 11px; color: #555; margin-top: 2px; }
#header-right { text-align: right; font-size: 11px; color: #555; }
.dmi-logo {
  display: inline-block;
  background: #003c8f;
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  padding: 2px 6px;
  margin-top: 4px;
  letter-spacing: 1.5px;
}
/* chart rows: fixed left axis + fluid canvas */
.chart-row {
  display: flex;
  border-bottom: 1px solid #a8b0b8;
  background: #d8dfe8;
  position: relative;
}
.chart-row:last-child { border-bottom: none; }
.y-axis {
  flex: 0 0 44px;
  width: 44px;
  border-right: 1px solid #a8b0b8;
  background: #d8dfe8;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 3px 3px 0;
  font-size: 9px;
  font-family: 'IBM Plex Mono', monospace;
  text-align: right;
  color: #444;
  position: relative;
  z-index: 2;
}
.chart-canvas-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}
.y-axis-right {
  flex: 0 0 36px;
  width: 36px;
  border-left: 1px solid #a8b0b8;
  background: #d8dfe8;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 0 3px 3px;
  font-size: 9px;
  font-family: 'IBM Plex Mono', monospace;
  text-align: left;
  color: #4466aa;
  position: relative;
  z-index: 2;
}
canvas.main-canvas {
  display: block;
  width: 100%;
}
#loading { padding: 40px; text-align: center; font-size: 15px; color: #555; }
#forecast-content.updating { opacity: 0.4; pointer-events: none; transition: opacity 0.15s; }
#error-msg {
  padding: 20px 24px; color: #900; text-align: center;
  line-height: 1.7; display: none;
}

/* ── Hover crosshair overlay ── */
.crosshair-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ── Tooltip card ── */
#hover-tooltip {
  display: none;
  position: fixed;
  z-index: 1000;
  bottom: max(10px, calc(env(safe-area-inset-bottom) + 4px));
  right:  max(10px, calc(env(safe-area-inset-right)  + 4px));
  background: rgb(18, 26, 38);
  border: 1px solid rgba(120,160,200,0.35);
  border-radius: 6px;
  padding: 8px 11px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  color: #e8eef5;
  pointer-events: auto;
  cursor: pointer;
  min-width: 148px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
  line-height: 1.55;
}
#hover-tooltip .tt-time {
  font-weight: 700;
  font-size: 11px;
  color: #8ab4d4;
  margin-bottom: 5px;
  border-bottom: 1px solid rgba(120,160,200,0.2);
  padding-bottom: 4px;
}
#hover-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
#hover-tooltip .tt-label { color: #8ab4d4; font-size: 10px; }
#hover-tooltip .tt-val   { font-weight: 600; font-size: 12px; }

/* ── Radar section ─────────────────────────────────────────────────────── */
#radar-section {
  width: 100%;
  margin-top: 12px;
  background: #e4e9ef;
  border: 1px solid #a8b0b8;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.22);
  display: none;
  flex-direction: column;
}
#radar-header {
  background: #d8dfe8;
  border-bottom: 1px solid #a8b0b8;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
#radar-header span { font-size: 10px; font-weight: 400; color: #667; }
#radar-tile-counter {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #334;
  background: rgba(0,0,0,0.08);
  padding: 2px 6px;
  border-radius: 3px;
  transition: color 0.3s;
}
#radar-tile-counter.warn  { color: #c07000; background: rgba(192,112,0,0.12); }
#radar-tile-counter.limit { color: #cc2200; background: rgba(204,34,0,0.12); font-weight: 700; }
#radar-map {
  width: 100%;
  flex: 1;
  min-height: 320px;
  background: #e8e0d8;
  position: relative;
  /* isolation:isolate creates a stacking context that contains Leaflet's
     internal z-indices (leaflet-top/bottom at 1000) without assigning a
     specific z-index in the root stacking context. */
  isolation: isolate;
}
#radar-loading {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8e0d8;
  color: #446;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.5px;
  pointer-events: none;
  transition: opacity 0.4s;
}
#radar-loading.hidden {
  opacity: 0;
}
#radar-pan-hint {
  position: absolute;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
#radar-pan-hint.visible {
  opacity: 1;
}
#radar-scroll-hint {
  position: absolute;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
#radar-scroll-hint.visible {
  opacity: 1;
}
#radar-ctx-menu {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #c0c8d0;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  padding: 4px 0;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  min-width: 160px;
  display: none;
}
#radar-ctx-menu.visible {
  display: block;
}
.radar-ctx-item {
  padding: 8px 16px;
  cursor: pointer;
  color: #222;
  white-space: nowrap;
  user-select: none;
}
.radar-ctx-item:hover {
  background: #eef2f8;
}
#radar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #d8dfe8;
  border-top: 1px solid #a8b0b8;
  flex-wrap: wrap;
  flex-shrink: 0;
}
#radar-play-btn {
  padding: 4px 14px;
  background: #2a3a50;
  color: #8ab4d4;
  border: 1px solid #4a6a8a;
  border-radius: 3px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.4px;
}
#radar-play-btn:hover { background: #334455; color: #b0d4f4; border-color: #6a8aaa; }
#radar-slider {
  flex: 1;
  min-width: 80px;
  accent-color: #003c8f;
  cursor: pointer;
}
#radar-time-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #334;
  white-space: nowrap;
  min-width: 130px;
  text-align: right;
}
.radar-zoom-btn {
  padding: 2px 10px;
  background: #2a3a50;
  color: #8ab4d4;
  border: 1px solid #4a6a8a;
  border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
}
.radar-zoom-btn:hover { background: #334455; color: #b0d4f4; border-color: #6a8aaa; }

/* ── Kite config button ── */
#kite-cfg-btn {
  padding: 7px 14px;
  background: #1a4a2e;
  color: #00e8b0;
  border: 1px solid #00c890;
  border-radius: 3px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}
#kite-cfg-btn:hover { background: #225a38; }

/* ── App footer ── */
#app-footer {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-top: 12px;
  background: #d8dfe8;
  border: 1px solid #a8b0b8;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.22);
}
#app-footer #shore-status {
  flex: 1;
  font-size: 10px;
  color: #667;
  font-family: 'IBM Plex Mono', monospace;
  min-width: 0;
}
#app-footer #build-number {
  font-size: 9px;
  color: #889;
  letter-spacing: 0.5px;
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Credits button (in footer) ── */
#credits-btn {
  padding: 7px 14px;
  background: #2a3a50;
  color: #8ab4d4;
  border: 1px solid #4a6a8a;
  border-radius: 3px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 36px;
}
#credits-btn:hover { background: #334455; color: #b0d4f4; border-color: #6a8aaa; }

/* ── Credits modal ── */
#credits-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0,0,0,0.55);
  align-items: center;
  justify-content: center;
}
#credits-modal-overlay.open { display: flex; }
#credits-modal {
  background: #1e2a38;
  border: 1px solid #3a5a7a;
  border-radius: 6px;
  padding: 18px 22px 16px;
  min-width: 280px;
  max-width: 420px;
  width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  color: #e0eaf4;
  font-family: 'IBM Plex Sans', sans-serif;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
}
#credits-modal h2 {
  font-size: 15px;
  font-weight: 700;
  color: #8ab4d4;
  letter-spacing: 0.4px;
  margin-bottom: 14px;
}
.credits-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.credits-item {
  padding: 10px 0;
  border-bottom: 1px solid #253545;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: 10px;
}
.credits-item:last-child { border-bottom: none; }
.credits-name {
  font-size: 13px;
  font-weight: 700;
  color: #c8dff0;
  grid-column: 1;
  grid-row: 1;
}
.credits-desc {
  font-size: 11px;
  color: #7a9ab8;
  grid-column: 1;
  grid-row: 2;
  margin-top: 2px;
}
.credits-license {
  font-size: 10px;
  color: #556a7a;
  font-family: 'IBM Plex Mono', monospace;
  grid-column: 1 / span 2;
  grid-row: 3;
  margin-top: 4px;
}
.credits-link {
  font-size: 11px;
  color: #5a9ac8;
  text-decoration: none;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  white-space: nowrap;
}
.credits-link:hover { color: #8ac4f0; text-decoration: underline; }
.credits-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}
.credits-actions button {
  padding: 7px 18px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  background: #2a3a4a;
  color: #8ab4d4;
  border: none;
}
.credits-actions button:hover { background: #334455; }

/* Credits modal inverted-colors pre-invert */
body.inverted-colors #credits-modal-overlay { filter: invert(1); }
body.inverted-colors #credits-btn {
  background:   #d5c5af;
  color:        #754b2b;
  border-color: #b5957a;
}
body.inverted-colors #credits-btn:hover { background: #c5b59f; }
body.inverted-colors #app-footer { filter: invert(1); }

/* ── Kite config modal ── */
#kite-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0,0,0,0.55);
  align-items: center;
  justify-content: center;
}
#kite-modal-overlay.open { display: flex; }
#kite-modal {
  background: #1e2a38;
  border: 1px solid #00c890;
  border-radius: 6px;
  padding: 18px 22px 16px;
  min-width: 280px;
  max-width: 360px;
  width: 90vw;
  color: #e8f5ef;
  font-family: 'IBM Plex Sans', sans-serif;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
}
#kite-modal h2 {
  font-size: 15px;
  font-weight: 700;
  color: #00e8b0;
  letter-spacing: 0.4px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.kite-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.kite-field label {
  font-size: 11px;
  color: #8ab4d4;
  letter-spacing: 0.3px;
}
.kite-field-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.kite-field input[type="number"] {
  width: 70px;
  padding: 5px 7px;
  background: #141e2a;
  border: 1px solid #336655;
  color: #e8f5ef;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  border-radius: 3px;
  outline: none;
}
.kite-field input[type="number"]:focus { border-color: #00c890; }
.kite-field-unit { font-size: 11px; color: #5a8a7a; }
.kite-field input[type="range"] {
  flex: 1;
  accent-color: #00c890;
  cursor: pointer;
  height: 4px;
}
.kite-sea-thresh-label {
  min-width: 34px;
  text-align: right;
  font-family: 'IBM Plex Mono', monospace;
  color: #00c890;
}
.kite-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}
.kite-modal-actions button {
  padding: 7px 18px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  border: none;
}
#kite-modal-cancel { background: #2a3a4a; color: #8ab4d4; }
#kite-modal-cancel:hover { background: #334455; }
#kite-modal-apply  { background: #006644; color: #00e8b0; }
#kite-modal-apply:hover  { background: #007755; }
#kite-modal-reset  { background: #1a2a38; color: #5a8a7a; border: 1px solid #336655; font-size:11px; padding: 7px 12px; }
#kite-modal-reset:hover  { color: #8ab4d4; }

/* ── Radar location marker ── */
@keyframes radar-pulse {
  0%   { transform: scale(0.5); opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0;   }
}
.radar-loc-wrap {
  position: relative;
  width: 30px;
  height: 30px;
}
.radar-loc-pulse {
  position: absolute;
  top: 50%; left: 50%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: rgba(0, 60, 143, 0.45);
  animation: radar-pulse 2s ease-out infinite;
  pointer-events: none;
}
.radar-loc-dot {
  position: absolute;
  top: 50%; left: 50%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #003c8f;
  border: 3px solid #ffffff;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
  pointer-events: auto;
  cursor: grab;
}
.radar-loc-dot:active {
  cursor: grabbing;
}

/* ── Shore compass ── */
#shore-compass-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
#shore-compass-canvas {
  width: 210px;
  height: 210px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #141e2a;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
#shore-compass-canvas:hover {
  box-shadow: 0 0 0 2px rgba(0,200,160,0.45);
}
#shore-compass-legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
}
.sc-leg { display: flex; align-items: center; gap: 4px; color: #8ab4d4; }
.sc-leg.sea   { color: rgba(60,160,255,0.9); }
.sc-leg.land  { color: rgba(180,110,40,0.9); }
.sc-leg.sel   { color: rgba(0,220,160,0.9); }
.sc-leg.unsel { color: rgba(22,34,48,1); text-shadow: 0 0 0 #8ab4d4; color: #445566; }
#shore-modal-status {
  margin-top: 6px;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  min-height: 14px;
  color: #778;
}
#kite-shore-fetch-btn {
  margin-top: 8px;
  padding: 6px 14px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid #336655;
  background: #1a2a38;
  color: #00c890;
}
#kite-shore-fetch-btn:hover:not(:disabled) { background: #223344; color: #00e8b0; }
#kite-shore-fetch-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Shore debug panel ── */
#shore-debug-details {
  margin-top: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
}
#shore-debug-summary {
  cursor: pointer;
  color: #8ab;
  font-size: 11px;
  font-weight: 600;
  user-select: none;
  padding: 2px 0;
}
#shore-debug-summary:hover { color: #acd; }
#shore-debug-panel {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}
/* top row: map left, meta right */
#shore-debug-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
#shore-debug-map {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
  background: #141e2a;
  border-radius: 4px;
  border: 1px solid rgba(80,100,130,0.4);
  image-rendering: pixelated;
}
#shore-debug-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: baseline;
  background: rgba(0,0,0,0.25);
  border-radius: 4px;
  padding: 6px 8px;
}
.sdd-key  { color: #778; white-space: nowrap; }
.sdd-val  { color: #c8d8e8; }
.sdd-sub  { color: #556; font-size: 10px; margin-left: 4px; }
.sdd-warn { color: #e8aa44; }
.shore-debug-section-title {
  font-size: 10px;
  font-weight: 600;
  color: #667;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
#shore-debug-rings-table,
#shore-debug-bearings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  color: #b0c4d8;
}
#shore-debug-rings-table th,
#shore-debug-bearings-table th {
  background: rgba(0,0,0,0.35);
  color: #778;
  text-align: center;
  padding: 2px 5px;
  border-bottom: 1px solid #223;
  position: sticky;
  top: 0;
}
#shore-debug-rings-table td,
#shore-debug-bearings-table td {
  padding: 2px 5px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.sdd-land { background: rgba(200,120,30,0.12); color: #d4903a; }
.sdd-sea  { background: rgba(0,180,140,0.10); color: #40c8a8; }
.sdd-sea-row  { background: rgba(0,180,140,0.06); }
.sdd-land-row { background: rgba(200,120,30,0.06); }
.sdd-sea-cell  { color: #40c8a8; }
.sdd-land-cell { color: #c88040; }

/* ── Radar stations group box ── */
.radar-stations-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid #a8b0b8;
  border-radius: 4px;
  background: rgba(0,0,0,0.04);
}
.radar-stations-label {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 9px;
  font-weight: 600;
  color: #778;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
  padding-right: 2px;
}

/* ── Radar overlay toggle buttons ── */
.radar-overlay-toggle {
  padding: 3px 8px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid #bbb;
  background: rgba(0,0,0,0.07);
  color: #556;
  border-radius: 3px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-weight: 400;
}
.radar-overlay-toggle:hover { background: rgba(0,0,0,0.13); }
.radar-overlay-toggle.active {
  background: rgba(0,200,144,0.12);
  border-color: #00a878;
  color: #006040;
  font-weight: 600;
}


/* ── Wind station markers ── */
.ws-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
}

.ws-speed {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  /* white halo so the number stays legible on any map background */
  text-shadow:
    0 0 3px #fff,
    0 0 6px rgba(255,255,255,0.85);
}

/* ── Portrait: hide right-side rain axis to save lateral space ── */
@media (orientation: portrait) {
  .y-axis-right { display: none; }
}

/* ── Portrait: horizontally scrollable canvas area ── */
/*    Each .chart-canvas-wrap is its own scroll container; JS syncs them.   */
/*    The .y-axis siblings stay fixed — no sticky needed.                   */
@media (orientation: portrait) {
  .chart-canvas-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    /* Hide scrollbar chrome — scrolling still works via swipe/drag */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .chart-canvas-wrap::-webkit-scrollbar { display: none; }

  /* Footer portrait: grid with shore-status+credits on row 1, build-number below */
  #app-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding-bottom: max(14px, calc(env(safe-area-inset-bottom) + 6px));
  }
  #app-footer #shore-status  { grid-column: 1; grid-row: 1; }
  #app-footer #credits-btn   { grid-column: 2; grid-row: 1; }
  #app-footer #build-number  {
    grid-column: 1 / -1;
    grid-row: 2;
    white-space: normal;
    margin-top: 4px;
  }
}


/* ── Inverted colours (iOS): applied via JS body class (matchMedia works;
      @media (inverted-colors) does not reliably fire in WKWebView) ── */

/* Pre-invert all chart backgrounds so OS double-inversion restores the same
   dark blue (#1e2a38) used by the canvas draws in inverted mode.
   #e1d5c7 = 255-#1e2a38 = invert(#1e2a38). */
body.inverted-colors .chart-row    { background: #e1d5c7 !important; }
body.inverted-colors .y-axis       { background: #e1d5c7 !important; }
body.inverted-colors .y-axis-right { background: #e1d5c7 !important; }

/* Kite button: pre-invert all green colors so OS restores the original green */
body.inverted-colors #kite-cfg-btn {
  background:   #e5b5d1;
  color:        #ff174f;
  border-color: #ff376f;
}
body.inverted-colors #kite-cfg-btn:hover { background: #dda5c7; }

/* Kite modal: pre-invert the entire overlay so the OS double-inversion
   restores all original dark-theme colors (background, text, borders,
   compass canvas). One rule covers all children. */
body.inverted-colors #kite-modal-overlay { filter: invert(1); }

/* Tooltip: same pre-invert trick — preserves dark background, light text,
   and the weather icon canvas after OS double-inversion. */
body.inverted-colors #hover-tooltip { filter: invert(1); }



