:root {
  --bg: #0b0d12;
  --panel: #151922;
  --panel-2: #1c2130;
  --accent: #e11d48;
  --accent-2: #f43f5e;
  --text: #e8eaf0;
  --muted: #8a90a2;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden özniteliği class'ların display kuralını ezebilmeli */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

/* iOS'ta gerçek görünür yükseklik */
.app, .login { min-height: 100dvh; }

/* ---------- Şifre / Hazırlık ekranı ---------- */
.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(225,29,72,.25), transparent 60%),
    var(--bg);
}

.login-card {
  width: min(92vw, 380px);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 18px;
  padding: 30px 26px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}

.logo { font-size: 46px; }
.login-card h1 { margin: 8px 0 4px; font-size: 23px; }
.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.login-card input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.1);
  background: #0e1118;
  color: var(--text);
  font-size: 16px; /* iOS'ta zoom yapmaması için >=16 */
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }

.login-card button {
  width: 100%;
  margin-top: 14px;
  padding: 15px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s ease, opacity .2s;
}
.login-card button:active { transform: scale(.98); }
.err { color: var(--accent-2); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- Lobi (salon seçimi) ---------- */
.lobby { display: flex; flex-direction: column; background: var(--bg); }
.lobby-body { padding: 22px 18px calc(22px + var(--safe-b)); max-width: 760px; width: 100%; margin: 0 auto; }
.lobby-title { margin: 8px 0 4px; font-size: 22px; }
.lobby-sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.halls { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .halls { grid-template-columns: 1fr 1fr; } }

.hall {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: transform .05s ease, border-color .2s, background .2s;
}
.hall:active { transform: scale(.98); }
.hall:hover { border-color: var(--accent); background: var(--panel-2); }
.hall .poster {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  font-size: 30px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(225,29,72,.25), rgba(244,63,94,.15));
}
.hall .meta { min-width: 0; }
.hall .hall-no { font-size: 12px; color: var(--accent-2); font-weight: 700; letter-spacing: .04em; }
.hall .hall-title { font-size: 17px; font-weight: 600; margin-top: 2px; }
.hall .hall-live { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- Uygulama ---------- */
.app { display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand { font-weight: 600; font-size: 15px; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.status {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  white-space: nowrap;
}
.status.ok  { color: #34d399; }
.status.bad { color: var(--accent-2); }

.icon-btn {
  position: relative;
  border: 0;
  background: rgba(255,255,255,.07);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 19px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:active { transform: scale(.94); }

.badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 12px;
  min-height: 0;
}

.video-js {
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
}

/* Uzaktan oynat engellenince çıkan katman */
.resume {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 12, .6);
  backdrop-filter: blur(2px);
  z-index: 60;
}
.resume button {
  padding: 16px 26px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}

/* ---------- Sohbet ---------- */
.chat {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: min(70dvh, 560px);
  background: var(--panel);
  border-top: 1px solid rgba(255,255,255,.08);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  z-index: 55;
  box-shadow: 0 -20px 60px rgba(0,0,0,.5);
  transform: translateY(105%);   /* varsayılan: ekran dışında */
  transition: transform .25s ease;
}
.chat.open { transform: translateY(0); }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.msg {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.35;
  word-wrap: break-word;
  animation: pop .15s ease;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.msg.them { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 4px; }
.msg.me {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.quick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  -webkit-overflow-scrolling: touch;
}
.quick::-webkit-scrollbar { display: none; }
.quick button {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.12);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.quick button:active { transform: scale(.95); }

.emojis {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 10px 4px;
  -webkit-overflow-scrolling: touch;
}
.emojis::-webkit-scrollbar { display: none; }
.emojis button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  font-size: 24px;
  padding: 4px 6px;
  cursor: pointer;
}
.emojis button:active { transform: scale(1.25); }

.chat-input { padding: 4px 12px calc(10px + var(--safe-b)); }
.chat-row { display: flex; gap: 8px; }
.chat-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1);
  background: #0e1118;
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.chat-row input:focus { border-color: var(--accent); }
.chat-row button {
  border: 0;
  width: 46px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.chat-row button:active { transform: scale(.94); }

/* ---------- Geniş ekran: sohbet sağa yaslı panel ---------- */
@media (min-width: 900px) {
  .chat {
    left: auto;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    height: 100dvh;
    border-radius: 0;
    border-left: 1px solid rgba(255,255,255,.08);
    border-top: 0;
    transform: translateX(105%);
  }
  .chat.open { transform: translateX(0); }
}
