:root {
  --bg: #050505;
  --bg-soft: #18181b;
  --text: #ffffff;
  --text-muted: #a1a1aa;
  --primary: #00ffc3;
  --primary-hover: #00e6b0;
  --primary-text: #000000;
  --border: #27272a;
  --surface: #18181b;
  --default-card-bg: url('https://picsum.photos/id/1069/1200/800');
}

html.theme-light {
  --bg: #ffffff;
  --bg-soft: #f4f4f5;
  --text: #09090b;
  --text-muted: #52525b;
  --primary: #000000;
  --primary-hover: #27272a;
  --primary-text: #ffffff;
  --border: #e4e4e7;
  --surface: #ffffff;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  transition: background-color 400ms ease, color 400ms ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms ease, visibility 600ms ease;
  z-index: 2000;
}

.splash.show {
  opacity: 1;
  visibility: visible;
}

.splash__content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.splash__logo {
  font-size: 80px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--text);
}

.splash__title {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.splash__btn {
  margin-top: 32px;
  padding: 14px 40px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.5px;
  border-radius: 4px;
  background: var(--primary);
  color: var(--primary-text);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.splash__btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.presentation {
  min-height: 100vh;
  opacity: 1;
  transition: opacity 600ms ease;
  background: var(--bg);
  border-radius: 12px;
}

.presentation.hidden {
  opacity: 0;
  pointer-events: none;
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-radius: 12px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 2px;
  transition: border-color 0.2s ease;
}

.toggle:hover {
  border-color: var(--text-muted);
}

.toggle__knob {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  transform: translateX(0);
  transition: transform 300ms cubic-bezier(0.25, 1, 0.5, 1);
}

html.theme-light .toggle__knob {
  transform: translateX(20px);
  background: var(--text);
}

.toggle.toggle--small {
  width: 36px;
  height: 20px;
}
.toggle.toggle--small .toggle__knob {
  width: 16px;
  height: 16px;
  transform: translateX(0);
}
html.theme-light .toggle.toggle--small .toggle__knob {
  transform: translateX(18px);
}

.hero {
  padding: 120px 20px;
  text-align: center;
  max-width: 1000px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 56px;
  margin-bottom: 24px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
}

.hero p {
  font-size: 20px;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 80px;
  line-height: 1.6;
}

.grid-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  padding: 0 20px;
  text-align: left;
}

.feature-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  transition: border-color 0.2s ease;
}

.feature-card:hover {
  border-color: var(--text-muted);
}

.feature-card h3 {
  font-size: 20px;
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--text);
}

.feature-card p {
  font-size: 16px;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.slides {
  position: relative;
  height: calc(100vh - 120px);
  width: 100%;
  overflow: hidden;
  margin-top: 20px;
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.slide.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  z-index: 2;
}

.slide.prev {
  transform: translateX(-100%);
  opacity: 0;
  z-index: 1;
}

.slide.next {
  transform: translateX(100%);
  opacity: 0;
  z-index: 1;
}

.icon-ring {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  margin: 0 auto 32px;
  font-size: 32px;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
  color: var(--primary);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05);
}

.slide h1 {
  font-size: 56px;
  margin: 0 0 16px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1.1;
  text-transform: uppercase;
}

.slide p {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 auto;
  max-width: 500px;
  line-height: 1.6;
}

.dots {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 10;
}

.dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  border: none;
  transition: all 0.3s ease;
  cursor: pointer;
}

.dots .dot.active {
  background: var(--primary);
  width: 24px;
  box-shadow: 0 0 10px rgba(0, 255, 195, 0.4);
}

html.theme-light .dots .dot.active {
  box-shadow: none;
}

.flow {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 100%;
  display: flex;
  justify-content: center;
}

.btn {
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 9999px; /* Pill shape */
  padding: 16px 48px;
  font-size: 14px;
  box-shadow: 0 0 20px rgba(0, 255, 195, 0.2);
}

html.theme-light .btn {
  box-shadow: none;
  border: 1px solid var(--border); /* Optional: add border for better definition in light mode */
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(0, 255, 195, 0.4);
}

html.theme-light .btn:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn:active {
  transform: scale(0.96);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.btn.loading {
  opacity: 0.75;
  pointer-events: none;
  position: relative;
}
.btn.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.btn.outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn.outline:hover {
  border-color: var(--text-muted);
  background: rgba(255,255,255,0.03);
}

.auth-btn {
  margin-top: 20px;
}

/* Auth Redesign Minimal */
.auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 20px;
}

.auth.hidden {
  display: none;
}

