:root {
  --teal-50: #eef8f6;
  --teal-600: #1f7f74;
  --teal-700: #18665d;
  --teal-800: #124f48;
  --ink: #1c2e2b;
  --muted: #657a74;
  --danger: #b54a4a;
  --warn-bg: #fff8e8;
  --warn-border: #e8d6a8;
  --surface: #f5f8f7;
  --card: #ffffff;
  --border: #d4e3df;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--surface);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { -webkit-font-smoothing: antialiased; }

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom, 0px));
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--teal-800);
}
.sub {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.notice {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
}
.notice-cert {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: #5c4a1e;
}

.status {
  margin: 0.85rem 0;
  padding: 0.55rem 0.75rem;
  background: var(--teal-50);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 550;
}
.status.error {
  background: #fdf4f4;
  border-color: #efd0d0;
  color: var(--danger);
}

.videos {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .videos {
    grid-template-columns: 1.4fr 0.8fr;
    align-items: stretch;
  }
}

.video-tile {
  position: relative;
  background: #0f1c1a;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
}
.video-tile.remote {
  min-height: 200px;
}
.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0f1c1a;
  display: block;
}
.video-tile .label {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
  position: sticky;
  bottom: 0.5rem;
  padding: 0.35rem 0;
  background: linear-gradient(to top, var(--surface) 70%, transparent);
}
.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  min-height: 48px;
  min-width: 7.5rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { border-color: var(--teal-600); color: var(--teal-700); }
.btn[aria-pressed="true"] {
  background: var(--teal-50);
  border-color: var(--teal-600);
  color: var(--teal-800);
}
.btn-danger {
  background: #fdf4f4;
  border-color: #efd0d0;
  color: var(--danger);
}
.btn-danger:hover { background: #faeaea; }

.privacy {
  margin-top: 1.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}
.privacy p { margin: 0 0 0.55rem; }
.privacy strong { color: var(--ink); font-weight: 650; }

@media (max-width: 559px) {
  .video-tile.local {
    max-width: 42%;
    position: absolute;
    right: 1.25rem;
    bottom: 5.5rem;
    z-index: 2;
    aspect-ratio: 3 / 4;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  }
  .videos {
    position: relative;
    display: block;
  }
  .video-tile.remote {
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 62vh;
  }
}
