/* --- CODENAMES ONLINE DESIGN SYSTEM (TURNUVA EKRAKI) --- */

:root {
  /* Color Palette */
  --bg-primary: #080b11;
  --bg-secondary: #0f131f;
  --panel-bg: rgba(16, 22, 37, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  /* Team Colors & Glows */
  --color-blue: #00D2FF;
  --color-blue-rgb: 0, 210, 255;
  --color-red: #ff3860;
  --color-red-rgb: 255, 56, 96;
  --color-yellow: #f59e0b;
  
  /* Card Themes */
  --card-neutral-bg: #d7ccc8;
  --card-neutral-text: #3e2723;
  --card-blue-bg: linear-gradient(135deg, #005f73, #0a9396);
  --card-red-bg: linear-gradient(135deg, #ae2012, #ca6702);
  --card-assassin-bg: radial-gradient(circle, #2b2b2b 0%, #111111 100%);

  /* Fonts */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Outfit', sans-serif;
}

/* --- BASE STYLES --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

*:focus {
  outline: none !important;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow: hidden; /* Prevent scroll */
  height: 100vh;
  position: relative;
}

/* --- DYNAMIC GLOW BACKGROUNDS --- */
.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #0d1222 0%, #07090e 100%);
}

.glow-sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.12;
}

.glow-sphere.red {
  background: var(--color-red);
  width: 600px;
  height: 600px;
  top: -10%;
  left: -10%;
}

.glow-sphere.blue {
  background: var(--color-blue);
  width: 500px;
  height: 500px;
  bottom: -10%;
  right: -10%;
}

/* --- APP CONTAINER (FULL HEIGHT, NO SCROLL) --- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0 1rem;
  overflow: hidden;
}

/* --- HEADER (Compact, 50px height) --- */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
  border-bottom: 1px solid var(--panel-border);
  padding: 0 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(0, 210, 255, 0.35));
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 1.2px;
  background: linear-gradient(135deg, #00d2ff 0%, #ff3860 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
  animation: logoGlowShift 6s infinite alternate;
}

@keyframes logoGlowShift {
  0% {
    filter: drop-shadow(0 0 4px rgba(0, 210, 255, 0.5));
  }
  100% {
    filter: drop-shadow(0 0 8px rgba(255, 56, 96, 0.6));
  }
}

.top-nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- MAIN CONTENT --- */
.main-content {
  height: calc(100vh - 50px);
  overflow: hidden;
  position: relative;
}

/* --- SCREENS --- */
.screen {
  display: none !important;
  opacity: 0;
  height: 100%;
}

.screen.active {
  display: block !important;
  opacity: 1;
}

/* --- 1. LANDING SCREEN (Center aligned) --- */
#screen-landing.active {
  display: flex !important;
  overflow-y: auto;
  justify-content: center;
  align-items: center;
}

.landing-card {
  max-width: 780px; /* 2x larger layout width */
  width: 100%;
  text-align: center;
  padding: 4rem 4.5rem; /* Taller padding */
  margin: auto 0;
  border-radius: 20px;
}

/* Card Header with Logo-Text-Logo */
.card-logo-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-header-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0, 210, 255, 0.3));
  animation: logoPulse 4s infinite ease-in-out;
}

@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(0, 210, 255, 0.35));
  }
  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 14px rgba(255, 56, 96, 0.55));
  }
}

.welcome-text h2 {
  font-family: var(--font-display);
  font-size: 2.8rem; /* 2x larger font */
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, #00d2ff 0%, #ff3860 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 15px rgba(0, 210, 255, 0.45);
  animation: logoGlowShift 6s infinite alternate;
}

.welcome-text p {
  color: var(--text-muted);
  font-size: 1.15rem; /* Larger font */
  line-height: 1.6;
  margin-bottom: 3rem;
}

.form-group {
  text-align: left;
  margin-bottom: 2rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  left: 1.25rem;
  color: var(--text-muted);
  font-size: 1.25rem;
}

.input-wrapper input {
  width: 100%;
  padding: 1.1rem 1.25rem 1.1rem 3.25rem; /* Scaled up padding! */
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(8, 11, 17, 0.7);
  color: var(--text-main);
  font-size: 1.15rem; /* Scaled up font */
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
}

.actions-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Landing buttons scaled up */
.landing-card .btn {
  padding: 1.1rem 2rem;
  font-size: 1.15rem;
  border-radius: 12px;
}

.join-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  margin: 1.5rem 0;
  letter-spacing: 1px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--panel-border);
}

.divider:not(:empty)::before { margin-right: .5em; }
.divider:not(:empty)::after { margin-left: .5em; }

