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

:root {
  --ui-font: 1rem;
}

/* Hidden SVG sprite for icon references */
.icon-sprite {
  display: none;
}

/* Header left section (title + author info) */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Inline SVG icons inside buttons */
.icon-inline {
  vertical-align: middle;
  margin-right: 4px;
}

/* Non-blocking status bar (replaces alert()) */
.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  pointer-events: none;
  display: flex;
  justify-content: center;
}

.status-message {
  pointer-events: auto;
  background: #1a2332;
  color: #c8d6e5;
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  font-size: var(--ui-font);
  border: 1px solid #2e3f52;
  border-top: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  max-width: 90%;
  text-align: center;
}

.status-message.error {
  border-color: #e74c3c;
  color: #f5b7b1;
}

body {
  background: #0a0e17;
  color: #c8d6e5;
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px;
  background: #0d1321;
  border-bottom: 1px solid #1e2a3a;
}

header h1 {
  font-size: 1.75rem;
  letter-spacing: 0.05em;
}

header h1 a {
  color: #f0c040;
  text-decoration: none;
  text-shadow: 0 0 12px rgba(240, 192, 64, 0.35);
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.controls label {
  margin-right: 0;
  font-size: var(--ui-font);
  white-space: nowrap;
}

.controls input[type="number"] {
  width: 85px;
  padding: 4px 4px;
  background: #1a2332;
  border: 1px solid #2e3f52;
  color: #c8d6e5;
  border-radius: 4px;
  font-size: var(--ui-font);
}

.controls input[type="number"]#lon {
  width: 95px;
}

/* Timezone input: native number spinners with '+' sign overlay prefix */
.tz-field {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tz-field .tz-sign {
  position: absolute;
  left: 6px;
  pointer-events: none;
  color: #c8d6e5;
  font-size: var(--ui-font);
  z-index: 1;
}

.controls input[type="number"]#tz {
  width: 60px;
  padding-left: 14px; /* room for '+'; JS shrinks to 4px for negatives */
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#tz-label {
  margin-left: 10px;
  font-size: var(--ui-font);
  color: #7ec8e3;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  overflow: hidden;
}

#sky-map {
  width: 100%;
  height: 100%;
  min-height: 300px;
  background: radial-gradient(ellipse at center, #0f1a2e 0%, #050810 100%);
  cursor: crosshair;
}

.zoom-slider-vertical {
  position: fixed;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 100;
}

.zoom-slider-vertical span,
.zoom-slider-vertical button {
  color: #c8d6e5;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
}

.zoom-slider-vertical button {
  background: #1a2332;
  border: 1px solid #2e3f52;
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
}

.zoom-slider-vertical button:hover {
  background: #2e3f52;
}

#zoom-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 24px;
  accent-color: #f0c040;
}

.time-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 16px;
  background: #0d1321;
  border-top: 1px solid #1e2a3a;
  width: 100%;
}

.time-controls label {
  font-size: var(--ui-font);
}

#time-slider {
  flex: 1;
  max-width: 600px;
  accent-color: #f0c040;
}

#time-display {
  font-family: 'Courier New', monospace;
  font-size: var(--ui-font);
  color: #f0c040;
  min-width: 180px;
}

#now-btn {
  padding: 6px 14px;
  background: #1a2332;
  border: 1px solid #2e3f52;
  color: #c8d6e5;
  border-radius: 4px;
  cursor: pointer;
  font-size: var(--ui-font);
}

#now-btn:hover {
  background: #2e3f52;
}

#locate-btn,
#go-btn {
  padding: 4px 10px;
  background: #1a2332;
  border: 1px solid #2e3f52;
  color: #c8d6e5;
  border-radius: 4px;
  cursor: pointer;
  font-size: var(--ui-font);
}

#locate-btn {
  margin-right: 12px;
}

#locate-btn:hover,
#go-btn:hover {
  background: #2e3f52;
}

.auto-refresh-controls {
  position: fixed;
  bottom: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 100;
}

#auto-refresh-btn {
  padding: 8px 14px;
  background: #1a2332;
  border: 1px solid #2e3f52;
  color: #c8d6e5;
  border-radius: 6px;
  cursor: pointer;
  font-size: var(--ui-font);
}

.interval-label {
  color: #c8d6e5;
  font-size: var(--ui-font);
}

#refresh-interval {
  padding: 8px 8px;
  background: #1a2332;
  border: 1px solid #2e3f52;
  color: #c8d6e5;
  border-radius: 6px;
  font-size: var(--ui-font);
  -webkit-appearance: none;
  appearance: none;
}

#auto-refresh-btn:hover {
  background: #2e3f52;
}

#author-info {
  display: flex;
  flex-direction: column;
  font-size: 0.7rem;
  line-height: 1.25;
  color: rgba(200, 214, 229, 0.5);
  border-left: 1px solid #1e2a3a;
  padding-left: 12px;
}

#starlink-status {
  font-size: var(--ui-font);
  color: #c8d6e5;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
}

#tle-status {
  font-size: var(--ui-font);
  color: #7a8fa6;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
}


/* ============================================================
   Responsive breakpoints
   ============================================================ */

/* --- Tablet (≤768px): controls wrap, smaller fonts --- */
@media (max-width: 768px) {
  :root {
    --ui-font: 0.9rem;
  }

  header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }

  header h1 {
    font-size: 1.4rem;
    text-align: center;
  }

  .controls {
    justify-content: center;
    flex-wrap: wrap;
  }

  .controls input[type="number"] {
    width: 70px;
  }

  .controls input[type="number"]#lon {
    width: 80px;
  }

  #locate-btn,
  #go-btn {
    padding: 6px 12px;
  }

  .time-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
  }

  #time-display {
    min-width: auto;
    order: -1;
    width: 100%;
    text-align: center;
  }

}

/* --- Phone (≤480px): full vertical stack, compact spacing --- */
@media (max-width: 480px) {
  :root {
    --ui-font: 0.85rem;
  }

  header h1 {
    font-size: 1.2rem;
  }

  #author-info {
    display: none;
  }

  .controls {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .controls input[type="number"] {
    width: 120px;
  }

  .controls input[type="number"]#lon {
    width: 130px;
  }

  #locate-btn,
  #go-btn {
    width: 140px;
    padding: 8px 16px;
  }

  .time-controls {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
  }

  #time-slider {
    width: 100%;
    max-width: none;
  }

  #now-btn {
    padding: 8px 16px;
  }

  .auto-refresh-controls {
    bottom: 2px;
    right: 2px;
    gap: 4px;
  }

  #auto-refresh-btn {
    padding: 6px 10px;
  }

  #refresh-interval {
    padding: 6px 6px;
  }

}
