:root {
  --bg: #0e1013;
  --bg-2: #15181d;
  --bg-3: #1c2027;
  --line: #262b33;
  --fg: #e7eaee;
  --muted: #8b93a0;
  --accent: #4f8cff;
  --accent-2: #2f6fe0;
  --danger: #e2504a;
  --ok: #3fb96b;
  --radius: 10px;
}

* { box-sizing: border-box; }

/* display: grid/flex veren kurallar hidden'i ezmesin */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

button {
  font: inherit;
  color: var(--fg);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
button:hover { background: #242a33; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: transparent; }
button.danger { border-color: #4a2320; color: #ffb4b0; }
button.on { background: var(--accent-2); border-color: var(--accent); color: #fff; }
button.rec-on { background: var(--danger); border-color: var(--danger); color: #fff; }

input, select {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
input[type="range"] { padding: 0; }
input[type="checkbox"] { width: auto; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: #ffb4b0; font-size: 13px; }
code { background: var(--bg-3); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---- overlay / kartlar ---- */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 9, 12, .82);
  z-index: 50;
  padding: 20px;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
}
.card.wide { width: min(700px, 100%); max-height: 80vh; overflow: auto; }
.card h1 { margin: 0; font-size: 24px; }
.card p { margin: 0; }
.card label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.card button[type="submit"] { background: var(--accent-2); border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.card-head h2 { margin: 0; font-size: 18px; }

/* ---- iskelet ---- */
#app { display: grid; grid-template-rows: 52px 1fr 58px; height: 100%; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.brand { display: flex; gap: 8px; align-items: center; }
.head-right { display: flex; gap: 8px; align-items: center; }

.rec-badge {
  color: #fff;
  background: var(--danger);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: .55; } }

main { display: grid; grid-template-columns: 1fr 320px; min-height: 0; }

#stage { position: relative; padding: 12px; overflow: auto; }
.videos {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.tile {
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.tile .label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, .6);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
}
.tile.speaking { border-color: var(--ok); }
.empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }

aside {
  border-left: 1px solid var(--line);
  background: var(--bg-2);
  display: grid;
  grid-template-rows: 42px 1fr;
  min-height: 0;
}
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-radius: 0; background: transparent; color: var(--muted); }
.tabs button.active { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }
.tab { overflow: auto; padding: 12px; min-height: 0; }
.tab[data-tab="chat"] { display: grid; grid-template-rows: 1fr auto; gap: 8px; padding-bottom: 12px; }

#people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#people li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--bg-3); }
#people li .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#people .tag { font-size: 11px; color: var(--muted); }

.chat-log { overflow: auto; display: grid; gap: 8px; align-content: start; }
.chat-log .msg { background: var(--bg-3); border-radius: 8px; padding: 6px 9px; }
.chat-log .msg .from { font-size: 12px; color: var(--accent); }
#chat-form, #music-add { display: grid; grid-template-columns: 1fr auto; gap: 6px; }

.tabaudio {
  display: grid;
  gap: 6px;
  padding: 10px;
  margin-bottom: 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.drop {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-top: 8px;
  text-align: center;
  display: grid;
  gap: 5px;
}
.drop.over { border-color: var(--accent); background: rgba(79, 140, 255, .08); }

.player { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; margin: 10px 0; }
.player-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row { display: flex; justify-content: space-between; align-items: center; }
.player-btns { display: flex; gap: 4px; }
.player-btns button { padding: 4px 9px; }
.vol { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

.tracks, .rec-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.tracks li, .rec-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-3);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 13px;
}
.tracks li .t, .rec-list li .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tracks li button, .rec-list li button { padding: 3px 8px; font-size: 12px; }
.tracks li.current { outline: 1px solid var(--accent); }

footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.pill { border-radius: 999px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  z-index: 60;
  max-width: 80vw;
}

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; grid-template-rows: 1fr 300px; }
  aside { border-left: 0; border-top: 1px solid var(--line); }
  footer { overflow-x: auto; }
}
