:root {
  --bg: #0b0c10;
  --panel: #13151b;
  --panel-2: #1b1e26;
  --panel-3: #232731;
  --line: #262a34;
  --line-2: #343946;
  --text: #eceef4;
  --muted: #8b92a3;
  --accent: #6b8cff;
  --accent-2: #8a6bff;
  --accent-soft: rgba(107, 140, 255, .16);
  --speak: #3ddc84;
  --danger: #ff5c6c;
  --danger-soft: rgba(255, 92, 108, .14);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 16px 40px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .03);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 0 10px; font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); margin: 0; }

/* İkonlar: index.html'deki SVG seti */
.ic {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -.2em;
}

::selection { background: var(--accent-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  transition: border-color .15s, background .15s;
}
input::placeholder { color: #6b7284; }
input:hover { border-color: var(--line-2); }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=range] { padding: 0; border: none; background: none; box-shadow: none; accent-color: var(--accent); cursor: pointer; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
button:hover { background: var(--panel-3); border-color: var(--line-2); }
button:active:not(:disabled) { transform: scale(.96); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, .attach:focus-within, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
button.primary:hover { background: #7f9bff; }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: var(--panel-2); }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger-soft); border-color: transparent; }
button.wide { width: 100%; }
button.icon { width: 40px; height: 40px; padding: 0; flex-shrink: 0; }
button.icon .ic { width: 20px; height: 20px; }
button.icon.sm { width: 32px; height: 32px; }
button.icon.sm .ic { width: 16px; height: 16px; }
button.sm { padding: 5px 10px; font-size: 13px; gap: 5px; }
button.sm .ic { width: 15px; height: 15px; }
button.round { border-radius: 50%; }
button.off { background: var(--danger); border-color: transparent; color: #fff; }
button.off:hover { background: #ff7482; }

/* Giriş */
.join {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(600px 400px at 30% 20%, rgba(107, 140, 255, .14), transparent 70%),
    radial-gradient(500px 400px at 75% 80%, rgba(138, 107, 255, .10), transparent 70%);
}
.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow);
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.brand img { border-radius: 12px; flex-shrink: 0; }
.brand p { margin: 2px 0 0; font-size: 14px; }
.card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.card #room-status { margin: -4px 0 0; }
.card button.primary { padding: 12px; }

/* Oda */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  padding: 20px 16px;
  max-width: 1240px;
  margin: 0 auto;
}

.player-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.player-wrap iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; }
.player-shield { position: absolute; inset: 0; }
.player-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 40%, #191c25, var(--panel) 70%);
}
.player-empty p { margin: 0; }
.player-empty p:not(.muted) { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.player-empty .ic {
  width: 56px;
  height: 56px;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  stroke-width: 1.75;
}
.poster { position: absolute; inset: 0; display: grid; place-items: center; background: #000; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; }
.poster-play {
  position: relative;
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.poster-play:hover { background: #7f9bff; }

/* Video altı: kartlar */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 12px;
}
.now-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.now-text { min-width: 0; flex: 1 1 260px; }
.now-title { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; letter-spacing: -.005em; }
.now .reactions { margin-top: 0; justify-content: flex-end; }

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
#play-toggle { background: var(--text); color: var(--bg); border-color: transparent; }
#play-toggle:hover { background: #fff; }
#play-toggle .ic { width: 18px; height: 18px; }
.controls #seek { flex: 1; min-width: 60px; margin: 0 4px; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.vol { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-left: 6px; }
.vol input { width: 90px; }

.sfx-pop { width: min(340px, calc(100vw - 32px)); padding: 12px; }
.sfx-pop:popover-open { display: grid; gap: 10px; }
.sfx { display: flex; gap: 6px; flex-wrap: wrap; }
.sfx-custom:empty { display: none; }
.sfx-custom .sfx-btn { width: auto; padding: 0 14px; font-size: 13px; position: relative; }
.sfx-custom .remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  display: none;
  place-items: center;
}
.sfx-custom .remove .ic { width: 10px; height: 10px; stroke-width: 3; }
.sfx-custom .remove:hover { background: var(--danger); color: #fff; }
.sfx-custom .sfx-btn:hover .remove { display: grid; }
.sfx-upload { display: flex; gap: 6px; }
.sfx-upload input { padding: 7px 10px; }
.sfx-upload .attach { width: auto; padding: 0 12px; gap: 6px; white-space: nowrap; font-size: 13px; }
.sfx-upload .attach .ic { width: 16px; height: 16px; }
.sfx-note { margin: 0; }
.sfx-btn { width: 42px; height: 42px; padding: 0; font-size: 20px; border-radius: 999px; }
.sfx-btn:hover { transform: translateY(-1px); }

.settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.settings-actions { display: flex; gap: 8px; }
.settings-actions button { flex: 1; min-width: 0; padding: 8px 10px; font-size: 14px; white-space: nowrap; }
.settings-actions .ic { width: 16px; height: 16px; }
.select { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.select select { width: auto; min-width: 0; max-width: 60%; padding: 6px 8px; cursor: pointer; text-overflow: ellipsis; }
.select input[type=range] { width: 140px; }
.p-badge { color: var(--muted); }
.p-badge .ic { width: 13px; height: 13px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.credits { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: auto; accent-color: var(--accent); }

/* Sıra / geçmiş sekmeleri */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px -6px 14px; padding: 0 6px; }
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 600;
}
.tab:hover { background: none; color: var(--text); }
.tab:active:not(:disabled) { transform: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.count { font-size: 11px; color: var(--muted); font-weight: 600; background: var(--panel-2); border-radius: 999px; padding: 0 6px; }
.count:empty { display: none; }
.empty { margin: 8px 0 2px; text-align: center; padding: 16px 0; }
.history-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.add { display: flex; gap: 8px; margin-bottom: 12px; }
.search-box { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.search-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.queue .dur { font-variant-numeric: tabular-nums; }

.queue { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.queue li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 10px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.queue li:hover { border-color: var(--line-2); }
.queue .thumb { width: 64px; height: 36px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: #000; }
.queue .q-text { flex: 1; min-width: 0; }
.queue .reactions { margin-top: 4px; }
.queue .q-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.queue li > button { flex-shrink: 0; }

.people-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.people-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow .12s;
}
.speaking .avatar { box-shadow: 0 0 0 3px var(--speak); }
.p-info { flex: 1; min-width: 0; }
.p-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-status { font-size: 12px; color: var(--muted); }
.p-vol { width: 100%; margin-top: 4px; }
.p-vol:disabled { opacity: .35; }
.p-mute { width: 34px; height: 34px; }
.p-mute .ic { width: 16px; height: 16px; }

.chat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  overflow: hidden;
}
.chat-list {
  list-style: none;
  margin: 0;
  padding: 12px;
  max-height: 280px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.chat-list:empty { display: none; }
.chat-empty { margin: 0; padding: 16px; text-align: center; align-self: center; }
.chat-msg { font-size: 14px; overflow-wrap: anywhere; }
.chat-msg .who { font-weight: 600; margin-right: 6px; }
.chat-msg.mine .who { color: var(--accent); }
.chat-msg .when { font-size: 11px; color: var(--muted); }
.chat-msg .text { margin-top: 1px; white-space: pre-wrap; }
.chat-msg a { color: var(--accent); }
.chat-msg .queue-add { margin-top: 6px; padding: 3px 10px 3px 8px; font-size: 12px; gap: 4px; border-radius: 999px; }
.chat-msg .queue-add .ic { width: 14px; height: 14px; }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); align-items: center; }
.attach {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.attach:hover { background: var(--panel-2); color: var(--text); border-color: transparent; }
.sfx-upload .attach { display: inline-flex; border-color: var(--line); background: var(--panel-2); color: var(--text); }
.chat-img { display: block; margin-top: 4px; max-width: 100%; max-height: 220px; border-radius: var(--radius-sm); cursor: zoom-in; background: var(--panel-2); }
.quick-emojis { display: flex; justify-content: space-between; padding: 6px 8px 0; border-top: 1px solid var(--line); }
.quick-emojis button { padding: 2px 4px; font-size: 18px; background: none; border: none; border-radius: 6px; transition: transform .12s, background .12s; }
.quick-emojis button:hover { background: var(--panel-2); transform: scale(1.18); }
.quick-emojis + .chat-form { border-top: none; }
.emoji-pop { width: min(300px, calc(100vw - 32px)); padding: 8px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button { padding: 4px 0; font-size: 20px; background: none; border: none; border-radius: 6px; }
.emoji-grid button:hover { background: var(--panel-2); }
.chat-msg .text.big { font-size: 32px; line-height: 1.2; }
.chat.dragging { outline: 2px dashed var(--accent); outline-offset: -4px; }
.chat-form input { padding: 8px 12px; border-radius: 999px; }
.chat-form .send { width: 36px; height: 36px; border-radius: 50%; }
.chat-form .send .ic { width: 17px; height: 17px; margin-left: -2px; }

.mic-settings {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 12px 0;
  display: grid;
  gap: 8px;
}
.mic-settings p { margin: 0; }
.mic-label { display: flex; justify-content: space-between; font-size: 14px; }
.meter { position: relative; height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: #4a5162; transition: width .05s linear; }
.meter-fill.open { background: var(--speak); }
.meter-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); }

.screen-wrap { margin-bottom: 16px; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.screen-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel);
  font-size: 14px;
}
.screen-actions { display: flex; gap: 6px; }
.screen-actions button { padding: 5px 10px; font-size: 13px; gap: 6px; }
.screen-actions .ic { width: 15px; height: 15px; }
#screen-video { display: block; width: 100%; max-height: 70vh; background: #000; }

.usage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: grid;
  gap: 4px;
}
.usage-row { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.usage-row strong { font-weight: 600; }
.usage-row.sub { font-size: 13px; color: var(--muted); }
.usage p { margin: 6px 0 0; }
.usage summary span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.usage summary .ic { width: 15px; height: 15px; }

.toasts {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(360px, calc(100% - 32px));
  z-index: 10;
  pointer-events: none;
}
.toast {
  background: rgba(35, 39, 49, .92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease-out, fade 4s forwards;
}
@keyframes toast-in { from { transform: translateY(-8px); } }
@keyframes fade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* Sağ panel: araç çubuğu + ekranı dolduran sohbet */
.side {
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.toolbar {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toolbar .tool { flex-shrink: 0; background: transparent; border-color: transparent; color: var(--muted); }
.toolbar .tool:hover { background: var(--panel-2); color: var(--text); }
.toolbar .tool.off { background: var(--danger); color: #fff; }
.tool.on { background: var(--accent) !important; color: #fff !important; }
.people-btn {
  --ring: var(--panel);
  flex: 1;
  min-width: 0;
  height: 40px;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 8px;
  background: transparent;
  border-color: transparent;
}
.people-btn:hover, .people-btn:focus-visible { --ring: var(--panel-2); background: var(--panel-2); border-color: transparent; }
.people-btn .muted { font-variant-numeric: tabular-nums; }
/* Üst üste binen avatarları arka planla aynı renkte bir halka ayırır */
.avatar-strip { display: flex; min-width: 0; overflow: hidden; padding: 5px; margin: -5px; }
.avatar-strip .avatar { width: 26px; height: 26px; font-size: 12px; margin-right: -6px; box-shadow: 0 0 0 2px var(--ring); transition: box-shadow .15s; }
.avatar-strip .avatar:last-child { margin-right: 0; }
.avatar-strip .avatar.speaking { box-shadow: 0 0 0 2px var(--ring), 0 0 0 4px var(--speak); position: relative; z-index: 1; }

.pop {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(320px, calc(100vw - 32px));
  max-height: 70vh;
  overflow: auto;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.pop:popover-open { animation: pop-in .14s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pop h2 { margin: 0 0 12px; }
#rec-pop { display: none; }
#rec-pop:popover-open { display: grid; gap: 10px; }
#rec-pop p { margin: 0; }
.tool.rec { width: auto; padding: 0 12px; gap: 6px; background: var(--danger) !important; color: #fff !important; font-variant-numeric: tabular-nums; font-size: 14px; }
.tool.rec .ic { width: 14px; height: 14px; }
.rec-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
}
.rec-banner::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; flex-shrink: 0; }
@keyframes blink { 50% { opacity: .25; } }
.pop .people-list { margin: 0; }
.pop .mic-settings { margin: 0; border: none; padding: 0; background: none; }

.side .chat { flex: 1; min-height: 0; grid-template-rows: 1fr auto auto; }
.side .chat-list { max-height: none; align-content: start; }
.chat-system { text-align: center; font-size: 12px; color: var(--muted); }
.chat-msg { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; }
.chat-msg .avatar { width: 28px; height: 28px; font-size: 13px; }
.chat-msg .queue-add { justify-self: start; }

details.usage summary { cursor: pointer; list-style: none; }
details.usage summary::-webkit-details-marker { display: none; }
details.usage summary span::after { content: '▸'; color: var(--muted); font-size: 11px; }
details.usage[open] summary span::after { content: '▾'; }

/* Şarkı tepkileri */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; align-items: center; }
.react {
  height: 28px;
  padding: 0 9px;
  font-size: 13px;
  border-radius: 999px;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}
.react .ic { width: 15px; height: 15px; }
.react.mine { border-color: var(--accent); background: var(--accent-soft); color: #c9d5ff; }
.react-picker { display: inline-flex; gap: 2px; }
.react-picker button { padding: 2px 6px; font-size: 15px; border-radius: 999px; }

@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 84px; gap: 12px; }
  .side { position: static; height: auto; }
  .side .chat { height: 420px; flex: none; }
  /* Telefonda araç çubuğu (mikrofon vs.) ekranın altında hep görünür */
  .toolbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 5;
    background: rgba(19, 21, 27, .9);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
  }
  .toasts { top: auto; bottom: 84px; }
  .vol input { width: 60px; }
  .controls { flex-wrap: wrap; }
  .controls .vol { display: none; } /* telefonda ses tuşları yeterli */
  .controls .time:first-of-type { margin-left: auto; }
  .controls #seek { order: 10; flex-basis: 100%; margin: 4px 0 0; }
  .quick-emojis { justify-content: flex-start; gap: 6px; flex-wrap: wrap; }
}
