:root {
  --bg: #08111f;
  --bg-accent: radial-gradient(circle at top left, rgba(22, 119, 255, 0.25), transparent 38%),
    radial-gradient(circle at top right, rgba(95, 211, 189, 0.18), transparent 32%),
    linear-gradient(160deg, #08111f 0%, #0e1e33 48%, #07101b 100%);
  --panel: rgba(9, 20, 36, 0.82);
  --panel-border: rgba(180, 209, 255, 0.14);
  --text: #f5f8ff;
  --muted: #a8bad8;
  --accent: #67d7c4;
  --accent-strong: #1ed4ff;
  --warning: #ffce73;
  --danger: #ff8475;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius: 22px;
  --font-stack: "Segoe UI", "SF Pro Display", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-stack);
  color: var(--text);
  background: #07101b;
}

body {
  background-image: var(--bg-accent);
  background-attachment: fixed;
}

button,
a {
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

button:hover,
a:hover {
  transform: translateY(-1px);
}

button:disabled,
.disabled-link {
  opacity: 0.55;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.app-shell,
.mobile-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.hero,
.mobile-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.hero h1,
.mobile-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.05;
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
}

.hero-actions,
.panel-actions,
.mobile-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 700;
}

.viewer-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(270px, 320px) minmax(0, 1.3fr) minmax(320px, 420px);
}

.recordings-panel {
  grid-column: 1 / -1;
}

.photos-panel {
  grid-column: 1 / -1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 18px;
}

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

.panel-header h2,
.panel h3 {
  margin: 0;
}

.badge,
.mono-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
}

.mono-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.badge-waiting {
  color: #ffe1a1;
}

.badge-connected {
  color: #9effd7;
}

.badge-error {
  color: #ffb4aa;
}

.primary-button,
.secondary-button,
.link-button {
  border-radius: 14px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
}

.primary-button {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #042032;
  font-weight: 700;
}

.secondary-button,
.link-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.notice {
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 18px;
  line-height: 1.45;
}

.notice.warning {
  background: rgba(255, 206, 115, 0.12);
  border: 1px solid rgba(255, 206, 115, 0.24);
  color: #ffe6b5;
}

.notice.info {
  background: rgba(30, 212, 255, 0.1);
  border: 1px solid rgba(30, 212, 255, 0.2);
  color: #d7f8ff;
}

.qr-image {
  display: block;
  width: min(100%, 280px);
  aspect-ratio: 1;
  margin: 18px auto;
  background: white;
  padding: 12px;
  border-radius: 22px;
}

.muted {
  color: var(--muted);
}

.kv-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.kv-list div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.kv-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.video-frame {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  min-height: 260px;
  background: linear-gradient(160deg, rgba(7, 18, 33, 0.96), rgba(15, 34, 58, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.video-frame video {
  width: 100%;
  height: 100%;
  min-height: 260px;
  display: block;
  object-fit: cover;
  background: #000;
}

.live-canvas {
  width: 100%;
  height: 100%;
  min-height: 260px;
  display: block;
  object-fit: cover;
  background: #000;
}

.mobile-video-frame video {
  min-height: 320px;
}

.video-overlay {
  position: absolute;
  inset: auto 16px 16px 16px;
  border-radius: 14px;
  background: rgba(5, 10, 18, 0.7);
  padding: 10px 12px;
  color: #eaf4ff;
  font-weight: 600;
}

.status-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.status-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.map-wrapper {
  margin: 16px 0;
}

.map-frame {
  width: 100%;
  min-height: 280px;
  border: 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
}

.latest-photo-card {
  margin-top: 8px;
}

.latest-photo-image {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #000;
}

.history-list,
.recordings-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

.history-list li,
.recordings-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.45;
}

.recordings-list strong,
.history-list strong {
  display: block;
  margin-bottom: 4px;
}

.recording-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.mobile-layout {
  display: grid;
  gap: 18px;
}

code {
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 1140px) {
  .viewer-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell,
  .mobile-shell {
    padding: 18px 14px 40px;
  }

  .hero,
  .mobile-hero,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions,
  .panel-actions,
  .mobile-controls {
    width: 100%;
  }

  .hero-actions > *,
  .panel-actions > *,
  .mobile-controls > * {
    flex: 1 1 100%;
  }
}

.minimal-mobile-page {
  background: #000;
}

.minimal-mobile-shell {
  position: relative;
  min-height: 100vh;
  background: #000;
  overflow: hidden;
}

.minimal-mobile-video {
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  background: #000;
}

.minimal-mobile-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border-radius: 14px;
  background: rgba(5, 10, 18, 0.56);
  padding: 10px 12px;
  color: #fff;
  font-weight: 600;
}

.minimal-mobile-overlay:empty {
  display: none;
}

.minimal-mobile-overlay.is-ghost {
  opacity: 0;
  pointer-events: none;
}

.minimal-mobile-status {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  gap: 10px;
}

.minimal-mobile-status.is-ghost {
  opacity: 0;
  pointer-events: none;
}

.minimal-mobile-message {
  margin-bottom: 0;
  background: rgba(30, 212, 255, 0.14);
}

.minimal-mobile-warning {
  position: absolute;
  top: 84px;
  left: 12px;
  right: 12px;
  z-index: 2;
}

.minimal-mobile-controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 84px;
  display: grid;
  gap: 10px;
  z-index: 2;
}
