:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e5e7eb;
  --radius: 8px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 600; }
.site-nav { display: flex; gap: 24px; align-items: center; }

/* Buttons */
.btn { display: inline-block; padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; color: var(--fg); cursor: pointer; font: inherit; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-ghost { background: transparent; }

/* Hero */
.hero { max-width: 760px; margin: 80px auto 60px; padding: 0 24px; text-align: center; }
.hero h1 { font-size: 48px; line-height: 1.1; margin: 0 0 20px; }
.lead { font-size: 20px; color: var(--muted); margin: 0 0 32px; }
.hero-note { color: var(--muted); font-size: 14px; margin-top: 16px; }

/* Features */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 32px; max-width: 1000px; margin: 60px auto; padding: 0 24px; }
.feature h3 { margin: 0 0 8px; }
.feature p { color: var(--muted); margin: 0; }

/* CTA */
.cta { background: #f9fafb; padding: 0px 24px; text-align: center; margin: 60px 0; }
.cta h2 { margin: 0 0 12px; }
.cta p { color: var(--muted); margin: 0 0 24px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 40px 24px 20px; max-width: 1200px; margin: 0 auto; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 32px; margin-bottom: 24px; }
.footer-cols strong { display: block; margin-bottom: 8px; }
.footer-cols a { display: block; color: var(--muted); margin-bottom: 4px; }
.footer-cols p { color: var(--muted); margin: 0; }
.copyright { color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); padding-top: 20px; }

