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

:root {
  --bg:     #080b18;
  --bg2:    #0c1020;
  --border: #1a2240;
  --dim:    #ef9d4b;
  --dimmer: #4a7fa5;
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, #0d1530 0%, #080b18 65%);
  color: #d0d8f0;
  font-family: 'SF Mono', ui-monospace, 'Fira Mono', 'Courier New', monospace;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Header ─────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,11,24,0.93);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.h-left { display: flex; align-items: center; gap: 9px; }

.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4A90D9; box-shadow: 0 0 7px #4A90D9;
  animation: pulse 2.6s ease-in-out infinite; flex-shrink: 0;
}
@keyframes pulse {
  0%,100% { opacity:1; box-shadow:0 0 7px #4A90D9; }
  50%      { opacity:.4; box-shadow:0 0 2px #4A90D9; }
}

header h1 {
  font-size: 16px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: #e8eeff;
}

.h-right { display: flex; align-items: center; gap: 8px; }

#utc-clock {
  font-size: 10px; color: var(--dim);
  letter-spacing: .05em; min-width: 64px; text-align: right;
}

#refresh-btn, #geo-btn, #band-btn, #visual-btn, #day-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 4px; color: var(--dim);
  font-family: inherit;
  padding: 3px 10px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, color .15s;
}
#refresh-btn { font-size: 14px; }
#geo-btn,
#band-btn,
#visual-btn,
#day-btn     { font-size: 9px; letter-spacing: .08em; }
#refresh-btn:active        { border-color: #4A90D9; color: #4A90D9; }
#geo-btn:active,
#geo-btn.active            { border-color: #6FA8DC; color: #6FA8DC; }
#band-btn:active,
#band-btn.active           { border-color: #50C8B4; color: #50C8B4; }
/* Experimental — see removal note in js/config.js next to sat.kmaVisual */
#visual-btn:active,
#visual-btn.active         { border-color: #E0708A; color: #E0708A; }
#day-btn:active,
#day-btn.active            { border-color: #E8C840; color: #E8C840; }

/* ── Subtitle ───────────────────────────── */
.subtitle {
  text-align: center; font-size: 11px;
  color: var(--dimmer); letter-spacing: .07em;
  padding: 8px 0 4px;
}

/* ── Grid: 2 col mobile → 3 tablet → 6 wide ── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 10px 12px 24px;
  max-width: 1440px; margin: 0 auto;
}
@media (min-width: 480px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(6, 1fr); gap: 16px; padding: 14px 24px 32px; } }

/* ── Card ───────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 10px 12px;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; position: relative; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s;
  user-select: none;
}
.card:active { transform: scale(.97); }
.card.loaded:hover { border-color: #1e2a4a; }

.card-accent {
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
}

/* ── Disc ───────────────────────────────── */
.disc-wrap {
  width: min(calc(100% - 8px), 240px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #030509;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  position: relative; flex-shrink: 0;
}

.disc-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
  opacity: 0; transition: opacity .5s;
}
.disc-img.show { opacity: 1; }
.disc-img.show.dim { opacity: .4; }
/* KMA's GK-2A VISUAL image has a title-text band along the top edge; the globe
   itself is offset down within the frame, so crop from the top instead of center. */
.disc-img.kma-frame { object-position: center bottom; }

.disc-status {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: var(--dim); letter-spacing: .04em;
  text-align: center; padding: 10px;
  transition: opacity .3s;
}
.disc-status.hide { opacity: 0; pointer-events: none; }

.spin { animation: rotateSpin 1.1s linear infinite; transform-origin: center; }
@keyframes rotateSpin { to { transform: rotate(360deg); } }

/* ── Card body ──────────────────────────── */
.card-body {
  margin-top: 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}

.sat-dot { width: 5px; height: 5px; border-radius: 50%; margin-bottom: 2px; }
.card-name { font-size: 13px; font-weight: 700; color: #e8eeff; letter-spacing: .05em; }
.card-sub  { font-size: 10px; color: var(--dim); letter-spacing: .04em; line-height: 1.4; }
.card-lon  { font-size: 10px; color: var(--dimmer); letter-spacing: .04em; }
.card-source {
  font-size: 9px; color: var(--dimmer); letter-spacing: .06em;
  text-transform: uppercase; opacity: .65; margin-top: 1px;
}

/* ── Modal ──────────────────────────────── */
#modal {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(3,5,12,.94);
  align-items: center; justify-content: center;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
#modal.open { display: flex; }

.modal-box {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 900px;
  max-height: 100vh; overflow-y: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  gap: 10px;
}

.modal-close {
  position: fixed; top: 14px; right: 18px; z-index: 110;
  background: rgba(8,11,24,.85); border: 1px solid var(--border);
  border-radius: 6px; color: var(--dim);
  font-size: 15px; cursor: pointer; font-family: inherit;
  -webkit-tap-highlight-color: transparent; padding: 5px 11px;
  transition: color .15s, border-color .15s;
}
.modal-close:active { color: #e8eeff; border-color: #4A90D9; }

.modal-viewer {
  display: flex; align-items: center; gap: 8px; width: 100%;
}

.modal-nav-btn {
  flex-shrink: 0; width: 44px; height: 44px;
  background: none; border: 1px solid var(--border);
  border-radius: 8px; color: var(--dim);
  font-size: 24px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, color .15s;
}
.modal-nav-btn:active { border-color: #4A90D9; color: #4A90D9; }
.modal-nav-btn.invis  { visibility: hidden; pointer-events: none; }

.modal-img-wrap {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center;
}

.modal-earth {
  width: min(calc(100vw - 108px), calc(100vh - 200px), 700px);
  aspect-ratio: 1;
  border-radius: 50%; border: 1px solid var(--border);
  display: block; transition: opacity .2s;
}

.modal-info {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
}
.modal-head  { display: flex; align-items: center; gap: 7px; justify-content: center; }
.modal-title { font-size: 16px; font-weight: 700; color: #e8eeff; letter-spacing: .08em; }
.modal-msub  { font-size: 10px; color: var(--dim); font-weight: 400; }
.modal-lon   { font-size: 9px; color: var(--dimmer); }
.modal-note  { font-size: 10px; color: var(--dimmer); letter-spacing: .04em; }
.modal-source {
  font-size: 9px; color: var(--dimmer); letter-spacing: .06em;
  text-transform: uppercase; opacity: .65;
}
.modal-link  {
  font-size: 9px; color: var(--dim); text-decoration: none;
  border-bottom: 1px solid var(--border); padding-bottom: 1px; letter-spacing: .04em;
}

.modal-dots { display: flex; gap: 8px; align-items: center; padding-top: 2px; }
.modal-dot  {
  width: 7px; height: 7px; border-radius: 50%;
  cursor: pointer; border: none;
  transition: opacity .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.modal-dot.active { transform: scale(1.5); }

/* ── Footer ─────────────────────────────── */
footer {
  padding: 10px 18px 14px; border-top: 1px solid var(--border);
  font-size: 10px; color: var(--dimmer); letter-spacing: .04em;
  text-align: center; line-height: 1.8;
  max-width: 1200px; margin: 0 auto;
}
