/* ============================================
   OTD GAMES — COMPONENTS
   ============================================ */

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  min-height: 48px;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--duration-fast);
}

.btn:active::after { background: rgba(255,255,255,0.1); }

.btn-primary {
  background: var(--accent-gradient);
  color: var(--text-inverse);
  box-shadow: 0 4px 15px rgba(var(--accent-primary-rgb), 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(var(--accent-primary-rgb), 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ff1744, #d50000);
  color: white;
  box-shadow: 0 4px 15px rgba(var(--color-danger-rgb), 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(var(--color-danger-rgb), 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #00e676, #00c853);
  color: var(--text-inverse);
  box-shadow: 0 4px 15px rgba(var(--color-success-rgb), 0.3);
}

.btn-ghost {
  background: rgba(255,255,255,0.06);
  border: var(--border-glass);
  color: var(--text-primary);
}

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--accent-primary);
  color: var(--accent-primary);
}

.btn-outline:hover {
  background: rgba(var(--accent-primary-rgb), 0.1);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
  min-height: 56px;
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
  min-height: 36px;
}

.btn-full { width: 100%; }

.btn-icon {
  width: 44px; height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.card-interactive:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-interactive:active {
  transform: translateY(0);
}

.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: var(--border-glass);
}

.card-accent {
  border-color: rgba(var(--accent-primary-rgb), 0.2);
}

.card-accent::before {
  background: linear-gradient(90deg, transparent, rgba(var(--accent-primary-rgb), 0.3), transparent);
}

/* === SCORE DISPLAY === */
.score-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-ring svg {
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.06);
}

.score-ring-fill {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease-out);
}

.score-ring-value {
  position: absolute;
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-xl);
}

.score-ring-label {
  position: absolute;
  bottom: -4px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* === PROGRESS BAR === */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-gradient-h);
  transition: width 0.8s var(--ease-out);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 20px; height: 100%;
  background: rgba(255,255,255,0.3);
  filter: blur(4px);
  animation: shimmer 2s infinite;
}

.progress-bar-lg { height: 12px; }

/* === BADGE === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  padding: 2px var(--space-xs);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-accent {
  background: rgba(var(--accent-primary-rgb), 0.15);
  color: var(--accent-primary);
}

.badge-success {
  background: rgba(var(--color-success-rgb), 0.15);
  color: var(--color-success);
}

.badge-warning {
  background: rgba(var(--color-warning-rgb), 0.15);
  color: var(--color-warning);
}

.badge-danger {
  background: rgba(var(--color-danger-rgb), 0.15);
  color: var(--color-danger);
}

.badge-level {
  padding: var(--space-xxs) var(--space-sm);
  font-size: var(--text-sm);
}

/* === STAT ITEM === */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* === TOAST === */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + var(--space-md));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: calc(100% - var(--space-xl));
  max-width: 400px;
  pointer-events: none;
}

.toast {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: toastIn var(--duration-slow) var(--ease-spring);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.toast-success {
  background: rgba(var(--color-success-rgb), 0.15);
  border: 1px solid rgba(var(--color-success-rgb), 0.3);
  color: var(--color-success);
}

.toast-error {
  background: rgba(var(--color-danger-rgb), 0.15);
  border: 1px solid rgba(var(--color-danger-rgb), 0.3);
  color: var(--color-danger);
}

.toast-warning {
  background: rgba(var(--color-warning-rgb), 0.15);
  border: 1px solid rgba(var(--color-warning-rgb), 0.3);
  color: var(--color-warning);
}

.toast-info {
  background: rgba(var(--accent-primary-rgb), 0.15);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.3);
  color: var(--accent-primary);
}

.toast-xp {
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.2), rgba(0, 212, 255, 0.2));
  border: 1px solid rgba(0, 230, 118, 0.4);
  color: var(--color-success);
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
}

.toast-out { animation: toastOut var(--duration-normal) var(--ease-out) forwards; }

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

.modal-content {
  background: var(--bg-secondary);
  border: var(--border-glass);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 400px;
  width: 100%;
  animation: modalIn var(--duration-slow) var(--ease-spring);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-md);
}

.modal-text {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
}

.modal-actions .btn { flex: 1; }

/* === GAME CARD === */
.game-card {
  background: var(--bg-card);
  border: var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}

.game-card:active {
  transform: scale(0.98);
}

.game-card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: var(--space-md);
}

.game-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-xxs);
}

.game-card-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.game-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.game-card-locked {
  opacity: 0.5;
  pointer-events: none;
}

.game-card-locked::after {
  content: '🔒';
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-size: 20px;
}

/* === CHIP TABS === */
.chip-tabs {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--space-xs);
}

.chip-tabs::-webkit-scrollbar { display: none; }

.chip-tab {
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  background: rgba(255,255,255,0.06);
  border: 1px solid transparent;
  transition: all var(--duration-fast);
}

.chip-tab.active {
  background: rgba(var(--accent-primary-rgb), 0.15);
  border-color: rgba(var(--accent-primary-rgb), 0.3);
  color: var(--accent-primary);
}

/* === RADAR CHART (CSS) === */
.radar-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 280px;
  margin: 0 auto;
}

/* === LEADERBOARD ROW === */
.lb-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: background var(--duration-fast);
}

.lb-row:nth-child(even) { background: rgba(255,255,255,0.02); }

.lb-rank {
  width: 32px;
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  color: var(--text-tertiary);
}

.lb-rank-1 { color: #ffd700; }
.lb-rank-2 { color: #c0c0c0; }
.lb-rank-3 { color: #cd7f32; }

.lb-avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
}

.lb-info { flex: 1; }
.lb-name { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.lb-title { font-size: var(--text-xs); color: var(--text-tertiary); }

.lb-score {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  color: var(--accent-primary);
}

/* === EMPTY STATE === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  gap: var(--space-md);
}

.empty-state-icon {
  font-size: 48px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.empty-state-desc {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  max-width: 260px;
}

/* === COACH BUBBLE === */
.coach-bubble {
  background: var(--bg-card);
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  border-top-left-radius: var(--space-xxs);
  padding: var(--space-md);
  position: relative;
}

.coach-bubble::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent-gradient-h);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.coach-name {
  font-size: var(--text-xs);
  color: var(--accent-primary);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-xs);
}

.coach-text {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  color: var(--text-primary);
}

.coach-text em {
  color: var(--color-warning);
  font-style: normal;
  font-weight: var(--weight-bold);
}
