:root {
  --bg-darkest: #1e1f22;
  --bg-panel: #2b2d31;
  --bg-content: #313338;
  --bg-elevated: #383a40;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --speaking: #23a559;
  --danger: #da373c;
  --danger-hover: #b32b30;
  --text: #f2f3f5;
  --text-muted: #949ba4;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg-content);
  color: var(--text);
  font-family: "gg sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

input {
  font-family: inherit;
}

/* ---------- Lobi ---------- */

.lobby {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-card {
  background: var(--bg-panel);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.lobby-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.lobby-card p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 4px;
  border: none;
  background: var(--bg-darkest);
  color: var(--text);
  font-size: 15px;
}

.field input:focus {
  outline: 2px solid var(--accent);
}

.primary-btn {
  width: 100%;
  padding: 12px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { background: var(--bg-elevated); color: var(--text-muted); cursor: not-allowed; }

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 16px;
}

.hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Oda ---------- */

.room-layout {
  height: 100%;
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 1fr auto;
}

.sidebar {
  grid-row: 1 / 3;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-header {
  padding: 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--bg-darkest);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.participant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 4px;
}

.participant:hover { background: var(--bg-elevated); }

.avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.avatar-wrap.speaking .avatar {
  box-shadow: 0 0 0 3px var(--speaking);
}

.participant-info {
  flex: 1;
  min-width: 0;
}

.participant-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-name.is-self { color: var(--text-muted); }

.participant-icons {
  display: flex;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.icon-muted { color: var(--danger); }
.icon-sharing { color: var(--speaking); }

.volume-row {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 0 8px 8px 54px;
}

.participant.has-volume:hover .volume-row,
.participant.has-volume.expanded .volume-row {
  display: flex;
}

.volume-row input[type="range"] {
  flex: 1;
}

/* ---------- Sahne ---------- */

.stage-area {
  overflow: auto;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 900px;
}

.avatar-tile {
  background: var(--bg-panel);
  border-radius: var(--radius);
  aspect-ratio: 16/10;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.avatar-tile .avatar {
  width: 72px;
  height: 72px;
  font-size: 26px;
}

.avatar-tile .tile-name {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 8px;
  border-radius: 4px;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  width: 100%;
}

.share-grid.single {
  grid-template-columns: 1fr;
  max-width: 1100px;
  margin: 0 auto;
}

.share-tile {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.share-tile video {
  width: 100%;
  display: block;
  aspect-ratio: 16/9;
  object-fit: contain;
  background: #000;
}

.share-tile .tile-name {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ---------- Kontrol barı ---------- */

.control-bar {
  background: var(--bg-darkest);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
}

.ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.ctrl-btn:hover { background: #45484e; }
.ctrl-btn.active { background: var(--accent); }
.ctrl-btn.danger { background: var(--danger); }
.ctrl-btn.danger:hover { background: var(--danger-hover); }

.ctrl-btn.leave {
  width: auto;
  padding: 0 18px;
  border-radius: 22px;
  font-weight: 600;
  font-size: 14px;
  gap: 6px;
}

/* ---------- Ayarlar modalı ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--bg-panel);
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
}

.modal h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.modal .field select {
  width: 100%;
  padding: 10px;
  border-radius: 4px;
  border: none;
  background: var(--bg-darkest);
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.modal-actions button {
  padding: 8px 16px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
}

.hidden { display: none !important; }
