:root {
  --bg: #04070d;
  --panel-1: rgba(16, 23, 38, 0.92);
  --panel-2: rgba(9, 14, 24, 0.92);
  --line: #1a2940;
  --line-soft: rgba(76, 201, 240, 0.12);
  --text: #e6edf7;
  --muted: #7c8aa4;
  --faint: #4a5870;
  --cyan: #4cc9f0;
  --orange: #ff7a45;
  --red: #ff3b5c;
  --amber: #ffc857;
  --green: #43d9a3;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  background:
    radial-gradient(1100px 600px at 82% -10%, rgba(76, 201, 240, 0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgba(255, 122, 69, 0.07), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 160, 220, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 220, 0.028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 0%, black, transparent 80%);
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--cyan); }

/* ------------------------------------------------------------------ header */

.top {
  max-width: 1380px;
  margin: 0 auto;
  padding: 26px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.orb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #9fe8ff 0 8%, #2b9fc4 34%, #0d3f5c 62%, #05131f 100%);
  box-shadow:
    0 0 0 1px rgba(76, 201, 240, 0.25),
    0 0 26px rgba(76, 201, 240, 0.28),
    inset -6px -8px 16px rgba(0, 0, 0, 0.7);
  position: relative;
  flex: none;
}
.orb::after {
  content: "";
  position: absolute;
  inset: -5px -9px;
  border-radius: 50%;
  border: 1px solid rgba(76, 201, 240, 0.35);
  transform: rotate(-24deg) scaleY(0.34);
}

h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 700;
  white-space: nowrap;
}

.brand p {
  margin: 1px 0 0;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.clocks { display: flex; gap: 18px; text-align: right; align-items: center; }

.top-nav { margin-right: 4px; display: flex; align-items: center; gap: 7px; }
.top-nav a,
.install-btn {
  display: inline-block;
  padding: 5px 11px;
  border: 1px solid #22334d;
  border-radius: 999px;
  background: rgba(76, 201, 240, 0.05);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: #9fb3cf;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}
.install-btn {
  border-color: rgba(255, 200, 87, 0.4);
  color: var(--amber);
  background: rgba(255, 200, 87, 0.07);
}
.top-nav a:hover,
.install-btn:hover {
  color: var(--cyan);
  border-color: rgba(76, 201, 240, 0.45);
  background: rgba(76, 201, 240, 0.10);
}
.install-btn:hover { color: var(--amber); border-color: rgba(255, 200, 87, 0.6); }

.clock span {
  font-family: var(--mono);
  font-size: 19px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.clock small {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--faint);
  margin-top: 1px;
}
.clock.dim span { color: var(--muted); }

/* ------------------------------------------------------------------ layout */

.cols {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 16px;
  align-items: start;
}

.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.quake-panel .feed { max-height: 440px; }

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px 18px;
  background: linear-gradient(180deg, var(--panel-1), var(--panel-2));
  box-shadow: 0 18px 40px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-soft), transparent);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-title { display: flex; align-items: center; gap: 7px; min-width: 0; }

.info {
  width: 17px;
  height: 17px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #2a3b57;
  background: rgba(76, 201, 240, 0.05);
  color: #6d7f9c;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.info:hover,
.info:focus-visible {
  color: var(--cyan);
  border-color: rgba(76, 201, 240, 0.6);
  background: rgba(76, 201, 240, 0.12);
  box-shadow: 0 0 12px rgba(76, 201, 240, 0.25);
  outline: none;
}

.info-tip {
  position: fixed;
  z-index: 60;
  width: 310px;
  max-width: calc(100vw - 20px);
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #263a58;
  background: rgba(6, 11, 20, 0.98);
  box-shadow: 0 22px 50px -22px #000, 0 0 0 1px rgba(76, 201, 240, 0.06);
  color: #c6d4e8;
  font-size: 12px;
  line-height: 1.6;
  pointer-events: none;
}
.info-tip p { margin: 0; }
.info-tip p + p { margin-top: 7px; }
.info-tip p:first-child { color: #e6edf7; }
.info-tip b { color: var(--cyan); font-weight: 600; }

h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #b9c7dc;
}

.sub {
  margin: -4px 0 12px;
  font-size: 11.5px;
  color: var(--faint);
  letter-spacing: 0.02em;
}
.sub.tight { margin: 10px 0 0; }

.hint { font-family: var(--mono); font-size: 11px; color: var(--faint); }

.badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(76, 201, 240, 0.05);
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--green);
}
.live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: blink 2.4s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ------------------------------------------------------------------ map */

.map-wrap { position: relative; }

