:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --border: #e6e2d8;
  --border-strong: #c9c4b6;
  --text: #181715;
  --text-muted: #6b685f;
  --text-subtle: #9a968a;
  --accent: #a8341e;
  --accent-hover: #141414;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  padding: 72px 32px 96px;
}

.container { max-width: 1240px; margin: 0 auto; }

/* ─── Header ─── */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  padding-bottom: 36px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
}
.header-left h1 {
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 10px;
}
.header-left p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 460px;
}
.header-right {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.header-right .label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  color: var(--text-subtle);
  margin-bottom: 6px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}
.header-right .value {
  font-size: 13px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.header-right .count {
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}
.header-right .count strong {
  color: var(--text);
  font-weight: 600;
}

/* ─── Grid ─── */
.launch-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* ─── Card ─── */
.launch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: border-color 240ms ease, transform 240ms ease;
  animation: cardEnter 520ms cubic-bezier(.22,1,.36,1) backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.launch-card:hover { border-color: var(--border-strong); }

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Countdown */
.countdown-section { display: flex; flex-direction: column; gap: 12px; }
.countdown-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 500;
}
.countdown-cells {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.countdown-cell {
  flex: 1 1 0;
  min-width: 52px;
  padding: 12px 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.countdown-cell .value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.countdown-cell .unit {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 500;
}

/* Mission */
.mission-section { display: flex; flex-direction: column; gap: 6px; }
.mission-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--text);
}
.mission-sub {
  font-size: 14px;
  color: var(--text-muted);
}
.mission-sub .sep {
  margin: 0 8px;
  color: var(--text-subtle);
}

/* Footer of card */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.datetime { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.datetime .label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 500;
}
.datetime .value {
  font-size: 13px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.broadcast-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  transition: background 200ms ease, color 200ms ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.broadcast-link:hover {
  background: var(--accent);
  color: #fff;
}
.broadcast-link .arrow {
  display: inline-block;
  transition: transform 200ms ease;
}
.broadcast-link:hover .arrow { transform: translateX(2px); }

.no-broadcast {
  font-size: 12px;
  color: var(--text-subtle);
  font-style: italic;
  padding: 9px 0;
}

/* States */
.state {
  grid-column: 1 / -1;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.state .spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error state */
.state .error-message { margin: 0 auto 18px; max-width: 420px; }
.retry-button {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  padding: 9px 18px;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}
.retry-button:hover { background: var(--accent); color: #fff; }

/* Footer */
footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-subtle);
}
footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--text); }

/* Responsive */
@media (max-width: 860px) {
  body { padding: 48px 20px 64px; }
  header { flex-direction: column; align-items: flex-start; gap: 20px; }
  .header-right { text-align: left; }
  .header-left h1 { font-size: 30px; }
  .launch-grid { grid-template-columns: 1fr; }
  .launch-card { padding: 22px; gap: 20px; }
  .countdown-cell { min-width: 0; padding: 10px 6px 8px; }
  .countdown-cell .value { font-size: 20px; }
  .mission-name { font-size: 18px; }
  .card-footer { flex-direction: column; align-items: stretch; gap: 14px; }
  .broadcast-link, .no-broadcast { justify-content: center; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