/* --- 2. LOBBY SCREEN (Flex layout) --- */
#screen-lobby {
  padding: 0.75rem 0 1.25rem 0;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1rem;
  height: 100%;
  overflow: hidden;
}

.glass-panel {
  background: rgba(16, 22, 37, 0.45);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  padding: 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lobby-left-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.lobby-room-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  gap: 1.5rem;
}

.room-code-container {
  display: flex;
  flex-direction: column;
}

.room-code-container .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 1px;
}

.room-code-container strong {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--color-blue);
  letter-spacing: 2px;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.lobby-roles-card {
  padding: 1rem;
}

.lobby-roles-card h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.4rem;
}

.team-role-slots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.lobby-team-slots {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}

.lobby-team-slots.red { border-top: 3px solid var(--color-red); }
.lobby-team-slots.blue { border-top: 3px solid var(--color-blue); }

.slots-header {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.slots-header.text-red { color: var(--color-red); }
.slots-header.text-blue { color: var(--color-blue); }

.role-slot-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  color: #fff;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.role-slot-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.role-slot-btn.active {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 5px rgba(255,255,255,0.1);
}

.lobby-team-slots.red .role-slot-btn.active { border-color: var(--color-red); background: rgba(255, 56, 96, 0.08); }
.lobby-team-slots.blue .role-slot-btn.active { border-color: var(--color-blue); background: rgba(0, 210, 255, 0.08); }

.role-slot-btn .role-title {
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.role-slot-btn .role-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.lobby-admin-panel {
  padding: 0.8rem 1rem;
}

.lobby-admin-panel h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--color-yellow);
  margin-bottom: 0.5rem;
}

.form-group-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.form-group-row label {
  font-size: 0.85rem;
  font-weight: 600;
}

.form-group-row select {
  background: rgba(8, 11, 17, 0.7);
  border: 1px solid var(--panel-border);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-family: var(--font-body);
}

.lobby-action-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  border-top: 1px solid var(--panel-border);
  padding-top: 0.75rem;
}

/* Lobby Room Panel (Chat + Player List) */
.lobby-room-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 0;
}

.room-panel-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--panel-border);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.8rem 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--color-blue);
  border-bottom-color: var(--color-blue);
  background: rgba(0, 210, 255, 0.03);
}

.room-panel-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.tab-content {
  display: none;
  height: 100%;
  flex-direction: column;
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
}

.tab-content.active {
  display: flex;
}

/* Chat content */
#chat-tab-content {
  padding: 0.75rem;
  flex-direction: column;
}

#chat-tab-content.active {
  display: flex;
}

.lobby-chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.25rem;
  background: rgba(0,0,0,0.15);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.02);
}

.chat-bubble {
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  max-width: 90%;
  align-self: flex-start;
}

.chat-bubble.my-msg {
  background: rgba(0, 210, 255, 0.1);
  align-self: flex-end;
  border-right: 2px solid var(--color-blue);
}

.chat-bubble.red-msg { border-left: 2px solid var(--color-red); }
.chat-bubble.blue-msg { border-left: 2px solid var(--color-blue); }

.chat-bubble.system {
  background: transparent;
  color: var(--text-muted);
  font-style: italic;
  align-self: center;
  text-align: center;
}

.chat-sender {
  font-weight: 700;
  display: block;
  font-size: 0.75rem;
  margin-bottom: 2px;
}

.chat-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  float: right;
  margin-top: 4px;
  margin-left: 8px;
}

.lobby-chat-form {
  display: flex;
  gap: 0.4rem;
}

.lobby-chat-form input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.lobby-chat-form input:focus {
  outline: none;
  border-color: var(--color-blue);
}

/* Players list content - see bottom of file for tab overlap fix */

.admin-players-list {
  padding: 0.75rem;
  overflow-y: auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lobby-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border: 1px solid var(--panel-border);
}

.lobby-user-row.me {
  border-color: var(--color-blue);
  background: rgba(0, 210, 255, 0.02);
}

