:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --line: #2a2f3a;
  --text: #e8e6e3;
  --muted: #9097a3;
  --accent: #e0a458;
  --accent-ink: #1a1206;
  --danger: #e5484d;
  --ok: #46a758;
  --radius: 12px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; color: inherit; }
button {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; transition: background .15s, border-color .15s;
}
button:hover { background: #272c37; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.active { border-color: var(--accent); color: var(--accent); }
button.off { background: #3a1d1f; border-color: #6b2a2d; color: #ffb3b5; }
button:disabled { opacity: .5; cursor: default; }
input, select {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.brand { font-weight: 700; letter-spacing: .3px; }
.brand span { color: var(--accent); }

/* ---------- Ortak kart sayfaları ---------- */
.center-page { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 100%; max-width: 920px; }
.card h1 { margin: 0 0 4px; font-size: 22px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.row > button { flex: 0 0 auto; }

.room-list { margin-top: 24px; display: grid; gap: 10px; }
.room-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.room-item h3 { margin: 0 0 8px; font-size: 16px; }
.link-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; font-size: 13px; }
.link-row code { flex: 1; background: var(--bg); padding: 6px 8px; border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row b { width: 70px; flex: 0 0 auto; color: var(--muted); font-weight: 500; }
.link-row button { padding: 4px 10px; font-size: 13px; }

/* ---------- Katılım öncesi ---------- */
.prejoin { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.preview { position: relative; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.meter { height: 6px; background: var(--panel-2); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s; }
.toggle { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px; background: var(--panel-2); border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.toggle input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.toggle small { display: block; color: var(--muted); margin-top: 2px; }
@media (max-width: 760px) { .prejoin { grid-template-columns: 1fr; } }

/* ---------- Oda ---------- */
.app { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.topbar .title { font-weight: 600; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.badge.student { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.spacer { flex: 1; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 10px; font-size: 13px; border-radius: 7px; }
.seg button.active { background: var(--accent); color: var(--accent-ink); }

.main { display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
.main.no-side { grid-template-columns: 1fr; }
.stage { position: relative; overflow: hidden; margin: 10px; min-height: 0; }
.side { border-left: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 14px; }
.side h4 { margin: 4px 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .side { position: fixed; right: 0; top: 0; bottom: 0; width: min(320px, 90vw); z-index: 50; box-shadow: -10px 0 30px #0008; }
}

/* Kamera kutuları */
.tile {
  position: absolute; background: #050608; border-radius: 10px; overflow: hidden;
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease, opacity .2s;
  border: 2px solid transparent;
}
.tile.speaking { border-color: var(--ok); }
.tile.dragging { transition: none; box-shadow: 0 10px 40px #000a; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.contain video { object-fit: contain; }
.tile.mirror video { transform: scaleX(-1); }
.tile .avatar { position: absolute; inset: 0; display: grid; place-items: center; }
.tile .avatar span { width: 30%; max-width: 96px; aspect-ratio: 1; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: clamp(16px, 3vw, 36px); font-weight: 700; color: var(--accent); }
.tile .label { position: absolute; left: 8px; bottom: 8px; background: #000a; padding: 3px 8px; border-radius: 6px; font-size: 12px; display: flex; gap: 6px; align-items: center; max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .label .mic-off { color: var(--danger); }
.tile .tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.tile:hover .tools, .tile.featured .tools .is-on { opacity: 1; }
.tile:hover .tools { opacity: 1; }
.tile .tools button { padding: 3px 8px; font-size: 12px; background: #000b; border-color: #fff2; }
.tile .tools button.is-on { color: var(--accent); border-color: var(--accent); }
.tile .resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, var(--accent) 50%); opacity: .8; }
.stage.free-edit .tile { cursor: move; }
.stage.free-edit { outline: 1px dashed var(--line); border-radius: 10px; background-image: radial-gradient(#ffffff10 1px, transparent 1px); background-size: 20px 20px; }

/* Alt kontrol çubuğu */
.controls { display: flex; justify-content: center; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.controls button { min-width: 44px; }

/* Katılımcı paneli */
.person { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.person .head { display: flex; align-items: center; gap: 8px; }
.person .name { flex: 1; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .acts { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.person .acts button, .person .trk button { padding: 3px 8px; font-size: 12px; }
.person .trk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.person .trk span { flex: 1; }
.person .trk button.is-on { color: var(--accent); border-color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 100; box-shadow: 0 10px 30px #0008; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(440px, 92vw); }
dialog::backdrop { background: #0009; }
dialog h3 { margin: 0 0 6px; }