.auth-container {
  width: 100%;
  max-width: 380px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

html.theme-light .auth-container {
  background: transparent;
  box-shadow: none;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header h2 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 24px;
}

html.theme-light .auth-tabs {
  background: #f4f4f5;
  border: none;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 10px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

.tab-btn.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 4px 16px -2px rgba(0,0,0,0.2);
}

html.theme-light .tab-btn.active {
  background: #ffffff;
  color: #000;
  box-shadow: 0 4px 12px -2px rgba(0,0,0,0.1);
}

.auth-form {
  display: none;
  animation: fadeIn 0.4s ease;
}

.auth-form.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.input-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 4px;
}

.input-group input {
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

html.theme-light .input-group input {
  background: #f4f4f5;
}

.input-group input:focus {
  background: var(--bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 255, 195, 0.1);
}

html.theme-light .input-group input:focus {
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

/* Platform Toggles */
.platform-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.platform-section .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 4px;
}

.platform-toggles {
  display: flex;
  gap: 12px;
  width: 100%;
}

.platform-toggle {
  cursor: pointer;
  position: relative;
  flex: 1;
}

.platform-toggle input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.toggle-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  background: transparent;
  height: 56px;
}

html.theme-light .toggle-card {
  background: #ffffff;
  border-color: #e4e4e7;
}

.platform-icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  transition: fill 0.2s ease;
}

.toggle-card span {
  font-size: 14px;
  font-weight: 700;
  transition: color 0.2s ease;
}

/* Checked State */
.platform-toggle input:checked + .toggle-card {
  background: var(--bg-soft);
  border-color: var(--primary);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(0, 255, 195, 0.25), 0 6px 16px -6px rgba(0, 255, 195, 0.3);
}

html.theme-light .platform-toggle input:checked + .toggle-card {
  background: #09090b;
  border-color: #09090b;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.platform-toggle input:checked + .toggle-card .platform-icon {
  fill: #ffffff;
}

.platform-toggle input:checked + .toggle-card span {
  color: #ffffff;
}

/* Hover State */
.platform-toggle:hover .toggle-card {
  border-color: var(--text-muted);
}

html.theme-light .platform-toggle:hover .toggle-card {
  border-color: #a1a1aa;
}

.full-width {
  width: 100%;
  margin-top: 16px;
  font-size: 14px;
  padding: 14px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

html.theme-light .full-width {
  background: #000;
  color: #fff;
  box-shadow: none;
}

html.theme-light .full-width:hover {
  background: #27272a;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px -4px rgba(0,0,0,0.3);
}

.auth #registerForm .full-width {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.auth-message {
  text-align: center;
  margin-top: 16px;
  min-height: 20px;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
}
html.theme-light .auth-message {
  color: #ef4444; /* Error color usually red in light theme, or keep brand color? Let's use brand/primary */
  color: #000;
}

/* ---- Home / Dashboard Redesign ---- */
.home {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  transition: opacity 0.4s ease;
}

.home.hidden {
  display: none;
  opacity: 0;
}

.home-container {
  display: flex;
  width: 100%;
  position: relative;
}

/* Sidebar Desktop */
.sidebar-desktop {
  display: none;
  width: 260px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-controls {
  margin-top: 16px;
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.control-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 40px;
  padding: 0 12px;
  color: var(--primary);
}
.sidebar-brand span {
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.nav-item.active {
  background: var(--bg);
  color: var(--primary);
  border-color: var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

html.theme-light .nav-item.active {
  background: #ffffff;
  color: #000;
  border-color: #e4e4e7;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.logout-btn {
  margin-top: auto;
  color: #ef4444;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Main Area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  overflow-y: auto;
}

.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(24, 24, 27, 0.8); /* Glassmorphism base */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
}

html.theme-light .mobile-header {
  background: rgba(255, 255, 255, 0.8);
}

/* Drawer controls (mobile) */
.drawer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.header-title {
  font-weight: 700;
  font-size: 16px;
}

.burger-icon {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 4px;
  cursor: pointer;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}

/* Content */
.content-wrapper {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-section {
  display: none;
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.page-section.active {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
#profileModal .modal-card {
  width: 540px;
  max-width: 92vw;
  max-height: 90vh;
}
#profileModal .modal-header {
  padding: 16px 20px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
#profileModal .modal-icon {
  background: var(--bg);
  border-color: var(--border);
  color: var(--primary);
}
#profileModal .modal-title {
  font-size: 20px;
  font-weight: 800;
}
#profileModal .modal-form {
  padding: 16px 20px 20px;
  gap: 16px;
}
#profileModal .pm-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#profileModal .pm-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
}
#profileModal .pm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--primary);
}
#profileModal .pm-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#profileModal .pm-nick {
  font-size: 18px;
  font-weight: 800;
}
#profileModal .pm-platform {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
#profileModal .pm-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
#profileModal .pm-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}
#profileModal .pm-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
}
#profileModal .pm-card .metric {
  padding: 14px;
}
@media (max-width: 640px) {
  #profileModal .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 24px;
  }
  #profileModal .pm-metrics {
    grid-template-columns: 1fr;
  }
}

