/* =========================================================
   CYBERARENA — общая тема «стекло» (glassmorphism)
   Подключается ПОСЛЕ основных стилей страницы:
   <link rel="stylesheet" href="theme.css">
   <script src="theme.js" defer></script>
   ========================================================= */

:root {
  --bg-dark: #05070c;
  --accent-green: #00ff88;
  --accent-blue: #00d2ff;
  --danger: #ff4757;
  --text-main: #f1f5f9;
  --text-muted: #8a97ad;

  --glass-1: rgba(255, 255, 255, 0.085);
  --glass-2: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-hi: rgba(255, 255, 255, 0.18);
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html { background: var(--bg-dark); }
body { background: transparent !important; }

::selection { background: rgba(0, 255, 136, 0.3); color: #fff; }

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.22) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Анимированный фон (создаётся theme.js) ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

.bg .orb {
  position: absolute;
  width: 46vmax; height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.bg .orb-1 {
  background: radial-gradient(circle, rgba(0, 255, 136, 0.8), transparent 65%);
  top: -16vmax; left: -12vmax;
  animation: drift1 26s ease-in-out infinite alternate;
}
.bg .orb-2 {
  background: radial-gradient(circle, rgba(0, 210, 255, 0.75), transparent 65%);
  bottom: -20vmax; right: -14vmax;
  animation: drift2 30s ease-in-out infinite alternate;
}
.bg .orb-3 {
  width: 30vmax; height: 30vmax;
  background: radial-gradient(circle, rgba(0, 255, 200, 0.5), transparent 65%);
  top: 40%; left: 55%;
  opacity: 0.3;
  animation: drift3 22s ease-in-out infinite alternate;
}
.bg .pitch {
  position: absolute; inset: 0; width: 100%; height: 100%;
  fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 2;
  animation: breathe 22s ease-in-out infinite alternate;
}

@keyframes drift1 { to { transform: translate(18vmax, 12vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-16vmax, -10vmax) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-20vmax, 8vmax) scale(1.3); } }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.06); } }