.lobby-user-details {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.lobby-user-details span {
  font-weight: 500;
}

.lobby-user-actions {
  display: flex;
  gap: 0.3rem;
}

/* Mini action buttons for admin */
.admin-action-btn {
  border: none;
  padding: 0.2rem 0.4rem;
  font-size: 0.68rem;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  font-family: var(--font-body);
}

.admin-action-btn.kick { background: #b45309; } /* Kick - orange-brown */
.admin-action-btn.ban { background: #991b1b; } /* Ban - red */
.admin-action-btn.promote { background: #0369a1; } /* Lead - blue */

.admin-action-btn:hover { filter: brightness(1.2); }


/* ==========================================
   3. GAME SCREEN - SINGLE VIEWPORT NO SCROLL (UPGRADED)
   ========================================== */
#screen-game {
  height: 100%;
  padding: 0.5rem 0;
}

/* ============================================================
   3-COLUMN GAME SCREEN LAYOUT
   ============================================================ */
.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 55px;
  border-bottom: 1px solid var(--panel-border);
  padding: 0 0.5rem;
  background: rgba(8, 11, 17, 0.4);
}

.game-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.game-room-code-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.game-room-label {
  color: var(--text-muted);
  font-weight: 600;
}

.game-room-code-wrap strong {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--color-blue);
  letter-spacing: 1px;
}

.icon-btn-mini {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn-mini:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: scale(1.05);
}

.icon-btn-mini.muted {
  color: var(--color-red);
  border-color: rgba(255, 56, 96, 0.2);
  background: rgba(255, 56, 96, 0.08);
}

.game-topbar-center {
  display: flex;
  justify-content: center;
}

.turn-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.45rem 1.25rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.turn-indicator.red {
  border-color: rgba(255, 56, 96, 0.3);
  box-shadow: 0 0 15px rgba(255, 56, 96, 0.1);
}

.turn-indicator.blue {
  border-color: rgba(0, 210, 255, 0.3);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.1);
}

.turn-indicator strong {
  text-transform: uppercase;
  font-family: var(--font-display);
}

.turn-indicator.red strong {
  color: var(--color-red);
  text-shadow: 0 0 8px rgba(255, 56, 96, 0.3);
}

.turn-indicator.blue strong {
  color: var(--color-blue);
  text-shadow: 0 0 8px rgba(0, 210, 255, 0.3);
}

.game-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-action-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: none;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: white;
  transition: all 0.2s ease;
}

.topbar-action-btn.warning {
  background: #d97706;
}

.topbar-action-btn.warning:hover {
  background: #b45309;
  transform: translateY(-1px);
}

.topbar-action-btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.topbar-action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.topbar-action-btn.danger {
  background: linear-gradient(135deg, var(--color-red), #b91c1c);
  box-shadow: 0 0 10px rgba(255, 56, 96, 0.20);
}

.topbar-action-btn.danger:hover {
  background: linear-gradient(135deg, #e11d48, #991b1b);
  transform: translateY(-1px);
  box-shadow: 0 0 15px rgba(255, 56, 96, 0.45);
}

/* 3-Column main area */
.game-3col {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 0.75rem;
  height: calc(100% - 55px);
  padding: 0.5rem 0;
  overflow: hidden;
}

.game-left-col, .game-right-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  overflow: hidden;
}

.game-side-panel {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  padding: 1rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.game-side-panel.red-side {
  background: rgba(255, 56, 96, 0.04);
  border-color: rgba(255, 56, 96, 0.2);
}

.game-side-panel.blue-side {
  background: rgba(0, 210, 255, 0.04);
  border-color: rgba(0, 210, 255, 0.2);
}

.side-panel-header {
  margin-bottom: 0.75rem;
}

.side-team-name {
  border: none;
  background: transparent;
  width: 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  outline: none;
}

.side-team-name.red {
  color: var(--color-red);
}

.side-team-name.blue {
  color: var(--color-blue);
}

.side-panel-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 1rem;
}

.side-panel-score.red {
  border-left: 4px solid var(--color-red);
}

.side-panel-score.blue {
  border-left: 4px solid var(--color-blue);
}

.score-big {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
}

.score-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 4px;
}

.side-panel-members {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 2px;
}

.member-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.member-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 2px;
  letter-spacing: 0.5px;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Red / Blue active member lists */
.spymaster-badge {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.agent-tag {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 0.3rem 0.45rem; /* Smaller padding */
  font-size: 0.72rem; /* Smaller font-size */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.red-side .spymaster-badge, .red-side .agent-tag {
  border-left: 3px solid var(--color-red);
}

.blue-side .spymaster-badge, .blue-side .agent-tag {
  border-left: 3px solid var(--color-blue);
}

.agent-tag.is-me, .spymaster-badge.is-me {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  font-weight: bold;
}

/* Gold Leader Name with Glow */
.leader-name-gold {
  color: #ffd700;
  font-weight: 800;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.5), 0 0 12px rgba(255, 215, 0, 0.3);
  animation: leaderGoldPulse 3s infinite ease-in-out;
}

@keyframes leaderGoldPulse {
  0%, 100% {
    text-shadow: 0 0 4px rgba(255, 215, 0, 0.4), 0 0 8px rgba(255, 215, 0, 0.2);
  }
  50% {
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.7), 0 0 18px rgba(255, 215, 0, 0.4);
  }
}