/* Hero Card */
.hero-card {
  background: linear-gradient(135deg, var(--bg-soft) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

html.theme-light .hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f4f4f5 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 60%;
}

.hero-content h1 {
  font-size: 28px;
  margin: 0 0 12px;
  font-weight: 800;
  letter-spacing: -1px;
}

.hero-content p {
  color: var(--text-muted);
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.5;
}

.hero-image {
  position: absolute;
  right: -20px;
  bottom: -20px;
  opacity: 0.5;
  transform: rotate(-10deg);
}

/* Stats Grid */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--text-muted);
}

.stat-card h3 {
  font-size: 24px;
  margin: 0 0 4px;
  color: var(--primary);
  font-weight: 800;
}

.stat-card span {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* News Grid */
.section-title {
  font-size: 18px;
  margin: 0 0 16px;
  font-weight: 700;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* Replace news with photo placeholders */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.photo-card {
  height: 160px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06), transparent),
    radial-gradient(circle at 20% 30%, rgba(0,255,195,0.15), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.04), transparent 40%);
  box-shadow: 0 8px 20px -8px rgba(0,0,0,0.4);
}

/* Tournament List */
.tournament-list {
  min-height: 120px;
}

.page-subtitle {
  margin: 6px 0 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.tournament-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px -12px rgba(0,0,0,0.35);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.tournament-card.has-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--bg-url, var(--default-card-bg));
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  transition: transform 0.25s ease;
  z-index: 0;
}
.tournament-card.has-bg:hover::before {
  transform: scale(1.05);
}
.tournament-card.has-bg > * {
  position: relative;
  z-index: 2;
}
.tournament-card.enter {
  animation: fadeInUp 0.40s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: opacity, transform;
}
.tournament-list .tournament-card.enter:nth-child(1) { animation-delay: 0ms; }
.tournament-list .tournament-card.enter:nth-child(2) { animation-delay: 50ms; }
.tournament-list .tournament-card.enter:nth-child(3) { animation-delay: 100ms; }
.tournament-list .tournament-card.enter:nth-child(4) { animation-delay: 150ms; }
.tournament-list .tournament-card.enter:nth-child(5) { animation-delay: 200ms; }
.tournament-list .tournament-card.enter:nth-child(6) { animation-delay: 250ms; }
.tournament-list .tournament-card.enter:nth-child(7) { animation-delay: 300ms; }
.tournament-list .tournament-card.enter:nth-child(8) { animation-delay: 350ms; }

.team-list .tournament-card.enter:nth-child(1) { animation-delay: 0ms; }
.team-list .tournament-card.enter:nth-child(2) { animation-delay: 50ms; }
.team-list .tournament-card.enter:nth-child(3) { animation-delay: 100ms; }
.team-list .tournament-card.enter:nth-child(4) { animation-delay: 150ms; }
.team-list .tournament-card.enter:nth-child(5) { animation-delay: 200ms; }
.team-list .tournament-card.enter:nth-child(6) { animation-delay: 250ms; }
.team-list .tournament-card.enter:nth-child(7) { animation-delay: 300ms; }
.team-list .tournament-card.enter:nth-child(8) { animation-delay: 350ms; }
.tournament-card .rules-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.tournament-card .rules-icon:hover {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 8px 20px -12px rgba(0,0,0,0.3);
  transform: translateY(-2px);
}

.tournament-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -12px rgba(0,0,0,0.45);
  border-color: var(--border-strong);
}

.t-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  gap: 8px;
  flex-wrap: wrap;
}

.t-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 768px) {
  .btn.small { padding: 8px 12px; font-size: 11px; }
  .btn { padding: 10px 14px; font-size: 12px; }
  .tournament-card { padding: 16px; }
  .t-header { padding-right: 40px; }
}
@media (max-width: 480px) {
  .btn.small { padding: 7px 10px; font-size: 10.5px; }
  .btn { padding: 9px 12px; font-size: 11.5px; }
  .t-header { padding-right: 38px; }
  .t-footer { display: block; }
  .t-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }
  .t-actions .btn {
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 360px) {
  .t-actions {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 380px) {
  .btn.small { padding: 6px 9px; font-size: 10px; }
  .btn { padding: 8px 10px; font-size: 10.5px; }
  .t-footer { justify-content: flex-start; gap: 6px; }
  .tournament-card { padding: 14px; }
  .t-header { padding-right: 36px; }
}
.tournament-card::after {
  content: none;
}
.tournament-card.has-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 1;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.44) 38%, rgba(0,0,0,0.28) 68%, rgba(0,0,0,0.14) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.12), rgba(0,0,0,0.22));
  background-image: none;
  z-index: 1;
}
.tournament-card.has-bg h3,
.tournament-card.has-bg .t-meta,
.tournament-card.has-bg .t-specop,
.tournament-card.has-bg .t-specop span,
.tournament-card.has-bg .t-badges,
.tournament-card.has-bg .t-badges .badge,
.tournament-card.has-bg .date {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6), 0 0 8px rgba(0,0,0,0.4);
}

