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

:root {
  --bg: #070e0b;
  --surface: #0d1f16;
  --border: #1a3825;
  --accent: #10b981;
  --danger: #f87171;
  --text: #e8faf2;
  --muted: #4b7262;
}

html, body, #app { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

/* ── Home screen ───────────────────────────────────────────── */

.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 2rem;
  padding: 1rem;
}

.home h1 { font-size: 2.5rem; letter-spacing: -0.03em; }
.home h1 span { color: var(--accent); }

.join-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 420px;
}

.join-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.join-form input:focus { border-color: var(--accent); }

.btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-ghost   { background: transparent; color: var(--text); border: 1px solid var(--border); }

.btn-icon {
  padding: 0.75rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  font-weight: 500;
}

.notice {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--surface);
  border-left: 3px solid var(--accent);
}
.notice.error { border-left-color: var(--danger); }

/* ── Room / video ──────────────────────────────────────────── */

.room {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

video { display: block; background: #111; }

.video-remote {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-local {
  position: absolute;
  bottom: 5rem;
  right: 1.5rem;
  width: 220px;
  height: 165px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.6);
}

.controls {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  padding: 0.75rem 1.25rem;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.ctrl-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s;
}
.ctrl-btn:hover { background: var(--border); }
.ctrl-btn.active { background: var(--danger); }
.ctrl-btn i { pointer-events: none; }

.room-waiting {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: #000;
  color: var(--muted);
}

.room-code-badge {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  padding: 0.35rem 0.9rem;
  border-radius: 99px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

/* ── Timer ─────────────────────────────────────────────────────────────────── */

.timer {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  padding: 0.35rem 0.9rem;
  border-radius: 99px;
  font-size: 0.85rem;
  transition: border-color 0.3s, color 0.3s;
}

.timer-warning {
  border-color: var(--danger);
  color: var(--danger);
}

.timer-digits {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.extend-btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 99px;
  opacity: 0.85;
}
.extend-btn:hover { opacity: 1; }

.timer-maxed {
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .video-local { width: 120px; height: 90px; bottom: 5.5rem; right: 0.75rem; }
  .home h1 { font-size: 1.8rem; }
  .join-form { flex-direction: column; }
}
