:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #5b6575;
  --line: #d7dce5;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --gold: #f2b84b;
  --space: #101828;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--wash);
  color: var(--ink);
}

a { color: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.nav {
  width: min(1120px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 900;
}

.menu {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.menu a:hover,
.menu a[aria-current="page"] {
  background: #e5f4f2;
  color: var(--accent-dark);
}

main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.hero {
  min-height: calc(100vh - 68px);
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 56px 0 72px;
}

.hero h1,
.page-title h1 {
  max-width: 840px;
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 6rem);
  line-height: 1;
  letter-spacing: 0;
}

.hero p,
.page-title p {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.7;
}

.hero-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.stat strong { display: block; font-size: 1.55rem; color: var(--accent-dark); }
.stat span { display: block; margin-top: 6px; color: var(--muted); line-height: 1.5; }

.page-title { padding: 54px 0 28px; display: grid; gap: 16px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 12px 0 64px;
}

.gallery figure {
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery figcaption {
  padding: 14px 15px 16px;
  color: var(--muted);
  line-height: 1.5;
}

.gallery strong { color: var(--ink); }

.map-wrap { padding: 12px 0 64px; }

.map-frame {
  width: 100%;
  min-height: 620px;
  border: 0;
  display: block;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
  background: #dbe8f2;
}

.tracker-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 12px 0 64px;
}

#iss-map,
#iss-globe {
  min-height: 620px;
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
  background: #dbe8f2;
  overflow: hidden;
}

.telemetry {
  display: grid;
  align-content: start;
  gap: 12px;
}

.telemetry-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.telemetry-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
}

.telemetry-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1.15;
}

.status-line {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.iss-marker {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--space);
  border: 3px solid var(--gold);
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.35);
  color: white;
  font-size: 18px;
  line-height: 1;
}

.iss-marker::before { content: "ISS"; font-size: 10px; font-weight: 900; letter-spacing: 0; }

@media (max-width: 900px) {
  .nav { align-items: flex-start; flex-direction: column; padding: 14px 0; }
  .menu { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu a { justify-content: center; padding: 0 8px; }
  .hero { min-height: auto; padding-top: 42px; }
  .hero-panel, .gallery, .tracker-layout { grid-template-columns: 1fr; }
  .map-frame, #iss-map,
#iss-globe { min-height: 520px; }
}

#iss-globe canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.hot-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  padding: 12px 0 64px;
}

.hot-gallery figure {
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.hot-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.hot-gallery figcaption {
  padding: 14px 15px 16px;
  color: var(--muted);
  line-height: 1.5;
}

.hot-gallery strong { color: var(--ink); }

@media (max-width: 900px) {
  .hot-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .hot-gallery { grid-template-columns: 1fr; }
}

.video-chat-shell {
  display: grid;
  gap: 18px;
  padding: 12px 0 64px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.video-panel {
  min-height: 420px;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b1320;
}

.video-panel video {
  width: 100%;
  height: 100%;
  min-height: 360px;
  display: block;
  object-fit: cover;
  background: #0b1320;
}

.video-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: #f7fafc;
  background: #111827;
  font-weight: 800;
}

.video-label span {
  color: #9ca3af;
  font-weight: 700;
}

.chat-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chat-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: white;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.chat-button.secondary { background: #334155; }
.chat-button.danger { background: #b42318; }
.chat-button:disabled { cursor: not-allowed; opacity: 0.48; }

.chat-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.safety-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .video-grid { grid-template-columns: 1fr; }
  .video-panel { min-height: 320px; }
  .video-panel video { min-height: 280px; }
  .chat-controls { align-items: stretch; flex-direction: column; }
  .control-buttons { width: 100%; }
  .chat-button { flex: 1 1 120px; }
}

.house-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 12px 0 64px;
}

#house-scene {
  min-height: 680px;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #101820;
}

#house-scene canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.house-info {
  display: grid;
  align-content: start;
  gap: 12px;
}

.house-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.house-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

.house-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.25;
}

.house-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 900px) {
  .house-shell { grid-template-columns: 1fr; }
  #house-scene { min-height: 560px; }
}

.monitor-page {
  width: min(1440px, calc(100% - 32px));
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  padding: 12px 0 64px;
}

.monitor-card {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
}

.monitor-card header {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 900;
}

.monitor-card header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.monitor-card .body {
  padding: 14px;
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.big-number {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 4rem;
  line-height: 1;
  font-weight: 900;
  color: var(--ink);
}

.big-number small {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}

.meter {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.meter > i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #f2b84b, #ef4444);
  transition: width 0.35s ease;
}

.monitor-kv {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.monitor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.monitor-table th,
.monitor-table td {
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.monitor-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.monitor-log {
  height: 280px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  background: #0b1320;
  color: #dbeafe;
  font: 0.78rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.monitor-chart {
  width: 100%;
  height: 160px;
  display: block;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-weight: 900;
}

.status-pill.warn {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.bad {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 1100px) {
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 6; }
}

@media (max-width: 760px) {
  .monitor-page { width: min(100% - 32px, 720px); }
  .monitor-grid { grid-template-columns: 1fr; }
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-12 { grid-column: span 1; }
  .big-number { font-size: 3rem; }
  .monitor-table { font-size: 0.84rem; }
}

.livecam-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 70px;
}

.livecam-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.8fr);
  gap: 18px;
  align-items: stretch;
  margin: 22px 0 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
}

.livecam-feature .livecam-frame {
  border-radius: 0;
}

.livecam-feature-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 24px;
}

.livecam-feature-copy span {
  width: fit-content;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.livecam-feature-copy h2,
.livecam-card-body h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

.livecam-feature-copy p,
.livecam-card-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.livecam-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.livecam-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.livecam-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0b1320;
}

.livecam-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.livecam-card-body {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.livecam-card-body a,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: #12332f;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.livecam-card-body a:hover,
.button-link:hover {
  background: #25645c;
}

@media (max-width: 840px) {
  .livecam-feature,
  .livecam-grid {
    grid-template-columns: 1fr;
  }
}