.tournament-card.has-bg .badge {
  background: rgba(0,0,0,0.35);
  border-color: rgba(255,255,255,0.35);
}
.tournament-card.has-bg .t-actions .btn,
.tournament-card.has-bg .t-footer .btn {
  box-shadow: 0 4px 12px rgba(0,0,0,0.22);
}
.tournament-card.has-bg .btn.outline {
  color: #ffffff;
  border-color: rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.35);
}
.tournament-card.has-bg .btn.outline:hover {
  border-color: #ffffff;
  background: rgba(255,255,255,0.10);
}
.tournament-card.has-bg .btn {
  color: #ffffff;
  border-color: rgba(255,255,255,0.65);
}
.tournament-card h3 {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.t-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
.btn.small {
  padding: 10px 16px;
  font-size: 12px;
  letter-spacing: 0.4px;
}

@media (max-width: 520px) {
  .t-badges .status { font-size: 13.5px; padding: 5px 12px; }
  .tournament-card .btn.small {
    padding: 7px 12px;
    font-size: 11px;
    letter-spacing: 0.1px;
    font-weight: 600;
  }
  .tournament-card .btn {
    padding: 9px 12px;
    font-size: 11.5px;
    letter-spacing: 0.1px;
    font-weight: 600;
  }
}
@media (max-width: 420px) {
  .t-badges .status { font-size: 14px; padding: 6px 12px; }
  .tournament-card .btn.small {
    padding: 6px 10px;
    font-size: 10.5px;
    letter-spacing: 0.05px;
    font-weight: 500;
  }
  .tournament-card .btn {
    padding: 8px 10px;
    font-size: 11px;
    letter-spacing: 0.05px;
    font-weight: 500;
  }
}

.empty-state {
  min-height: 260px;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  background: var(--bg-soft);
}
.empty-state h3 {
  margin: 0;
  font-size: 18px;
}
.empty-state p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
/* Admin Panel */
.admin-panel {
  display: none;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}
.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}
.admin-sub {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton-shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 37%, rgba(255,255,255,0.06) 63%);
  background-size: 300% 100%;
  animation: shimmer 1.2s infinite;
}
html.theme-light .skeleton-shimmer {
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 37%, rgba(0,0,0,0.06) 63%);
}
.tournament-card.skeleton {
  background: var(--bg-soft);
  border-color: var(--border);
}
.tournament-card.skeleton .s-header {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.tournament-card.skeleton .s-line {
  height: 16px;
  border-radius: 8px;
}
.tournament-card.skeleton .s-circle {
  width: 28px;
  height: 28px;
  border-radius: 999px;
}
.tournament-card.skeleton .s-title {
  height: 22px;
  border-radius: 10px;
  margin-bottom: 10px;
}
.tournament-card.skeleton .s-meta {
  height: 14px;
  border-radius: 7px;
}
.tournament-card.skeleton .s-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.tournament-card.skeleton .s-btn {
  height: 32px;
  width: 110px;
  border-radius: 999px;
}
.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-60 { width: 60%; }
.w-80 { width: 80%; }
.w-100 { width: 100%; }
/* Profile */
.profile-panel {
  background: linear-gradient(135deg, var(--bg-soft) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
}
.profile-banner {
  position: relative;
  padding: 32px;
}
.profile-cover {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 400px at -10% -20%, rgba(0,255,195,0.2), transparent 40%),
    radial-gradient(800px 300px at 120% 20%, rgba(255,255,255,0.06), transparent 40%);
  opacity: 0.3;
}
.profile-avatar-hero {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--primary);
  color: var(--primary-text);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 32px;
  box-shadow: 0 8px 24px rgba(0,255,195,0.25);
}
.profile-main {
  margin-top: 12px;
}
.profile-main h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}
.profile-tags {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
}
.tag.creator {
  color: #a855f7;
  border-color: #a855f7;
  background: rgba(168,85,247,0.12);
}
.tag.admin {
  color: #3b82f6;
  border-color: #3b82f6;
  background: rgba(59,130,246,0.12);
}
.profile-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 0 32px 24px;
}
.metric {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}
.metric-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}
.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.profile-controls {
  display: grid;
  gap: 12px;
  padding: 0 32px 32px;
}
.control {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.t-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 44px;
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 700;
}
.t-header .date {
  color: var(--text-muted);
  white-space: nowrap;
}
.t-badges {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.t-badges .badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  backdrop-filter: saturate(160%) blur(2px);
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.badge.t-size {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-weight: 700;
  font-size: 11px;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

.status.live {
  color: #ffffff;
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(239, 68, 68, 0.45);
}
.status.upcoming {
  color: #0cf5c0;
  background: rgba(0, 255, 195, 0.20);
  border-color: rgba(0, 255, 195, 0.45);
}
.status.finished {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.20);
  border-color: rgba(34, 197, 94, 0.45);
}

.t-meta {
  display: flex;
  gap: 18px;
  margin: 10px 0 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.t-specop {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: -8px;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 13px;
}
.t-specop-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  object-fit: contain;
}
.form-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 12px 40px 12px 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.form-select:focus {
  background: var(--bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 255, 195, 0.1);
}
.specop-picker {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 8px;
}
.specop-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  object-fit: contain;
}

