/* ============================================================
   SCREEGO — MINIMAL GRAPHITE
   A quiet, dark-grey shell for the Screego web client.
   The app keeps working untouched; this file re-themes its UI.
   ============================================================ */

:root {
  --bg: #0c0c0e;
  --bg-soft: #111113;
  --surface: #17171a;
  --surface-2: #1c1c20;
  --surface-3: #232327;
  --line: #27272c;
  --line-strong: #36363d;
  --text: #e8e8ea;
  --text-dim: #9a9aa2;
  --text-faint: #6a6a72;
  --accent: #d8d8dc;
  --danger: #c96a6a;

  --font-display: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-label: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body.gta {
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 620px at 50% -12%, #1b1b1f 0%, transparent 62%),
    radial-gradient(900px 560px at 50% 112%, #151518 0%, transparent 58%),
    var(--bg) !important;
}

::selection {
  background: #3a3b42;
  color: #fff;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid #5a5b63;
  outline-offset: 2px;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.stage {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100svh;
  padding: clamp(16px, 4vw, 48px);
}

.panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.85);
  animation: panel-in 0.4s ease both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   LOBBY
   ============================================================ */

html.is-lobby #root {
  display: none !important;
}

.lobby {
  padding: 26px 26px 24px;
}

.lobby[hidden] {
  display: none !important;
}

.lobby__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.lobby__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--text);
}

.lobby__count {
  font-family: var(--font-body);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  white-space: nowrap;
}

.lobby__field {
  display: block;
}

.lobby__caption {
  display: block;
  margin-bottom: 7px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-faint);
}

.lobby__input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lobby__input::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

.lobby__input:hover {
  border-color: #3f3f46;
}

.lobby__input:focus {
  border-color: #54555e;
  background: #0f0f11;
}

.lobby__status {
  margin: 0;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-faint);
}

.lobby__status:not(:empty) {
  margin-top: 10px;
}

.lobby__status.is-error {
  color: var(--danger);
}

.lobby__rooms {
  display: flex;
  flex-direction: column;
  max-height: 44vh;
  margin: 16px -6px 0;
  padding: 0 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lobby__empty {
  padding: 18px 0;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  color: var(--text-faint);
}

.lobby-room {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 1px;
  border-top: 1px solid var(--line);
}

.lobby-room:last-child {
  border-bottom: 1px solid var(--line);
}

.lobby-room__body {
  flex: 1;
  min-width: 0;
}

.lobby-room__id {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  overflow-wrap: anywhere;
}

.lobby-room__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-faint);
}

.lobby-room__dot {
  opacity: 0.5;
}

.lobby-room__users {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.lobby__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.lobby__btn:hover {
  background: var(--surface-3);
  border-color: #45464e;
  color: var(--text);
}

.lobby__btn:active {
  background: var(--surface-2);
}

.lobby__btn--main {
  width: 100%;
  height: 42px;
  margin-top: 18px;
  border-color: transparent;
  background: var(--accent);
  color: #141416;
  font-size: 13.5px;
}

.lobby__btn--main:hover {
  background: #ededf0;
  border-color: transparent;
  color: #0e0e10;
}

.lobby__btn--main:active {
  background: #c4c4ca;
}

.lobby-room__join {
  flex: 0 0 auto;
}

/* ============================================================
   APP LOADER
   ============================================================ */

#root {
  width: 100%;
  height: auto;
}

#root > div {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  justify-content: stretch !important;
}

#root:empty {
  display: grid;
  place-items: center;
  min-height: 300px;
}

#root:empty::after {
  content: "Загрузка…";
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-faint);
  animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ============================================================
   APP SKIN — Screego's MUI interface
   ============================================================ */

#root .MuiGrid-container,
#root .MuiGrid-grid-xs-12 {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-basis: 100% !important;
}

#root .MuiPaper-root {
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: var(--text) !important;
  padding: 24px 22px 22px !important;
}

#root .MuiTypography-root {
  font-family: var(--font-body);
  color: var(--text);
}

#root .MuiLink-root {
  color: var(--text-dim);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

#root .MuiLink-root:hover {
  color: var(--text);
}

/* logo lockups, github links and the app footer are not wanted */
.gta-logo,
.gta-appfooter,
body.gta a[href*="github.com"],
body.gta a[href*="github.io"],
body.gta a[href*="screego.net"] {
  display: none !important;
}

