/* Prevent pull-to-refresh on mobile */
html,
body {
  overscroll-behavior-y: none !important;
  overscroll-behavior-x: none !important;
}

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  --bg-color: #0a0a0c;
  /* Çok karanlık arka plan */
  --card-bg: #1a1a1e;
  /* Kart rengi (Koyu Gri) */
  --primary-red: #950101;
  /* Kan kırmızısı */
  --accent-red: #ff0000;
  /* Parlak kırmızı detaylar */
  --text-color: #d1d1d1;
  /* Ana yazı rengi */
  --border-color: #000000;
  /* Pixel kenarlıklar */
  --gold: #d4af37;
  /* Önemli vurgular için altın sarısı */
}

body {
  /* Safe area and 100dvh adjustments for mobile notches */
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  background-color: var(--bg-color);
  /* Arka plandaki noktaları koyu kırmızı yaptık */
  background-image: radial-gradient(var(--primary-red) 1px, transparent 1px);
  background-size: 40px 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  font-family: 'Press Start 2P', cursive;
  color: var(--text-color);
  overflow: hidden;
  /* Sayfanın yukarı aşağı kaymasını tamamen engeller */
}

/* Ana Kart Yapısı */
.main-card {
  background: var(--card-bg);
  border: 6px solid var(--border-color);
  /* Pixel gölge efekti */
  box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.5);
  padding: 30px;
  width: 480px;
  max-width: 95vw;
  max-height: 95vh;
  overflow-y: auto;
  /* İçerik çok uzarsa kartın içi kayar, sayfa kaymaz */
  box-sizing: border-box;
  text-align: center;
  position: relative;
}

.game-title {
  color: var(--accent-red);
  font-size: 22px;
  margin-bottom: 30px;
  text-shadow: 4px 4px 0px #4a0000;
}

/* Inputlar */
.pixel-input {
  width: 90%;
  padding: 15px;
  margin-bottom: 15px;
  background: #000;
  border: 4px solid var(--border-color);
  color: var(--gold);
  font-family: inherit;
  font-size: 10px;
  outline: none;
}

.pixel-input::placeholder {
  color: #555;
}

/* Ayarlar Satırı */
.row {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin: 15px 0;
}

.input-group label {
  display: block;
  font-size: 8px;
  margin-bottom: 8px;
  color: #888;
}

.input-group .pixel-input {
  width: 100px;
  text-align: center;
}

/* Açık/Gizli Oda Seçici */
.toggle-group {
  display: flex;
  border: 4px solid var(--border-color);
  margin: 15px 0;
}

.toggle-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: #2a2a2a;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  font-size: 9px;
  transition: 0.2s;
}

.toggle-btn.active {
  background: var(--primary-red);
  color: white;
}

/* Aksiyon Butonları */
.action-btn {
  width: 100%;
  padding: 18px;
  border: 4px solid var(--border-color);
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
}

.create-btn {
  background: var(--primary-red);
  color: white;
}

.create-btn:hover {
  background: var(--accent-red);
}

.join-btn {
  background: #444;
  color: white;
}

.join-btn:hover {
  background: #666;
}

/* Ayraçlar */
.separator {
  margin: 30px 0;
  position: relative;
  border-top: 4px solid var(--border-color);
}

.separator span {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  padding: 0 15px;
  font-size: 10px;
  color: #555;
}

/* Odalar Listesi */
.rooms-container {
  background: #000;
  border: 4px solid var(--border-color);
  padding: 10px;
  min-height: 80px;
  max-height: 150px;
  overflow-y: auto;
}

.room-item {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 2px solid #222;
  cursor: pointer;
}

.room-item:hover {
  background: #111;
  color: var(--accent-red);
}

/* Rol Gösterimi (Oyun İçi) */
#role-display {
  padding: 20px;
  border: 4px dashed #444;
  margin-bottom: 20px;
  font-size: 14px;
}