@keyframes rise {
  from { opacity: 0; transform: translateY(22px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-24px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Навигация (плавающая стеклянная панель) ---------- */
.navbar {
  top: 12px;
  margin: 12px auto 0;
  width: calc(100% - 32px);
  max-width: 1240px;
  height: 68px;
  padding: 0 22px;
  border-radius: 20px;
  background: linear-gradient(160deg, var(--glass-1), rgba(255, 255, 255, 0.035));
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 14px 40px rgba(0, 0, 0, 0.4);
  animation: dropIn 0.8s var(--ease) both;
}

.nav-brand { text-shadow: 0 0 24px rgba(0, 255, 136, 0.25); }
.nav-brand i { filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.6)); }

.nav-link {
  border: 1px solid transparent;
  border-radius: 12px;
  transition: color 0.25s, background 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.25s var(--ease);
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.nav-link.active,
.nav-link.current {
  color: var(--accent-green);
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.16), rgba(0, 210, 255, 0.09));
  border-color: rgba(0, 255, 136, 0.35);
  box-shadow: 0 0 24px rgba(0, 255, 136, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.lang-switcher {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
}
.lang-btn { transition: color 0.2s, background 0.3s; }
.lang-btn:hover { color: #fff; }
.lang-btn.active {
  background: linear-gradient(120deg, var(--accent-green), var(--accent-blue));
  color: #03140b;
  box-shadow: 0 4px 14px rgba(0, 255, 136, 0.25);
}

.rp-badge {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.14), rgba(0, 210, 255, 0.07));
  border: 1px solid rgba(0, 255, 136, 0.45);
  box-shadow: 0 0 22px rgba(0, 255, 136, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-logout {
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.45);
  border-radius: 11px;
  transition: background 0.25s, transform 0.25s var(--ease), box-shadow 0.25s;
}
.btn-logout:hover { background: rgba(255, 71, 87, 0.22); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(255, 71, 87, 0.2); }

.bell-btn { background: rgba(255, 255, 255, 0.06); border-radius: 11px; transition: all 0.25s var(--ease); }
.bell-btn:hover { transform: translateY(-1px); }
.bell-btn.has-new { box-shadow: 0 0 22px rgba(255, 215, 0, 0.3); }

@media (max-width: 768px) {
  .navbar { top: 10px; margin-top: 10px; width: calc(100% - 20px); padding: 0 16px; }
  .mobile-dropdown {
    top: 76px;
    border-radius: 18px;
    background: rgba(14, 18, 27, 0.95);
    border: 1px solid var(--glass-border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  }
  .mobile-dropdown.active { animation: modalIn 0.3s var(--ease) both; }
}

/* ---------- Стеклянные карточки ---------- */
.card {
  position: relative;
  background:
    radial-gradient(360px circle at var(--mx, -999px) var(--my, -999px), rgba(0, 255, 136, 0.11), transparent 60%),
    linear-gradient(160deg, var(--glass-1), var(--glass-2));
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 var(--glass-hi), inset 0 -1px 0 rgba(255, 255, 255, 0.03), 0 20px 50px rgba(0, 0, 0, 0.35);
  animation: rise 0.75s var(--ease) both;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.card:hover { border-color: rgba(255, 255, 255, 0.2); }
.container .card:nth-of-type(2) { animation-delay: 0.09s; }
.container .card:nth-of-type(3) { animation-delay: 0.18s; }
.container > div:nth-child(2) .card { animation-delay: 0.14s; }

.card-header { border-bottom-color: rgba(255, 255, 255, 0.09); }
.card-title { text-shadow: 0 0 20px rgba(255, 255, 255, 0.08); }

/* Внутренние стеклянные блоки (в т.ч. в динамически подгружаемом HTML) */
.player-card,
.challenge-item,
.friend-item {
  background:
    radial-gradient(260px circle at var(--mx, -999px) var(--my, -999px), rgba(0, 255, 136, 0.10), transparent 60%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 0.28s var(--ease), border-color 0.28s, box-shadow 0.28s;
}
.player-card:hover,
.friend-item:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 255, 136, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 16px 36px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 255, 136, 0.07);
}
.challenge-item:hover { border-color: rgba(255, 255, 255, 0.2); }
.friend-item.request { border-color: rgba(255, 215, 0, 0.4); }

.leader-row { border-bottom-color: rgba(255, 255, 255, 0.07); border-radius: 10px; padding-left: 8px; padding-right: 8px; transition: background 0.25s; }
.leader-row:hover { background: rgba(255, 255, 255, 0.05); }
.card .leader-row:nth-child(2) b:first-child { color: #ffd700; text-shadow: 0 0 12px rgba(255, 215, 0, 0.5); }
.card .leader-row:nth-child(3) b:first-child { color: #dbe4f0; text-shadow: 0 0 12px rgba(219, 228, 240, 0.4); }
.card .leader-row:nth-child(4) b:first-child { color: #e6955c; text-shadow: 0 0 12px rgba(230, 149, 92, 0.4); }

/* ---------- Значки ---------- */
.badge-friendly, .badge-rank { border-radius: 8px; backdrop-filter: blur(6px); }
.badge-friendly { background: rgba(0, 210, 255, 0.1); border-color: rgba(0, 210, 255, 0.5); }
.badge-rank { background: rgba(0, 255, 136, 0.1); border-color: rgba(0, 255, 136, 0.5); }
.status-dot.online { box-shadow: 0 0 10px #00ff88, 0 0 3px #00ff88; }

/* ---------- Кнопки ---------- */
.btn-action,
.btn-duel {
  position: relative;
  overflow: hidden;
  border-radius: 11px;
  font-weight: 700;
  transition: transform 0.22s var(--ease), box-shadow 0.3s, filter 0.3s;
}
.btn-action::after,
.btn-duel::after {
  content: '';
  position: absolute; top: 0; left: -70%;
  width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}
.btn-action:hover::after,
.btn-duel:hover::after { left: 130%; }
.btn-action:hover,
.btn-duel:hover { transform: translateY(-2px); }
.btn-action:active,
.btn-duel:active { transform: translateY(0) scale(0.98); }

.btn-accept,
.btn-duel {
  background: linear-gradient(120deg, var(--accent-green), var(--accent-blue));
  color: #03140b;
  box-shadow: 0 8px 22px rgba(0, 255, 136, 0.22);
}
.btn-accept:hover, .btn-duel:hover { box-shadow: 0 14px 30px rgba(0, 255, 136, 0.34); }

.btn-decline {
  background: linear-gradient(120deg, #ff4757, #ff6b81);
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 71, 87, 0.22);
}
.btn-decline:hover { box-shadow: 0 14px 30px rgba(255, 71, 87, 0.34); }

.btn-chat {
  background: linear-gradient(120deg, #00d2ff, #3da5ff);
  color: #00121a;
  box-shadow: 0 8px 22px rgba(0, 210, 255, 0.22);
}
.btn-chat:hover { box-shadow: 0 14px 30px rgba(0, 210, 255, 0.34); }

.btn-add-friend {
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.5);
  border-radius: 9px;
  transition: all 0.25s var(--ease);
}
.btn-add-friend:hover { background: rgba(0, 210, 255, 0.22); transform: translateY(-2px); }

/* ---------- Поля ввода ---------- */
.chat-input,
select.type-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  color: #fff;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
select.type-select { border-radius: 10px; }
.chat-input:hover, select.type-select:hover { border-color: rgba(255, 255, 255, 0.22); }
.chat-input:focus,
select.type-select:focus {
  outline: none;
  border-color: rgba(0, 255, 136, 0.6);
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.12);
}
select option { background: #0e131c; color: #fff; }

/* ---------- Чат ---------- */
.chat-container {
  background: linear-gradient(160deg, rgba(0, 210, 255, 0.08), rgba(0, 210, 255, 0.02));
  border: 1px solid rgba(0, 210, 255, 0.32);
  border-radius: 18px;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.chat-box { background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 13px; }
.chat-msg { border-radius: 14px; }
.chat-msg.my {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.22), rgba(0, 210, 255, 0.13));
  border: 1px solid rgba(0, 255, 136, 0.4);
  border-bottom-right-radius: 4px;
}
.chat-msg.other {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 4px;
}
.pm-messages .chat-msg { animation: msgIn 0.3s var(--ease) both; }

/* Личный чат с другом */
.pm-panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04)), rgba(10, 14, 22, 0.72);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid rgba(0, 210, 255, 0.4);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 210, 255, 0.1);
}
.pm-panel[style*="display: flex"] { animation: modalIn 0.35s var(--ease) both; }
.pm-header { background: rgba(0, 210, 255, 0.08); border-bottom-color: rgba(255, 255, 255, 0.08); }
.pm-messages { background: rgba(0, 0, 0, 0.22); }
.pm-input-group { border-top-color: rgba(255, 255, 255, 0.08); }

/* ---------- Уведомления и ошибки ---------- */
.alert-error {
  background: rgba(255, 71, 87, 0.13);
  border: 1px solid rgba(255, 71, 87, 0.45);
  border-radius: 14px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.toast-notification {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05)), rgba(10, 14, 22, 0.6);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 4px solid var(--accent-green);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 18px 44px rgba(0, 0, 0, 0.5);
}
.toast-notification.duel { border-left-color: #ffd700; }

/* ---------- Модальное окно статистики игрока ---------- */
#playerStatsModal > div {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)), rgba(10, 14, 22, 0.7) !important;
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid var(--glass-border) !important;
  border-radius: 22px !important;
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 30px 80px rgba(0, 0, 0, 0.6) !important;
  animation: modalIn 0.35s var(--ease) both;
}
#playerModalContent div[style*="background:#07090e"] {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  border-radius: 13px !important;
}