.gta-title {
  margin: 0 0 20px !important;
  font-family: var(--font-display) !important;
  font-size: 18px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  letter-spacing: 0.01em !important;
  color: var(--text) !important;
}

.gta-hello {
  font-family: var(--font-display) !important;
  font-size: 17px !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
  color: var(--text) !important;
}

/* SCREEGO_AUTH_MODE=none: no guest row, no login button, no password form. */
.gta-no-auth .gta-guestbar {
  display: none !important;
}

/* the NAT docs link and other external references are not wanted */
.gta-note {
  display: none !important;
}

/* text fields */
body.gta .MuiOutlinedInput-root {
  border-radius: 9px !important;
  background: var(--bg-soft) !important;
  transition: border-color 0.15s ease, background 0.15s ease;
}

body.gta .MuiOutlinedInput-notchedOutline {
  border: 1px solid var(--line-strong) !important;
  border-radius: 9px !important;
}

body.gta .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline {
  border-color: #3f3f46 !important;
}

body.gta .MuiOutlinedInput-root.Mui-focused {
  background: #0f0f11 !important;
}

body.gta .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {
  border-color: #54555e !important;
  border-width: 1px !important;
}

body.gta .MuiOutlinedInput-root.Mui-error .MuiOutlinedInput-notchedOutline {
  border-color: var(--danger) !important;
}

body.gta .MuiInputBase-input {
  padding: 12px 13px !important;
  font-family: var(--font-body) !important;
  font-size: 14px !important;
  color: var(--text) !important;
}

body.gta .MuiInputBase-input::placeholder {
  color: var(--text-faint) !important;
  opacity: 1;
}

body.gta .MuiInputLabel-root {
  font-family: var(--font-body) !important;
  font-size: 12.5px !important;
  color: var(--text-faint) !important;
}

body.gta .MuiInputLabel-root.MuiInputLabel-shrink {
  padding: 0 5px !important;
  background: var(--surface) !important;
  color: var(--text-dim) !important;
}

body.gta .MuiInputLabel-root.Mui-focused {
  color: var(--text-dim) !important;
}

body.gta .MuiFormHelperText-root {
  font-family: var(--font-body) !important;
  font-size: 11.5px !important;
  color: var(--danger) !important;
}

/* buttons */
body.gta .MuiButton-root {
  border-radius: 9px !important;
  font-family: var(--font-body) !important;
  font-weight: 500 !important;
  font-size: 13.5px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
}

body.gta .MuiButton-contained {
  min-height: 42px;
  padding: 6px 18px !important;
  border: 1px solid transparent !important;
  background: var(--accent) !important;
  color: #141416 !important;
  box-shadow: none !important;
}

body.gta .MuiButton-contained:hover {
  background: #ededf0 !important;
  color: #0e0e10 !important;
}

body.gta .MuiButton-contained:active {
  background: #c4c4ca !important;
}

body.gta .MuiButton-outlined {
  min-height: 34px;
  padding: 3px 14px !important;
  border: 1px solid var(--line-strong) !important;
  background: transparent !important;
  color: var(--text-dim) !important;
  box-shadow: none !important;
}

body.gta .MuiButton-outlined:hover {
  background: var(--surface-3) !important;
  border-color: #45464e !important;
  color: var(--text) !important;
}

body.gta .MuiButton-text {
  color: var(--text-dim) !important;
  font-size: 13px !important;
  padding: 6px 10px !important;
}

body.gta .MuiButton-text:hover {
  background: var(--surface-3) !important;
  color: var(--text) !important;
}

body.gta .MuiButton-root.Mui-disabled {
  opacity: 0.4;
}

body.gta .MuiTouchRipple-child {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* checkbox */
body.gta .MuiCheckbox-root {
  color: var(--text-faint) !important;
}

body.gta .MuiCheckbox-root.Mui-checked {
  color: var(--text-dim) !important;
}

body.gta .MuiFormControlLabel-label {
  font-family: var(--font-body) !important;
  font-size: 13.5px !important;
  color: var(--text-dim) !important;
}

body.gta .MuiFormControlLabel-root {
  margin-left: -6px !important;
}

body.gta .MuiFormControl-root {
  margin: 8px 0 !important;
}

body.gta .gta-note a {
  color: var(--text-dim) !important;
  text-decoration: none;
}

/* ============================================================
   PORTALED UI — dialogs, menus, snackbars (outside #root)
   ============================================================ */

body.gta .MuiDialog-paper {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--line);
  border-radius: 16px !important;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9) !important;
}