/* Role emoji icon */
.role-emoji {
  font-size: 1rem;
  margin-right: 0.15rem;
}

/* 2-column layout for agent lists by default */
#game-red-agents, #game-blue-agents {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  max-height: 300px;
  overflow-y: auto;
}

.empty-state {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.2rem 0.5rem;
}

/* Horizontal Timer in Topbar */
.topbar-timer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--color-yellow);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.topbar-timer .timer-pulse-icon {
  font-size: 0.95rem;
  animation: timerPulse 2s ease infinite;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
}

.topbar-progress-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 10;
}

.timer-progress-bar {
  height: 100%;
  background: var(--color-yellow);
  box-shadow: 0 0 8px var(--color-yellow);
  transition: width 1s linear, background-color 0.5s ease;
}

.timer-progress-bar.red {
  background: var(--color-red) !important;
  box-shadow: 0 0 8px var(--color-red) !important;
}

.timer-progress-bar.orange {
  background: #f97316 !important;
  box-shadow: 0 0 8px #f97316 !important;
}

.timer-progress-bar.green {
  background: #10b981 !important;
  box-shadow: 0 0 8px #10b981 !important;
}


/* CENTER COLUMN (Cards Board + Clue + Footer) */
.game-center-col {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  height: 100%;
  overflow: hidden;
}

.game-center-col .cards-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 0.5rem;
}

/* Clue Bar below cards */
.game-clue-bar {
  background: rgba(16, 22, 37, 0.65);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
}

.clue-display-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.75rem;
}

.clue-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

#display-clue-word {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--color-yellow);
  letter-spacing: 1px;
}

.clue-count-badge {
  background: var(--color-yellow);
  color: #000;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-weight: 800;
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.guesses-left {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-pass {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-pass:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Clue input mode (Spymaster) styling matching referans */
.clue-input-mode {
  width: 100%;
}

#clue-form {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.75rem;
}

.clue-info-title {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.clue-info-title .title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-yellow);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#input-clue-word {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  font-family: var(--font-display);
}

#input-clue-word:focus {
  outline: none;
  border-color: var(--color-yellow);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.clue-count-selector {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
}

.clue-count-selector .count-btn {
  background: transparent;
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.clue-count-selector .count-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

#input-clue-count {
  width: 40px;
  background: transparent;
  border: none;
  color: #fff;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-display);
}

.btn-send-glow {
  background: linear-gradient(135deg, #d97706, #b45309);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px rgba(217, 119, 6, 0.3);
  padding: 0.45rem 1.2rem;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 8px;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease;
}

.btn-send-glow:hover {
  box-shadow: 0 0 22px rgba(217, 119, 6, 0.55);
  transform: translateY(-1px);
}

/* Footer Bar in game screen */
.game-footer-bar {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--panel-border);
  padding-top: 0.25rem;
}

.footer-left-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.emoji-reaction-bar {
  display: flex;
  gap: 0.35rem;
}

.emoji-btn {
  background: transparent;
  border: none;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.emoji-btn:hover {
  transform: scale(1.3) rotate(5deg);
}

/* LEFT/RIGHT COLUMN GÜNLÜK & SOHBET PANELS */
.game-log-panel, .game-chat-panel {
  background: rgba(16, 22, 37, 0.45);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.log-panel-header {
  padding: 0.5rem 0.75rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.chat-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.15);
}

.chat-tab-btn {
  flex: 1;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.chat-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.chat-tab-btn.active {
  color: var(--color-blue);
  background: rgba(0, 210, 255, 0.05);
  border-bottom: 2px solid var(--color-blue);
}

.chat-tab-btn#tab-lider.active {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.05);
  border-bottom: 2px solid #ffd700;
}

.chat-bubble.leader-exclusive {
  border-left: 3px solid #ffd700 !important;
  background: rgba(255, 215, 0, 0.01) !important;
}

.game-log-panel .log-messages,
.game-chat-panel .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Chat Input inside Game Screen */
.game-chat-form {
  display: flex;
  gap: 0.35rem;
  padding: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.15);
}

.game-chat-form input {
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: #fff;
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  outline: none;
  font-family: var(--font-body);
  transition: border-color 0.25s ease;
}

.game-chat-form input:focus {
  border-color: var(--color-blue);
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.15);
}

.game-chat-send-btn {
  background: linear-gradient(135deg, var(--color-blue), #0066ff);
  border: none;
  border-radius: 6px;
  color: #fff;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.game-chat-send-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.game-chat-send-btn:active {
  transform: scale(0.95);
}


.log-entry {
  font-size: 0.76rem;
  line-height: 1.4;
  padding: 0.25rem 0.45rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.01);
  border-left: 2.5px solid transparent;
}

