/* ========================================================
   СУПЕРДЕБАФ (SuperDebuff) — СТИЛИ ИГРЫ
   Космический дизайн, 3D карточки, анимации и подиум
   ======================================================== */

.superdebuff-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(8, 4, 18, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px;
}

.superdebuff-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.superdebuff-window {
  width: 100%;
  max-width: 1100px;
  height: 92vh;
  max-height: 860px;
  background: linear-gradient(145deg, #130c24 0%, #1a1033 50%, #0d071a 100%);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(168, 85, 247, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #fff;
  user-select: none;
}

/* Cosmic background canvas behind game */
.superdebuff-canvas-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  z-index: 0;
}

/* Header */
.superdebuff-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: rgba(19, 12, 36, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.superdebuff-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.superdebuff-logo-badge {
  font-size: 24px;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.6));
  animation: sdbFloat 3s ease-in-out infinite alternate;
}

.superdebuff-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, #fbbf24 0%, #f43f5e 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.superdebuff-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.superdebuff-room-badge {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.35);
  padding: 5px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: #e9d5ff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.superdebuff-room-badge:hover {
  background: rgba(168, 85, 247, 0.3);
  transform: translateY(-1px);
}

.superdebuff-btn-share {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fef08a;
  padding: 5px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.superdebuff-btn-share:hover {
  background: rgba(245, 158, 11, 0.3);
}

.superdebuff-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d1d5db;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.superdebuff-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.5);
}

/* Main Body */
.superdebuff-body {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ----------------------------------------------------
   1. LOBBY & ROOM BROWSER
   ---------------------------------------------------- */
.superdebuff-lobby-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  overflow-y: auto;
}

.superdebuff-hero-banner {
  text-align: center;
  margin-bottom: 28px;
}

.superdebuff-hero-banner h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fcd34d 0%, #f43f5e 50%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.superdebuff-hero-banner p {
  margin: 8px 0 0;
  font-size: 14px;
  color: #cbd5e1;
  max-width: 520px;
}

.superdebuff-lobby-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  width: 100%;
  max-width: 780px;
}

.superdebuff-lobby-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.superdebuff-lobby-card:hover {
  transform: translateY(-2px);
  border-color: rgba(168, 85, 247, 0.4);
}

.superdebuff-card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Players waiting in room */
.superdebuff-room-lobby {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.superdebuff-players-slot-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.superdebuff-player-slot {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: all 0.25s ease;
}

.superdebuff-player-slot.filled {
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.08);
}

.superdebuff-player-slot.is-hero-slot {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
}

.superdebuff-slot-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  object-fit: cover;
  margin-bottom: 8px;
}

.superdebuff-slot-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.superdebuff-slot-status {
  font-size: 10.5px;
  font-weight: 600;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 6px;
}

.superdebuff-slot-status.ready {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.superdebuff-slot-status.wait {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

.superdebuff-slot-empty {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  font-size: 12px;
}

/* ----------------------------------------------------
   2. GAME BOARD (ACTIVE PLAY)
   ---------------------------------------------------- */
.superdebuff-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Players status rail at top */
.superdebuff-score-rail {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.superdebuff-player-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  transition: all 0.2s ease;
}

.superdebuff-player-pill.is-hero {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.25);
}

.superdebuff-player-pill.has-played {
  border-color: #22c55e;
}

.superdebuff-pill-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.superdebuff-pill-name {
  font-size: 12px;
  font-weight: 700;
}

.superdebuff-pill-score {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 10px;
}

/* Timer strip */
.superdebuff-timer-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.superdebuff-timer-progress {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  transition: width 1s linear;
}

/* Arena / Center Stage */
.superdebuff-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 24px;
  overflow-y: auto;
  position: relative;
}

.superdebuff-phase-instruction {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  padding: 6px 18px;
  border-radius: 20px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #e9d5ff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: sdbPulse 2s infinite;
}

/* ----------------------------------------------------
   3. CARDS DESIGN (SUPERPOWERS & DEBUFFS)
   ---------------------------------------------------- */