/* Custom Select */
.ui-select {
  position: relative;
}
.ui-select__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.ui-select__trigger:hover {
  background: var(--bg);
}
.ui-select.open .ui-select__trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,255,195,0.1);
}
.ui-select__chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.ui-select.open .ui-select__chevron {
  transform: rotate(180deg);
}
.ui-select__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  z-index: 10;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.ui-select.open .ui-select__menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.ui-select__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.ui-select__option:hover {
  background: var(--bg-soft);
}
.ui-select__option.selected {
  background: var(--surface);
  border: 1px solid var(--border);
}
.ui-select__icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  object-fit: contain;
}
@media (max-width: 640px) {
  .ui-select__menu {
    max-height: 50vh;
  }
}
.form-textarea {
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  outline: none;
  min-height: 96px;
  resize: vertical;
  transition: all 0.2s ease;
}
.form-textarea:focus {
  background: var(--bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 255, 195, 0.1);
}

.t-rules {
  margin-top: 10px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-soft);
}
.t-rules-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.t-rules-content {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
}

.team-list {
  min-height: 120px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-drawer.open {
  opacity: 1;
  visibility: visible;
}

.drawer-content {
  width: 80%;
  max-width: 320px;
  height: 100%;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 24px;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.mobile-drawer.open .drawer-content {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  font-size: 20px;
  font-weight: 800;
}

.close-icon {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text);
  cursor: pointer;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-item {
  padding: 14px;
  text-align: left;
  background: transparent;
  border: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 12px;
  transition: all 0.2s;
}

.drawer-item.active {
  background: var(--bg-soft);
  color: var(--text);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Media Queries */
@media (min-width: 1024px) {
  .sidebar-desktop { display: flex; }
  .mobile-header { display: none; }
  .content-wrapper { padding: 40px; }
  .grid-stats { gap: 24px; }
}

@media (max-width: 1023px) {
  .sidebar-desktop { display: none; }
  .mobile-header { display: flex; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 4000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}
.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}
#confirmModal {
  z-index: 4500;
}
#confirmModal .modal-icon {
  color: #f59e0b;
}

#myTeamModal .modal-card {
  width: 640px;
  max-width: 96vw;
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#myTeamModal .modal-header {
  padding: 16px 20px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
#myTeamModal .modal-icon {
  background: var(--bg);
  border-color: var(--border);
  color: var(--primary);
}
#myTeamModal .modal-title {
  font-size: 20px;
  font-weight: 800;
}
#myTeamModal .modal-form {
  padding: 16px 20px 120px;
  gap: 16px;
  overflow-y: auto;
  min-height: 0;
}
#myTeamModal .modal-actions {
  padding: 12px 20px;
  background: linear-gradient(to top, var(--surface) 70%, rgba(0,0,0,0));
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
#myTeamModal .modal-actions .btn {
  min-width: 160px;
}
#myTeamModal .mtm-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#myTeamModal .mtm-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
}
#myTeamModal .mtm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--primary);
}
#myTeamModal .mtm-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#myTeamModal .mtm-title {
  font-size: 18px;
  font-weight: 800;
}
#myTeamModal .mtm-meta {
  font-size: 13px;
  color: var(--text-muted);
}
#myTeamModal #myTeamAttemptIndicator {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#myTeamModal .mtm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
#myTeamModal .mtm-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}
#myTeamModal .mtm-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
#myTeamModal .mtm-card-title {
  font-size: 15px;
  font-weight: 800;
}
#myTeamModal .mtm-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}
#myTeamModal .mtm-members-list::-webkit-scrollbar {
  width: 6px;
}
#myTeamModal .mtm-members-list::-webkit-scrollbar-track {
  background: transparent;
}
#myTeamModal .mtm-members-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
#myTeamModal .mtm-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}
#myTeamModal .mtm-member-item:hover {
  background: var(--bg-soft);
  border-color: var(--border);
  transform: translateX(4px);
}
#myTeamModal .mtm-member-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
#myTeamModal .mtm-member-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--primary);
}
#myTeamModal .mtm-member-name {
  font-weight: 700;
}
#myTeamModal .mtm-platform {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
#myTeamModal .mtm-role-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}
#myTeamModal .mtm-role-captain {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(59,130,246,0.12);
}
#myTeamModal .mtm-role-reserve {
  color: #a855f7;
  border-color: #a855f7;
  background: rgba(168,85,247,0.12);
}
#myTeamModal .mtm-role-member {
  color: var(--text-muted);
}
@media (max-width: 640px) {
  #myTeamModal .modal-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 95vh;
    border: none;
    border-top: 1px solid var(--border);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #myTeamModal.open .modal-card {
    transform: translateY(0);
  }
  #myTeamModal.closing .modal-card {
    transform: translateY(100%);
  }
  #myTeamModal .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  #myTeamModal .modal-actions .btn {
    width: 100%;
  }
  #myTeamModal .mtm-header-info {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }
  #myTeamModal #myTeamAttemptIndicator {
    margin-left: 0;
    margin-top: 6px;
  }
  #myTeamModal .mtm-members-list {
    max-height: 55vh;
  }
  #myTeamModal .mtm-member-item {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  #myTeamModal .mtm-member-main {
    flex: 1 1 100%;
    min-width: 0;
  }
  #myTeamModal .mtm-member-name {
    font-size: 14px;
    max-width: 70%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #myTeamModal .mtm-platform {
    font-size: 12px;
  }
  #myTeamModal .mtm-role-chip {
    order: 2;
    margin-top: 6px;
    margin-left: 38px;
  }
}
@media (min-width: 641px) and (max-width: 1024px) {
  #myTeamModal .modal-card {
    width: 720px;
    max-width: 96vw;
  }
  #myTeamModal .mtm-grid {
    grid-template-columns: 1fr 1fr;
  }
  #myTeamModal .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  #myTeamModal .modal-actions .btn {
    width: 100%;
  }
}
/* JOIN MODAL REDESIGN - THEMED STYLES */
#joinModal .join-modal-card {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  /* Start hidden at bottom */
  transform: translateY(100vh);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text);
}

