/* ========== БАЗА ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0b0d14;
  --bg-soft:   #121522;
  --card:      #171b2e;
  --card-hi:   #1e2338;
  --border:    #262b45;
  --border-hi: #343a5e;
  --text:      #eaeef7;
  --muted:     #8b93b8;
  --accent:    #5b7cfa;
  --accent-hi: #7a95ff;
  --green:     #2ecc71;
  --red:       #e74c3c;
  --yellow:    #f1c40f;
  --radius:    14px;
  --shadow:    0 8px 24px rgba(0,0,0,.35);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(91,124,250,.18), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(46,204,113,.10), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== HEADER ========== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: rgba(18, 21, 34, .75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  background: linear-gradient(135deg, #7a95ff, #b28bff 60%, #6ee7b7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

header > div {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

header > div a {
  color: var(--accent-hi);
  font-weight: 500;
}

/* ========== MAIN ========== */
main {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 20px 60px;
}

/* ========== CARDS (главная) ========== */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}

.card:hover { border-color: var(--border-hi); }

.card h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
}

/* ========== INPUT / BUTTON ========== */
input[type="text"],
input[type="password"],
input:not([type]) {
  width: 100%;
  padding: 12px 14px;
  margin: 8px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,124,250,.18);
}

button {
  width: 100%;
  padding: 12px 16px;
  margin: 8px 0 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, opacity .15s;
  box-shadow: 0 4px 14px rgba(91,124,250,.35);
}

button:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(91,124,250,.45); }
button:active { transform: translateY(0); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

button.danger {
  background: linear-gradient(135deg, #d64545, #e74c3c);
  box-shadow: 0 4px 14px rgba(231,76,60,.35);
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 12px;
  line-height: 1.5;
}

/* ========== СПИСОК КОМНАТ ========== */
#roomsList a {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px !important;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text) !important;
  font-size: 13.5px;
  transition: border-color .15s, background .15s;
  text-decoration: none;
}

#roomsList a:hover {
  background: var(--card-hi);
  border-color: var(--accent);
  text-decoration: none;
}

/* ========== TOOLBAR (комната) ========== */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 14px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.toolbar input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.toolbar button {
  width: auto;
  margin: 0;
  padding: 9px 18px;
  font-size: 13.5px;
}

.toolbar #leaveVoice {
  background: linear-gradient(135deg, #444a6e, #2f3452);
  box-shadow: none;
}

#voiceStatus {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(46,204,113,.12);
  color: var(--green);
  font-weight: 600;
}

#voiceStatus:empty { display: none; }

/* ========== SEATS (сетка мест) ========== */
.seats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.seat {
  position: relative;
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, transform .15s;
}

.seat:hover { border-color: var(--border-hi); }

.seat .num {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.seat .who {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  word-break: break-word;
}

.seat .who:empty::before { content: "—"; color: var(--muted); }

.seat .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.seat .actions button {
  width: auto;
  margin: 0;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--card-hi);
  color: var(--text);
  box-shadow: none;
  border: 1px solid var(--border);
}

.seat .actions button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Пустое место */
.seat:has(.who:not(:empty)) {
  /* нельзя использовать JS-состояние в CSS, но визуально: */
}

.seat.locked {
  opacity: .45;
  background: repeating-linear-gradient(
    45deg,
    var(--bg-soft),
    var(--bg-soft) 8px,
    var(--card) 8px,
    var(--card) 16px
  );
}

.seat.locked::after {
  content: "🔒";
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 16px;
}

.seat.muted {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(231,76,60,.25) inset;
}

.seat.muted::before {
  content: "MUTED";
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--red);
  background: rgba(231,76,60,.15);
  padding: 3px 7px;
  border-radius: 999px;
}

/* ========== LOG ========== */
.log {
  margin-top: 24px;
  background: rgba(11,13,20,.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.6;
}

.log div {
  color: var(--muted);
  padding: 2px 0;
  border-bottom: 1px dashed rgba(38,43,69,.6);
}

.log div:last-child { border-bottom: none; }

/* ========== СКРОЛЛБАР ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ========== АДАПТИВ ========== */
@media (max-width: 900px) {
  .seats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  .cards { grid-template-columns: 1fr; }
  header { padding: 14px 18px; }
  header h1 { font-size: 17px; }
  header > div { font-size: 12.5px; }
  main { margin: 20px auto; }
  .seats { grid-template-columns: repeat(2, 1fr); }
  .toolbar { gap: 8px; }
  .toolbar button { padding: 8px 14px; font-size: 12.5px; }
}

/* ========== ТОСТ-УВЕДОМЛЕНИЯ (если добавите JS) ========== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: toastIn .25s ease;
  z-index: 999;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== ЗАГРУЗКА ========== */
.loading {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.loading::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }