/* ============================================================
   Rehearse With Me — movie-maker theme
   Cinematic warm UI: charcoal "screening room" backdrop, gold
   spotlight + film-crimson accents, subtle film-strip motifs.
   ============================================================ */
:root {
  --bg: #100d0a;           /* deep warm charcoal */
  --bg2: #1a1511;
  --panel: rgba(34, 28, 22, 0.66);
  --panel2: rgba(46, 38, 30, 0.6);
  --ink: #f6efe2;          /* warm cream */
  --muted: #b4a48c;        /* warm grey */
  --accent: #f5b62c;       /* spotlight gold */
  --accent-2: #e2453b;     /* film crimson */
  --accent-3: #ff8a3d;     /* warm amber */
  --ok: #6fd08c;
  --line: rgba(245, 182, 44, 0.18);
  --glow: 0 0 0 1px rgba(245, 182, 44, 0.16), 0 10px 40px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-3) 50%, var(--accent-2));
}
* { box-sizing: border-box; }

html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 50% -10%, rgba(245, 182, 44, 0.16), transparent 60%),
    radial-gradient(900px 700px at 8% 8%, rgba(226, 69, 59, 0.10), transparent 55%),
    radial-gradient(900px 800px at 100% 100%, rgba(255, 138, 61, 0.08), transparent 55%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
/* film-strip sprocket holes running down both edges */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(0,0,0,0.55) 38%, transparent 42%),
    radial-gradient(rgba(0,0,0,0.55) 38%, transparent 42%);
  background-size: 22px 34px, 22px 34px;
  background-position: 8px 0, calc(100% - 8px) 0;
  background-repeat: repeat-y, repeat-y;
  opacity: 0.5;
  z-index: 0;
}
@media (max-width: 860px) { body::before { opacity: 0; } }
.container, .topbar, main, .room-grid { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.plain, a.plain:hover { color: var(--ink); text-decoration: none; }

/* ---- Top bar -------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
  background: rgba(22, 17, 12, 0.55);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 800; font-size: 19px; letter-spacing: 0.3px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(245, 182, 44, 0.35));
}
.who { margin-left: auto; color: var(--muted); }
.who b { color: var(--ink); }
.controls { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- Layout --------------------------------------------------------- */
.container { max-width: 1140px; margin: 28px auto; padding: 0 18px; }

.card {
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--glow);
  position: relative;
  overflow: hidden;
}
/* glowing top hairline on cards */
.card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: var(--grad);
  opacity: 0.7;
}
h2 {
  margin: 0 0 10px; font-size: 18px; font-weight: 700; letter-spacing: 0.2px;
}
h3 {
  margin: 14px 0 8px; font-size: 12px; font-weight: 700;
  color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.14em;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok { color: var(--ok); text-shadow: 0 0 12px rgba(54, 255, 176, 0.4); }
.hidden { display: none !important; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input { width: auto; flex: 1; }

/* ---- Form controls -------------------------------------------------- */
input, textarea, select {
  background: rgba(14, 10, 7, 0.6);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px; width: 100%; margin: 6px 0;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: #8a7c66; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(245, 182, 44, 0.6);
  box-shadow: 0 0 0 3px rgba(245, 182, 44, 0.14), 0 0 22px rgba(245, 182, 44, 0.12);
  background: rgba(18, 13, 9, 0.8);
}

/* ---- Buttons -------------------------------------------------------- */
button, .btnlink {
  background: var(--grad);
  color: #04101c;
  border: none; border-radius: 10px;
  padding: 10px 16px; font-weight: 700; font-size: 14px;
  cursor: pointer; text-decoration: none; display: inline-block;
  letter-spacing: 0.2px;
  box-shadow: 0 6px 20px rgba(245, 182, 44, 0.18), inset 0 0 0 1px rgba(255,255,255,0.08);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
button:hover, .btnlink:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(226, 69, 59, 0.34);
  filter: brightness(1.05);
  text-decoration: none;
}
button:active { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

button.ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
}
button.ghost:hover {
  color: var(--ink);
  border-color: rgba(245, 182, 44, 0.5);
  box-shadow: 0 0 18px rgba(245, 182, 44, 0.12);
}
button.off { background: linear-gradient(135deg, #ff4d6d, #b1004a); color: #fff; }
.btnlink { background: var(--grad); color: #04101c; }
.leave { background: linear-gradient(135deg, #ff4d6d, #9b0039); color: #fff; }

/* ---- Lists ---------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.item {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.item:hover {
  border-color: rgba(245, 182, 44, 0.32);
  box-shadow: 0 0 22px rgba(245, 182, 44, 0.08);
}
.item .charName { width: 200px; }
.item .role { width: 160px; }
.cleanup {
  display: flex; gap: 10px; align-items: center; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line); flex-wrap: wrap;
}

/* ---- Wake notice (free-tier cold start) ----------------------------- */
.wake-notice {
  max-width: 640px; margin: 14px auto 0; text-align: center;
  background: rgba(245, 182, 44, 0.08); border: 1px solid rgba(245, 182, 44, 0.3);
  color: var(--ink); border-radius: 12px; padding: 10px 16px; font-size: 14px;
}

/* ---- Welcome / hero ------------------------------------------------- */
.hero { max-width: 860px; margin: 28px auto 8px; text-align: center; padding: 0 16px; }
.hero-title {
  font-size: clamp(28px, 5vw, 46px); line-height: 1.1; margin: 0 0 14px; font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 24px rgba(245, 182, 44, 0.25));
}
.hero-sub { color: var(--muted); font-size: 16px; line-height: 1.6; max-width: 640px; margin: 0 auto 24px; }
.hero-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; text-align: left; margin: 0 auto 22px;
}
@media (max-width: 700px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-feat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  backdrop-filter: blur(14px); font-size: 14px; color: var(--muted); line-height: 1.5;
}
.hero-feat span { font-size: 22px; display: block; margin-bottom: 6px; }
.hero-feat b { color: var(--ink); font-size: 15px; }
.hero-cta { color: var(--accent); font-weight: 700; letter-spacing: 0.02em; margin: 4px 0 0; }

/* ---- Admin stat grid ------------------------------------------------ */
.statgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px; margin: 6px 0 16px;
}
.stat {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; text-align: center;
}
.stat .num {
  font-size: 24px; font-weight: 800; line-height: 1.1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat .lbl { color: var(--muted); font-size: 11px; margin-top: 4px; letter-spacing: 0.02em; }

/* ---- Legal pages ---------------------------------------------------- */
.legal { max-width: 760px; }
.legal article h1 { font-size: 26px; margin: 0 0 6px; }
.legal article h2 { font-size: 16px; margin: 22px 0 6px; color: var(--accent); }
.legal article p { line-height: 1.6; color: var(--ink); }
.template-note { border-color: rgba(255,180,84,.5); background: rgba(255,180,84,.08); }

/* ---- Site footer ---------------------------------------------------- */
.site-footer {
  max-width: 1140px; margin: 8px auto 28px; padding: 16px 18px 0;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12px;
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ---- Cookie consent banner ------------------------------------------ */
.cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 70;
  max-width: 760px; margin: 0 auto;
  background: rgba(22, 17, 12, 0.92); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--glow);
  color: var(--ink); font-size: 13px; padding: 12px 16px;
  display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.cookie-banner a { color: var(--accent); }
.cookie-banner button {
  background: var(--grad); color: #04101c; border: none; border-radius: 999px;
  padding: 6px 16px; font-weight: 700; font-size: 12px; cursor: pointer; white-space: nowrap;
}

/* registration agree checkbox + danger button */
.agree { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; margin: 6px 0; }
.agree input { width: auto; margin: 2px 0 0; }
button.danger { border-color: #6b2330; color: #ff9fb0; }
button.danger:hover { border-color: #ff4d6d; color: #ffd9df; }

/* ---- Auth card ------------------------------------------------------ */
.authcard { max-width: 420px; margin: 40px auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tab {
  background: transparent; color: var(--muted); border: none; box-shadow: none;
  border-radius: 0; padding: 10px 14px; font-weight: 700; border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); transform: none; box-shadow: none; filter: none; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.authform { display: flex; flex-direction: column; gap: 4px; }
.authform button { margin-top: 8px; }
.authform a { color: var(--accent); }
.authmsg { min-height: 20px; margin-top: 8px; font-size: 13px; }
.authmsg .err { color: #ff7a90; }
.err { color: #ff7a90; }

/* ====================================================================
   Rehearsal room
   ==================================================================== */
body.room { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.room-grid { flex: 1; display: grid; grid-template-columns: 1.3fr 1fr; gap: 0; min-height: 0; }
@media (max-width: 900px) { .room-grid { grid-template-columns: 1fr; } }

.videos {
  padding: 16px; display: grid; gap: 14px; align-content: start; overflow: auto;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.tile {
  position: relative;
  background: #0c0805;
  border-radius: 14px; overflow: hidden; aspect-ratio: 4/3;
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.tile::after { /* neon frame glow */
  content: ""; position: absolute; inset: 0; border-radius: 14px; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(245, 182, 44, 0.25), inset 0 0 30px rgba(245, 182, 44, 0.06);
}
.tile:hover { border-color: rgba(245, 182, 44, 0.45); box-shadow: 0 0 34px rgba(245, 182, 44, 0.16); }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #0c0805; }
.tile .label {
  position: absolute; left: 8px; bottom: 8px; font-size: 12px; font-weight: 600;
  background: rgba(12, 9, 6, 0.7);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  padding: 3px 10px; border-radius: 999px;
  color: var(--ink);
  z-index: 2;
}
/* Per-tile moderation controls (appear on hover) */
.tile-controls {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 6px;
  opacity: 0; transition: opacity 0.15s; z-index: 3;
}
.tile:hover .tile-controls { opacity: 1; }
.tile-btn {
  background: rgba(12, 9, 6, 0.8); color: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 8px; font-size: 13px; line-height: 1;
  box-shadow: none; cursor: pointer;
}
.tile-btn:hover { border-color: rgba(245, 182, 44, 0.5); transform: none; filter: none; }
.tile-btn.kick:hover { border-color: #ff4d6d; }
.tile-btn.active { background: #6b2330; }
.tile.blocked video { filter: blur(22px) brightness(0.4); }
.tile.blocked::after {
  content: "Blocked"; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 77, 109, 0.4);
}

/* Connection-trouble notice (NAT/firewall / TURN needed) */
.conn-notice {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: linear-gradient(90deg, #b88121, #8a5a12); color: #fff;
  font-size: 13px; font-weight: 600; text-align: center; padding: 9px 16px;
  display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.conn-notice button {
  background: rgba(255,255,255,0.18); color: #fff; border: 1px solid rgba(255,255,255,0.5);
  border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 700; cursor: pointer; box-shadow: none;
}

/* Recording-consent banner shown to everyone in the room */
.rec-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: linear-gradient(90deg, #ff2d55, #b1004a);
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
  text-align: center; padding: 8px 14px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  box-shadow: 0 4px 24px rgba(255, 45, 85, 0.4);
  animation: blink 1.4s steps(2, start) infinite;
}
/* When you've opted out, the banner goes neutral and stops blinking */
.rec-banner.opted-out {
  background: linear-gradient(90deg, #2a3350, #1b2238);
  animation: none;
}
.banner-btn {
  background: rgba(255, 255, 255, 0.16); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 999px;
  padding: 4px 12px; font-size: 12px; font-weight: 700; cursor: pointer;
  box-shadow: none; white-space: nowrap;
}
.banner-btn:hover { background: rgba(255, 255, 255, 0.28); transform: none; filter: none; }

.script-pane {
  border-left: 1px solid var(--line);
  background: rgba(16, 12, 8, 0.6);
  backdrop-filter: blur(18px);
  display: flex; flex-direction: column; min-height: 0;
}
.script-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.script-head h3 {
  margin: 0; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 16px;
}
.script { flex: 1; overflow: auto; padding: 18px 24px; line-height: 1.55; }

.ln { padding: 5px 10px; border-radius: 8px; transition: background 0.15s; }
.ln.scene {
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); margin-top: 18px;
  text-shadow: 0 0 16px rgba(245, 182, 44, 0.3);
}
.ln.action { color: var(--muted); font-style: italic; }
.ln.dlg { margin: 10px 0; padding: 9px 12px; }
.ln .cue { font-weight: 800; letter-spacing: 0.05em; }
.ln .paren { color: var(--muted); font-weight: 400; font-style: italic; }
.ln .speech { margin-left: 8px; }
/* my lines: highlighted with a violet neon edge */
.ln.mine {
  background: linear-gradient(90deg, rgba(226, 69, 59, 0.14), rgba(226, 69, 59, 0.03));
  border-left: 3px solid var(--accent-2);
  box-shadow: 0 0 22px rgba(226, 69, 59, 0.1);
}
.ln.mine .cue {
  color: var(--accent-3);
  text-shadow: 0 0 14px rgba(255, 138, 61, 0.4);
}
/* active cue (host pointer) */
.ln.active {
  background: linear-gradient(90deg, rgba(245, 182, 44, 0.2), rgba(245, 182, 44, 0.04));
  outline: 1px solid rgba(245, 182, 44, 0.55);
  box-shadow: 0 0 26px rgba(245, 182, 44, 0.18);
}

.hostbar {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; align-items: center;
  background: rgba(14, 10, 7, 0.5);
}

/* ---- Controls extras ------------------------------------------------ */
.controls button.active {
  background: var(--grad);
  color: #04101c;
  box-shadow: 0 0 22px rgba(245, 182, 44, 0.4);
}
.slider-wrap { display: inline-flex; align-items: center; gap: 8px; }
.slider-wrap input[type=range] { width: 96px; accent-color: var(--accent); margin: 0; }

.rec-dot {
  color: #ff4d6d; font-weight: 800; font-size: 13px;
  display: inline-flex; align-items: center; gap: 5px;
  text-shadow: 0 0 12px rgba(255, 77, 109, 0.6);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }

/* nice neon scrollbars */
.script::-webkit-scrollbar, .videos::-webkit-scrollbar { width: 10px; }
.script::-webkit-scrollbar-thumb, .videos::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), var(--accent-2));
  border-radius: 999px; border: 2px solid transparent; background-clip: padding-box;
}
.script::-webkit-scrollbar-track, .videos::-webkit-scrollbar-track { background: transparent; }