/* ---------- SweetAlert2 ---------- */
div.swal2-container.swal2-backdrop-show {
  background: rgba(5, 7, 12, 0.7) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.swal2-popup.cyber-modal {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)), rgba(12, 16, 24, 0.72) !important;
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid var(--glass-border) !important;
  border-radius: 24px !important;
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 30px 80px rgba(0, 0, 0, 0.6) !important;
}
.swal2-popup.cyber-modal .swal2-confirm,
.swal2-popup.cyber-modal .swal2-cancel { transition: transform 0.2s var(--ease), opacity 0.2s !important; }
.swal2-popup.cyber-modal .swal2-confirm:hover,
.swal2-popup.cyber-modal .swal2-cancel:hover { transform: translateY(-2px); }
.swal2-popup.cyber-modal .swal2-cancel { background: rgba(255, 255, 255, 0.08) !important; }

/* ---------- Уважение к настройке «уменьшить анимацию» ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================
   3D ФУТБОЛЬНЫЙ СТИЛЬ
   ========================================================= */
.stadium3d { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.stadium3d canvas { width: 100% !important; height: 100% !important; display: block; }
.stadium3d::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(5,7,12,0.25) 0%, rgba(5,7,12,0.78) 75%); }
html.has-3d .bg { display: none; }

/* Карточки игроков в стиле eFootball/FIFA */
.player-card, .friend-item { transform-style: preserve-3d; will-change: transform;
  transition: transform 0.18s ease-out, border-color 0.28s, box-shadow 0.28s; position: relative; overflow: hidden; }
