/* ============================================================
   NAVTRACK - CSS
   Dark nautical theme, mobile-first
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:       #0a1628;
  --bg2:      #0f2040;
  --bg3:      #142850;
  --accent:   #00d4ff;
  --gold:     #ffd700;
  --text:     #e0f0ff;
  --text-dim: #7a9abf;
  --danger:   #ff4d4d;
  --success:  #00e676;
  --radius:   12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ---- HEADER ---- */
header {
  background: var(--bg2);
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  border-bottom: 1px solid var(--bg3);
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
}

.gps-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.gps-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s;
}
.gps-dot.searching { background: var(--gold); animation: pulse 1s infinite; }
.gps-dot.active    { background: var(--success); }
.gps-dot.error     { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.gps-coords {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}

/* ---- USER BUTTON ---- */
.user-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--text-dim);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  padding: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.user-btn svg {
  width: 18px;
  height: 18px;
}

.user-btn.signed-in {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.15);
  color: var(--accent);
}

.user-btn-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ---- TASK BUTTON ---- */
.task-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--text-dim);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.2s, color 0.2s;
  padding: 0;
}

.task-btn-pending { border-color: var(--danger);  color: var(--danger); }
.task-btn-working { border-color: var(--gold);    color: var(--gold); }
.task-btn-done    { border-color: var(--success); color: var(--success); }

.task-btn-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ---- TASKS OVERLAY ---- */
.tasks-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.tasks-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-top) + 14px) 16px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bg3);
  flex-shrink: 0;
}

.tasks-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.tasks-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
  text-transform: uppercase;
}

