:root {
  /* палитра: #FC0046 — акцент, #3A0015 — глубокий бордо */
  --bg: #0d0409;               /* почти чёрный с бордовым подтоном */
  --bg-2: #150710;
  --bg-3: #200b16;
  --deep: #3A0015;             /* тёмный бордо из палитры */
  --border: #2c1120;
  --border-hi: #43141f;
  --text: #f2e7ec;
  --muted: #a38d97;
  --accent: #FC0046;
  --accent-hi: #ff6d92;        /* светлый розовый — ссылки, ховеры */
  --accent-soft: rgba(252, 0, 70, 0.14);
  --ok: #3ecf8e;
  --warn: #e5b84b;
  --danger: #ff5252;

  --grad-accent: linear-gradient(135deg, #FC0046 0%, #8c002d 100%);
  --grad-accent-hover: linear-gradient(135deg, #ff1d5c 0%, #a30034 100%);
  --grad-panel: linear-gradient(180deg, rgba(58, 0, 21, 0.35) 0%, rgba(21, 7, 16, 0.9) 60%, var(--bg-2) 100%);
  --grad-bar: linear-gradient(90deg, #FC0046 0%, #ff7aa2 100%);

  --radius: 4px;    /* минимальное скругление — строгие прямоугольники */
  --radius-lg: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(1100px 500px at 50% -120px, rgba(58, 0, 21, 0.55) 0%, rgba(13, 4, 9, 0) 70%);
  background-repeat: no-repeat;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  min-height: 100vh;
}

::selection { background: rgba(252, 0, 70, 0.35); color: #fff; }

a { color: var(--accent-hi); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

/* ---- шапка ---- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: linear-gradient(180deg, #200a13 0%, #150610 100%);
  border-bottom: 1px solid var(--deep);
  box-shadow: 0 1px 0 rgba(252, 0, 70, 0.12);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .4px;
  background: linear-gradient(135deg, #FC0046 0%, #ff8fb0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand:hover { text-decoration: none; filter: brightness(1.15); }

.nav { display: flex; gap: 18px; flex: 1; }
.nav a { color: var(--muted); padding: 4px 2px; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--accent); }

.userbox { display: flex; align-items: center; gap: 10px; }
.user-name { color: var(--muted); }

.container { max-width: 1280px; margin: 0 auto; padding: 24px; }

/* ---- кнопки, формы ---- */

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-hi);
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: border-color .15s, filter .15s, transform .1s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; filter: brightness(1.15); }
.btn.primary {
  background: var(--grad-accent);
  border: 1px solid rgba(252, 0, 70, 0.7);
  color: #fff;
  box-shadow: 0 2px 12px rgba(252, 0, 70, 0.25);
}
.btn.primary:hover { background: var(--grad-accent-hover); filter: none; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(255, 82, 82, 0.1); border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }

input, select, textarea {
  background: #100509;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 14px;
  width: 100%;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(252, 0, 70, 0.18);
}

label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
label input, label select { margin-top: 6px; color: var(--text); font-size: 14px; }

.form-error {
  background: rgba(252, 0, 70, 0.1);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: #ffb3c4;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

.notice {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid var(--deep);
  background: linear-gradient(180deg, rgba(58, 0, 21, 0.45), rgba(58, 0, 21, 0.15));
}
.notice.warn { background: rgba(229, 184, 75, 0.08); border-color: var(--warn); }
.notice p { margin: 6px 0; }

.hint { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }

/* ---- страницы ---- */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

h1 {
  font-size: 24px;
  margin: 0 0 8px;
  padding-left: 14px;
  position: relative;
}
h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, #FC0046 0%, #3A0015 100%);
}

h2 { font-size: 18px; margin: 26px 0 12px; }
h3 {
  font-size: 15px;
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

.card {
  background: var(--grad-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  color: var(--text);
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.card:hover {
  border-color: rgba(252, 0, 70, 0.6);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(252, 0, 70, 0.12);
}
.card-title { font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-meta { color: var(--muted); font-size: 13px; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid var(--border-hi);
  color: var(--muted);
  background: var(--bg-3);
}
.badge.status-live {
  color: var(--accent-hi);
  border-color: rgba(252, 0, 70, 0.55);
  background: linear-gradient(135deg, rgba(252, 0, 70, 0.2), rgba(58, 0, 21, 0.45));
}
.badge.status-ready { color: var(--ok); border-color: rgba(62, 207, 142, 0.5); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---- центральные карточки ---- */

.auth-card {
  max-width: 420px;
  margin: 48px auto;
  background: var(--grad-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.auth-card.wide { max-width: 560px; }

/* ---- таблицы (админка) ---- */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  background: linear-gradient(180deg, rgba(58, 0, 21, 0.4), rgba(58, 0, 21, 0.1));
}
.table tr.status-pending td { background: rgba(252, 0, 70, 0.05); }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- комната ---- */

.room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}
@media (max-width: 980px) { .room { grid-template-columns: 1fr; } }

.room-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.room-head h1 { margin: 0; font-size: 20px; }

.player-wrap {
  position: relative;
  background: #000;
  border: 1px solid var(--deep);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.player-wrap video { width: 100%; height: 100%; display: block; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(620px 320px at 50% 42%, rgba(58, 0, 21, 0.78) 0%, rgba(8, 2, 5, 0.9) 100%);
  z-index: 5;
  padding: 20px;
  text-align: center;
}
.overlay.hidden { display: none; }
#overlay-text { max-width: 560px; line-height: 1.5; }

.panel {
  background: var(--grad-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-top: 14px;
}

.progress-bar {
  height: 8px;
  border-radius: 3px;
  background: var(--bg-3);
  border: 1px solid var(--deep);
  overflow: hidden;
  margin: 10px 0 6px;
}
.progress-bar > div {
  height: 100%;
  background: var(--grad-bar);
  width: 0%;
  transition: width .5s;
  box-shadow: 0 0 10px rgba(252, 0, 70, 0.5);
}

.host-panel .invite-row { display: flex; gap: 10px; align-items: end; }
.host-panel .invite-row label { flex: 1; margin-bottom: 0; }
.host-panel .invite-row input { background: #100509; }
.host-panel .inline-form { display: flex; gap: 10px; align-items: end; }
.host-panel .inline-form label { flex: 1; }
.host-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 10px; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; margin: 0; }
.checkbox input { width: auto; accent-color: var(--accent); }

/* ---- участники/чат ---- */

.side-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.side-col .panel { margin-top: 0; }

.participants { list-style: none; margin: 0; padding: 0; }
.participants li {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
}
.participants li:last-child { border-bottom: none; }
.host-mark { color: var(--accent-hi); font-size: 12px; }

.chat-panel { display: flex; flex-direction: column; min-height: 420px; }
.chat-log {
  flex: 1;
  overflow-y: auto;
  max-height: 460px;
  min-height: 260px;
  padding: 4px 2px;
  font-size: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--deep) transparent;
}
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--deep); border-radius: 3px; }
.chat-log::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.chat-msg { margin-bottom: 8px; line-height: 1.45; word-wrap: break-word; }
.chat-msg .chat-author { color: var(--accent-hi); font-weight: 600; margin-right: 6px; }
.chat-msg .chat-time { color: var(--muted); font-size: 11px; margin-left: 6px; }
.chat-msg.chat-system { color: var(--muted); font-style: italic; }

.chat-form { display: flex; gap: 8px; margin-top: 10px; }