#joinModal.open .join-modal-card {
  transform: translateY(0);
}

#joinModal.closing .join-modal-card {
  transform: translateY(100vh);
}

/* Override existing keyframes/animation property */
/* No animation property needed as we use transition on transform */


#joinModal .join-modal-header {
  padding: 24px 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

#joinModal .join-modal-title-group h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.5px;
}

#joinModal .join-modal-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

#joinModal .join-modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}

#joinModal .join-modal-close-btn:hover {
  background: var(--bg);
  color: var(--text);
}

#joinModal .join-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--surface);
}

#joinModal .join-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#joinModal .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

#joinModal .input-icon {
  position: absolute;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#joinModal input[type="text"] {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 15px;
  transition: all 0.2s;
}

#joinModal input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

#joinModal .join-members-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#joinModal .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

#joinModal .member-counter {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  background: var(--bg-soft);
  color: var(--primary);
  border-radius: 6px;
  border: 1px solid var(--border);
}

#joinModal .search-wrapper {
  position: relative;
  margin-bottom: 12px;
  color: var(--text-muted);
}

#joinModal .search-wrapper .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
}

#joinModal .search-wrapper input {
  padding-left: 40px;
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 14px;
  background: var(--bg);
  border-color: var(--border);
}
/* Global search styling */
.search-wrapper {
  position: relative;
  color: var(--text-muted);
}
.search-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  pointer-events: none;
}
.search-wrapper input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  font-size: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}
.search-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,255,195,0.10);
}

#joinModal .join-user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 0;
}

#joinModal .custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
#joinModal .custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
#joinModal .custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
#joinModal .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

#joinModal .select-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

#joinModal .select-item:hover {
  background: var(--bg-soft);
  border-color: var(--primary);
}

#joinModal .select-item input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 6px;
  margin-right: 12px;
  position: relative;
  transition: all 0.2s;
  flex-shrink: 0;
  background: var(--bg);
}

#joinModal .select-item input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

#joinModal .select-item input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 800;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#joinModal .select-item .meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#joinModal .select-item .name {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

#joinModal .select-item .platform {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

#joinModal .badges {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
#joinModal .badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-soft);
}
#joinModal .badge-captain {
  border-color: var(--primary);
  color: var(--primary);
  background: transparent;
}
#joinModal .badge-added {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