.log-entry.system {
  border-left-color: var(--text-muted);
}

.log-entry.red-team {
  border-left-color: var(--color-red);
  background: rgba(255, 56, 96, 0.02);
}

.log-entry.blue-team {
  border-left-color: var(--color-blue);
  background: rgba(0, 210, 255, 0.02);
}

.log-entry.clue {
  border-left-color: var(--color-yellow);
  background: rgba(245, 158, 11, 0.03);
}

.log-text {
  color: rgba(255, 255, 255, 0.85);
}

/* --- BUTTONS & MISC --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  border: none;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  width: auto;
  outline: none;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-blue), #0066ff);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-local {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.btn-local:hover {
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background: rgba(255, 56, 96, 0.15);
  color: var(--color-red);
  border: 1px solid rgba(255, 56, 96, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 56, 96, 0.25);
  border-color: rgba(255, 56, 96, 0.5);
  box-shadow: 0 0 15px rgba(255, 56, 96, 0.2);
}

.role-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.role-btn:hover { background: rgba(255, 255, 255, 0.05); }

/* --- LOBBY PLAYERS SLOT LISTS --- */
.players-sublist {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.4rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.1);
  min-height: 35px;
}

.players-sublist.empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.settings-form-grid .form-group-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.settings-form-grid select {
  width: 100%;
}

/* --- EMOJI REACTION PANEL & BUBBLE --- */
.emoji-reaction-bar {
  display: inline-flex;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.25rem;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
}

.emoji-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.emoji-btn:hover {
  transform: scale(1.3);
}

.emoji-reaction-bubble {
  display: inline-flex;
  background: rgba(8, 11, 17, 0.85);
  border: 1px solid var(--color-yellow);
  padding: 0.1rem 0.4rem;
  border-radius: 12px;
  font-size: 0.95rem;
  margin-left: 0.4rem;
  vertical-align: middle;
  animation: popEmoji 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

@keyframes popEmoji {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* --- 3D KART TASARIMI & PNG OYUN MOTORU --- */
.card-item {
  perspective: 1000px;
  cursor: pointer;
  user-select: none;
  position: relative;
  width: 100%;
  height: 100%;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-radius: 8px;
}

/* 3D Flip Animasyonu */
.card-item.revealed .card-inner {
  transform: rotateY(180deg);
  animation: cardRevealGlow 0.8s ease-out;
}

@keyframes cardRevealGlow {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.4) drop-shadow(0 0 15px rgba(255, 255, 255, 0.5)); }
  100% { filter: brightness(1); }
}

/* %60 Yarı-Döndürülmüş Durum (Stage 2 - Kelime gösterimi) */
.card-item.revealed.stage-2 .card-inner {
  transform: rotateY(180deg) rotateX(10deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  overflow: hidden;
}

/* KAPALI KART: Grid görselinin sağ üst köşesi (bej sivil kart) */
.card-front {
  background-image: url('logos/kartlogosu.png');
  background-size: 235% 235%;
  background-position: 91% 9%; /* Top-Right: Beige Card texture cropped */
  background-repeat: no-repeat;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-item:not(.revealed):hover .card-front {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0, 210, 255, 0.15);
  border-color: rgba(0, 210, 255, 0.3);
}

/* CASUSBAŞI (ANLATICI) GÖRÜNÜMÜ: Kapalı kartların gerçek renkli garaj görünümleri */
.card-item.is-spymaster.color-red .card-front {
  background-image: url('logos/spymaster_cards.png') !important;
  background-size: 235% 235% !important;
  background-position: 9% 91% !important; /* Bottom-Left: Red Garage card cropped */
  border-color: rgba(255, 56, 96, 0.4);
}

.card-item.is-spymaster.color-blue .card-front {
  background-image: url('logos/spymaster_cards.png') !important;
  background-size: 235% 235% !important;
  background-position: 91% 91% !important; /* Bottom-Right: Blue Garage card cropped */
  border-color: rgba(0, 210, 255, 0.4);
}

.card-item.is-spymaster.color-neutral .card-front {
  background-image: url('logos/spymaster_cards.png') !important;
  background-size: 235% 235% !important;
  background-position: 91% 9% !important; /* Top-Right: Beige Garage card cropped */
  border-color: rgba(215, 204, 200, 0.4);
}

.card-item.is-spymaster.color-assassin .card-front {
  background-image: url('logos/spymaster_cards.png') !important;
  background-size: 235% 235% !important;
  background-position: 9% 9% !important; /* Top-Left: Black Garage card cropped */
  border-color: rgba(17, 17, 17, 0.4);
}

/* AÇILAN KART YÜZÜ (Geriye Dönük Base Layer - Garaj Kartı) */
.card-back {
  transform: rotateY(180deg);
  background-image: url('logos/spymaster_cards.png') !important;
  background-size: 235% 235% !important;
  background-repeat: no-repeat !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  overflow: visible !important; /* Menteşeli kapağın taşması için */
}

/* Menteşeli Karakter Kapağı (Karakter Görseli Katmanı) */
.card-character-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-size: 235% 235% !important;
  background-repeat: no-repeat !important;
  transform-origin: top;
  transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
  pointer-events: none; /* Tıklamaların karta geçmesi için */
  border-radius: 8px;
}