/* Room */
.room-page { display: flex; flex-direction: column; height: 100vh; background: #111; color: #fff; }
.room-header { display: flex; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid #333; }
.room-info { display: flex; gap: 12px; align-items: center; }
.room-info .status { color: #9ca3af; font-size: 13px; }
.room-main { flex: 1; display: grid; grid-template-columns: 1fr 320px; overflow: hidden; }
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
.video-tile { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.video-tile video { width: 100%; height: 100%; object-fit: cover; }
.video-label { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,0.6); padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.chat-panel { border-left: 1px solid #333; display: flex; flex-direction: column; padding: 12px; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1; padding: 8px; background: #222; color: #fff; border: 1px solid #333; border-radius: var(--radius); }
.room-controls { display: flex; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid #333; }
.ctrl { width: 48px; height: 48px; border-radius: 50%; border: 1px solid #333; background: #222; color: #fff; font-size: 20px; cursor: pointer; }
.ctrl.active { background: #374151; }
.ctrl.danger { background: #dc2626; border-color: #dc2626; }

/* Forms */
.form-page {
  max-width: 420px;
  margin: 60px auto;
  padding: 0 24px;
}
.form-page h1 {
  margin: 0 0 8px;
  font-size: 32px;
}
.form-sub {
  color: var(--muted);
  margin: 0 0 28px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.auth-form .checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  color: var(--muted);
}
.btn-block {
  width: 100%;
  text-align: center;
  padding: 12px 16px;
  font-size: 16px;
}
.form-foot {
  text-align: center;
  color: var(--muted);
  margin-top: 20px;
}
.form-error {
  color: #dc2626;
  font-size: 14px;
  margin: 4px 0 0;
}

/* Content pages */
.content-page {
  max-width: 720px;
  margin: 60px auto;
  padding: 0 24px;
}
.content-page h1 {
  font-size: 36px;
  margin: 0 0 24px;
}
.content-page h2 {
  font-size: 20px;
  margin: 32px 0 12px;
}
.content-page p {
  color: #374151;
  margin: 0 0 16px;
  line-height: 1.7;
}
.muted {
  color: var(--muted);
}

/* Dashboard */
.dashboard {
  max-width: 900px;
  margin: 60px auto;
  padding: 0 24px;
}
.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.dashboard-head h1 {
  margin: 0;
  font-size: 32px;
}
.rooms-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.room-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.room-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
  text-decoration: none;
}
.room-card-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.room-card-sub {
  color: var(--muted);
  font-size: 13px;
}
.empty-state {
  padding: 60px 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Error page */
.error-page {
  text-align: center;
  padding: 100px 24px;
}
.error-page h1 {
  font-size: 72px;
  margin: 0;
  color: var(--muted);
}
.error-page p {
  color: var(--muted);
  margin: 8px 0 32px;
}

/* Speaking indicator */
.video-tile {
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  border: 2px solid transparent;
}
.video-tile.speaking {
  border-color: #22c55e;             /* зелёный */
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4),
              0 0 20px rgba(34, 197, 94, 0.25);
}


/* Device error modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal h2 {
  margin: 0 0 12px;
  font-size: 20px;
  color: #fff;
}
.modal p {
  margin: 0 0 16px;
  color: #cbd5e1;
  line-height: 1.5;
}
.modal-help {
  margin-bottom: 20px;
  background: #0f172a;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
}
.modal-help summary {
  cursor: pointer;
  color: #60a5fa;
  font-weight: 500;
}
.modal-help ol {
  margin: 12px 0 0;
  padding-left: 20px;
  color: #cbd5e1;
}
.modal-help li { margin-bottom: 6px; }
.modal-help code {
  background: #1e293b;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-actions .btn {
  flex: 1;
  min-width: 140px;
}
.modal-actions .btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 480px) {
  .modal { padding: 20px; }
  .modal h2 { font-size: 18px; }
}



/* Copy-link button in the dark room header. The base .btn sets
   color: var(--fg) (dark), which is invisible on the room's #111
   background. Force light foreground and a subtle translucent
   background, same pattern as the controls. */
.room-header .btn,
.room-header .btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.20);
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.room-header .btn:hover,
.room-header .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  text-decoration: none;
}



/* Minimal landing page: brand, one CTA, nothing else. Matches the
   "one-click to start" pattern of Google Meet / Whereby landing
   pages; no marketing copy means fewer assets and fewer distinctive
   text fingerprints. */
.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: #0f172a;
  color: #f1f5f9;
}
.landing-main {
  text-align: center;
  max-width: 480px;
  padding: 0 24px;
}
.landing-title {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -1px;
  margin: 0 0 16px;
  color: #fff;
}
.landing-sub {
  font-size: 18px;
  line-height: 1.5;
  color: #94a3b8;
  margin: 0 0 40px;
}
.landing .btn-primary {
  padding: 14px 32px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 10px;
}
.landing .form-error {
  margin-top: 20px;
  color: #f87171;
}




/* Кнопка «на весь экран» в углу плитки */
.video-tile .tile-fullscreen {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.video-tile:hover .tile-fullscreen,
.video-tile:fullscreen .tile-fullscreen,
.video-tile:-webkit-full-screen .tile-fullscreen {
  opacity: 1;
}
.video-tile .tile-fullscreen:hover {
  background: rgba(0,0,0,0.75);
}

/* Полноэкранный режим: плитка на весь экран, видео не обрезается */
.video-tile:fullscreen,
.video-tile:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
}
.video-tile:fullscreen video,
.video-tile:-webkit-full-screen video {
  object-fit: contain;      /* важно для screen share: ничего не обрезаем */
}
.video-tile:fullscreen .video-label,
.video-tile:-webkit-full-screen .video-label {
  left: 16px;
  bottom: 16px;
  font-size: 14px;
}
/* Полноэкранному видео зелёная рамка «speaking» не нужна */
.video-tile:fullscreen.speaking,
.video-tile:-webkit-full-screen.speaking {
  border-color: transparent;
  box-shadow: none;
}



.resolution-select {
  background: rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.20);
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.resolution-select:hover {
  background: rgba(255, 255, 255, 0.22);
}
.resolution-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.40);
}
.resolution-select option {
  background: #1e293b;
  color: #e5e7eb;
}