.tasks-role-label {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  margin-left: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tasks-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  padding-bottom: calc(var(--safe-bot) + 14px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.tasks-status {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.9rem;
}

.tasks-error { color: var(--danger); font-style: normal; }

/* ---- TASK ITEM ---- */
.task-item {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.task-item-pending { border-left: 3px solid var(--danger); }
.task-item-working { border-left: 3px solid var(--gold); }
.task-item-done    { border-left: 3px solid var(--success); opacity: 0.7; }

.task-item-body {
  flex: 1;
  min-width: 0;
}

.task-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.task-wp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.task-wp-name {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-wp-tracking {
  color: var(--accent);
  border-color: var(--accent);
}

.task-status-badge {
  padding: 6px 10px;
  border-radius: 20px;
  border: none;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.task-status-badge:hover { opacity: 0.8; }

.status-pending { background: rgba(255, 77, 77, 0.2);  color: var(--danger); }
.status-working { background: rgba(255, 215, 0, 0.2);  color: var(--gold); }
.status-done    { background: rgba(0, 230, 118, 0.2);  color: var(--success); }

/* ---- LOGIN MODAL ---- */
.login-modal {
  max-width: 380px;
}

.login-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.login-logo {
  width: 36px;
  height: 36px;
  color: var(--accent);
  flex-shrink: 0;
}

.login-modal h3 {
  font-size: 1.2rem;
  letter-spacing: 1px;
  color: var(--text);
  margin: 0;
}

.login-error {
  background: rgba(255, 77, 77, 0.15);
  border: 1px solid rgba(255, 77, 77, 0.4);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--danger);
  margin-bottom: 14px;
}

.login-google-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg3);
  border: 1px solid #2a5080;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s;
}

.login-google-btn:hover { background: var(--bg2); }

.login-toggle {
  margin-top: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.login-toggle-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ---- USER SIGNED-IN VIEW ---- */
.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 212, 255, 0.2);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.user-info-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.user-info-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info-email {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.danger-btn {
  color: var(--danger);
  border-color: rgba(255, 77, 77, 0.3);
}

.danger-btn:hover {
  background: rgba(255, 77, 77, 0.1);
}

/* ---- TABS ---- */
.tabs {
  display: flex;
  background: var(--bg2);
  border-bottom: 2px solid var(--bg3);
  flex-shrink: 0;
}

.tab {
  flex: 1;
  padding: 12px 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- MAIN / TAB CONTENT ---- */
main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-content {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 12px;
  padding-bottom: calc(var(--safe-bot) + 12px);
  -webkit-overflow-scrolling: touch;
}
.tab-content.active { display: block; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}
.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.4;
}
.empty-hint {
  font-size: 0.85rem;
  margin-top: 8px;
  line-height: 1.5;
}

/* ---- TRACK LIST ---- */
.track-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.track-card {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
}

.track-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.track-card-update-icon {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 20px;
  padding: 3px 8px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.track-card-update-icon.flash {
  animation: wpUpdateFlash 10s ease-out forwards;
}

.track-metrics {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.track-metric {
  flex: 1;
}

.track-metric-value {
  font-size: 2.6rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;
}

.track-metric-value.bearing-val {
  color: var(--gold);
}

.track-metric-unit {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-left: 2px;
}

.track-metric-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}

.track-no-gps {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
}

/* ---- WAYPOINTS LIST ---- */
.wp-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.wp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wp-item {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wp-item.tracked {
  border-color: var(--accent);
}

.wp-track-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  position: relative;
}

.wp-item.tracked .wp-track-toggle {
  border-color: var(--accent);
  background: var(--accent);
}

.wp-track-toggle::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--bg2);
  transition: all 0.2s;
}

.wp-item.tracked .wp-track-toggle::after {
  background: var(--accent);
}

.wp-info {
  flex: 1;
  min-width: 0;
}

.wp-name {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wp-coords {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
  margin-top: 2px;
}

.wp-origin {
  font-size: 0.65rem;
  color: var(--gold);
  font-family: 'Courier New', monospace;
  margin-top: 3px;
  opacity: 0.8;
}

.wp-buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--bg3);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-icon:hover { background: var(--bg); }
.btn-icon.delete { color: var(--danger); }

/* ---- FORMS ---- */
.form-card {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.form-card h3 {
  font-size: 1rem;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.form-row {
  margin-bottom: 12px;
}

.form-row label {
  display: block;
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-row input,
.form-row select {
  width: 100%;
  padding: 14px 14px;
  background: var(--bg3);
  border: 1px solid #1e4070;
  border-radius: 8px;
  color: var(--text);
  font-size: 1.2rem;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-row input:focus,
.form-row select:focus {
  border-color: var(--accent);
}

.form-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%237a9abf'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.hidden { display: none !important; }

/* ---- BUTTONS ---- */
.btn-primary {
  padding: 14px 22px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  padding: 14px 22px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid #1e4070;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--bg2); }

.btn-ghost {
  padding: 14px 22px;
  background: none;
  color: var(--text-dim);
  border: 1px solid var(--bg3);
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
}

/* ---- TARGET DISPLAY ---- */
.target-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.target-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
  background: rgba(0,212,255,0.12);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(0,212,255,0.3);
}

.target-coords-small {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
}

/* ---- COMPASS ---- */
.compass-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
}

.compass-wrap svg {
  width: min(260px, 80vw);
  height: min(260px, 80vw);
}

.big-metric-row {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.big-metric {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
}

.metric-value {
  font-size: 2.6rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;
}

.big-metric:first-child .metric-value {
  color: var(--gold);
}

.metric-unit {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.metric-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ---- WAYPOINT DETAIL FULLSCREEN ---- */
.wp-detail-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--safe-top) + 0px) 0 calc(var(--safe-bot) + 16px);
}

.wp-detail-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bg3);
  flex-shrink: 0;
}

.wp-detail-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.wp-detail-update-icon {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 20px;
  padding: 4px 10px;
  flex-shrink: 0;
}

.wp-detail-update-icon.flash {
  animation: wpUpdateFlash 10s ease-out forwards;
}

@keyframes wpUpdateFlash {
  0%    { opacity: 1; transform: scale(1.2);  background: rgba(255, 215, 0, 0.6); }
  5%    { opacity: 0; transform: scale(1); }
  10%   { opacity: 1; background: rgba(255, 215, 0, 0.5); }
  15%   { opacity: 0; }
  20%   { opacity: 1; background: rgba(255, 215, 0, 0.4); }
  25%   { opacity: 0; }
  30%   { opacity: 1; background: rgba(255, 215, 0, 0.35); }
  35%   { opacity: 0; }
  40%   { opacity: 1; background: rgba(255, 215, 0, 0.3); }
  50%   { opacity: 0.2; }
  60%   { opacity: 1; }
  70%   { opacity: 0.2; }
  80%   { opacity: 1; }
  90%   { opacity: 0.5; }
  100%  { opacity: 0; }
}

.wp-detail-name {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text);
  text-transform: uppercase;
  flex: 1;
}

.wp-detail-dist-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 32px;
  flex-shrink: 0;
}