/* Card base */
.sdb-card {
  width: 220px;
  min-height: 290px;
  border-radius: 18px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.sdb-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

.sdb-card.selected {
  outline: 3px solid #fbbf24;
  box-shadow: 0 0 25px rgba(251, 191, 36, 0.6);
  transform: translateY(-12px) scale(1.05);
}

/* Superpower Card (Gold & Cosmic Neon) */
.sdb-card-superpower {
  background: linear-gradient(150deg, #2e1065 0%, #1e1b4b 50%, #0f172a 100%);
  border: 2px solid #a855f7;
  color: #fff;
}

.sdb-card-superpower::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.sdb-card-superpower .sdb-card-type-badge {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #fff;
}

/* Debuff Card (Crimson / Toxic / Shadow) */
.sdb-card-debuff {
  background: linear-gradient(150deg, #3f0d12 0%, #1a080a 50%, #0a0304 100%);
  border: 2px solid #ef4444;
  color: #fff;
}

.sdb-card-debuff::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.sdb-card-debuff .sdb-card-type-badge {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
}

/* Card face-down */
.sdb-card-facedown {
  background: linear-gradient(135deg, #1e1035, #0f0720);
  border: 2px dashed rgba(168, 85, 247, 0.4);
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: default;
}

.sdb-card-facedown:hover {
  transform: none;
}

/* Card Interior */
.sdb-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sdb-card-type-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 8px;
}

.sdb-card-icon {
  font-size: 28px;
}

.sdb-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sdb-card-title {
  font-size: 15px;
  font-weight: 800;
  color: #fde047;
  margin-bottom: 6px;
  line-height: 1.25;
}

.sdb-card-text {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: #f1f5f9;
}

.sdb-card-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
}

/* Active combo on table (Hero's superpower + played debuff) */
.sdb-active-combo-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.sdb-combo-superpower-card {
  width: 250px;
  min-height: 310px;
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.35);
}

.sdb-submissions-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  max-width: 960px;
  margin-top: 10px;
}

/* ----------------------------------------------------
   4. BOTTOM PLAYER HAND
   ---------------------------------------------------- */
.superdebuff-hand-area {
  background: rgba(15, 9, 28, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 10;
}

.superdebuff-hand-title {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.superdebuff-hand-cards-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 4px 10px;
  scrollbar-width: thin;
}

.superdebuff-hand-cards-row .sdb-card {
  width: 170px;
  min-height: 220px;
  padding: 12px;
  flex-shrink: 0;
}

.superdebuff-hand-cards-row .sdb-card .sdb-card-text {
  font-size: 12px;
}

.superdebuff-hand-cards-row .sdb-card .sdb-card-icon {
  font-size: 22px;
}

.superdebuff-action-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn-sdb-action {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
  transition: all 0.2s ease;
}

.btn-sdb-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.btn-sdb-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ----------------------------------------------------
   5. WINNER & PODIUM
   ---------------------------------------------------- */
.superdebuff-podium-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 20px;
}

.superdebuff-podium-title {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, #fcd34d, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.superdebuff-podium-slots {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
}

.superdebuff-podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.superdebuff-podium-bar {
  width: 100px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
}

.superdebuff-podium-1 .superdebuff-podium-bar {
  height: 140px;
  background: linear-gradient(180deg, #f59e0b, #b45309);
  color: #fff;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.4);
}

.superdebuff-podium-2 .superdebuff-podium-bar {
  height: 100px;
  background: linear-gradient(180deg, #94a3b8, #475569);
  color: #fff;
}

.superdebuff-podium-3 .superdebuff-podium-bar {
  height: 70px;
  background: linear-gradient(180deg, #d97706, #78350f);
  color: #fff;
}

/* Floating Reactions */
.sdb-floating-emoji {
  position: absolute;
  font-size: 32px;
  pointer-events: none;
  animation: sdbFloatUp 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 1000;
}

/* In-Chat Game Invite Card */
.chat-game-card {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  max-width: 380px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.chat-game-badge {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-game-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.chat-game-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.chat-game-join-btn {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  align-self: flex-start;
  transition: transform 0.15s ease;
}

.chat-game-join-btn:hover {
  transform: scale(1.04);
}

/* Animations */
@keyframes sdbFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

@keyframes sdbPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; transform: scale(1.02); }
}

@keyframes sdbFloatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.7);
  }
  50% {
    opacity: 1;
    transform: translateY(-50px) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translateY(-110px) scale(1);
  }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .superdebuff-window {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .sdb-card {
    width: 170px;
    min-height: 240px;
    padding: 12px;
  }
  .sdb-combo-superpower-card {
    width: 200px;
    min-height: 260px;
  }
  .superdebuff-hand-cards-row .sdb-card {
    width: 140px;
    min-height: 190px;
  }
  .superdebuff-hero-banner h1 {
    font-size: 26px;
  }
}
