/* =========================================================
   CROSSGAMES - MODALS & OVERLAYS STYLES
   ========================================================= */

/* In-Game Overlays (Pause, Victory, Defeat) */
.game-overlay-modal {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 18, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.overlay-card {
  background: rgba(22, 27, 46, 0.95);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  position: relative;
  overflow: hidden;
}

.pause-card {
  border-color: rgba(0, 242, 254, 0.3);
}

.victory-card {
  border-color: rgba(255, 183, 3, 0.4);
  box-shadow: 0 20px 60px rgba(255, 183, 3, 0.15);
}

.defeat-card {
  border-color: rgba(255, 75, 114, 0.4);
  box-shadow: 0 20px 60px rgba(255, 75, 114, 0.15);
}

.victory-ribbon {
  position: absolute;
  top: 14px;
  background: linear-gradient(135deg, #ffe259, #ffa751);
  color: #0b0d14;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 4px 18px;
  border-radius: var(--radius-full);
}

.overlay-icon, .victory-header-icon {
  font-size: 54px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.overlay-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 4px;
}

.text-danger {
  color: var(--color-danger);
}
.text-gold {
  color: var(--color-gold);
}
.text-accent {
  color: var(--accent-primary);
}

.overlay-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Victory Stars Animation Box */
.victory-stars-box {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
  width: 100%;
}

.star-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  flex: 1;
  transition: all 0.3s ease;
}

.star-slot.earned {
  background: rgba(255, 183, 3, 0.12);
  border-color: var(--color-gold);
  box-shadow: 0 0 16px var(--color-gold-glow);
}

.star-badge {
  font-size: 32px;
  filter: grayscale(1) opacity(0.3);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-slot.earned .star-badge {
  filter: grayscale(0) opacity(1);
  transform: scale(1.15);
  animation: starPop 0.5s ease;
}

@keyframes starPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.3); }
  100% { transform: scale(1.15); }
}

.star-cond {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.star-slot.earned .star-cond {
  color: #fff;
}

/* Victory Stats Table */
.victory-stats-table {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.vstat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.vstat-name {
  color: var(--text-muted);
  font-weight: 600;
}

.vstat-value {
  font-family: var(--font-display);
  font-weight: 800;
  color: #fff;
}

/* Defeat Tip Box */
.defeat-tip-box {
  width: 100%;
  background: rgba(255, 75, 114, 0.08);
  border: 1px solid rgba(255, 75, 114, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  text-align: left;
}

.tip-icon {
  font-size: 16px;
}

.tip-text {
  font-size: 12px;
  color: #ffccd5;
  line-height: 1.5;
}

/* Overlay Buttons */
.overlay-buttons {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 12px;
}

.button-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
.button-row > * {
  flex: 1;
}

/* =========================================================
   GLOBAL MODALS (Profile, Achievements, Leaderboard, Settings)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(14px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-box {
  background: #131726;
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-xl);
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.modal-title-with-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.achievement-count-pill {
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Profile Modal Styles */
.profile-preview-card {
  display: flex;
  gap: 20px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  align-items: center;
}

.avatar-selection-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.profile-big-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffe259, #ffa751);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.avatar-hint {
  font-size: 10px;
  color: var(--text-muted);
}

.profile-info-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label, .section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
}
.input-with-action input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
}

.avatar-options-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.avatar-option-btn {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.avatar-option-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
}
.avatar-option-btn.selected {
  background: rgba(0, 242, 254, 0.2);
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-glow);
}

.data-manage-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-danger-outline:hover {
  background: rgba(255, 75, 114, 0.15);
}

/* Achievements List */
.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.achievement-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: all 0.2s ease;
}

.achievement-card.unlocked {
  background: rgba(0, 242, 254, 0.06);
  border-color: rgba(0, 242, 254, 0.3);
}

.ach-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.achievement-card.unlocked .ach-icon-wrap {
  background: rgba(0, 242, 254, 0.15);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.3);
}

.ach-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ach-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.ach-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.ach-reward-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-gold);
  background: rgba(255, 183, 3, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* Leaderboard & Stats */
.leaderboard-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.ltab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ltab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ltab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
}
.ltab-content.active {
  display: flex;
}

.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-metric-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.stat-metric-num {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  color: var(--accent-primary);
}

.stat-metric-lbl {
  font-size: 11px;
  color: var(--text-muted);
}

.ranking-header-bar, .ranking-row {
  display: grid;
  grid-template-columns: 50px 1.5fr 1fr 1fr 1fr;
  align-items: center;
  padding: 10px 14px;
  font-size: 12px;
}

.ranking-header-bar {
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ranking-row {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.ranking-row.self {
  background: rgba(0, 242, 254, 0.1);
  border-color: var(--accent-primary);
}

.ranking-row .rank-num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 14px;
}
.ranking-row .rank-1 { color: #ffd700; }
.ranking-row .rank-2 { color: #c0c0c0; }
.ranking-row .rank-3 { color: #cd7f32; }

/* Settings Modal Styles */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.setting-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--accent-primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
  background-color: #0b0d14;
}

/* =========================================================
   SHOP MODAL STYLES
   ========================================================= */
.shop-coins-pill {
  background: rgba(255, 183, 3, 0.12);
  border: 1px solid rgba(255, 183, 3, 0.35);
  color: var(--color-gold);
  font-size: 13px;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: var(--radius-full);
}

.shop-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 6px;
}

.stab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.stab-btn.active {
  background: var(--accent-gradient);
  color: #0b0d14;
  font-weight: 800;
}

.stab-content {
  display: none;
  flex-direction: column;
}
.stab-content.active {
  display: flex;
}

.shop-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.shop-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: all 0.25s ease;
  position: relative;
}

.shop-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-glass-bright);
  background: rgba(255, 255, 255, 0.04);
}

.shop-card.equipped {
  border-color: var(--color-success);
  background: rgba(0, 230, 118, 0.08);
  box-shadow: 0 0 16px var(--color-success-glow);
}

.shop-card-icon {
  font-size: 38px;
  margin-bottom: 2px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.shop-card-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.shop-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  min-height: 30px;
}

.shop-card-action {
  width: 100%;
  margin-top: 6px;
}

.btn-shop-buy, .btn-shop-equip, .btn-shop-equipped {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  transition: all 0.2s ease;
}

.btn-shop-buy {
  background: linear-gradient(135deg, #ffb703, #fb8500);
  color: #0b0d14;
}
.btn-shop-buy:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 12px var(--color-gold-glow);
}

.btn-shop-equip {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid var(--border-glass-bright);
}
.btn-shop-equip:hover {
  background: rgba(0, 242, 254, 0.2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-shop-equipped {
  background: rgba(0, 230, 118, 0.2);
  color: var(--color-success);
  cursor: default;
  border: 1px solid var(--color-success);
}
