:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e8eaef;
  --muted: #9aa2b1;
  --accent: #4f7cff;
  --accent-2: #3d63d6;
  --danger: #e35d5d;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.brand { color: var(--text); font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.eyebrow {
  display: inline-block;
  color: #9fb4ff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

#user-bar { display: flex; align-items: center; gap: 12px; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

h1 { margin-top: 0; font-size: 1.4rem; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
h3 { font-size: 0.95rem; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); min-height: 1.2em; }

input[type="text"], input[type="email"], input[type="password"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  width: 100%;
}

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 0.8rem; }

.inline-form { display: flex; gap: 8px; margin: 12px 0; }
.inline-form input { flex: 1; }

.auth-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 560px) { .auth-forms { grid-template-columns: 1fr; } }

.asl-login { margin-bottom: 16px; text-align: center; }

.meeting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.meeting-actions { display: flex; gap: 8px; }
.site-footer {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.85rem;
  gap: 20px;
  justify-content: space-between;
  margin: 8px auto 24px;
  max-width: 720px;
  padding: 0 24px;
}
.site-footer a { color: #b9c8ff; }
.site-footer nav { display: flex; gap: 14px; }
.privacy-note {
  background: rgba(79, 124, 255, 0.12);
  border: 1px solid rgba(79, 124, 255, 0.32);
  border-radius: 8px;
  color: #cbd6ff;
  font-size: 0.84rem;
  margin: 0;
  padding: 9px 11px;
}

/* Room */
.room-body { margin: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.room-header {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  min-height: 54px;
  padding: 8px 14px;
}
.room-header div { align-items: baseline; display: flex; gap: 10px; min-width: 0; }
.room-header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-header span { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

.overlay {
  position: fixed; inset: 0; background: rgba(10, 11, 14, 0.92);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.overlay .card { max-width: 420px; width: 100%; }
.overlay form { display: flex; flex-direction: column; gap: 12px; }

.status-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--text);
  padding: 8px 16px; border-radius: 8px; z-index: 40; font-size: 0.85rem;
}
.status-banner.error { border-color: var(--danger); }

.room-layout { flex: 1; display: flex; min-height: 0; }

.video-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  padding: 8px;
  overflow: auto;
  align-content: start;
}

.video-tile {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.video-tile video { width: 100%; height: 100%; object-fit: cover; }
.tile-label {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.5); padding: 2px 8px; border-radius: 6px; font-size: 0.8rem;
}

.side-panel {
  width: 280px;
  border-left: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 20px;
}
.panel-section { display: flex; flex-direction: column; gap: 8px; }
.chat-section { flex: 1; min-height: 0; }
.participant-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; padding: 4px 0; }
.chat-log { flex: 1; overflow-y: auto; font-size: 0.85rem; display: flex; flex-direction: column; gap: 6px; min-height: 100px; }
.chat-row span { color: var(--text); }
.chat-row strong { color: var(--accent); }

.control-bar {
  display: flex; justify-content: center; gap: 10px;
  padding: 14px; border-top: 1px solid var(--border); background: var(--panel);
}
.control { min-width: 96px; text-align: center; }
.control.recording { background: var(--danger); border-color: var(--danger); color: #fff; }

@media (max-width: 720px) {
  .room-layout { flex-direction: column; }
  .side-panel { width: auto; border-left: none; border-top: 1px solid var(--border); max-height: 40vh; }
  .control-bar { gap: 6px; justify-content: flex-start; overflow-x: auto; }
  .control { min-width: 86px; }
  .meeting-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .meeting-actions { flex-wrap: wrap; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}