.player-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(255,215,0,0.14) 45%, rgba(255,255,255,0.22) 50%, transparent 60%);
  background-size: 250% 100%; background-position: 120% 0; transition: background-position 0.8s var(--ease); }
.player-card:hover::before { background-position: -30% 0; }
.player-card { border-top: 2px solid rgba(255,215,0,0.45); }
.pc-avatar { box-shadow: 0 0 0 2px rgba(255,215,0,0.55), 0 8px 20px rgba(0,0,0,0.5); transform: translateZ(24px); }
.pc-name { transform: translateZ(16px); letter-spacing: 0.5px; text-transform: uppercase; }

/* Бренд — вращающийся мяч */
.nav-brand i { display: inline-block; animation: spinBall 6s linear infinite; }
@keyframes spinBall { to { transform: rotate(360deg); } }

/* Кнопки — «табло» */
.btn-action, button[type=submit] { transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.btn-action:hover, button[type=submit]:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 10px 24px rgba(0,255,136,0.25); }

/* Настройки языка */
.ca-settings-btn { position: fixed; right: 18px; bottom: 18px; z-index: 9999; width: 52px; height: 52px;
  border-radius: 50%; font-size: 24px; cursor: pointer; color: #fff;
  background: linear-gradient(160deg, var(--glass-1), rgba(255,255,255,0.03));
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  transition: transform 0.4s var(--ease); }
.ca-settings-btn:hover { transform: rotate(90deg) scale(1.08); }
.ca-settings { position: fixed; right: 18px; bottom: 80px; z-index: 9999; width: min(340px, calc(100vw - 36px));
  max-height: 60vh; overflow: auto; padding: 16px; border-radius: 18px;
  background: rgba(12,16,24,0.92); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border); box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  opacity: 0; transform: translateY(12px) scale(0.96); pointer-events: none; transition: all 0.3s var(--ease); }
.ca-settings.open { opacity: 1; transform: none; pointer-events: auto; }
.ca-settings-title { color: var(--text-main); font-weight: 700; margin-bottom: 12px; }
.ca-lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ca-lang-grid button { padding: 9px 10px; border-radius: 10px; cursor: pointer; text-align: left; font-size: 13px;
  color: var(--text-main); background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); }
.ca-lang-grid button:hover { border-color: rgba(0,255,136,0.4); }
.ca-lang-grid button.on { background: linear-gradient(120deg, var(--accent-green), var(--accent-blue)); color: #03140b; font-weight: 700; }

/* Прячем полосу Google Translate */
.goog-te-banner-frame, #goog-gt-tt, .goog-te-balloon-frame, .skiptranslate iframe { display: none !important; }
body { top: 0 !important; }