/* =========================================
   ÖZEL MODAL VE GİZLEME (HATA ÇÖZÜMLERİ) 
========================================= */

/* Modal Arka Plan Karartma */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Modal İçerik Kutusu */
.modal-content {
  width: 350px !important;
  animation: pixelPop 0.3s steps(4);
}

#modal-username {
  border-color: var(--primary-red);
  text-align: center;
}

@keyframes pixelPop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* GİZLEME SINIFI (Tüm çakışmaları ezer) */
.hidden {
  display: none !important;
}

/* GECE MODU */
body.night-mode {
  background-color: #030303;
  background-image: none;
}

body.night-mode .main-card {
  background: #0a0a0c;
  border-color: #333;
}

/* OYLAMA BUTONLARI */
.vote-btn {
  font-family: inherit;
  font-size: 7px;
  padding: 5px 10px;
  border: 2px solid white;
  cursor: pointer;
  background: black;
  color: white;
}

.vote-btn.kill {
  background: var(--primary-red);
}

.vote-btn.save {
  background: #00d2ff;
  color: black;
}

.vote-btn.lynch {
  background: var(--gold);
  color: black;
}

.vote-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}


/* Büyük Bildirim Animasyonu */
@keyframes epicZoom {
  0% {
    transform: scale(0.1);
    opacity: 0;
  }

  60% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

#announcement-text {
  animation: epicZoom 0.5s ease-out forwards;
}

/* ÖZEL ARTI/EKSİ BUTONLARI */
.pixel-btn-small {
  background: var(--primary-red);
  color: white;
  border: 4px solid var(--border-color);
  width: 35px;
  height: 35px;
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.1s;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
}

.pixel-btn-small:hover {
  background: var(--accent-red);
}

.pixel-btn-small:active {
  transform: translateY(2px);
  box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
}

/* Tarayıcının varsayılan sayı oklarını (spinner) gizleme */
.no-spinners::-webkit-outer-spin-button,
.no-spinners::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spinners {
  -moz-appearance: textfield;
  /* Firefox için */
  appearance: textfield;
  /* YENİ STANDART (Uyarıyı kaldıran kısım) */
}

/* --- LIVEKIT SES AYAR ÇUBUĞU --- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: #222;
  border: 1px solid #444;
  height: 8px;
  border-radius: 4px;
  outline: none;
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.8);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--gold, #f1c40f);
  cursor: pointer;
  border: 1px solid #000;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--gold, #f1c40f);
  cursor: pointer;
  border: 1px solid #000;
}

/* --- ŞIK MİKROFON BUTONU TASARIMI --- */
#micBtn {
  background-color: #c0392b;
  /* Kapalıyken Kırmızı */
  color: #fff;
  border: 2px solid #555;
  border-radius: 8px;
  /* Köşeleri yumuşatır, karelikten kurtarır */
  padding: 8px 12px;
  /* Butonu yatayda genişletir, dolgun gösterir */
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease-in-out;
  box-shadow: -3px 3px 0px #000;
  /* Retro / Pixel gölge efekti */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* İkon ile yazı arasına boşluk koyar */
}

/* Mikrofon Açıkkenki Görünüm */
#micBtn.active {
  background-color: #27ae60;
  /* Açıkken Yeşil */
  border-color: #fff;
}

/* Fareyle Üzerine Gelince (Hover) */
#micBtn:hover {
  filter: brightness(1.2);
  /* Rengi hafif açıp parlatır */
  transform: translate(-1px, 1px);
  /* Hafifçe aşağı kaydırır */
  box-shadow: -2px 2px 0px #000;
  /* Gölgeyi küçültür */
}

/* Butona Tıklanma Anı (Basma Hissiyatı) */
#micBtn:active {
  transform: translate(-3px, 3px);
  /* Tamamen gömülür */
  box-shadow: 0px 0px 0px #000;
  /* Gölge kaybolur */
}

