

:root {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f5f5f5;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --border-color: #e5e5e5;
  --accent: #1a1a1a;
  --accent-hover: #333333;
  --accent-light: #e5e5e5;
  --accent-subtle: #f5f5f5;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --squid-green: #22c55e;
  --squid-red: #ef4444;
  --gold: #fbbf24;
  --silver: #94a3b8;
  --bronze: #cd7c3f;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px;
  --space-xl: 32px; --space-2xl: 48px; --space-3xl: 64px;
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px; --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --transition-fast: 150ms ease; --transition-base: 200ms ease; --transition-slow: 300ms ease;
}

body.dark-mode {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1e1e1e;
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-tertiary: #606060;
  --border-color: #2a2a2a;
  --accent: #ffffff;
  --accent-hover: #e0e0e0;
  --accent-light: #333333;
  --accent-subtle: #1e1e1e;
  --success-bg: #052e16;
  --warning-bg: #422006;
  --error-bg: #2c0a0a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { 
  font-family: var(--font-sans); 
  font-size: 1rem; 
  line-height: 1.6; 
  color: var(--text-primary); 
  background: var(--bg-primary); 
  min-height: 100vh;
  transition: background-color var(--transition-base), color var(--transition-base);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; border: none; outline: none; }

#app { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; padding: var(--space-xl); max-width: 1200px; margin: 0 auto; width: 100%; }
.view { animation: fadeIn var(--transition-base); }
.view.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.hidden { display: none !important; }
.text-muted { color: var(--text-tertiary); }
.text-center { text-align: center; }

.nav { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding: var(--space-md) var(--space-xl); 
  background: var(--bg-secondary); 
  border-bottom: 1px solid var(--border-color); 
  position: sticky; 
  top: 0; 
  z-index: 100;
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.nav-brand { display: flex; align-items: center; gap: var(--space-sm); cursor: pointer; transition: opacity var(--transition-fast); }
.nav-brand:hover { opacity: 0.8; }
.nav-logo { display: flex; align-items: center; color: var(--accent); }
.nav-logo svg { display: block; }
.nav-title { font-weight: 700; font-size: 1.2rem; letter-spacing: -0.03em; }
.nav-links { display: flex; align-items: center; gap: var(--space-xs); }
.nav-link { 
  position: relative; 
  color: var(--text-secondary); 
  font-size: 0.9rem; 
  font-weight: 500; 
  padding: var(--space-sm) var(--space-md); 
  border-radius: var(--radius-md); 
  transition: all var(--transition-fast); 
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.nav-user-links {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-xs);
}

.nav-auth-links {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
}

.nav-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  background: none;
  border: none;
  cursor: pointer;
}
.nav-icon-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.nav-icon-link svg {
  flex-shrink: 0;
}

.settings-wrapper {
  position: relative;
  display: inline-flex;
}
.settings-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: var(--space-xs);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.dropdown-item:hover {
  background: var(--bg-tertiary);
}
.dropdown-item-danger {
  color: var(--error);
}
.dropdown-item-danger:hover {
  background: var(--error-bg);
}
.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-xs) 0;
}

.badge { position: absolute; top: -4px; right: -4px; background: var(--error); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: var(--radius-full); font-weight: 600; }
.theme-toggle { 
  padding: var(--space-sm); 
  font-size: 1.25rem; 
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}
.theme-toggle:hover { background: var(--bg-tertiary); }

.btn { 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: var(--space-sm); 
  padding: var(--space-sm) var(--space-md); 
  font-size: 0.9rem; 
  font-weight: 500; 
  border-radius: var(--radius-md); 
  transition: all var(--transition-fast);
  color: var(--text-primary);
}
.btn-primary { background: var(--accent); color: white; }
body.dark-mode .btn-primary { background: var(--accent); color: #0a0a0a; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-secondary:hover { background: var(--border-color); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--error); color: white; }
.btn-full { 
  width: 100%; 
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}
.btn-sm { padding: var(--space-xs) var(--space-sm); font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
select:hover {
  border-color: var(--text-tertiary);
}
select:focus {
  outline: none;
  border-color: var(--accent);
}

.hero { text-align: center; padding: var(--space-2xl) 0; }

.home-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  min-height: calc(100vh - 120px);
  justify-content: center;
}

.home-wrapper::-webkit-scrollbar {
  width: 8px;
}

.home-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.home-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.home-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.home-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
}

.hero-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.hero-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.hero-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.hero-tagline {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin: 0;
}

.btn-hero-play {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: fit-content;
}

body.dark-mode .btn-hero-play {
  color: #0a0a0a;
}

.btn-hero-play:hover {
  transform: translateY(-2px);
}

.btn-hero-play svg {
  width: 20px;
  height: 20px;
}

.hero-stats {
  display: flex;
  gap: var(--space-md);
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  min-width: 80px;
}