body.gta .MuiDialogTitle-root {
  font-family: var(--font-display) !important;
  font-size: 17px !important;
  font-weight: 500;
}

body.gta .MuiDialogContent-root {
  color: var(--text);
}

body.gta .MuiDialogContent-root .MuiTypography-root,
body.gta .MuiDialogContent-root .MuiFormControlLabel-label {
  color: var(--text-dim) !important;
}

body.gta .MuiBackdrop-root {
  background: rgba(5, 5, 7, 0.72) !important;
  backdrop-filter: blur(6px);
}

body.gta .MuiSelect-icon {
  color: var(--text-faint) !important;
}

body.gta .MuiSelect-select {
  color: var(--text) !important;
  background: transparent !important;
}

body.gta .MuiDialog-paper .MuiButton-text {
  color: var(--text-dim) !important;
}

body.gta .MuiDialog-paper .MuiButton-text:hover {
  color: var(--text) !important;
}

body.gta .MuiPopover-paper,
body.gta .MuiMenu-paper {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--line-strong);
  border-radius: 10px !important;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.7) !important;
}

body.gta .MuiMenuItem-root {
  font-family: var(--font-body) !important;
  font-size: 13.5px !important;
  color: var(--text-dim) !important;
}

body.gta .MuiMenuItem-root:hover,
body.gta .MuiMenuItem-root.Mui-selected {
  background: var(--surface-3) !important;
  color: var(--text) !important;
}

body.gta .MuiSlider-root {
  color: var(--text-dim) !important;
}

body.gta .MuiSnackbarContent-root,
body.gta .notistack-MuiContent {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 10px !important;
  font-family: var(--font-body) !important;
  font-size: 13px !important;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.7) !important;
}

body.gta .MuiTooltip-tooltip {
  background: var(--surface-3) !important;
  border: 1px solid var(--line-strong);
  border-radius: 8px !important;
  color: var(--text) !important;
  font-family: var(--font-body) !important;
  font-size: 12px !important;
}

body.gta .MuiTooltip-arrow {
  color: var(--surface-3) !important;
}

/* ============================================================
   ROOM MODE — full-bleed stage
   ============================================================ */

html.is-room,
html.is-room body {
  height: 100%;
  background: #0a0a0c;
}

html.is-room .stage {
  display: block;
  min-height: 100svh;
  padding: 0;
}

html.is-room .panel {
  width: 100%;
  max-width: none;
  height: 100svh;
  background: #0a0a0c;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  animation: none;
}

html.is-room #root,
html.is-room #root > div {
  height: 100% !important;
}

html.is-room #root > div {
  background: #0a0a0c !important;
}

html.is-room #root .MuiPaper-root {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--line);
  border-radius: 14px !important;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(10px);
}

html.is-room #root .MuiPaper-root .MuiTypography-root {
  color: var(--text) !important;
}

html.is-room #root .MuiIconButton-root {
  color: var(--text-dim) !important;
}

html.is-room #root .MuiIconButton-root:hover {
  color: var(--text) !important;
  background: var(--surface-3) !important;
}

html.is-room #root .MuiBadge-badge {
  background: var(--surface-3) !important;
  color: var(--text) !important;
  font-family: var(--font-body);
  font-weight: 700;
}

/* room id title */
html.is-room #root .MuiPaper-root .MuiTypography-h4 {
  font-family: var(--font-display) !important;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-size: 17px !important;
}

/* the empty stage */
html.is-room #root .MuiTypography-h4.MuiTypography-alignCenter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display) !important;
  font-size: clamp(18px, 2vw, 22px) !important;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-dim) !important;
}

html.is-room #root .MuiTypography-h4.MuiTypography-alignCenter::after {
  content: "S — начать показ";
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-faint);
}

@media (hover: none) {
  html.is-room #root .MuiTypography-h4.MuiTypography-alignCenter::after {
    content: "Кнопка показа — в панели";
  }
}

html.is-room #root video {
  background: #000;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2c2c32;
  border: 3px solid var(--bg);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3b42;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  .stage {
    padding: 14px;
  }

  .panel {
    max-width: none;
    border-radius: 16px;
  }

  .lobby {
    padding: 22px 20px 20px;
  }

  .lobby__rooms {
    max-height: 40vh;
  }

  html.is-room .panel {
    border-radius: 0;
  }

  html.is-room .stage {
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
