:root {
  --bg: #0d1b2e;
  --bg-alt: #14273f;
  --card: #17304d;
  --card-border: #24425f;
  --text: #eef4fb;
  --text-dim: #a9bdd4;
  --accent: #5fc7ff;
  --accent-strong: #8fe1ff;
  --radius: 14px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(ellipse at top, var(--bg-alt), var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.site-header {
  padding: 2rem 1.25rem 1.5rem;
  text-align: center;
  padding-top: max(2rem, env(safe-area-inset-top));
}

.header-inner h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  letter-spacing: -0.01em;
}

.logo-icon {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.tagline {
  margin: 0.4rem 0 0;
  color: var(--text-dim);
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
}

.status {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 0 1rem 1rem;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.card-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(160deg, #1e3a5c, #0e223b 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-fill {
  font-size: 3rem;
  opacity: 0.35;
}

.cam-label {
  position: absolute;
  top: 0.6rem;
  left: 0.7rem;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.play-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(13, 27, 46, 0.75);
  color: var(--text);
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.15s ease, transform 0.15s ease;
}

.play-btn:hover,
.play-btn:focus-visible {
  background: rgba(95, 199, 255, 0.25);
  border-color: var(--accent);
}

.play-btn:active {
  transform: scale(0.97);
}

.play-icon {
  color: var(--accent-strong);
}

.card-body {
  padding: 0.9rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.elevation {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.area {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.weather {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--card-border);
  font-size: 0.9rem;
  min-height: 1.6rem;
}

.weather-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.weather-text strong {
  color: var(--accent-strong);
}

.site-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 1.5rem 1rem 2rem;
}

.site-footer a {
  color: var(--accent);
}

/* --- Cam modal --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 16, 0.85);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  border-bottom: 1px solid var(--card-border);
}

.modal-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.modal-close {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 8px;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.modal-frame-wrap {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
}

#modalFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

body.modal-open {
  overflow: hidden;
}

/* --- Mobile-specific tuning --- */
@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    padding: 1.5rem 1rem 1rem;
  }

  .card-heading h2 {
    font-size: 1.05rem;
  }

  .modal {
    padding: 0;
  }

  .modal-panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-height: 100%;
  }

  .modal-frame-wrap {
    flex: 1;
    aspect-ratio: auto;
  }
}

@media (hover: none) {
  .play-btn {
    background: rgba(13, 27, 46, 0.85);
  }
}