#map {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 12px;
  background: #050a12;
  border: 1px solid rgba(76, 201, 240, 0.10);
  cursor: crosshair;
}

.map-corner {
  position: absolute;
  left: 12px;
  top: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(124, 138, 164, 0.75);
  pointer-events: none;
  text-transform: uppercase;
}

.legend { display: flex; align-items: center; gap: 10px; }
.legend span {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10px; color: var(--faint);
}
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.m3 { background: #4cc9f0; }
.dot.m4 { background: var(--amber); }
.dot.m5 { background: var(--orange); }
.dot.m6 { background: var(--red); }

.map-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 11px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.iss-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  color: var(--cyan);
  border: 1px solid rgba(76, 201, 240, 0.25);
  background: rgba(76, 201, 240, 0.06);
  padding: 2px 8px; border-radius: 999px;
}
.pulse {
  width: 5px; height: 5px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
#iss-info { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* --------------------------------------------------------------- timeline */

.timeline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  padding-top: 12px;
  border-top: 1px solid rgba(26, 41, 64, 0.65);
}

.tl-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #22334d;
  background: rgba(76, 201, 240, 0.05);
  color: #9fb3cf;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: none;
}
.tl-btn:hover {
  color: var(--cyan);
  border-color: rgba(76, 201, 240, 0.45);
  background: rgba(76, 201, 240, 0.10);
}
.tl-btn.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #031018;
}

.tl-range {
  flex: 1;
  min-width: 60px;
  height: 4px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.tl-time {
  font-family: var(--mono);
  font-size: 11px;
  color: #9fb3cf;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#tl-speed { color: #6d7f9c; }
.timeline[hidden] { display: none; }

.tip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -125%);
  background: rgba(5, 10, 18, 0.95);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text);
  box-shadow: 0 10px 30px -12px #000;
  white-space: nowrap;
  z-index: 3;
}
.tip b { font-family: var(--mono); color: var(--orange); margin-right: 5px; }
.tip small { color: var(--faint); display: block; font-size: 10.5px; }

/* ------------------------------------------------------------------ digest */

.digest {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 16px;
  align-items: end;
}