/* Karakter İsim Rozeti (Sağ Üst - Kapağa bağlı) */
.character-name-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.55rem;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.7);
  z-index: 3;
  pointer-events: none;
  background: rgba(8, 11, 17, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.12rem 0.35rem;
  border-radius: 3px;
  animation: characterPulseGlow 3s infinite ease-in-out;
}

@keyframes characterPulseGlow {
  0%, 100% {
    opacity: 0.9;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8), 0 0 6px var(--color-blue);
    box-shadow: 0 0 4px rgba(0, 210, 255, 0.2);
    border-color: rgba(0, 210, 255, 0.2);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.9), 0 0 10px var(--color-blue), 0 0 14px var(--color-blue);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.45);
    border-color: rgba(0, 210, 255, 0.5);
  }
}

/* Takım Renklerine Göre Arka Planlar (Garaj Base Kartları) */
.card-item.color-red .card-back {
  background-position: 9% 91% !important; /* Bottom-Left: Red Garage card cropped */
}

.card-item.color-blue .card-back {
  background-position: 91% 91% !important; /* Bottom-Right: Blue Garage card cropped */
}

.card-item.color-neutral .card-back {
  background-position: 91% 9% !important; /* Top-Right: Beige Garage card cropped */
}

.card-item.color-assassin .card-back {
  background-position: 9% 9% !important; /* Top-Left: Black Garage card cropped */
}

/* Takım Renklerine Göre Karakter Kapak Katmanı Hizalaması (2x2 karakter grid) */
.card-item.color-red .card-character-cover {
  background-position: 9% 91% !important; /* Bottom-Left: Red Character sheet cropped */
}

.card-item.color-blue .card-character-cover {
  background-position: 91% 91% !important; /* Bottom-Right: Blue Character sheet cropped */
}

.card-item.color-neutral .card-character-cover {
  background-position: 91% 9% !important; /* Top-Right: Beige Character sheet cropped */
}

.card-item.color-assassin .card-character-cover {
  background-position: 9% 9% !important; /* Top-Left: Black Character sheet cropped */
}

/* Stage 2 - Kapağın Yukarı Doğru Menteşeli Olarak Kalkması (Lid Hinge Lift) */
.card-item.revealed.stage-2 .card-character-cover {
  transform: rotateX(-65deg) translateZ(10px) translateY(-3px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.7);
}

.card-item.revealed.stage-2 .card-inner {
  transform: rotateY(180deg);
}

/* Kelime Etiketleri */
.card-word {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #ffffff; /* Beyaz renkli yazı */
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
  z-index: 3;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  
  /* Kabartma kutu hizalaması */
  position: absolute;
  bottom: 5.5%;
  left: 5.5%;
  right: 5.5%;
  height: 27%;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Modern Glassmorphic Dark Plate */
  background: rgba(8, 11, 17, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.05), 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.25s ease;
}

.card-item:not(.revealed):hover .card-word {
  border-color: var(--color-blue);
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.05), 0 0 12px rgba(0, 210, 255, 0.35);
}

/* Stage 1 & 2 (Kelime Her Zaman Görünür) */
.card-item.stage-1 .card-back .card-word,
.card-item.stage-2 .card-back .card-word {
  display: flex;
  color: #ffffff;
}

/* --- KART DÜŞÜNME / ONAYLAMA SİSTEMİ --- */

/* Sol Üst Düşünme Kutusu */
.thinking-container {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  z-index: 5;
  max-width: 80%;
  pointer-events: none;
}

.thinking-bubble {
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  color: #0d131f;
  background: var(--color-yellow);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.thinking-bubble.small-text {
  font-size: 0.62rem;
  padding: 0.1rem 0.35rem;
  max-width: 90px;
}

/* Sağ Üst Onay/El Butonu */
.confirm-reveal-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #10b981;
  border: 1px solid #fff;
  border-radius: 4px;
  width: 24px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}