/* ── ULTRA-PREMIUM FLOATING (i) BUTTON & MODAL ── */
.global-how-to-btn {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: calc(20px + env(safe-area-inset-left, 0px));
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #47130f 0%, #210705 70%, #120302 100%);
  border: 2px solid #e74c3c;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.75),
    inset 0 1px 2px rgba(255, 255, 255, 0.35),
    inset 0 -2px 6px rgba(0, 0, 0, 0.8),
    0 0 16px rgba(231, 76, 60, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999999;
  outline: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease, border-color 0.25s ease;
  user-select: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.how-to-btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e74c3c;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
  transition: color 0.25s ease, transform 0.25s ease;
}

.how-to-icon {
  stroke: #e74c3c;
  transition: stroke 0.25s ease, transform 0.25s ease;
}

.global-how-to-btn:hover {
  transform: translateY(-3px) scale(1.1);
  border-color: #ffffff;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.85),
    inset 0 1px 2px rgba(255, 255, 255, 0.5),
    0 0 25px rgba(231, 76, 60, 0.6);
}

.global-how-to-btn:hover .how-to-icon {
  stroke: #ffffff;
  transform: scale(1.1);
}

.global-how-to-btn:active {
  transform: translateY(1px) scale(0.95);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}

/* Ambient Pulsing Aura Effect */
.btn-glow-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(231, 76, 60, 0.35);
  animation: auraPulse 2.8s infinite cubic-bezier(0.45, 0, 0.55, 1);
  pointer-events: none;
}

@keyframes auraPulse {
  0% {
    transform: scale(0.92);
    opacity: 0.85;
  }

  50% {
    transform: scale(1.18);
    opacity: 0.15;
  }

  100% {
    transform: scale(0.92);
    opacity: 0.85;
  }
}

.global-how-to-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999;
  padding: 15px;
  animation: fadeInHowToModal 0.25s ease-out forwards;
}

.global-how-to-modal.hidden {
  display: none !important;
}