.wp-detail-dist {
  font-size: 7rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -3px;
}

.wp-detail-dist-unit {
  font-size: 2rem;
  color: var(--text-dim);
  font-weight: 600;
}

.wp-detail-arrow-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  gap: 8px;
}

.wp-detail-heading-hint {
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  font-style: italic;
}

.wp-detail-arrow-wrap svg {
  width: min(280px, 70vw);
  height: min(280px, 70vw);
}

.wp-detail-bearing-val {
  font-size: 3.5rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--gold);
  letter-spacing: 3px;
  flex-shrink: 0;
}

.wp-detail-bearing-lbl {
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 6px;
  flex-shrink: 0;
}

.wp-detail-stats-row {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 16px;
}

.wp-detail-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}

.wp-detail-stat-val {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--text);
  line-height: 1;
}

.wp-detail-stat-unit {
  font-size: 1rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-left: 2px;
}

.wp-detail-stat-lbl {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
}

.track-card { cursor: pointer; }
.track-card:active { opacity: 0.75; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
}

.modal h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text);
}

.modal input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid #1e4070;
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  margin-bottom: 16px;
}

/* ---- RACE SELECTION ---- */
.race-section {
  margin-top: 18px;
  border-top: 1px solid var(--bg3);
  padding-top: 14px;
}

.race-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.race-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.race-refresh-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
  line-height: 1;
}
.race-refresh-btn:hover { color: var(--accent); }

.race-select {
  width: 100%;
  padding: 12px 32px 12px 14px;
  background: var(--bg3);
  border: 1px solid #1e4070;
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%237a9abf'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.race-select:focus  { border-color: var(--accent); }
.race-select:disabled { opacity: 0.45; cursor: not-allowed; }

.race-status {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 5px;
  font-style: italic;
  min-height: 1em;
}
.race-status-error {
  color: var(--danger);
  font-style: normal;
}

/* ---- SHARED WAYPOINTS ---- */
.shared-wp-section {
  margin-top: 20px;
  border-top: 2px solid var(--bg3);
  padding-top: 14px;
}

.shared-wp-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.shared-wp-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.shared-wp-race-name {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-wp-item {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.shared-wp-item.tracked {
  border-color: var(--accent);
}

.shared-wp-item.tracked .wp-track-toggle {
  border-color: var(--accent);
  background: var(--accent);
}

.shared-wp-item.tracked .wp-track-toggle::after {
  background: var(--accent);
}

.shared-wp-info {
  flex: 1;
  min-width: 0;
}

.shared-wp-name {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-wp-meta {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
  margin-top: 2px;
}

.shared-wp-by {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 2px;
  font-style: italic;
}

.shared-wp-status {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  padding: 12px;
  font-style: italic;
}
.shared-wp-error { color: var(--danger); font-style: normal; }

.shared-wp-imported {
  color: var(--success);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0 6px;
}

.btn-icon-shared {
  color: var(--accent);
  opacity: 0.7;
  cursor: default;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }

/* ---- INPUT placeholder ---- */
input::placeholder { color: #3a5a7a; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { opacity: 0.4; }
