* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a1628;
  color: #e0e8f0;
  overflow-x: hidden;
}
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 100vw;
}

/* Header */
header { text-align: center; padding: 6px 12px 2px; flex-shrink: 0; }
header h1 { font-size: 18px; color: #60b0f4; }
.header-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.subtitle { font-size: 11px; color: #5a6a80; }
.settings-btn { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px 8px; }
.settings-btn:hover { opacity: 0.7; }

.login-btn {
  background: none; border: 1px solid #2a3a50; border-radius: 4px;
  color: #5a7a9a; font-size: 11px; padding: 2px 8px; cursor: pointer;
}
.login-btn:hover { border-color: #60b0f4; color: #60b0f4; }
.login-btn.logged-in { border-color: #4ecdc4; color: #4ecdc4; }

/* Picker */
.picker { display: flex; gap: 4px; padding: 4px 8px; flex-shrink: 0; }
.picker input, .picker select, .picker button {
  background: #142238; border: 1px solid #2a3a50; border-radius: 6px;
  color: #e0e8f0; padding: 6px 4px; font-size: 13px; min-height: 30px;
}
.picker input[type="date"] { flex: 2; min-width: 0; }
.time-select { width: 44px; text-align: center; }
.time-colon { color: #5a6a80; display: flex; align-items: center; font-size: 14px; }
.picker button {
  background: #1a4a7a; border-color: #2a6a9a; color: #fff;
  font-weight: 600; cursor: pointer; padding: 6px 8px; font-size: 13px;
}
.mode-btn { background: #2a3a50; border-color: #4a6a8a; }
.mode-btn.active { background: #1a4a7a; border-color: #60b0f4; }

/* Points Bar */
.points-bar {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  flex-shrink: 0; overflow-x: auto;
}
.bar-label { font-size: 12px; color: #5a7a9a; white-space: nowrap; }
.points-list { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.point-chip {
  display: flex; align-items: center; gap: 4px;
  background: #142238; border: 1px solid #2a3a50; border-radius: 14px;
  padding: 3px 10px; font-size: 12px; color: #b0c8e0;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.point-chip.active { background: #1a3a5a; border-color: #60b0f4; color: #60b0f4; }
.point-chip .del { color: #5a6a80; cursor: pointer; font-size: 14px; line-height: 1; }
.point-chip .del:hover { color: #ff6b6b; }
.add-btn {
  background: #0f2440; border: 1px dashed #3a5a7a; border-radius: 50%;
  width: 28px; height: 28px; color: #5a7a9a; font-size: 16px;
  cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}

/* Current Card */
.current-card {
  background: linear-gradient(135deg, #0f2440, #1a3050);
  border: 1px solid rgba(96,176,244,0.2);
  border-radius: 10px; margin: 4px 8px; padding: 10px 14px;
  flex-shrink: 0; min-height: 70px;
}
.loading { color: #5a6a80; font-size: 13px; text-align: center; padding: 16px 0; }
.hidden { display: none !important; }
.pname { font-size: 14px; font-weight: 600; color: #e0e8f0; }
.coords { font-size: 11px; color: #5a7a9a; margin-bottom: 2px; }
.speed-row { margin: 2px 0; }
.speed-val { font-size: 32px; font-weight: 700; color: #60b0f4; }
.speed-unit { font-size: 13px; color: #5a7a9a; margin-left: 4px; }
.dir-row { margin: 3px 0; display: flex; align-items: center; gap: 6px; }
.dir-arrow { font-size: 18px; transition: transform 0.3s; }
.dir-text { font-size: 13px; color: #b0c8e0; }
.strength-bar { margin-top: 6px; height: 4px; background: #1a2a40; border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s, background 0.5s; }
.hydro-point { font-size: 11px; color: #4a6a8a; margin-top: 3px; }

/* Cards Row (current + wind side by side) */
.cards-row {
  display: flex; gap: 6px; margin: 4px 8px; flex-shrink: 0;
}
.cards-row > .current-card,
.cards-row > .wind-card {
  flex: 1; min-width: 0; margin: 0;
}

/* HKO Wind Card */
.wind-card {
  background: linear-gradient(135deg, #0f1c30, #1a2a40);
  border: 1px solid rgba(78,205,196,0.15);
  border-radius: 10px; padding: 8px 12px; min-height: 70px;
  display: flex; flex-direction: column;
}
.wind-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: #5a7a9a; margin-bottom: 4px;
}
.wind-toggle {
  color: #4ecdc4; cursor: pointer; font-size: 10px;
  border: 1px solid rgba(78,205,196,0.3); border-radius: 4px; padding: 1px 6px;
}
.wind-toggle:hover { background: rgba(78,205,196,0.1); }
.wind-body { padding: 2px 0; }

/* HKO Wind layout */
.wind-station-select {
  width: 100%; background: #142238; border: 1px solid #2a3a50; border-radius: 6px;
  color: #e0e8f0; padding: 5px 6px; font-size: 12px; margin-bottom: 6px; cursor: pointer;
  appearance: auto;
}
.wind-station-select option { background: #0f1c30; color: #e0e8f0; }
.hko-wind-main { text-align: center; margin-bottom: 4px; }
.hko-wind-speed { display: flex; align-items: baseline; justify-content: center; gap: 3px; }
.hko-speed-val { font-size: 28px; font-weight: 700; color: #4ecdc4; }
.hko-speed-unit { font-size: 12px; color: #4a6a8a; }
.hko-wind-details { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 8px; }
.hko-wind-row { display: flex; justify-content: space-between; padding: 1px 0; font-size: 11px; min-width: 0; }
.dir-row-full { grid-column: 1 / -1; }
.dir-hko-wrap { display: flex; align-items: center; gap: 4px; }
.dir-arrow-hko { font-size: 14px; transition: transform 0.3s; display: inline-block; }
.hko-label { color: #4a6a8a; white-space: nowrap; flex-shrink: 0; }
.hko-value { color: #b0c8e0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Forecast Wind Card (reference) */
.forecast-wind-card {
  margin: 0 8px 4px; background: #0f1c30; border: 1px solid rgba(96,176,244,0.1);
  border-radius: 8px; padding: 6px 12px; flex-shrink: 0;
}
.forecast-wind-body { padding: 2px 0; }
.wind-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px; }
.wind-model {
  font-size: 9px; font-weight: 700; border-radius: 3px;
  padding: 1px 5px; width: 44px; text-align: center; flex-shrink: 0;
}
.brand-gfs { background: #1a4a7a; color: #60b0f4; }
.brand-ecmwf { background: #3a2a5a; color: #b478f4; }
.wind-data { color: #b0c8e0; font-size: 12px; }

/* Tide colors */
.tide-high { color: #4ecdc4 !important; font-weight: 600; }
.tide-low { color: #ff6b6b !important; font-weight: 600; }

/* Map */
.map-wrapper { flex: 1; position: relative; margin: 2px 4px; border-radius: 8px; overflow: hidden; min-height: 180px; }
#map { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }

/* Tide Wrapper */
.tide-wrapper {
  margin: 0 8px 4px; background: #0f1c30; border: 1px solid rgba(96,176,244,0.12);
  border-radius: 8px; padding: 4px 8px; flex-shrink: 0;
}
.tide-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: #5a7a9a; padding: 2px 0;
}
.tide-toggle { color: #3a5a7a; cursor: pointer; font-size: 11px; }
.tide-toggle:hover { color: #60b0f4; }
.tide-row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 12px; }
.tide-row .label { color: #5a6a80; }
.tide-row span:last-child { color: #b0c8e0; }
.tide-chart { margin-top: 4px; height: 60px; min-height: 60px; }
.loading-sm { color: #5a6a80; font-size: 11px; text-align: center; padding: 16px; }
#tideCanvas, #speedCanvas { width: 100%; height: 100%; }
.tide-source { color: #4a6a8a; font-size: 10px; }

/* Footer */
footer { text-align: center; padding: 4px 0; font-size: 10px; color: #2a3a50; flex-shrink: 0; }

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
  z-index: 10000;
}
.modal {
  background: #0f2440; border: 1px solid #2a4a6a; border-radius: 12px;
  padding: 20px; width: 300px; max-width: 90vw;
}
.modal h3 { font-size: 16px; margin-bottom: 12px; color: #60b0f4; }
.modal label { font-size: 12px; color: #5a7a9a; display: block; margin-bottom: 4px; }
.modal input {
  width: 100%; background: #142238; border: 1px solid #2a3a50; border-radius: 6px;
  color: #e0e8f0; padding: 8px; font-size: 14px; margin-bottom: 8px;
}
.modal-btns { display: flex; gap: 6px; justify-content: flex-end; }
.modal-btns button {
  padding: 6px 14px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px;
}
.modal-btns .cancel { background: #2a3a50; color: #7a8aa0; }
.modal-btns .save { background: #1a4a7a; color: #fff; font-weight: 600; }
.login-error { color: #ff6b6b; font-size: 12px; margin-bottom: 8px; }