.global-how-to-box {
  background: linear-gradient(165deg, #2b0a07 0%, #140302 100%);
  border: 2px solid #e74c3c;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.9), inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 0 18px rgba(231, 76, 60, 0.25);
  color: #f8fafc;
  padding: 26px 28px;
  border-radius: 20px;
  width: min(92vw, 530px);
  position: relative;
  max-height: calc(88vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: 'Outfit', 'Inter', 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

.global-how-to-box::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

.global-how-to-box::-webkit-scrollbar-thumb {
  display: none !important;
}

.global-how-to-close {
  position: absolute;
  top: 14px;
  z-index: 10;
  right: 18px;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #e74c3c;
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: color 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.global-how-to-close:hover {
  color: #ffffff;
  transform: scale(1.15);
}

.global-how-to-title {
  color: #e74c3c;
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin: 0 0 4px 0;
  padding: 0 35px;
  letter-spacing: 0.4px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  font-family: inherit;
}

.global-how-to-subtitle {
  color: #cbd5e1;
  font-size: 0.88rem;
  text-align: center;
  margin: 0 0 20px 0;
  font-weight: 500;
  letter-spacing: 0.2px;
  opacity: 0.95;
  font-family: inherit;
}

.global-how-to-content .rules-section {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(231, 76, 60, 0.25);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.global-how-to-content h4 {
  color: #e74c3c;
  font-size: 1.02rem;
  margin: 0 0 10px 0;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-family: inherit;
}

.global-how-to-content p {
  font-size: 0.93rem;
  line-height: 1.65;
  color: #f1f5f9;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.15px;
  font-family: inherit;
}

.global-how-to-content ul,
.global-how-to-content ol {
  margin: 0;
  padding-left: 22px;
  font-size: 0.92rem;
  color: #f1f5f9;
  line-height: 1.68;
  font-weight: 400;
  letter-spacing: 0.15px;
  font-family: inherit;
}

.global-how-to-content li {
  margin-bottom: 8px;
}

.global-how-to-content li strong {
  color: #ffffff;
  font-weight: 700;
}

.global-how-to-content li:last-child {
  margin-bottom: 0;
}

@keyframes fadeInHowToModal {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── MOBİL / DİK / YATIK EKRAN UYUMLULUĞU ── */
@media (max-width: 600px) {
  .global-how-to-btn {
    width: 44px;
    height: 44px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    left: calc(14px + env(safe-area-inset-left, 0px));
  }

  .how-to-icon {
    width: 20px;
    height: 20px;
  }

  .global-how-to-box {
    padding: 20px 20px;
    border-radius: 16px;

    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
  }

  .global-how-to-title {
    font-size: 1.2rem;
  }

  .global-how-to-content .rules-section {
    padding: 12px 14px;
    margin-bottom: 12px;
  }

  .global-how-to-content p,
  .global-how-to-content ul,
  .global-how-to-content ol {
    font-size: 0.88rem;
    line-height: 1.6;
  }
}

@media (max-height: 500px) {
  .global-how-to-btn {
    width: 40px;
    height: 40px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
  }

  .how-to-icon {
    width: 18px;
    height: 18px;
  }

  .global-how-to-box {
    max-height: 90vh;
    padding: 16px 18px;

    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
  }
}

/* ── LANDSCAPE ENGELLEYİCİ (Masaüstü ve Dik Mobilde Gizli, Sadece Mobil Yatık Ekranda Görünür) ── */
#landscape-blocker {
  display: none !important;
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #landscape-blocker {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(13, 3, 23, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-align: center;
    padding: 20px;
  }

  #landscape-blocker .rotate-icon {
    font-size: 3rem;
    color: #ffde00;
    margin-bottom: 12px;
    animation: rotatePhone 2s infinite ease-in-out;
  }

  #landscape-blocker h2 {
    font-size: 1.4rem;
    color: #ffde00;
    margin-bottom: 6px;
    font-weight: 800;
  }

  #landscape-blocker p {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin: 0;
  }
}

@keyframes rotatePhone {
  0% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(-90deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

/* İZLEYİCİ DOSTLUK UYARISI MODALI */
.spectate-warning-box {
  width: 420px !important;
  max-width: 90vw !important;
  border: 4px solid var(--gold) !important;
  background: #141418 !important;
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.3), 10px 10px 0px rgba(0, 0, 0, 0.7) !important;
  text-align: center;
  padding: 25px 20px !important;
}

.spectate-warning-title {
  color: var(--gold);
  font-size: 13px;
  margin-bottom: 15px;
  text-shadow: 2px 2px 0px #000;
  line-height: 1.4;
}

.spectate-warning-desc {
  font-size: 9px;
  line-height: 1.6;
  color: #cccccc;
  margin-bottom: 25px;
  padding: 0 10px;
}

.btn-spectate-warning-confirm {
  width: 100%;
  padding: 14px 18px;
  background: var(--gold);
  color: #000000;
  border: 4px solid #000000;
  font-family: inherit;
  font-size: 9px;
  font-weight: bold;
  cursor: pointer;
  text-shadow: none;
  box-shadow: 4px 4px 0px #000000;
  transition: transform 0.1s ease, background-color 0.2s ease;
}

.btn-spectate-warning-confirm:hover {
  background: #ffe066;
  transform: translateY(-2px);
}

.btn-spectate-warning-confirm:active {
  transform: translateY(1px);
  box-shadow: 2px 2px 0px #000000;
}

/* SADE İZLE / İZLENİYOR BUTON STİLİ */
.spectate-badge {
  font-family: inherit;
  font-size: 7px;
  padding: 5px 9px;
  border: 2px solid #555566;
  border-radius: 4px;
  background: #1e1e24;
  color: #cccccc;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.spectate-badge:hover {
  background: #2b2b36;
  color: #ffffff;
  border-color: var(--gold);
}

.spectate-badge.active-spectating {
  background: var(--gold);
  color: #000000;
  font-weight: bold;
  border-color: #ffffff;
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}