#joinModal .select-item.disabled {
  opacity: 0.5;
  pointer-events: none;
  background: var(--bg-soft);
}

#joinModal .join-modal-footer {
  padding: 20px 24px;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

#joinModal .btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 12px 20px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s;
}

#joinModal .btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

#joinModal .btn-primary-large {
  background: var(--primary);
  color: var(--primary-text);
  border: none;
  padding: 12px 24px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#joinModal .btn-primary-large:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

#joinModal .btn-primary-large:active {
  transform: translateY(1px);
}

#joinModal .join-error-msg {
  color: #ef4444;
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}

#joinModal .join-warning {
  margin-top: 10px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
#joinModal .join-warning__icon {
  display: grid;
  place-items: center;
}
#joinModal .join-warning__text {
  font-size: 13px;
  line-height: 1.3;
}

@media (max-width: 640px) {
  #joinModal .join-modal-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 95vh;
    border: none;
    border-top: 1px solid var(--border);
    /* Mobile slide behavior managed by base style (transform transition) */
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* No keyframes needed, using base class states */
  #joinModal.open .join-modal-card {
    transform: translateY(0);
  }
  
  #joinModal.closing .join-modal-card {
    transform: translateY(100%);
  }

  #joinModal .join-modal-body {
    padding: 20px;
  }
}
.modal-card {
  width: 520px;
  max-width: 92vw;
  max-height: 92vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.45);
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--primary);
}
.modal-close:hover {
  color: var(--primary);
  transform: scale(1.06);
}
.modal-title {
  font-weight: 800;
  font-size: 18px;
  flex: 1;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}
.modal-form {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding-bottom: 84px;
  min-height: 0; /* allow flex container to constrain */
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 8px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--surface) 60%, rgba(0,0,0,0));
  padding-top: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  z-index: 2;
}
.form-msg {
  min-height: 18px;
  font-size: 13px;
  color: var(--primary);
  text-align: right;
}

/* Select List for users */
.select-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-soft);
}
.select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--bg);
}
.select-item.disabled {
  opacity: 0.5;
}
.select-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
}
.select-item .meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.select-item .meta .name {
  font-weight: 700;
  font-size: 14px;
}
.select-item .meta .platform {
  font-size: 12px;
  color: var(--text-muted);
}

/* Team panel actions */
.team-panel .form-actions .btn {
  padding: 10px 16px;
  font-size: 12px;
}

/* Team Dashboard Redesign */
.team-dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.4s ease-out;
}

.team-header-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.team-identity {
  display: flex;
  align-items: center;
  gap: 20px;
}

.team-avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--bg-soft);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  border: 2px solid var(--border);
}

.team-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.team-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin: 0;
}

.team-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.team-badge.captain-badge {
  border-color: var(--primary);
  color: var(--primary);
}
.team-badge.admin-badge {
  border-color: #3b82f6;
  color: #3b82f6;
  background: rgba(59,130,246,0.12);
}
.team-badge.creator-badge {
  border-color: #a855f7;
  color: #a855f7;
  background: rgba(168,85,247,0.12);
}

.team-content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.count-badge {
  background: var(--bg-soft);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.members-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 16px;
  border: 1px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.member-item:hover {
  border-color: var(--border);
  background: var(--bg-soft);
  transform: translateX(4px);
}

.member-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.member-name {
  font-weight: 600;
  font-size: 15px;
}

.captain-star {
  color: var(--primary);
}

.tournaments-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.badge-registered {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34,197,94,0.12);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
}
.badge-admin {
  border-color: #3b82f6;
  color: #3b82f6;
  background: rgba(59,130,246,0.12);
}
.badge-creator {
  border-color: #a855f7;
  color: #a855f7;
  background: rgba(168,85,247,0.12);
}

.attempt-badge {
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.attempt--not_attempted {
  border-color: var(--border);
  color: var(--text-muted);
  background: var(--bg-soft);
}
.attempt--counted {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34,197,94,0.12);
}
.attempt--not_counted {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245,158,11,0.12);
}
.attempt--disqualified {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239,68,68,0.12);
}
.appeal-timer-block {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  margin-top: 8px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
}
#myTeamModal .appeal-timer-block {
  background: var(--surface);
}
.appeal-timer-block.compact {
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 11px;
}
.attempt-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.attempt-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  padding: 10px 32px 10px 12px;
  min-height: 36px;
  line-height: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  transition: border-color 200ms ease, background-color 200ms ease, color 200ms ease;
}
.attempt-select:focus {
  outline: none;
  border-color: var(--primary);
}