.stat-card:hover {
  border-color: var(--accent);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.stat-dot.online {
  background: var(--success);
}

.stat-dot.live {
  background: var(--error);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.home-modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.mode-card.squid:hover { border-color: var(--error); }
.mode-card.sudden:hover { border-color: #f59e0b; }
.mode-card.marathon:hover { border-color: #10b981; }
.mode-card.practice:hover { border-color: var(--success); }

.mode-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
}

.mode-card.squid .mode-icon {
  background: color-mix(in srgb, var(--error) 15%, transparent);
  color: var(--error);
}

.mode-card.sudden .mode-icon {
  background: color-mix(in srgb, #f59e0b 15%, transparent);
  color: #f59e0b;
}

.mode-card.marathon .mode-icon {
  background: color-mix(in srgb, #10b981 15%, transparent);
  color: #10b981;
}

.mode-card.practice .mode-icon {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}

.mode-icon svg {
  width: 24px;
  height: 24px;
}

.mode-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.mode-desc {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.home-bottom {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-lg);
  align-items: start;
}

.home-lobbies {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lobbies-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.lobbies-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.lobbies-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--bg-secondary);
  color: var(--accent);
}

.lobbies-list {
  max-height: 220px;
  overflow-y: auto;
}

.lobbies-list::-webkit-scrollbar {
  width: 6px;
}

.lobbies-list::-webkit-scrollbar-track {
  background: transparent;
}

.lobbies-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.lobbies-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.lobbies-empty {
  padding: var(--space-xl);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.lobbies-empty svg {
  width: 32px;
  height: 32px;
  opacity: 0.5;
}

.lobbies-empty p {
  margin: 0;
}

.lobby-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.lobby-item:last-child { border-bottom: none; }
.lobby-item:hover { background: var(--bg-tertiary); }

.lobby-mode-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.lobby-mode-icon.classic {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.lobby-mode-icon.squidgame {
  background: color-mix(in srgb, var(--error) 15%, transparent);
  color: var(--error);
}

.lobby-mode-icon svg {
  width: 18px;
  height: 18px;
}

.lobby-info { flex: 1; min-width: 0; }

.lobby-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.lobby-players {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.lobby-players svg {
  width: 14px;
  height: 14px;
}

.home-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.top-player-mini {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, color-mix(in srgb, gold 5%, var(--bg-secondary)) 100%);
  border: 1px solid color-mix(in srgb, gold 20%, var(--border-color));
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.top-player-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
}

.top-player-mini svg {
  width: 22px;
  height: 22px;
}

.top-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-wpm {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
}

.recent-mini {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.recent-label {
  display: block;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.recent-list {
  max-height: 220px;
  overflow-y: auto;
}

.recent-list::-webkit-scrollbar {
  width: 6px;
}

.recent-list::-webkit-scrollbar-track {
  background: transparent;
}

.recent-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.recent-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.recent-empty {
  display: block;
  padding: var(--space-md);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-tertiary); }

.activity-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.activity-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.activity-avatar-letter {
  font-weight: 600;
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.activity-content { flex: 1; min-width: 0; }

.activity-text {
  font-size: 0.7rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-text strong {
  color: var(--accent);
  cursor: pointer;
}

.activity-text strong:hover { text-decoration: underline; }

.activity-meta {
  font-size: 0.6rem;
  color: var(--text-tertiary);
}

.activity-wpm {
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.activity-empty {
  text-align: center;
  padding: var(--space-md);
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

.loader-small {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item:hover {
  background: var(--bg-tertiary);
}

.activity-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.activity-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.activity-avatar-letter {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: 0.8rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-text strong {
  color: var(--accent);
  cursor: pointer;
}

.activity-text strong:hover {
  text-decoration: underline;
}

.activity-meta {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.activity-wpm {
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.activity-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.not-found-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  text-align: center;
  padding: var(--space-xl);
}

.not-found-icon {
  color: var(--text-tertiary);
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.not-found-container h1 {
  font-size: 5rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: var(--space-sm);
  line-height: 1;
}

.not-found-message {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.not-found-sub {
  color: var(--text-tertiary);
  margin-bottom: var(--space-xl);
  max-width: 400px;
}

.not-found-container .btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.matchmaking { text-align: center; padding: var(--space-3xl) 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-md); }
.matchmaking h2 { font-weight: 600; }
.matchmaking-mode { color: var(--text-secondary); font-size: 0.9rem; }
.matchmaking-info { color: var(--text-tertiary); font-size: 0.85rem; }
.matchmaking-info span { color: var(--text-primary); font-weight: 600; }
.matchmaking-divider { 
  display: flex; 
  align-items: center; 
  gap: var(--space-md); 
  color: var(--text-tertiary); 
  width: 200px; 
  margin: var(--space-md) 0; 
}
.matchmaking-divider::before, .matchmaking-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }

.queue-players {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin: var(--space-md) 0;
  min-height: 60px;
}

.queue-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  min-width: 80px;
  animation: fadeIn 0.3s ease;
}

.queue-player.is-self {
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-tertiary));
  border: 1px solid var(--accent);
}

.queue-player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.queue-player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-player-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-match-section {
  margin: var(--space-md) 0;
}

.btn-start-match {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  background: var(--success);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-start-match:hover {
  background: #16a34a;
  transform: translateY(-2px);
}

.btn-start-match:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-start-match svg {
  fill: currentColor;
  stroke: none;
}

.invite-link-section {
  width: 100%;
  max-width: 400px;
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--accent);
}

.invite-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.invite-link-box {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.invite-link-box span {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy {
  padding: var(--space-sm) var(--space-md);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

body.dark-mode .btn-copy {
  color: #0a0a0a;
}

.btn-copy:hover {
  opacity: 0.9;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.loader { 
  width: 48px; 
  height: 48px; 
  border: 3px solid var(--border-color); 
  border-top-color: var(--accent); 
  border-radius: 50%; 
  animation: spin 1s linear infinite; 
}

.loader-home {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.game { 
  max-width: 800px; 
  margin: 0 auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
}
.progress-container { 
  display: flex; 
  flex-direction: column; 
  gap: var(--space-sm); 
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.progress-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) 0; }
.progress-rank { width: 24px; font-weight: 700; font-size: 0.85rem; color: var(--text-tertiary); flex-shrink: 0; text-align: center; }
.progress-rank:first-child { color: gold; }
.progress-avatar { 
  width: 28px; 
  height: 28px; 
  border-radius: 50%; 
  background: var(--bg-tertiary); 
  display: flex; 
  align-items: center; 
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  object-fit: cover;
}
.progress-avatar.ai {
  font-size: 0.9rem;
  background: transparent;
}
img.progress-avatar {
  object-fit: cover;
}
.progress-name { flex: 0 0 100px; font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-name.self { color: var(--accent); font-weight: 600; }
.progress-name.ai { color: var(--text-tertiary); }
.progress-name.eliminated { color: var(--error); text-decoration: line-through; opacity: 0.6; }
.progress-name.left { color: var(--text-tertiary); text-decoration: line-through; opacity: 0.5; }
.progress-bar { flex: 1; height: 8px; background: var(--bg-tertiary); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width 0.1s ease; }
.progress-fill.self { background: var(--success); }
.progress-fill.eliminated { background: var(--error); opacity: 0.4; }
.progress-fill.left { background: var(--text-tertiary); opacity: 0.4; }
.progress-wpm { width: 90px; text-align: right; font-size: 0.8rem; font-family: var(--font-mono); color: var(--text-secondary); font-weight: 500; }

.typing-area { 
  background: var(--bg-secondary); 
  border: 2px solid var(--border-color); 
  border-radius: var(--radius-xl); 
  padding: var(--space-xl) var(--space-2xl); 
  margin-bottom: var(--space-lg); 
  cursor: text;
  transition: all var(--transition-base);
}
.typing-area:focus-within { 
  border-color: var(--accent); 
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}
.typing-area.error { border-color: var(--error); animation: shake 0.3s ease; }
.typing-area.spectator-mode { pointer-events: none; opacity: 0.9; cursor: default; }
.typing-area.spectator-mode .typing-hint { display: block !important; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.text-display { 
  font-family: var(--font-mono); 
  font-size: 1.35rem; 
  line-height: 1.9; 
  color: var(--text-tertiary);
  word-break: break-word;
  text-align: left;
  letter-spacing: 0.01em;
}
.char { transition: color 0.05s ease; }
.char.correct { color: var(--text-primary); }
.char.incorrect { color: var(--error); background: var(--error-bg); border-radius: 3px; padding: 0 2px; margin: 0 -1px; }
.char.current { 
  background: var(--accent); 
  color: white; 
  border-radius: 3px; 
  padding: 0 2px; 
  margin: 0 -1px;
  animation: cursorBlink 1s ease infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
body.dark-mode .char.current { color: #0a0a0a; }
.typing-input-hidden { 
  position: absolute; 
  opacity: 0; 
  pointer-events: none; 
  width: 1px;
  height: 1px;
}
.typing-hint { color: var(--text-tertiary); font-size: 0.85rem; margin-top: var(--space-md); text-align: center; }

.game-stats { 
  display: flex; 
  justify-content: center; 
  gap: var(--space-xl);
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.stat { text-align: center; }
.stat-value { 
  display: block; 
  font-size: 1.75rem; 
  font-weight: 700; 
  font-family: var(--font-mono); 
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-label { font-size: 0.7rem; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }

.squid-indicator { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  gap: var(--space-md); 
  padding: var(--space-md) var(--space-lg); 
  border-radius: var(--radius-lg); 
  margin-bottom: var(--space-lg); 
  font-weight: 600;
  transition: background var(--transition-fast);
}
.squid-indicator.green { background: var(--success-bg); color: var(--success); border: 2px solid var(--success); }
.squid-indicator.red { background: var(--error-bg); color: var(--error); border: 2px solid var(--error); animation: redPulse 0.5s ease infinite; }
@keyframes redPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.squid-light-container { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.squid-light { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }

.mode-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  font-weight: 600;
  font-size: 0.9rem;
}

.mode-indicator.sudden-death {
  background: color-mix(in srgb, #f59e0b 15%, transparent);
  color: #f59e0b;
  border: 2px solid #f59e0b;
}

.mode-indicator.marathon {
  background: color-mix(in srgb, #10b981 15%, transparent);
  color: #10b981;
  border: 2px solid #10b981;
}

.countdown-overlay { 
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.8); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  z-index: 1000; 
}
.countdown-overlay span { font-size: 8rem; font-weight: 700; color: white; animation: countPop 1s ease infinite; }
@keyframes countPop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

.results { text-align: center; padding: var(--space-xl) 0; max-width: 600px; margin: 0 auto; }
.results h2 { font-size: 1.75rem; margin-bottom: var(--space-xl); }
.results-podium { display: flex; justify-content: center; align-items: flex-end; gap: var(--space-lg); margin-bottom: var(--space-xl); }
.podium-place { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  padding: var(--space-lg); 
  background: var(--bg-secondary); 
  border-radius: var(--radius-lg); 
  min-width: 100px;
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.podium-place.first { order: 2; transform: scale(1.1); border-color: var(--gold); }
.podium-place.second { order: 1; }
.podium-place.third { order: 3; }
.podium-medal { font-size: 2rem; }
.podium-name { font-weight: 600; margin: var(--space-sm) 0; font-size: 0.9rem; }
.podium-wpm { font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono); color: var(--success); }
.podium-label { font-size: 0.7rem; color: var(--text-tertiary); text-transform: uppercase; }
.results-list { 
  display: flex; 
  flex-direction: column; 
  gap: var(--space-sm); 
  margin-bottom: var(--space-xl);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.results-player { 
  display: flex; 
  align-items: center; 
  gap: var(--space-md); 
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base);
}
.results-player.self { background: var(--accent-subtle); border: 1px solid var(--accent); }
.results-player.eliminated { opacity: 0.6; }
.results-player.left { opacity: 0.5; }
.results-rank { font-weight: 600; min-width: 50px; font-size: 0.9rem; }
.results-info { flex: 1; text-align: left; }
.results-name { font-weight: 500; display: block; }
.results-name.ai { color: var(--text-tertiary); }
.results-stats-row { font-size: 0.8rem; color: var(--text-secondary); }
.results-actions { display: flex; justify-content: center; gap: var(--space-md); }

.modal { 
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.5); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  z-index: 1000; 
  padding: var(--space-md);
}
.modal-content { 
  background: var(--bg-secondary); 
  border-radius: var(--radius-xl); 
  padding: var(--space-xl); 
  max-width: 400px; 
  width: 100%; 
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.modal-content.modal-lg {
  max-width: 550px;
}
.modal-close { 
  position: absolute; 
  top: var(--space-md); 
  right: var(--space-md); 
  font-size: 1.5rem; 
  color: var(--text-tertiary); 
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.modal h2 { margin-bottom: var(--space-lg); font-size: 1.25rem; }
.modal-switch { margin-top: var(--space-lg); text-align: center; font-size: 0.9rem; color: var(--text-secondary); }
.modal-switch button { color: var(--accent); font-weight: 500; text-decoration: underline; }
.modal-small { max-width: 320px; text-align: center; }
.modal-buttons { display: flex; gap: var(--space-sm); justify-content: center; }
.modal-buttons .btn { min-width: 100px; }

.modal-lobby {
  max-width: 420px;
  text-align: center;
}
.modal-lobby h2 {
  margin-bottom: var(--space-xs);
}
.modal-header-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  border-radius: var(--radius-lg);
}
.modal-subtitle {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  margin-bottom: var(--space-xl);
}
.modal-lobby .form-group {
  text-align: left;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
.checkbox-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-left: 26px;
  margin-top: 2px;
}

.modal-wide {
  max-width: 720px;
  width: calc(100vw - 40px);
}

.edit-profile-layout {
  display: grid;
  grid-template-columns: 340px 280px;
  gap: var(--space-xl);
  align-items: start;
  justify-content: center;
}

.edit-profile-form {
  max-height: 480px;
  overflow-y: auto;
  padding-right: var(--space-md);
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.edit-profile-form::-webkit-scrollbar {
  width: 6px;
}

.edit-profile-form::-webkit-scrollbar-track {
  background: transparent;
}

.edit-profile-form::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.edit-profile-form::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.edit-profile-preview {
  position: sticky;
  top: 0;
}

.edit-profile-preview > label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

.banner-upload {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.banner-preview-small {
  width: 100%;
  height: 80px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--accent) 0%, #1a1a2e 100%);
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.banner-upload-actions {
  display: flex;
  gap: var(--space-xs);
}

.status-input-row {
  display: flex;
  gap: var(--space-xs);
}

.status-input-row input {
  flex: 1;
}

.status-input-row .btn {
  flex-shrink: 0;
  padding: var(--space-sm);
  min-width: auto;
}

.profile-preview-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
  max-width: 320px;
}

.preview-card-wrapper {
  
}

.preview-gradient-border {
  padding: 3px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--accent-color) 0%, var(--primary-color) 100%);
}

.preview-gradient-bg {
  border-radius: calc(var(--radius-lg) - 2px);
  overflow: hidden;
  background: linear-gradient(180deg, 
    color-mix(in srgb, var(--accent-color) 85%, var(--primary-color)) 0%,
    color-mix(in srgb, var(--accent-color) 40%, var(--primary-color)) 30%,
    var(--primary-color) 100%
  );
}

.preview-banner-overlay {
  height: 80px;
  background-size: cover;
  background-position: center;
}

.preview-banner-space {
  height: 80px;
}

.preview-avatar-section {
  padding: 0 var(--space-lg);
  margin-top: -35px;
  margin-left: -4px;
}

.preview-avatar-cutout {
  width: 80px;
  height: 80px;
  padding: 4px;
  border-radius: 50%;
  background: linear-gradient(180deg, 
    color-mix(in srgb, var(--accent-color) 50%, var(--primary-color)) 0%,
    color-mix(in srgb, var(--accent-color) 35%, var(--primary-color)) 100%
  );
}

.preview-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-avatar-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-avatar-inner .avatar-letter {
  font-size: 2rem;
  font-weight: 700;
}

.preview-info {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.preview-name {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preview-name .name-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 0;
}

.preview-name .name-badges .badge-icon,
.preview-name .name-badges .badge-img {
  width: 18px;
  height: 18px;
  font-size: 0.9rem;
}

.preview-name .name-badges .admin-badge svg {
  width: 14px;
  height: 14px;
}

.preview-username {
  font-size: 0.8rem;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.preview-status {
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  margin-top: var(--space-sm);
}

.preview-bio {
  font-size: 0.8rem;
  margin-top: var(--space-sm);
  opacity: 0.85;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .edit-profile-layout {
    grid-template-columns: 1fr;
  }
  
  .edit-profile-preview {
    order: -1;
  }
  
  .modal-wide {
    max-width: 100%;
  }
}

.friends-modal-list { 
  display: flex; 
  flex-direction: column; 
  gap: var(--space-xs); 
  max-height: 60vh; 
  overflow-y: auto; 
  padding-right: var(--space-xs);
  margin-top: var(--space-md);
}

.friends-modal-list::-webkit-scrollbar {
  width: 6px;
}

.friends-modal-list::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.friends-modal-list::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.friends-modal-list .friend-item {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.friends-modal-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.friends-modal-item:hover { background: var(--accent-subtle); transform: translateX(4px); }

.form-group { margin-bottom: var(--space-md); }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: var(--space-xs); color: var(--text-primary); }
.form-group input, .form-group textarea { 
  width: 100%; 
  padding: var(--space-sm) var(--space-md); 
  background: var(--bg-tertiary); 
  border: 1px solid var(--border-color); 
  border-radius: var(--radius-md); 
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-tertiary); }
.form-group input:focus, .form-group textarea:focus { 
  border-color: var(--accent); 
  background: var(--bg-secondary);
}
.form-error { color: var(--error); font-size: 0.85rem; margin-bottom: var(--space-md); min-height: 1.2em; }
.form-hint { 
  display: block; 
  font-size: 0.75rem; 
  color: var(--text-tertiary); 
  margin-top: var(--space-xs);
}
.form-hint strong {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
}

.bio-input-wrapper {
  position: relative;
}

.form-row {
  display: flex;
  gap: var(--space-md);
}
.form-row .form-group {
  flex: 1;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.avatar-upload { display: flex; align-items: center; gap: var(--space-md); }
.avatar-upload-actions { display: flex; gap: var(--space-xs); }
.avatar-preview { 
  width: 64px; 
  height: 64px; 
  border-radius: 50%;
  background: var(--bg-tertiary); 
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.avatar-letter-lg {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.leaderboard { max-width: 700px; margin: 0 auto; }
.leaderboard h2 { text-align: center; margin-bottom: var(--space-lg); }
.leaderboard-tabs { 
  display: flex; 
  gap: var(--space-sm); 
  margin-bottom: var(--space-lg); 
  justify-content: center;
  background: var(--bg-secondary);
  padding: var(--space-sm);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.tab { 
  padding: var(--space-sm) var(--space-md); 
  font-size: 0.85rem; 
  font-weight: 500; 
  color: var(--text-secondary); 
  border-radius: var(--radius-md); 
  transition: all var(--transition-fast); 
}
.tab:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.tab.active { background: var(--accent); color: var(--bg-primary); }
.leaderboard-table { 
  display: flex; 
  flex-direction: column; 
  gap: var(--space-lg);
}
.leaderboard-row { 
  display: flex; 
  align-items: center; 
  gap: var(--space-md); 
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.leaderboard-row:hover { transform: translateX(4px); background: var(--accent-subtle); }

.leaderboard-row.rank-1 {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%);
  border: 1px solid rgba(255, 215, 0, 0.3);
}
.leaderboard-row.rank-1 .leaderboard-rank { color: #ffd700; }

.leaderboard-row.rank-2 {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.15) 0%, rgba(192, 192, 192, 0.05) 100%);
  border: 1px solid rgba(192, 192, 192, 0.3);
}
.leaderboard-row.rank-2 .leaderboard-rank { color: #c0c0c0; }

.leaderboard-row.rank-3 {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, rgba(205, 127, 50, 0.05) 100%);
  border: 1px solid rgba(205, 127, 50, 0.3);
}
.leaderboard-row.rank-3 .leaderboard-rank { color: #cd7f32; }

.leaderboard-rank { font-weight: 700; width: 36px; color: var(--text-tertiary); }
.leaderboard-avatar { 
  width: 40px; 
  height: 40px; 
  border-radius: var(--radius-full); 
  background: var(--accent); 
  color: var(--bg-primary); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: 600;
  font-size: 1rem;
}
.leaderboard-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.leaderboard-name { flex: 1; font-weight: 500; display: flex; align-items: center; gap: var(--space-sm); }
.leaderboard-online { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }
.leaderboard-stat { font-size: 0.85rem; color: var(--text-secondary); min-width: 80px; text-align: right; }
.leaderboard-stat strong { color: var(--text-primary); font-family: var(--font-mono); }
.leaderboard-races { font-size: 0.8rem; color: var(--text-tertiary); min-width: 70px; text-align: right; }

.leaderboard-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--space-md);
  padding: var(--space-xl) var(--space-md);
  margin-bottom: var(--space-lg);
}

.podium-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.podium-player:hover {
  transform: translateY(-4px);
}

.podium-avatar-wrapper {
  position: relative;
  margin-bottom: var(--space-sm);
}

.podium-crown {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffd700;
  filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.4));
  z-index: 2;
}

.podium-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  position: relative;
  z-index: 1;
}

.podium-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.podium-rank {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 3;
}

.podium-info {
  text-align: center;
  margin-bottom: var(--space-sm);
}

.podium-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.podium-stat {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
}

.podium-stat small {
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.7;
}

.podium-stage {
  width: 100px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.podium-first .podium-avatar {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
  color: #1a1a1a;
  border: 3px solid #ffd700;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.podium-first .podium-rank {
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
  color: #1a1a1a;
  border: 2px solid #fff;
}

.podium-first .podium-stat {
  color: #ffd700;
}

.podium-first .podium-stage {
  height: 100px;
  background: linear-gradient(180deg, #ffd700 0%, #b8860b 100%);
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.podium-second .podium-avatar {
  background: linear-gradient(135deg, #e8e8e8 0%, #c0c0c0 100%);
  color: #1a1a1a;
  border: 3px solid #c0c0c0;
  box-shadow: 0 4px 15px rgba(192, 192, 192, 0.4);
}

.podium-second .podium-rank {
  background: linear-gradient(135deg, #e8e8e8 0%, #c0c0c0 100%);
  color: #1a1a1a;
  border: 2px solid #fff;
}

.podium-second .podium-stat {
  color: #c0c0c0;
}

.podium-second .podium-stage {
  height: 70px;
  background: linear-gradient(180deg, #c0c0c0 0%, #808080 100%);
  box-shadow: 0 4px 15px rgba(192, 192, 192, 0.3);
}

.podium-third .podium-avatar {
  background: linear-gradient(135deg, #e6a86c 0%, #cd7f32 100%);
  color: #1a1a1a;
  border: 3px solid #cd7f32;
  box-shadow: 0 4px 15px rgba(205, 127, 50, 0.4);
}

.podium-third .podium-rank {
  background: linear-gradient(135deg, #e6a86c 0%, #cd7f32 100%);
  color: #1a1a1a;
  border: 2px solid #fff;
}

.podium-third .podium-stat {
  color: #cd7f32;
}

.podium-third .podium-stage {
  height: 50px;
  background: linear-gradient(180deg, #cd7f32 0%, #8b4513 100%);
  box-shadow: 0 4px 15px rgba(205, 127, 50, 0.3);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  background: var(--bg-secondary);
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.profile { 
  max-width: 650px; 
  margin: 0 auto; 
  width: 100%; 
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.profile-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 3px solid var(--border-color);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar .avatar-letter { font-size: 2rem; font-weight: 700; }
.profile-identity { flex: 1; min-width: 0; }
.profile-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 2px 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.profile-pronouns {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 2px;
}
.profile-handle {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.profile-action { flex-shrink: 0; }
.profile-bio {
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: var(--space-md);
}
.profile-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-tertiary);
}
.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-meta-item.online { color: var(--success); }
.profile-meta-item.clickable {
  cursor: pointer;
  transition: color var(--transition-fast);
}
.profile-meta-item.clickable:hover { color: var(--text-primary); }
.profile-meta-item strong { color: var(--text-primary); }
.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
}

.btn-add-friend {
  background: var(--accent);
  color: var(--bg-primary);
  padding: var(--space-sm) var(--space-lg);
  font-weight: 600;
}
.btn-add-friend:hover { background: var(--accent-light); }
.btn-unfriend {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  padding: var(--space-sm) var(--space-lg);
  font-weight: 600;
}
.btn-unfriend:hover { background: var(--error); color: white; }

.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.profile-stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.stat-number {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.stat-title {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.profile-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.section-header {
  margin-bottom: var(--space-md);
}
.section-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.empty-state {
  color: var(--text-tertiary);
  text-align: center;
  padding: var(--space-lg);
  font-size: 0.9rem;
}

.match-history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.match-history-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  transition: background-color var(--transition-base);
}
.match-history-item.eliminated { opacity: 0.6; }
.match-result {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 100px;
}
.match-placement {
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 32px;
}
.match-history-item.eliminated .match-placement { color: var(--error); }
.match-mode {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  padding: 2px 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}
.match-stats {
  flex: 1;
  display: flex;
  gap: var(--space-md);
}
.match-wpm { font-weight: 600; color: var(--success); font-family: var(--font-mono); }
.match-accuracy { color: var(--text-secondary); }
.match-date { color: var(--text-tertiary); font-size: 0.8rem; }

.comment-form {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.comment-form textarea {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  resize: none;
  min-height: 60px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}
.comment-form textarea:focus {
  border-color: var(--accent);
  background: var(--bg-secondary);
}
.comment-form .btn { align-self: flex-end; }
.comments-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.comment {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base);
}
.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-body { flex: 1; min-width: 0; }
.comment-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}
.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.comment-author:hover { text-decoration: underline; }
.comment-date { font-size: 0.75rem; color: var(--text-tertiary); }
.comment-delete {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.comment-delete:hover { color: var(--error); background: var(--error-bg); }
.comment-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.friends-modal-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.friends-modal-item:hover { background: var(--accent-subtle); transform: translateX(4px); }
.friend-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  overflow: hidden;
}
.friend-avatar img { width: 100%; height: 100%; object-fit: cover; }
.friend-info { flex: 1; }
.friend-name { font-weight: 500; display: block; }
.friend-stat { font-size: 0.8rem; color: var(--text-tertiary); }

.profile-status {
  font-style: italic;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  font-size: 0.9rem;
}
.profile-streak {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: linear-gradient(135deg, #ff6b35, #f7c59f);
  color: white;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: var(--space-md);
}
.streak-fire { font-size: 1rem; }

.btn-challenge {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: var(--space-sm) var(--space-lg);
  font-weight: 600;
}
.btn-challenge:hover {
  background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

.profile-achievements-preview {
  display: flex;
  gap: var(--space-xs);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
  cursor: pointer;
  flex-wrap: wrap;
  align-items: center;
}
.achievement-badge {
  width: 36px;
  height: 36px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: transform var(--transition-fast);
}
.achievement-badge:hover { transform: scale(1.1); }
.more-achievements {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  padding: 0 var(--space-sm);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-sm);
}
.achievement-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.achievement-card:hover {
  background: var(--accent-subtle);
  transform: translateY(-2px);
}
.achievement-icon-large {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}
.achievement-info { flex: 1; min-width: 0; }
.achievement-name {
  font-weight: 600;
  font-size: 0.9rem;
  display: block;
  margin-bottom: 2px;
}
.achievement-desc {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: block;
}

.color-picker-row {
  display: flex;
  gap: var(--space-lg);
}

.color-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.color-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.color-option input[type="color"] {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
}

.color-option input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-option input[type="color"]::-webkit-color-swatch {
  border-radius: var(--radius-sm);
  border: none;
}

.hex-input {
  width: 70px;
  padding: 4px 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-transform: uppercase;
}

.color-option span {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.color-hint {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.form-actions-sticky {
  position: sticky;
  bottom: 0;
  padding: var(--space-xl) 0 var(--space-sm);
  background: var(--bg-secondary);
  margin-top: var(--space-xl);
}

.modal-crop {
  max-width: 500px;
}

.crop-container {
  margin: var(--space-md) 0;
}

.crop-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 2;
  background: #111;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: move;
}

.crop-wrapper-square {
  aspect-ratio: 1 / 1;
  max-width: 300px;
  margin: 0 auto;
}

.crop-image-wrapper img {
  position: absolute;
  transform-origin: center;
  user-select: none;
  pointer-events: none;
  z-index: 1;
}

.crop-frame-banner {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  height: 50%;
  border-top: 2px solid rgba(255,255,255,0.9);
  border-bottom: 2px solid rgba(255,255,255,0.9);
  pointer-events: none;
  z-index: 10;
}

.crop-darkened-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 25%;
  background: rgba(0,0,0,0.7);
  pointer-events: none;
  z-index: 5;
}

.crop-darkened-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 25%;
  background: rgba(0,0,0,0.7);
  pointer-events: none;
  z-index: 5;
}

.crop-frame-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  height: 95%;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
  
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.7);
}

.crop-overlay-circle {
  display: none;
}

.crop-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
}

.crop-controls svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.crop-controls input[type="range"] {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  appearance: none;
}

.crop-controls input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.toast.achievement {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.comments-list { display: flex; flex-direction: column; gap: var(--space-md); }
.comment { 
  display: flex; 
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base);
}
.comment-avatar { 
  width: 36px; 
  height: 36px; 
  border-radius: var(--radius-full); 
  background: var(--accent); 
  color: var(--bg-primary);
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.comment-content { flex: 1; min-width: 0; overflow: hidden; }
.comment-header { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-xs); flex-wrap: wrap; }
.comment-author { font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.comment-author:hover { text-decoration: underline; }
.comment-date { font-size: 0.75rem; color: var(--text-tertiary); }
.comment-text { 
  font-size: 0.9rem; 
  color: var(--text-secondary); 
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

/* Comment reply styles */
.comment-item.is-reply {
  margin-left: var(--space-xl);
  padding-left: var(--space-md);
  border-left: 2px solid var(--border-color);
}

.comment-reply-to {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
}

.comment-reply-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 6px;
  margin-top: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.comment-reply-btn:hover {
  color: var(--accent);
  background: var(--bg-tertiary);
}

.reply-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.reply-indicator button {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.reply-indicator button:hover {
  color: var(--error);
  background: var(--error-bg);
}

.comment-form { display: flex; gap: var(--space-sm); margin-top: var(--space-md); }
.comment-form textarea { 
  flex: 1; 
  padding: var(--space-sm); 
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md); 
  resize: none;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.comment-form textarea:focus { border-color: var(--accent); background: var(--bg-secondary); }

.friends-page { max-width: 600px; margin: 0 auto; }
.friends-page h2 { text-align: center; margin-bottom: var(--space-xl); }
.friends-section { 
  margin-bottom: var(--space-xl);
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.friends-section h3 { font-size: 1rem; margin-bottom: var(--space-md); color: var(--text-secondary); }
.friends-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.friend-item { 
  display: flex; 
  align-items: center; 
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base);
}
.friend-avatar { 
  width: 40px; 
  height: 40px; 
  border-radius: var(--radius-full); 
  background: var(--accent); 
  color: var(--bg-primary);
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: 600;
  cursor: pointer;
}
.friend-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-weight: 500; cursor: pointer; display: block; }
.friend-name:hover { text-decoration: underline; }
.friend-status { font-size: 0.8rem; color: var(--text-tertiary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-actions { display: flex; gap: var(--space-sm); }
.add-friend-form { display: flex; gap: var(--space-sm); }
.add-friend-section { 
  background: var(--bg-tertiary); 
  padding: var(--space-md); 
  border-radius: var(--radius-md); 
  margin-bottom: var(--space-md);
}
.add-friend-form input { 
  flex: 1; 
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.add-friend-form input:focus { border-color: var(--accent); background: var(--bg-secondary); }

.admin-badge-label { 
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); 
  color: white; 
  font-size: 0.65rem; 
  font-weight: 700; 
  padding: 2px 6px; 
  border-radius: var(--radius-sm); 
  text-transform: uppercase; 
  letter-spacing: 0.05em;
}
.admin-badge-label.small { font-size: 0.6rem; padding: 1px 4px; }

.admin-panel { max-width: 900px; margin: 0 auto; }
.admin-panel h2 { text-align: center; margin-bottom: var(--space-lg); }
.admin-stats { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); 
  gap: var(--space-md); 
  margin-bottom: var(--space-lg);
}
.admin-stat { 
  text-align: center;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.admin-stat-value { font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono); color: var(--text-primary); display: block; }
.admin-stat-label { font-size: 0.7rem; color: var(--text-tertiary); text-transform: uppercase; }
.admin-tabs { 
  display: flex; 
  gap: var(--space-sm); 
  margin-bottom: var(--space-lg);
  background: var(--bg-secondary);
  padding: var(--space-sm);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.admin-content { 
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}
.admin-search { 
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.admin-search input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.admin-search input:focus { border-color: var(--accent); background: var(--bg-secondary); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td { padding: var(--space-sm) var(--space-md); text-align: left; border-bottom: 1px solid var(--border-color); }
.admin-table th { font-weight: 600; color: var(--text-secondary); font-size: 0.75rem; text-transform: uppercase; }
.admin-table tr:hover { background: var(--bg-tertiary); }
.admin-table tr.banned { background: var(--error-bg); }
.admin-table tr.admin { background: rgba(139, 92, 246, 0.1); }
.admin-actions { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
.admin-pagination { display: flex; justify-content: center; gap: var(--space-sm); margin-top: var(--space-md); }
.admin-action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-md); }
.admin-action-card {
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: background-color var(--transition-base);
}
.admin-action-card h4 { margin-bottom: var(--space-sm); }
.admin-action-card p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: var(--space-md); }
.system-info { display: flex; flex-direction: column; gap: var(--space-sm); }
.system-row { 
  display: flex; 
  justify-content: space-between; 
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base);
}
.system-label { color: var(--text-secondary); }
.system-value { font-family: var(--font-mono); font-weight: 500; }

.online-users-list { display: flex; flex-direction: column; gap: var(--space-sm); max-height: 400px; overflow-y: auto; }
.online-user { 
  display: flex; 
  align-items: center; 
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.online-user:hover { background: var(--accent-subtle); transform: translateX(4px); }
.online-user-avatar { 
  width: 40px; 
  height: 40px; 
  border-radius: var(--radius-full); 
  background: var(--accent); 
  color: var(--bg-primary);
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: 600;
}
.online-user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.online-user-info { flex: 1; }
.online-user-name { font-weight: 500; display: flex; align-items: center; gap: var(--space-sm); }
.online-user-stats { font-size: 0.8rem; color: var(--text-tertiary); display: block; }

.live-races-list { 
  display: flex; 
  flex-direction: column; 
  gap: var(--space-md); 
  max-height: 450px; 
  overflow-y: auto; 
}

.live-race-item {
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.live-race-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.live-race-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.live-race-mode {
  font-weight: 600;
  font-size: 0.95rem;
}

.live-race-time {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.live-race-progress {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.live-race-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.live-race-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live-race-players {
  display: flex;
  gap: calc(-1 * var(--space-xs));
}

.live-player-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
}

.live-player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-player-avatar.eliminated {
  opacity: 0.4;
  filter: grayscale(1);
}

.live-race-leader {
  text-align: right;
}

.leader-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  display: block;
}

.leader-progress {
  font-size: 0.8rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
}

.live-race-watch {
  position: absolute;
  right: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.live-race-item:hover .live-race-watch {
  opacity: 1;
}

.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-secondary);
}

.loading-spinner {
  display: flex;
  justify-content: center;
  padding: var(--space-xl);
}

.toast-container { position: fixed; bottom: var(--space-lg); right: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-sm); z-index: 2000; }
.toast { 
  padding: var(--space-md) var(--space-lg); 
  background: var(--bg-secondary); 
  border: 1px solid var(--border-color); 
  border-radius: var(--radius-md); 
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  transition: all 0.3s ease;
  color: var(--text-primary);
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast.info { border-left: 4px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.status-waiting { color: var(--warning); }
.status-countdown, .status-racing { color: var(--success); }
.status-finished { color: var(--text-tertiary); }

.profile-page-wrapper {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.discord-profile {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  padding: var(--space-lg);
}

.profile-card-border {
  padding: 4px;
  border-radius: calc(var(--radius-xl) + 4px);
  background: linear-gradient(180deg, var(--accent-color) 0%, var(--primary-color) 100%);
  margin-bottom: var(--space-lg);
}

.profile-card-full {
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  
  background: linear-gradient(180deg, 
    color-mix(in srgb, var(--accent-color) 85%, var(--primary-color)) 0%,
    color-mix(in srgb, var(--accent-color) 40%, var(--primary-color)) 30%,
    var(--primary-color) 100%
  );
}

.profile-banner-area {
  height: 120px;
  background-size: cover;
  background-position: center;
  
}

.profile-avatar-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 var(--space-lg);
  margin-top: -50px;
  margin-left: -5px; 
  position: relative;
}

.avatar-cutout-wrapper {
  padding: 5px;
  border-radius: 50%;
  
  background: linear-gradient(180deg, 
    color-mix(in srgb, var(--accent-color) 50%, var(--primary-color)) 0%,
    color-mix(in srgb, var(--accent-color) 35%, var(--primary-color)) 100%
  );
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-large .avatar-letter {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-color);
}

.profile-avatar-container .status-indicator {
  position: absolute;
  bottom: 4px;
  left: 82px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #747f8d;
  border: 3px solid var(--bg-secondary);
  z-index: 1;
}

.status-indicator.online {
  background: #22c55e;
}

.profile-actions {
  display: flex;
  gap: var(--space-sm);
  padding-top: 56px;
}

.btn-profile-action {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.btn-profile-action:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.btn-profile-action.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

body.dark-mode .btn-profile-action.btn-primary {
  color: #0a0a0a;
}

.btn-profile-action.btn-primary:hover {
  filter: brightness(0.9);
}

.btn-profile-action.btn-accept {
  background: #22c55e;
  color: white;
}

.btn-profile-action.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.btn-profile-action.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

.btn-profile-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-info-section {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.profile-names {
  margin-bottom: var(--space-xs);
}

.profile-card-full .display-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  color: var(--text-color);
}

.name-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.username-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.profile-card-full .username-tag {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.profile-card-full .status-message {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: var(--space-sm) 0;
}

.status-emoji {
  font-size: 1rem;
}

.profile-card-full .profile-divider {
  height: 1px;
  background: var(--divider-color);
  margin: var(--space-md) 0;
}

.profile-card-full .profile-section-mini {
  margin-bottom: var(--space-md);
}

.profile-card-full .profile-section-mini h3 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 var(--space-xs) 0;
  letter-spacing: 0.02em;
}

.profile-card-full .profile-section-mini p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-color);
}

.bio-code {
  display: inline;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: inherit;
  font-weight: 500;
  cursor: default;
  position: relative;
  transition: all var(--transition-fast);
}

.bio-code-timezone {
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

body.dark-mode .bio-code-timezone {
  background: rgba(255, 255, 255, 0.12);
}

.profile-card-full .bio-code-timezone {
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
}

.bio-code-country {
  padding: 0 2px;
  cursor: pointer;
  background: transparent;
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
  position: relative;
  top: 2px;
}

.bio-code-country .bio-flag {
  width: 20px;
  height: 14px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
}

.bio-code-time {
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

body.dark-mode .bio-code-time {
  background: rgba(255, 255, 255, 0.12);
}

.profile-card-full .bio-code-time {
  background: rgba(255, 255, 255, 0.15);
}

.bio-code-unknown {
  background: rgba(128, 128, 128, 0.15);
  color: inherit;
  opacity: 0.7;
  font-style: italic;
}

.bio-code.custom-tooltip {
  cursor: pointer;
}

.bio-code.custom-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-mono);
  color: #fff;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
}

.bio-code.custom-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1a1a1a;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1001;
}

.bio-code.custom-tooltip:hover::after,
.bio-code.custom-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

body:not(.dark-mode) .bio-code.custom-tooltip::after {
  background: #fff;
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

body:not(.dark-mode) .bio-code.custom-tooltip::before {
  border-top-color: #fff;
}

.profile-card-full .bio-code.custom-tooltip::after {
  background: #0a0a0a;
  border-color: #222;
  color: #fff;
}

.profile-card-full .bio-code.custom-tooltip::before {
  border-top-color: #0a0a0a;
}

.bio-autocomplete {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  min-width: 180px;
}

.bio-autocomplete-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.bio-autocomplete-item:hover,
.bio-autocomplete-item.selected {
  background: var(--bg-tertiary);
}

.bio-autocomplete-item .code-name {
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  min-width: 80px;
}

.bio-autocomplete-item .code-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex: 1;
}

.bio-autocomplete-item .code-preview {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

.bio-code-date,
.bio-code-day,
.bio-code-year {
  background: rgba(0, 0, 0, 0.06);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

body.dark-mode .bio-code-date,
body.dark-mode .bio-code-day,
body.dark-mode .bio-code-year {
  background: rgba(255, 255, 255, 0.1);
}

.profile-card-full .bio-code-date,
.profile-card-full .bio-code-day,
.profile-card-full .bio-code-year {
  background: rgba(255, 255, 255, 0.12);
}

.bio-code-greeting {
  background: rgba(0, 0, 0, 0.06);
}

body.dark-mode .bio-code-greeting {
  background: rgba(255, 255, 255, 0.1);
}

.profile-card-full .bio-code-greeting {
  background: rgba(255, 255, 255, 0.12);
}

.bio-code-season {
  background: rgba(0, 0, 0, 0.06);
}

body.dark-mode .bio-code-season {
  background: rgba(255, 255, 255, 0.1);
}

.profile-card-full .bio-code-season {
  background: rgba(255, 255, 255, 0.12);
}

.bio-code-wpm,
.bio-code-races,
.bio-code-wins,
.bio-code-accuracy,
.bio-code-streak,
.bio-code-best,
.bio-code-winrate,
.bio-code-level,
.bio-code-joined,
.bio-code-dice,
.bio-code-quote,
.bio-code-rank,
.bio-code-progress,
.bio-code-online,
.bio-code-typing,
.bio-code-countdown,
.bio-code-mood,
.bio-code-random {
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

body.dark-mode .bio-code-wpm,
body.dark-mode .bio-code-races,
body.dark-mode .bio-code-wins,
body.dark-mode .bio-code-accuracy,
body.dark-mode .bio-code-streak,
body.dark-mode .bio-code-best,
body.dark-mode .bio-code-winrate,
body.dark-mode .bio-code-level,
body.dark-mode .bio-code-joined,
body.dark-mode .bio-code-dice,
body.dark-mode .bio-code-quote,
body.dark-mode .bio-code-rank,
body.dark-mode .bio-code-progress,
body.dark-mode .bio-code-online,
body.dark-mode .bio-code-typing,
body.dark-mode .bio-code-countdown,
body.dark-mode .bio-code-mood,
body.dark-mode .bio-code-random {
  background: rgba(255, 255, 255, 0.12);
}

.profile-card-full .bio-code-wpm,
.profile-card-full .bio-code-races,
.profile-card-full .bio-code-wins,
.profile-card-full .bio-code-accuracy,
.profile-card-full .bio-code-streak,
.profile-card-full .bio-code-best,
.profile-card-full .bio-code-winrate,
.profile-card-full .bio-code-level,
.profile-card-full .bio-code-joined,
.profile-card-full .bio-code-dice,
.profile-card-full .bio-code-quote,
.profile-card-full .bio-code-rank,
.profile-card-full .bio-code-progress,
.profile-card-full .bio-code-online,
.profile-card-full .bio-code-typing,
.profile-card-full .bio-code-countdown,
.profile-card-full .bio-code-mood,
.profile-card-full .bio-code-random {
  background: rgba(255, 255, 255, 0.15);
}

.bio-code-clickable {
  cursor: pointer !important;
  user-select: none;
}

.bio-code-clickable:hover {
  filter: brightness(1.1);
  transform: scale(1.02);
}

.bio-code-clickable:active {
  transform: scale(0.98);
}

.bio-code-dice.bio-code-rolling {
  animation: dice-shake 0.08s ease-in-out infinite;
}

@keyframes dice-shake {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

.bio-code-quote {
  font-style: italic;
}

.bio-code-quote.bio-code-fading,
.bio-code-mood.bio-code-fading,
.bio-code-random.bio-code-fading {
  opacity: 0.3;
  transition: opacity 0.15s ease;
}
}

.bio-code-fading {
  opacity: 0.3;
  transition: opacity 0.15s ease;
}

.profile-card-full .profile-meta-row {
  display: flex;
  gap: var(--space-lg);
}

.profile-card-full .meta-item {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.profile-card-full .meta-item strong {
  color: var(--text-color);
}

.profile-card-full .meta-item.clickable {
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.profile-card-full .meta-item.clickable:hover {
  opacity: 0.8;
}

.badge-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  position: relative;
  cursor: pointer;
}
.badge-svg svg {
  width: 100%;
  height: 100%;
}

.badge-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
  cursor: pointer;
  position: relative;
}

.custom-tooltip {
  position: relative;
  display: inline-flex;
}

.custom-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-mono);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1000;
  border: 1px solid #333;
  pointer-events: none;
}

.custom-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1a1a1a;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1001;
}

.custom-tooltip:hover::after,
.custom-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

.custom-tooltip.tooltip-active::after,
.custom-tooltip.tooltip-active::before {
  opacity: 1;
  visibility: visible;
}

.name-badges .custom-tooltip::after {
  bottom: calc(100% + 6px);
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f59e0b;
  vertical-align: middle;
  position: relative;
  cursor: pointer;
}
.admin-badge svg {
  width: 16px;
  height: 16px;
}

.user-badge {
  margin-left: 2px;
}

.dot-separator {
  font-weight: 700;
  margin: 0 2px;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 3px 10px;
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border-radius: var(--radius-full);
  font-weight: 600;
  border: 1px solid rgba(249, 115, 22, 0.3);
  position: relative;
  cursor: pointer;
}

.streak-badge svg {
  width: 12px;
  height: 12px;
}

.streak-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  pointer-events: none;
}

.streak-badge:hover::after {
  opacity: 1;
  visibility: visible;
}

.profile-tabs {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  border: 1px solid var(--border-color);
  max-width: 600px;
  width: 100%;
}

.profile-tab-content {
  animation: fadeIn 0.2s ease;
  max-width: 600px;
  width: 100%;
}

.profile-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.profile-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.profile-tab.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.profile-tab svg {
  flex-shrink: 0;
}

.profile-tab-content.hidden {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.profile-section-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.profile-section-card h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 var(--space-md) 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.profile-section-card h3 .count {
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
}

.achievements-mini-grid {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-xs) 0 var(--space-md) 0;
  margin: 0 calc(-1 * var(--space-md));
  padding-left: var(--space-md);
  padding-right: var(--space-md);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-tertiary) 50%, transparent) transparent;
}

.achievements-mini-grid::-webkit-scrollbar {
  height: 6px;
}

.achievements-mini-grid::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.achievements-mini-grid::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-tertiary) 60%, transparent);
  border-radius: 3px;
}

.achievements-mini-grid::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.achievement-mini {
  min-width: 90px;
  padding: var(--space-sm) var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  position: relative;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.achievement-mini .achievement-icon {
  font-size: 1.5rem;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.achievement-mini svg {
  width: 24px;
  height: 24px;
}

.achievement-mini .achievement-name {
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75px;
  color: var(--text-primary);
}

.achievement-mini:hover {
  background: var(--bg-secondary);
}

.achievement-tooltip {
  display: none;
}

.achievement-mini.more {
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-tertiary);
  min-width: 70px;
}

.achievement-mini.more:hover {
  border-color: var(--text-tertiary);
  background: var(--bg-tertiary);
}

.achievement-mini.more .achievement-icon {
  font-size: 1rem;
}

.achievement-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.achievement-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.achievement-modal {
  width: 300px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.achievement-modal-overlay.active .achievement-modal {
  transform: scale(1);
}

.achievement-modal-header {
  padding: var(--space-lg);
  text-align: center;
  position: relative;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.achievement-modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.achievement-modal-icon svg {
  width: 32px;
  height: 32px;
}

.achievement-modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.achievement-modal-body {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  background: var(--bg-secondary);
  text-align: center;
}

.achievement-modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 var(--space-md) 0;
}

.achievement-modal-category {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.achievement-modal.cat-milestone .achievement-modal-icon {
  color: #3b82f6;
}
.achievement-modal.cat-milestone .achievement-modal-category {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.3);
}

.achievement-modal.cat-speed .achievement-modal-icon {
  color: #f59e0b;
}
.achievement-modal.cat-speed .achievement-modal-category {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

.achievement-modal.cat-accuracy .achievement-modal-icon {
  color: #10b981;
}
.achievement-modal.cat-accuracy .achievement-modal-category {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

.achievement-modal.cat-dedication .achievement-modal-icon {
  color: #8b5cf6;
}
.achievement-modal.cat-dedication .achievement-modal-category {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  border-color: rgba(139, 92, 246, 0.3);
}

.achievement-modal.cat-competitive .achievement-modal-icon {
  color: #f59e0b;
}
.achievement-modal.cat-competitive .achievement-modal-category {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

.achievement-modal.cat-streak .achievement-modal-icon {
  color: #f97316;
}
.achievement-modal.cat-streak .achievement-modal-category {
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.3);
}

.achievement-modal.cat-squid .achievement-modal-icon {
  color: #ef4444;
}
.achievement-modal.cat-squid .achievement-modal-category {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.achievement-modal.cat-default .achievement-modal-icon {
  color: var(--text-secondary);
}

.achievement-mini.cat-milestone {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.3);
}
.achievement-mini.cat-speed {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
}
.achievement-mini.cat-accuracy {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.3);
}
.achievement-mini.cat-dedication {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.3);
}
.achievement-mini.cat-competitive {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}
.achievement-mini.cat-streak {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.1);
  border-color: rgba(251, 146, 60, 0.3);
}
.achievement-mini.cat-squid {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
}
.achievement-mini.cat-default {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.achievements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.achievements-header h3 {
  margin-bottom: 0;
}

.achievements-progress {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.achievements-progress-bar {
  width: 60px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.achievements-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.badge-award-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.badge-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-tertiary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.badge-btn:hover {
  border-color: var(--accent);
  transform: scale(1.1);
}

.badge-btn.active {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.2);
}

.badge-award-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 120px;
}

.badge-award-btn:hover {
  border-color: var(--badge-color, var(--accent));
  background: var(--bg-secondary);
}

.badge-award-btn.active {
  border-color: var(--badge-color, var(--success));
  background: rgba(34, 197, 94, 0.1);
}

.badge-award-btn .badge-name {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.badge-award-btn .badge-check {
  color: var(--success);
  font-weight: 700;
}

.badge-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-sm);
}

.badge-select-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.badge-select-btn:hover {
  border-color: var(--badge-color, var(--accent));
  background: var(--bg-secondary);
}

.badge-select-btn.active {
  border-color: var(--badge-color, var(--success));
  background: color-mix(in srgb, var(--badge-color) 10%, transparent);
}

.badge-select-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.badge-select-icon svg {
  width: 100%;
  height: 100%;
}

.badge-select-name {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.badge-select-check {
  color: var(--success);
  font-weight: 700;
  font-size: 0.9rem;
}

.admin-badges-section {
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.admin-badges-section h3 {
  margin-bottom: var(--space-xs);
}

.badge-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-sm);
}

.badge-preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.badge-preview-icon {
  width: 24px;
  height: 24px;
}

.badge-preview-icon svg {
  width: 100%;
  height: 100%;
}

.badge-preview-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
}

.custom-badge-form {
  background: var(--bg-tertiary);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.custom-badge-form .form-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.custom-badge-form .form-group {
  flex: 1;
  min-width: 120px;
}

.custom-badges-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.custom-badge-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.custom-badge-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.custom-badge-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.custom-badge-info .text-muted {
  font-size: 0.75rem;
}

.admin-section {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.05);
}

.matches-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.match-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.match-item.eliminated {
  opacity: 0.5;
}

.match-place {
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 36px;
  padding: 4px 8px;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.match-place.first { background: linear-gradient(135deg, #ffd700, #f59e0b); color: #000; }
.match-place.second { background: linear-gradient(135deg, #c0c0c0, #9ca3af); color: #000; }
.match-place.third { background: linear-gradient(135deg, #cd7f32, #a16207); color: #fff; }
.match-place.out { background: var(--error); color: white; }

.match-mode-tag {
  font-size: 1rem;
}

.match-wpm {
  font-weight: 600;
  color: var(--success);
  font-family: var(--font-mono);
}

.match-acc {
  color: var(--text-secondary);
}

.match-time {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  margin-left: auto;
}

.comment-input-row {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  align-items: stretch;
}

.comment-input-row textarea {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  resize: none;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.comment-input-row textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.comment-input-row .btn {
  height: 40px;
  width: 40px;
  width: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comments-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.comment-item {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
}

.comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-letter-sm {
  font-size: 0.9rem;
}

.comment-content {
  flex: 1;
  min-width: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.comment-author:hover {
  text-decoration: underline;
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.comment-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.5;
  transition: all var(--transition-fast);
}

.comment-delete:hover {
  color: var(--error);
  opacity: 1;
}

.comment-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.empty-text {
  text-align: center;
  color: var(--text-tertiary);
  padding: var(--space-md);
  font-size: 0.9rem;
}

.friend-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-xs);
}

.friend-item:hover {
  background: var(--accent-subtle);
}

.friend-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.friend-status-dot.online {
  background: #22c55e;
}

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

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: var(--error);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 1000;
  overflow: hidden;
}

.dropdown-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.dropdown-content {
  max-height: 340px;
  overflow-y: auto;
}

.dropdown-loading {
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.notif-item {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--bg-tertiary);
}

.notif-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: var(--space-xs);
}

.notif-text strong {
  color: var(--text-primary);
}

.ready-tag {
  color: var(--success);
  font-weight: 600;
  font-size: 0.75rem;
  margin-left: var(--space-xs);
}

.notif-actions {
  display: flex;
  gap: var(--space-xs);
}

.btn-tiny {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-accept {
  background: var(--success);
  color: white;
}

.btn-accept:hover {
  background: #16a34a;
}

.btn-decline {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.btn-decline:hover {
  background: var(--error);
  color: white;
}

.notif-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .nav { padding: var(--space-sm) var(--space-md); flex-wrap: wrap; gap: var(--space-sm); }
  .nav-brand { gap: var(--space-xs); }
  .nav-title { font-size: 1rem; }
  .nav-links { gap: var(--space-xs); flex-wrap: wrap; }
  .nav-link { font-size: 0.8rem; padding: var(--space-xs) var(--space-sm); }
  .nav-icon-link { width: 36px; height: 36px; }
  .nav-auth-links { gap: var(--space-xs); }
  .nav-auth-links .btn { font-size: 0.8rem; padding: var(--space-xs) var(--space-sm); }
  .main { padding: var(--space-md); }
  .hero-title { font-size: 1.75rem; }
  .mode-selector { grid-template-columns: 1fr; max-width: 300px; }
  .live-stats { flex-direction: column; gap: var(--space-sm); }
  .profile-header { flex-direction: column; align-items: center; }
  .profile-actions { margin-top: var(--space-md); }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .game-stats { gap: var(--space-lg); }
  .results-podium { flex-direction: column; }
  .podium-place.first { order: 1; transform: none; }
  .how-to-grid { grid-template-columns: 1fr; }
  
  .discord-profile {
    padding: 0 var(--space-sm);
  }
  
  .profile-card-border {
    transform: scale(0.92);
    transform-origin: top center;
    margin-bottom: var(--space-sm);
  }
  
  .profile-actions {
    padding-top: var(--space-sm);
    flex-wrap: wrap;
    gap: var(--space-xs);
  }
  
  .profile-actions .btn,
  .btn-profile-action {
    flex: 0 1 auto;
    min-width: auto;
    font-size: 0.8rem !important;
    padding: 8px 16px !important;
  }
  
  .profile-section-card {
    padding: var(--space-md);
  }
  
  .profile-section-card h3 {
    font-size: 0.9rem;
  }
  
  .stat-item .stat-value {
    font-size: 1.25rem;
  }
  
  .progress-name {
    flex: 0 0 70px;
    font-size: 0.75rem;
  }
  
  .progress-wpm {
    width: 80px;
    font-size: 0.7rem;
  }
  
  .progress-avatar {
    width: 20px;
    height: 20px;
  }
  
  .modal-wide { max-width: 100%; }
  .edit-profile-layout { 
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  .edit-profile-preview { 
    order: -1;
    position: static;
  }
  .edit-profile-form {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .form-actions-sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 10;
    margin: 0;
  }
  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    padding-bottom: 80px; 
  }
  
  
  .profile-tabs {
    flex-wrap: wrap;
  }
  .profile-tab {
    flex: 1 1 auto;
    min-width: 80px;
    font-size: 0.8rem;
    padding: var(--space-xs) var(--space-sm);
  }
  .profile-tab svg {
    display: none;
  }
  
  
  .profile-avatar-container {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  .profile-actions {
    padding-top: var(--space-sm);
    width: 100%;
  }
  
  
  .settings-dropdown {
    right: -8px;
  }
  
  
  .color-picker-row {
    flex-direction: column;
    gap: var(--space-md);
  }
  .color-option {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
  .color-input-group {
    flex-direction: row;
  }
  
  
  .modal-crop {
    max-width: 100%;
  }
  .crop-image-wrapper {
    height: 150px;
  }
  
  .typing-area {
    padding: var(--space-md);
  }
  
  .text-display {
    font-size: 1.1rem;
    line-height: 1.7;
  }
  
  .game-stats {
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.65rem;
  }
  
  
  .matchmaking {
    padding: var(--space-xl) var(--space-md);
  }
  
  .matchmaking h2 {
    font-size: 1.25rem;
  }
  
  .invite-link-section {
    max-width: 100%;
    padding: var(--space-sm);
  }
  
  .invite-link-box {
    flex-direction: column;
    gap: var(--space-sm);
  }
  
  .invite-link-box span {
    width: 100%;
    text-align: center;
  }
  
  .btn-copy {
    width: 100%;
  }
  
  
  .leaderboard-podium {
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
  }
  
  .podium-player {
    width: 100%;
  }
  
  .podium-stage {
    display: none;
  }
  
  .podium-avatar {
    width: 50px !important;
    height: 50px !important;
  }
  
  .podium-first .podium-avatar {
    width: 60px !important;
    height: 60px !important;
  }
}

.challenges-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.challenge-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.challenge-item.sent {
  opacity: 0.7;
}

.challenge-info {
  flex: 1;
}

.challenge-info strong {
  color: var(--text-primary);
}

.challenge-mode {
  display: block;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

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

@media (max-width: 768px) {
  .custom-tooltip::after,
  .custom-tooltip::before,
  .achievement-tooltip {
    
    pointer-events: none;
  }
  
  .custom-tooltip.tooltip-active::after,
  .custom-tooltip.tooltip-active::before {
    opacity: 1;
    visibility: visible;
  }
  
  .achievement-mini.tooltip-active .achievement-tooltip {
    opacity: 1;
    visibility: visible;
  }
  
  
  .custom-tooltip:hover::after,
  .custom-tooltip:hover::before {
    opacity: 0;
    visibility: hidden;
  }
  
  .achievement-mini:hover .achievement-tooltip {
    opacity: 0;
    visibility: hidden;
  }
  
  
  .custom-tooltip.tooltip-active:hover::after,
  .custom-tooltip.tooltip-active:hover::before,
  .achievement-mini.tooltip-active:hover .achievement-tooltip {
    opacity: 1;
    visibility: visible;
  }
}

.banned-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: var(--space-xl);
}

.banned-icon {
  font-size: 6rem;
  color: var(--error);
  margin-bottom: var(--space-lg);
  font-family: var(--font-mono);
}

.banned-container h1 {
  font-size: 2rem;
  color: var(--error);
  margin-bottom: var(--space-md);
}

.banned-reason {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  max-width: 400px;
}

.banned-info {
  font-size: 0.9rem;
  color: var(--text-tertiary);
}

.user-options-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.user-options-header h3 {
  margin: 0 0 var(--space-xs);
  font-size: 1.25rem;
}

.user-options-section {
  margin-bottom: var(--space-lg);
}

.user-options-section h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.user-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

.user-options-grid .btn {
  justify-content: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
}

.user-options-grid .btn svg {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .user-options-grid {
    grid-template-columns: 1fr;
  }
}

.btn-loading {
  opacity: 0.7;
  cursor: wait;
}

@media (max-width: 900px) {
  .home-hero {
    flex-direction: column;
    text-align: center;
    gap: var(--space-lg);
  }
  
  .hero-main {
    align-items: center;
  }
  
  .hero-brand {
    align-items: center;
  }
  
  .hero-stats {
    justify-content: center;
  }
  
  .home-modes {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .home-bottom {
    grid-template-columns: 1fr;
  }
  
  .home-sidebar {
    flex-direction: row;
  }
  
  .top-player-mini {
    flex: 1;
  }
  
  .recent-mini {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .home-wrapper {
    padding: var(--space-md);
    gap: var(--space-lg);
    min-height: auto;
  }
  
  .hero-title {
    font-size: 1.2rem;
  }
  
  .hero-tagline {
    font-size: 0.75rem;
  }
  
  .btn-hero-play {
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.9rem;
  }
  
  .btn-hero-play svg {
    width: 18px;
    height: 18px;
  }
  
  .stat-card {
    padding: var(--space-sm) var(--space-md);
    min-width: 60px;
  }
  
  .stat-value {
    font-size: 1.2rem;
  }
  
  .stat-label {
    font-size: 0.6rem;
  }
  
  .mode-card {
    padding: var(--space-md);
  }
  
  .mode-icon {
    width: 40px;
    height: 40px;
  }
  
  .mode-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .mode-name {
    font-size: 0.8rem;
  }
  
  .mode-desc {
    font-size: 0.7rem;
  }
  
  .lobbies-header h3 {
    font-size: 0.8rem;
  }
  
  .home-sidebar {
    flex-direction: column;
  }
  
  .top-player-mini {
    padding: var(--space-xs) var(--space-sm);
  }
  
  .top-name {
    font-size: 0.75rem;
  }
  
  .top-wpm {
    font-size: 0.7rem;
  }
}