.confirm-reveal-btn:hover {
  transform: scale(1.15);
  background: #059669;
}

.confirm-reveal-btn:active {
  transform: scale(0.95);
}

/* Card revealed by tag bottom-left overlay */
.card-opened-by-tag {
  position: absolute;
  bottom: 4px;
  left: 6px;
  font-size: 0.65rem;
  color: #ffffff;
  z-index: 3;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.95);
  pointer-events: none;
}

/* ============================================================
   MODAL OVERLAY & CONTENT (Kurallar + GameOver)
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  animation: modalFadeIn 0.35s ease forwards;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  max-width: 620px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  position: relative;
  background: rgba(12, 17, 30, 0.92);
  border: 1px solid rgba(0, 210, 255, 0.15);
  box-shadow: 
    0 0 40px rgba(0, 210, 255, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes modalSlideUp {
  from { transform: translateY(30px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 210, 255, 0.12);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, var(--color-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-header h2 i {
  -webkit-text-fill-color: var(--color-blue);
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px rgba(0, 210, 255, 0.4));
}

.close-modal-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.close-modal-btn:hover {
  background: rgba(255, 56, 96, 0.15);
  border-color: var(--color-red);
  color: var(--color-red);
  transform: rotate(90deg);
}

.modal-body {
  color: var(--text-main);
  font-size: 0.9rem;
  line-height: 1.7;
}

.modal-body p {
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.85);
}

.modal-body h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  color: var(--color-blue);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.modal-body h3::before {
  content: '▸';
  color: var(--color-blue);
  font-size: 0.8rem;
}

.modal-body ul {
  list-style: none;
  padding: 0;
  margin-bottom: 0.75rem;
}

.modal-body ul li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.5rem;
  border-left: 2px solid rgba(0, 210, 255, 0.1);
  margin-bottom: 0.35rem;
  transition: border-color 0.2s ease;
}

.modal-body ul li:hover {
  border-left-color: var(--color-blue);
}

.modal-body ul li::before {
  content: '◆';
  position: absolute;
  left: -5px;
  top: 0.45rem;
  font-size: 0.45rem;
  color: var(--color-blue);
}

.modal-body ul li strong {
  color: #fff;
}

/* GameOver Modal Override */
.gameover-card {
  text-align: center;
  padding: 3rem 2rem;
}

.winner-icon {
  font-size: 3rem;
  color: var(--color-yellow);
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.5));
  animation: trophyPulse 1.5s ease infinite;
}

@keyframes trophyPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.gameover-card h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.gameover-card p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.gameover-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ============================================================
   CUSTOM SCROLLBAR (Site Temasına Uygun)
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 210, 255, 0.2);
  border-radius: 3px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 210, 255, 0.4);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 210, 255, 0.2) rgba(0, 0, 0, 0.2);
}

/* ============================================================
   SMALL BUTTON (.small-btn) - Copy & Chat Send
   ============================================================ */
.small-btn {
  background: rgba(0, 210, 255, 0.08);
  border: 1px solid rgba(0, 210, 255, 0.2);
  color: var(--color-blue);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.small-btn:hover {
  background: rgba(0, 210, 255, 0.18);
  border-color: var(--color-blue);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
  transform: scale(1.05);
}

.small-btn:active {
  transform: scale(0.92);
}

/* Copy code button (next to room code) */
#copy-code-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.8rem;
}

/* Chat send button */
.lobby-chat-form .small-btn {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.15), rgba(0, 210, 255, 0.08));
  border-color: rgba(0, 210, 255, 0.3);
  width: 42px;
  height: auto;
}

.lobby-chat-form .small-btn:hover {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.3), rgba(0, 210, 255, 0.15));
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.25);
}

/* ============================================================
   FIX: Tab Content Overlap (Oyuncular vs Sohbet)
   ============================================================ */
#players-tab-content {
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
  height: 100%;
  overflow-y: auto;
}

#chat-tab-content {
  position: relative;
}

/* Responsive grid fallback sizes */
@media (max-width: 900px) {
  .lobby-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
    height: auto;
  }
  .lobby-room-panel {
    height: 350px;
  }
}