.stat {
  padding: 10px 12px;
  border-left: 2px solid rgba(76, 201, 240, 0.35);
  background: linear-gradient(90deg, rgba(76, 201, 240, 0.06), transparent);
  border-radius: 0 8px 8px 0;
  min-width: 0;
}
.stat span {
  display: block;
  font-family: var(--mono);
  font-size: 25px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat small {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-box { grid-column: 1 / -1; margin-top: 4px; }
#quake-chart { width: 100%; height: 62px; display: block; }
.chart-cap {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

/* ------------------------------------------------------------------ feeds */

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #223047 transparent;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent 100%);
}
.feed::-webkit-scrollbar { width: 6px; }
.feed::-webkit-scrollbar-thumb { background: #223047; border-radius: 3px; }

.feed li {
  display: flex;
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px solid rgba(26, 41, 64, 0.55);
}
.feed li:last-child { border-bottom: 0; }
.feed .empty { color: var(--faint); justify-content: center; font-size: 12px; padding: 22px 0; }
.feed .more {
  justify-content: center;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 10px 0 4px;
}
.q-region { color: #5c7ba1; }
.badge.busy { opacity: 0.45; }

/* ------------------------------------------------------------------ quake filter */

.qf {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
}

.seg {
  display: flex;
  border: 1px solid #22334d;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(6, 11, 20, 0.5);
}
.seg button {
  flex: 1;
  height: 27px;
  padding: 0;
  border: 0;
  border-right: 1px solid #22334d;
  background: transparent;
  color: #7c8aa4;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--cyan); }
.seg button.on {
  background: rgba(76, 201, 240, 0.15);
  color: var(--cyan);
  box-shadow: inset 0 -2px 0 rgba(76, 201, 240, 0.55);
}

.mag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--faint);
}
.mag-row input {
  flex: 1;
  min-width: 0;
  height: 4px;
  accent-color: var(--orange);
  cursor: pointer;
}
.mag-row b {
  min-width: 38px;
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

#qf-q {
  width: 100%;
  height: 29px;
  padding: 0 9px;
  border: 1px solid #22334d;
  border-radius: 8px;
  background: #070d16;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}
#qf-q::placeholder { color: #3f4d63; }
#qf-q:focus {
  outline: none;
  border-color: rgba(76, 201, 240, 0.5);
  box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.08);
}
#qf-q::-webkit-search-cancel-button { filter: invert(0.6); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips:empty { display: none; }
.chip {
  padding: 2px 8px;
  border: 1px solid #22334d;
  border-radius: 999px;
  background: rgba(76, 201, 240, 0.04);
  color: #8fa3bf;
  font-family: inherit;
  font-size: 10.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { color: var(--cyan); border-color: rgba(76, 201, 240, 0.4); }
.chip.on {
  color: var(--cyan);
  border-color: rgba(76, 201, 240, 0.55);
  background: rgba(76, 201, 240, 0.16);
}

.mag {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  width: 42px;
  flex: none;
  text-align: right;
  color: var(--cyan);
}
.m3 .mag { color: #6fd3f2; }
.m4 .mag { color: var(--amber); }
.m5 .mag { color: var(--orange); }
.m6 .mag { color: var(--red); }

.q-place {
  min-width: 0;
  width: 0;
  flex: 1;
  font-size: 12.5px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-place small {
  display: block;
  color: var(--faint);
  font-size: 10.5px;
  font-family: var(--mono);
  margin-top: 2px;
}
.m5 .q-place, .m6 .q-place { color: #fff; font-weight: 500; }

/* wiki feed */
.compact li { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 8px 2px; }
.compact time { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.wiki-body { min-width: 0; }
.wiki-title {
  display: block;
  font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wiki-meta {
  display: block;
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.delta { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

/* ------------------------------------------------------------------ air */

.air-main { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 6px; }
.air-main span {
  font-family: var(--mono);
  font-size: 40px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.air-main small { color: var(--faint); font-size: 10.5px; letter-spacing: 0.06em; }

.air-meta {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--faint);
  margin-bottom: 8px;
}
.air-meta b { font-family: var(--mono); color: var(--muted); font-weight: 500; }

.spark { width: 100%; height: 54px; display: block; }

.badge.good { color: var(--green); border-color: rgba(67, 217, 163, 0.35); background: rgba(67, 217, 163, 0.08); }
.badge.mid { color: var(--amber); border-color: rgba(255, 200, 87, 0.35); background: rgba(255, 200, 87, 0.08); }
.badge.bad { color: var(--red); border-color: rgba(255, 59, 92, 0.35); background: rgba(255, 59, 92, 0.08); }

/* ------------------------------------------------------------------ sky */

.sky-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.sky-grid small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--faint);
}
.sky-grid b {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.moon-bar {
  height: 4px;
  border-radius: 2px;
  background: #16202f;
  margin: 14px 0 2px;
  overflow: hidden;
}
#moon-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, #6b7f9e, #dbe7f8);
  transition: width 0.6s ease;
}

/* --------------------------------------------------------------- station */

.station-list { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 9px; }
.station-list li {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.sdot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(67, 217, 163, 0.8);
}
.sdot.stale { background: var(--amber); box-shadow: 0 0 8px rgba(255, 200, 87, 0.7); }
.sdot.err { background: var(--red); box-shadow: 0 0 8px rgba(255, 59, 92, 0.7); }
.station-list b { font-weight: 500; font-size: 12px; }
.station-list small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.station-list em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
}

/* ------------------------------------------------------------------ foot */

.foot {
  max-width: 1380px;
  margin: 0 auto;
  padding: 4px 24px 30px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #43516a;
}
.foot-hint { color: #4d5f7a; }
.foot-hint b { color: #6d829f; font-weight: 600; }
#status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dot-live {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green);
}
#status.stale .dot-live { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
#status.down .dot-live { background: var(--red); box-shadow: 0 0 8px var(--red); }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1080px) {
  .cols { grid-template-columns: minmax(0, 1fr) 330px; }
  .air-main span { font-size: 34px; }
}

@media (max-width: 900px) {
  .cols {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 16px 16px;
  }
  .col { display: contents; }
  .map-panel { order: 1; }
  .quake-panel { order: 2; }
  .digest-panel { order: 3; }
  .air-panel { order: 4; }
  .wiki-panel { order: 5; }
  .sky-panel { order: 6; }
  .station-panel { order: 7; }
  .top { padding: 20px 16px 14px; }
  .digest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock span { font-size: 16px; }
  .brand p { display: none; }
  .feed { max-height: 280px; }
  .quake-panel .feed { max-height: 320px; }
  .foot { flex-direction: column; gap: 4px; padding-bottom: 24px; }
}

@media (max-width: 560px) {
  h1 { font-size: 20px; }
  .top { flex-wrap: wrap; gap: 10px; }
  .clocks { width: 100%; justify-content: space-between; }
  .clock.dim { display: none; }
  .map-foot { gap: 8px; font-size: 11px; }
  .stat span { font-size: 22px; }
  .timeline { gap: 7px; }
  .tl-time { font-size: 10px; }
  .tl-btn { padding: 0 6px; height: 27px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .live i { animation: none; }
}