.team-participation {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.team-participation strong {
  color: var(--primary);
}

.tournament-tiles { display: none; }
.tournament-tile .t-status.finished {
  color: var(--text-muted);
  background: var(--bg-soft);
}
.platform-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  border: 1px solid var(--border);
}
.platform-ps {
  background: #0070D1;
  border-color: #0070D1;
}
.platform-xbox {
  background: #107C10;
  border-color: #107C10;
}

.platform-ps-icon {
  color: #0070D1;
}
.platform-xbox-icon {
  color: #107C10;
}

@media (max-width: 640px) {
  .select-list {
    grid-template-columns: 1fr;
  }
  .modal-card {
    width: 96vw;
    padding: 16px;
    border-radius: 16px;
  }
  .modal-actions .btn {
    padding: 12px 16px;
    font-size: 12px;
  }
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 5000;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.toast-success {
  border-left: 4px solid var(--primary);
}

.toast.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-icon {
  display: grid;
  place-items: center;
  color: var(--primary);
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}

.toast-msg {
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .toast-container {
    left: 20px;
    right: 20px;
    bottom: 20px;
    align-items: center;
  }
  .toast {
    width: 100%;
    min-width: 0;
  }
}

.rules-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rule-intro {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  font-size: 14px;
  color: var(--text);
}
.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.rule-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
}
.rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.rule-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}
.rule-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.rule-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
}
.rule-list li strong {
  font-weight: 800;
  margin-right: 8px;
  color: var(--primary);
}
.variant-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.variant-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
}
.rules-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding: 12px 4px;
  color: var(--text-muted);
  font-size: 13px;
}
@media (max-width: 840px) {
  .rules-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .brand { font-size: 16px; }
  .toggle { width: 36px; height: 20px; padding: 2px; }
  .toggle__knob { width: 16px; height: 16px; }
  .content-wrapper { padding: 16px; }
  .hero { padding: 60px 16px; }
  .hero h1 { font-size: 32px; letter-spacing: -1px; }
  .hero p { font-size: 14px; margin: 0 auto 40px; max-width: 92%; }
  .slides { height: calc(100vh - 160px); }
  .icon-ring { width: 64px; height: 64px; font-size: 28px; border-radius: 16px; margin: 0 auto 24px; }
  .slide h1 { font-size: 32px; letter-spacing: -1px; }
  .slide p { font-size: 14px; max-width: 92%; }
  .dots { bottom: 60px; }
  .flow { bottom: 24px; }
  .btn { padding: 12px 20px; font-size: 12px; }
  .feature-card h3 { font-size: 18px; }
  .feature-card p { font-size: 14px; }
  #profileModal .modal-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 95vh;
    border: none;
    border-top: 1px solid var(--border);
  }
  #profileModal .modal-actions { display: grid; grid-template-columns: 1fr; }
  #profileModal .modal-actions .btn { width: 100%; }
  #rulesModal .modal-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 95vh;
    border: none;
    border-top: 1px solid var(--border);
  }
#rulesModal .modal-header {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0));
}
#rulesModal .modal-icon {
  background: linear-gradient(135deg, rgba(0, 255, 195, 0.15), rgba(0, 0, 0, 0));
  border-color: var(--border);
}
#rulesModal .modal-body {
  padding: 12px 2px 0;
}
#rulesBody {
  line-height: 1.7;
  font-size: 14.5px;
  color: var(--text);
}
.rules-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rules-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.rules-list li::before {
  content: '';
  flex: 0 0 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(0,255,195,0.15);
}
  #rulesModal .modal-actions { display: grid; grid-template-columns: 1fr; }
  #rulesModal .modal-actions .btn { width: 100%; }
  #confirmModal .modal-card {
    width: 100%;
    max-width: 92vw;
    border-radius: 20px;
  }
  .profile-banner { padding: 20px; }
  .profile-avatar-hero { width: 64px; height: 64px; font-size: 26px; }
  .profile-main h3 { font-size: 18px; }
  .profile-metrics { grid-template-columns: 1fr; padding: 0 20px 20px; }
  .metric-val { font-size: 20px; }
  .profile-controls { padding: 0 20px 24px; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .topbar { padding: 20px 24px; }
  .brand { font-size: 18px; }
  .toggle { width: 40px; height: 22px; }
  .content-wrapper { padding: 24px; }
  .hero { padding: 90px 20px; }
  .hero h1 { font-size: 48px; }
  .hero p { font-size: 16px; }
  .slides { height: calc(100vh - 140px); }
  .slide h1 { font-size: 44px; }
  .slide p { font-size: 16px; }
  .btn { padding: 14px 24px; font-size: 13px; }
  #profileModal .modal-card { width: 720px; max-width: 96vw; }
  #rulesModal .modal-card { width: 720px; max-width: 96vw; }
  .profile-metrics { grid-template-columns: 1fr 1fr; }
}