/* Mobile responsive optimizations for the game screen */
@media (max-width: 800px) {
  .game-3col {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow-y: auto !important;
    gap: 1rem !important;
    padding: 0.5rem !important;
  }

  .game-center-col {
    order: 1 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .game-center-col .cards-grid {
    aspect-ratio: 1 / 0.8 !important;
    height: auto !important;
    min-height: 280px !important;
    gap: 0.3rem !important;
  }

  .game-left-col {
    order: 2 !important;
    height: auto !important;
  }

  .game-right-col {
    order: 3 !important;
    height: auto !important;
  }

  /* Automatically hide the game log and chat panels on mobile */
  .game-log-panel,
  .game-chat-panel {
    display: none !important;
  }

  /* Automatically hide the emoji reaction bar on mobile */
  .emoji-reaction-bar {
    display: none !important;
  }

  /* Make card words smaller on mobile for better fit */
  .card-word {
    font-size: 0.58rem !important;
  }

  /* Scale down character badges on mobile */
  .character-name-badge {
    font-size: 0.45rem !important;
    padding: 0.08rem 0.2rem !important;
    top: 4px !important;
    right: 4px !important;
  }

  /* Adjust topbar for mobile */
  .game-topbar {
    flex-direction: column !important;
    height: auto !important;
    gap: 0.5rem !important;
    padding: 0.5rem !important;
  }

  .game-topbar-left, .game-topbar-right {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Floating emoji container position on mobile */
  .floating-reactions-container {
    bottom: 50px !important;
    width: 280px !important;
    height: 350px !important;
  }
}

/* --- RENAME & PLAYER LAYOUT DETAILS --- */
.edit-team-name-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-team-name-btn:hover {
  color: #fff;
  transform: scale(1.15);
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 0.85rem;
  width: 100%;
}

.player-item.me {
  border-color: var(--color-blue);
  background: rgba(0, 210, 255, 0.03);
}

.player-name-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.host-badge {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--color-yellow);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.lobby-team-name-edit-input {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--color-blue);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  width: 140px;
  outline: none;
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.2);
}

.lobby-team-name-edit-input:focus {
  border-color: var(--color-yellow);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

/* ============ CLUE POPUP ANIMATION ============ */
.clue-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 0.4s ease;
}

.clue-popup-overlay.show {
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.clue-popup-overlay.hide {
  background: rgba(0, 0, 0, 0);
}

.clue-popup-card {
  text-align: center;
  padding: 2.5rem 4rem;
  border-radius: 20px;
  background: rgba(10, 14, 22, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  transform: scale(0.3) translateY(80px);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clue-popup-overlay.show .clue-popup-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.clue-popup-overlay.hide .clue-popup-card {
  transform: scale(0.6) translateY(60px);
  opacity: 0;
  transition: all 0.5s ease-in;
}

/* Team-colored borders and glow */
.clue-popup-card.red {
  border-color: var(--color-red);
  box-shadow: 0 0 50px rgba(255, 56, 96, 0.35), 0 0 100px rgba(255, 56, 96, 0.15);
}

.clue-popup-card.blue {
  border-color: var(--color-blue);
  box-shadow: 0 0 50px rgba(0, 210, 255, 0.35), 0 0 100px rgba(0, 210, 255, 0.15);
}

.clue-popup-label {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-yellow);
  margin-bottom: 1rem;
  animation: popupLabelPulse 1s infinite alternate;
}

@keyframes popupLabelPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; text-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
}

.clue-popup-word {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  margin-bottom: 0.5rem;
  animation: popupWordGlow 2s infinite alternate;
}

@keyframes popupWordGlow {
  0% { text-shadow: 0 0 10px rgba(255, 255, 255, 0.2); }
  100% { text-shadow: 0 0 30px rgba(255, 255, 255, 0.5), 0 0 60px rgba(255, 255, 255, 0.2); }
}

.clue-popup-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-yellow);
  color: #000;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 1rem;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.clue-popup-team {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.clue-popup-card.red .clue-popup-team {
  color: var(--color-red);
}

.clue-popup-card.blue .clue-popup-team {
  color: var(--color-blue);
}

/* ============ FLOATING EMOJI REACTIONS ============ */
.floating-reactions-container {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 500px;
  overflow: visible;
  pointer-events: none; /* Crucial! So it never blocks clicks on the word board cards */
  z-index: 99999;
}

.floating-emoji-item {
  position: absolute;
  bottom: 0;
  font-size: 2.5rem;
  pointer-events: none; /* Crucial! Direct pass-through for mouse clicks */
  opacity: 0;
  user-select: none;
  animation: emojiFloatUp 2s cubic-bezier(0.08, 0.82, 0.17, 1) forwards;
}

@keyframes emojiFloatUp {
  0% {
    transform: translateY(0) scale(0.5) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 1;
    transform: translateY(-30px) scale(1.1) rotate(var(--rotate-deg));
  }
  80% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translateY(-400px) scale(0.9) translateX(var(--drift-x)) rotate(calc(var(--rotate-deg) * 1.5));
  }
}
