/* Cineroom — sade, Apple tarzı arayüz */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f2;
  --line: rgba(0, 0, 0, .08);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --accent-text: #ffffff;
  --danger: #ff3b30;
  --live: #30d158;
  --glass: rgba(255, 255, 255, .72);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .08);
  --ease: cubic-bezier(.32, .72, 0, 1);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --line: rgba(255, 255, 255, .09);
    --text: #f5f5f7;
    --muted: #98989d;
    --accent: #0a84ff;
    --danger: #ff453a;
    --glass: rgba(28, 28, 30, .72);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --line: rgba(255, 255, 255, .09);
  --text: #f5f5f7; --muted: #98989d; --accent: #0a84ff; --danger: #ff453a;
  --glass: rgba(28, 28, 30, .72); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; letter-spacing: -.01em;
  display: flex; flex-direction: column;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Etkileşim: basınca hafif küçülme */
.btn, .pill, .send, .icon-btn { transition: transform .16s var(--ease), background-color .2s var(--ease), color .2s var(--ease), opacity .2s; }
.btn:active:not(:disabled), .pill:active:not(:disabled), .send:active, .icon-btn:active { transform: scale(.96); }

input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); outline: none; transition: border-color .2s, background-color .2s, box-shadow .2s;
}
input::placeholder { color: var(--muted); }
input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

.btn { padding: 12px 18px; border-radius: 12px; font-weight: 500; background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.block { width: 100%; }
.link { color: var(--muted); font-size: 13px; text-decoration: none; text-align: center; }
.link:hover { color: var(--text); }
.err { color: var(--danger); font-size: 13px; min-height: 1.2em; margin: 0; text-align: center; }

/* Marka */
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.mark { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(145deg, #5e5ce6, #0a84ff); position: relative; }
.mark::after { content: ""; position: absolute; left: 8px; top: 6px; border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }

/* Kart (giriş / ana sayfa) */
.card {
  width: min(380px, calc(100% - 32px)); background: var(--surface); border-radius: 24px;
  padding: 32px 28px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
}
.card h1 { margin: 4px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.card p.lead { margin: -6px 0 6px; color: var(--muted); }
.enter { animation: enter .5s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.gate { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--bg); transition: opacity .35s var(--ease), visibility .35s; }
.gate.hidden { opacity: 0; visibility: hidden; }

/* Üst çubuk */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.people li {
  position: relative; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: #fff; background: var(--c, #8e8e93);
  box-shadow: 0 0 0 2px var(--bg); transition: box-shadow .2s var(--ease), transform .3s var(--ease);
  animation: pop .35s var(--ease) both;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.people li.speaking { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--live); }
.people li .badge {
  position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--surface); color: var(--text); display: grid; place-items: center; box-shadow: 0 0 0 1.5px var(--bg);
}
.people li .badge svg { width: 10px; height: 10px; stroke-width: 2.4; }
.people li .badge.live { background: var(--live); color: #fff; }
.people li[data-me]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px dashed var(--line); }

/* Yerleşim */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 320px; gap: 16px; padding: 0 20px 96px; }

/* Sahne */
.stage { position: relative; min-height: 240px; border-radius: var(--radius); overflow: hidden; background: #000; display: grid; place-items: center; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .5s var(--ease); }
.stage.live video { opacity: 1; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #98989d; text-align: center; padding: 24px; transition: opacity .3s var(--ease); }
.empty svg { width: 36px; height: 36px; stroke-width: 1.4; margin-bottom: 6px; opacity: .7; }
.empty p { margin: 0; color: #f5f5f7; font-weight: 500; }
.empty span { font-size: 13px; }
.stage.live .empty { opacity: 0; pointer-events: none; }
.stage-meta {
  position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 12px; opacity: 0; transform: translateY(4px); transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.stage.live:hover .stage-meta, .stage.live:focus-within .stage-meta { opacity: 1; transform: none; }
#stageInfo:not(:empty) { padding: 5px 10px; border-radius: 999px; background: rgba(0, 0, 0, .5); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-weight: 500; }
#quality { color: rgba(255, 255, 255, .6); font-variant-numeric: tabular-nums; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn.ghost { background: rgba(0, 0, 0, .5); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.icon-btn svg { width: 16px; height: 16px; }

/* Sohbet */
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
#msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.msg { animation: msgIn .3s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg .who { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.msg .who b { color: var(--text); font-weight: 600; }
.msg .body { word-wrap: break-word; }
.msg.sys { align-self: center; font-size: 12px; color: var(--muted); text-align: center; }
#chatForm { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
#chatForm input { border-radius: 999px; padding: 10px 16px; }
.send { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.send svg { width: 18px; height: 18px; stroke-width: 2.2; }

/* Alt kontrol çubuğu */
.dock {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  display: flex; gap: 6px; padding: 6px; border-radius: 999px; background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.pill { height: 44px; padding: 0 16px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; white-space: nowrap; }
.pill:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 7%, transparent); }
.pill.round { width: 44px; padding: 0; justify-content: center; }
.pill.accent { background: var(--accent); color: #fff; }
.pill.accent:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.pill.danger { background: var(--danger); color: #fff; }
.pill.danger:hover:not(:disabled) { background: var(--danger); filter: brightness(1.08); }
.pill.on { background: color-mix(in srgb, var(--live) 18%, transparent); color: var(--live); }
.pill.off { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.pill .slash { opacity: 0; transition: opacity .2s; }
.pill.off .slash { opacity: 1; }
[hidden] { display: none !important; }

/* Bildirim */
.toast {
  position: fixed; left: 50%; bottom: 92px; z-index: 30; padding: 10px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 500; box-shadow: var(--shadow);
  opacity: 0; transform: translate(-50%, 8px) scale(.96); pointer-events: none; transition: opacity .25s var(--ease), transform .35s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Ana sayfa adımları */
.step { display: flex; flex-direction: column; gap: 10px; }
.step:not(.on) { display: none; }
.step.on { animation: enter .35s var(--ease) both; }
.label { font-size: 13px; color: var(--muted); margin: 0; }
.foot { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 0; }
body.home { display: grid; place-items: center; }

@media (max-width: 860px) {
  .top { padding: 12px 16px; }
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; padding: 0 16px 96px; gap: 12px; }
  .stage { min-height: 0; aspect-ratio: 16 / 9; }
  .stage-meta { opacity: 1; transform: none; }
  .chat { min-height: 280px; }
  .pill span { display: none; }
  .pill { width: 44px; padding: 0; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
