/* =============================================================
   mygamesandi — Components
   Elite Gamer Arena dark theme. Mobile-first.
   ============================================================= */


/* =============================================================
   BUTTONS
   ============================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-comfortable);
  padding: 0 var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  font-size: var(--text-md);
  letter-spacing: 0.04em;
  border: none;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  user-select: none;
  position: relative;
  overflow: hidden;
}

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

/* Primary — yellow gradient, dark text */
.btn--primary {
  background: var(--gradient-yellow);
  color: #0B121E;
  font-weight: var(--fw-bold);
}

.btn--primary:hover {
  filter: brightness(1.1);
  color: #0B121E;
  text-decoration: none;
}

.btn--primary:active {
  filter: brightness(0.95);
  transform: scale(0.98);
}

/* Arena — primary with yellow glow */
.btn--arena {
  background: var(--gradient-yellow);
  color: #0B121E;
  font-weight: var(--fw-bold);
  box-shadow: 0 0 20px rgba(245, 197, 24, 0.4);
}

.btn--arena:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 32px rgba(245, 197, 24, 0.6);
  color: #0B121E;
  text-decoration: none;
}

/* Secondary — cyan gradient */
.btn--secondary {
  background: var(--gradient-deepsea);
  color: #ffffff;
  font-weight: var(--fw-semibold);
}

.btn--secondary:hover {
  filter: brightness(1.1);
  color: #ffffff;
  text-decoration: none;
}

/* Ghost — transparent with yellow border */
.btn--ghost {
  background: transparent;
  color: var(--color-accent-yellow);
  border: 1px solid var(--color-accent-yellow);
}

.btn--ghost:hover {
  background: rgba(245, 197, 24, 0.1);
  text-decoration: none;
}

/* Ghost cyan variant */
.btn--ghost-cyan {
  background: transparent;
  color: var(--color-accent-cyan);
  border: 1px solid var(--color-accent-cyan);
}

.btn--ghost-cyan:hover {
  background: rgba(0, 212, 255, 0.1);
  text-decoration: none;
}

/* Success */
.btn--success {
  background: var(--color-accent-green);
  color: #0B121E;
  font-weight: var(--fw-bold);
}

.btn--success:hover {
  filter: brightness(1.1);
  color: #0B121E;
  text-decoration: none;
}

/* Danger */
.btn--danger {
  background: var(--color-accent-red);
  color: #ffffff;
}

.btn--danger:hover {
  filter: brightness(1.15);
  color: #ffffff;
  text-decoration: none;
}

/* Sunset — mobile CTAs */
.btn--sunset {
  background: var(--gradient-sunset);
  color: #ffffff;
  font-weight: var(--fw-bold);
}

.btn--sunset:hover {
  filter: brightness(1.1);
  color: #ffffff;
  text-decoration: none;
}

/* Size variants */
.btn--sm {
  min-height: 36px;
  font-size: var(--text-sm);
  padding: 0 var(--space-4);
}

.btn--lg {
  min-height: 56px;
  font-size: var(--text-lg);
  padding: 0 var(--space-8);
  letter-spacing: 0.06em;
}

.btn--full {
  width: 100%;
}

.btn--icon {
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

/* Loading state — yellow spinner */
.btn--loading {
  opacity: 0.75;
  cursor: wait;
  pointer-events: none;
}

.btn--loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-accent-yellow);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: var(--space-2);
}

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


/* =============================================================
   GLOW UTILITIES
   ============================================================= */

.glow-cyan {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3),
              0 0 60px rgba(0, 212, 255, 0.1);
}

.glow-yellow {
  box-shadow: 0 0 20px rgba(245, 197, 24, 0.4),
              0 0 60px rgba(245, 197, 24, 0.15);
}

.glow-purple {
  box-shadow: 0 0 20px rgba(155, 89, 255, 0.3);
}

.text-glow-cyan {
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
}

.text-glow-yellow {
  text-shadow: 0 0 10px rgba(245, 197, 24, 0.8);
}


/* =============================================================
   CARDS
   ============================================================= */

.card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Game card */
.card--game {
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
  display: block;
  text-decoration: none;
  color: inherit;
  border-top: 3px solid var(--color-accent-yellow);
}

.card--game:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
              0 0 0 1px var(--color-accent-yellow);
  text-decoration: none;
  border-top-color: var(--color-accent-yellow);
}

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

.card--game__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--color-bg-elevated);
  display: block;
}

.card--game__cover-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--color-bg-elevated), var(--color-bg-panel));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  position: relative;
}

/* Dark overlay gradient on cover images */
.card--game__cover-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 0.4;
  pointer-events: none;
}

.card--game__body {
  padding: var(--space-4);
}

.card--game__title {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: var(--text-lg);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
  letter-spacing: 0.03em;
}

.card--game__tagline {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.card--game__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* Tournament card */
.card--tournament {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-top: 3px solid var(--color-accent-yellow);
  border-radius: 12px;
  min-width: 280px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}

.card--tournament:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
              0 0 0 1px rgba(245, 197, 24, 0.3);
}

.card--tournament__banner {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--color-bg-elevated);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.card--tournament__banner-overlay {
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  pointer-events: none;
}

.card--tournament__game-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  background: var(--color-accent-yellow);
  color: #0B121E;
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.card--tournament__status-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.card--tournament__status-badge--live {
  background: rgba(255, 71, 87, 0.9);
  color: #ffffff;
}

.card--tournament__status-badge--upcoming {
  background: rgba(245, 197, 24, 0.15);
  color: var(--color-accent-yellow);
  border: 1px solid rgba(245, 197, 24, 0.3);
}

.card--tournament__body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.card--tournament__name {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: var(--text-xl);
  color: var(--color-text-primary);
  line-height: var(--leading-tight);
  letter-spacing: 0.03em;
}

.card--tournament__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.card--tournament__entry {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--color-accent-yellow);
  font-weight: var(--fw-semibold);
}

.card--tournament__entry-icon {
  font-size: 0.9rem;
}

.card--tournament__slots {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.card--tournament__progress-track {
  width: 100%;
  height: 4px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-1);
}

.card--tournament__progress-fill {
  height: 100%;
  background: var(--gradient-deepsea);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

.card--tournament__footer {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

/* Player card */
.card--player {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-comfortable);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.card--player__info {
  flex: 1;
  min-width: 0;
}

.card--player__name {
  font-weight: var(--fw-semibold);
  font-size: var(--text-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary);
}

.card--player__status {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.card--player__points {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent-yellow);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

/* Profile card */
.card--profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.card--profile__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  width: 100%;
}

.card--profile__stat-value {
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--text-2xl);
  color: var(--color-accent-cyan);
  display: block;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.card--profile__stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Leaderboard card */
.card--leaderboard {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-height: 56px;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}

.card--leaderboard:hover {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-subtle);
  text-decoration: none;
}

/* Top 3 highlight */
.card--leaderboard--top {
  border-color: var(--color-border-subtle);
  background: var(--color-bg-surface);
}

.card--leaderboard__rank {
  font-family: var(--font-heading);
  font-weight: var(--fw-extrabold);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.card--leaderboard__rank--gold   { color: var(--color-gold); }
.card--leaderboard__rank--silver { color: var(--color-silver); }
.card--leaderboard__rank--bronze { color: var(--color-bronze); }

.card--leaderboard__info {
  flex: 1;
  min-width: 0;
}

.card--leaderboard__name {
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card--leaderboard__sub {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.card--leaderboard__score {
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--text-md);
  color: var(--color-accent-yellow);
  flex-shrink: 0;
}

/* Glass card — glassmorphism */
.card--glass {
  background: rgba(26, 35, 50, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: var(--radius-lg);
}

/* Challenge / promo card */
.card--challenge {
  border-color: rgba(245, 197, 24, 0.3);
  border-width: 1px;
  background: rgba(245, 197, 24, 0.06);
  position: relative;
}

.card--challenge__dismiss {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: var(--space-1);
  touch-action: manipulation;
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-out);
}

.card--challenge__dismiss:hover {
  color: var(--color-text-secondary);
}

/* Daily reward day card */
.card--day {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  min-height: 100px;
  transition: transform var(--duration-base) var(--ease-out);
}

.card--day--past {
  background: rgba(245, 197, 24, 0.06);
  border-color: rgba(245, 197, 24, 0.2);
  opacity: 0.7;
}

.card--day--today {
  border: 2px solid var(--color-accent-cyan);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.25);
  animation: glow-pulse-cyan 2s ease-in-out infinite;
}

.card--day--future {
  opacity: 0.4;
  filter: grayscale(0.5);
}

.card--day__label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card--day__icon {
  font-size: 1.8rem;
  line-height: 1;
}

.card--day__reward {
  font-size: var(--text-xs);
  color: var(--color-accent-yellow);
  font-weight: var(--fw-semibold);
}


/* =============================================================
   STAT BLOCKS
   ============================================================= */

.stat-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-block__value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  color: var(--color-accent-cyan);
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
  line-height: 1;
}

.stat-block__value--yellow {
  color: var(--color-accent-yellow);
  text-shadow: 0 0 20px rgba(245, 197, 24, 0.5);
}

.stat-block__label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}


/* =============================================================
   BADGES (chips / pills)
   ============================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.05em;
  min-height: 20px;
  white-space: nowrap;
}

.badge::before {
  content: none;
}

/* Online — cyan */
.badge--online {
  background: rgba(0, 212, 255, 0.15);
  color: var(--color-accent-cyan);
}

.badge--online::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--color-accent-cyan);
  border-radius: 50%;
  flex-shrink: 0;
  animation: glow-pulse-cyan 2s ease-in-out infinite;
}

/* Offline */
.badge--offline {
  background: rgba(68, 85, 102, 0.4);
  color: var(--color-text-muted);
}

/* In-game */
.badge--in-game {
  background: rgba(155, 89, 255, 0.15);
  color: var(--color-accent-purple);
}

.badge--in-game::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--color-accent-purple);
  border-radius: 50%;
  flex-shrink: 0;
}

/* New / alert */
.badge--new {
  background: var(--color-accent-red);
  color: #ffffff;
}

/* Live — pulsing red */
.badge--live {
  background: rgba(255, 71, 87, 0.15);
  color: var(--color-accent-red);
  border: 1px solid rgba(255, 71, 87, 0.3);
}

.badge--live::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--color-accent-red);
  border-radius: 50%;
  flex-shrink: 0;
  animation: glow-pulse-red 1s ease-in-out infinite;
}

/* Points */
.badge--points {
  background: rgba(245, 197, 24, 0.12);
  color: var(--color-accent-yellow);
  border: 1px solid rgba(245, 197, 24, 0.2);
}

/* Rank tiers */
.badge--rank-gold {
  background: rgba(245, 197, 24, 0.15);
  color: var(--color-gold);
}

.badge--rank-silver {
  background: rgba(136, 153, 170, 0.15);
  color: var(--color-silver);
}

.badge--rank-bronze {
  background: rgba(205, 127, 50, 0.15);
  color: var(--color-bronze);
}

/* Notification count */
.badge--count {
  background: var(--color-accent-red);
  color: #ffffff;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  font-size: 11px;
}


/* =============================================================
   MODALS
   ============================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(0, 212, 255, 0.05);
  max-width: 480px;
  width: 100%;
  max-height: calc(100dvh - var(--space-8));
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(8px);
  transition: transform var(--duration-base) var(--ease-out);
}

.modal-overlay.is-open .modal {
  transform: scale(1) translateY(0);
}

/* Bottom sheet variant */
.modal--sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 85dvh;
  transform: translateY(100%);
  margin: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  border-bottom: none;
}

.modal-overlay.is-open .modal--sheet {
  transform: translateY(0);
  animation: slideUp var(--duration-slow) var(--ease-out);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}

.modal__title {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: var(--text-xl);
  color: var(--color-text-primary);
  letter-spacing: 0.04em;
}

.modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}

.modal__close:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
}

.modal__body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-subtle);
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: var(--color-bg-surface);
}


/* =============================================================
   NAVIGATION — BOTTOM (mobile)
   ============================================================= */

.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottomnav-height);
  background: var(--color-bg-panel);
  border-top: 1px solid var(--color-border-subtle);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-bottom__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--touch-min);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  font-family: var(--font-body);
  transition: color var(--duration-fast) var(--ease-out);
  touch-action: manipulation;
  border-top: 2px solid transparent;
  position: relative;
}

.nav-bottom__item:hover {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.nav-bottom__item--active {
  color: var(--color-accent-yellow);
  border-top-color: var(--color-accent-yellow);
}

/* Show labels at 480px+ */
@media (max-width: 479px) {
  .nav-bottom__item span {
    display: none;
  }
}


/* =============================================================
   NAVIGATION — SIDEBAR (desktop, >= 768px)
   ============================================================= */

.nav-sidebar {
  display: none; /* hidden on mobile — shown via layout */
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-bg-panel);
  border-right: 1px solid var(--color-border-subtle);
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  padding-bottom: var(--space-8);
}

/* Desktop: swap bottom nav for sidebar */
@media (min-width: 768px) {
  .nav-bottom {
    display: none;
  }

  .nav-sidebar {
    display: flex;
  }
}

.nav-sidebar__logo {
  padding: var(--space-6) var(--space-6) var(--space-4);
  flex-shrink: 0;
}

.nav-sidebar__wordmark {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: var(--text-2xl);
  letter-spacing: 0.05em;
  color: var(--color-accent-yellow);
  text-decoration: none;
  display: block;
  line-height: 1;
}

.nav-sidebar__wordmark span {
  color: var(--color-accent-cyan);
  display: block;
  width: 32px;
  height: 2px;
  background: var(--color-accent-cyan);
  margin-top: 4px;
  border-radius: 1px;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

.nav-sidebar__section {
  padding: var(--space-4) 0 var(--space-2);
}

.nav-sidebar__section-label {
  padding: 0 var(--space-6);
  font-size: 10px;
  font-weight: var(--fw-bold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: var(--space-1);
  display: block;
}

.nav-sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4) 0 var(--space-6);
  height: var(--touch-comfortable);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--text-md);
  font-weight: var(--fw-medium);
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
  border-left: 3px solid transparent;
  position: relative;
}

.nav-sidebar__item:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  text-decoration: none;
}

.nav-sidebar__item--active {
  color: var(--color-accent-yellow);
  border-left-color: var(--color-accent-yellow);
  background: rgba(245, 197, 24, 0.06);
}

.nav-sidebar__item--active:hover {
  color: var(--color-accent-yellow);
}

.nav-sidebar__icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-sidebar__divider {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-2) var(--space-6);
}


/* =============================================================
   TOP BAR (desktop)
   ============================================================= */

.top-bar {
  height: var(--topbar-height);
  background: var(--color-bg-panel);
  border-bottom: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.top-bar__search {
  flex: 1;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  height: 36px;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.top-bar__search-input {
  background: none;
  border: none;
  outline: none;
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  flex: 1;
  min-width: 0;
}

.top-bar__search-input::placeholder {
  color: var(--color-text-muted);
}

.top-bar__region {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.top-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.top-bar__notif-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: color var(--duration-fast) var(--ease-out);
}

.top-bar__notif-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
}

.top-bar__user-pill {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out);
  text-decoration: none;
  color: inherit;
}

.top-bar__user-pill:hover {
  border-color: var(--color-accent-yellow);
  text-decoration: none;
}

.top-bar__user-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-primary);
}


/* =============================================================
   FORMS
   ============================================================= */

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4);
  /* CRITICAL: 16px minimum prevents iOS Safari zoom */
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

.form-input--error {
  border-color: var(--color-accent-red);
}

.form-input--error:focus {
  box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.2);
}

.form-error {
  font-size: var(--text-sm);
  color: var(--color-accent-red);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}


/* =============================================================
   AVATARS
   ============================================================= */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-bg-elevated);
  border: 2px solid var(--color-border-subtle);
}

.avatar--sm { width: 32px; height: 32px; }
.avatar--md { width: 48px; height: 48px; }
.avatar--lg {
  width: 80px;
  height: 80px;
  border-width: 3px;
}

/* Cyan ring on online avatars */
.avatar--online {
  border-color: var(--color-accent-cyan);
  box-shadow: 0 0 0 2px var(--color-bg-base),
              0 0 12px rgba(0, 212, 255, 0.4);
}

/* Stacked avatar group */
.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-stack .avatar,
.avatar-stack .avatar-placeholder {
  margin-left: -10px;
  border: 2px solid var(--color-bg-base);
}

.avatar-stack .avatar:first-child,
.avatar-stack .avatar-placeholder:first-child {
  margin-left: 0;
}

/* Fallback avatar (initials) */
.avatar-placeholder {
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(0, 212, 255, 0.12);
  color: var(--color-accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  border: 2px solid var(--color-border-subtle);
}

.avatar-placeholder--sm  { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-placeholder--md  { width: 48px; height: 48px; font-size: var(--text-md); }
.avatar-placeholder--lg  { width: 80px; height: 80px; font-size: var(--text-xl); border-width: 3px; }


/* =============================================================
   TOASTS
   ============================================================= */

.toast-container {
  position: fixed;
  bottom: calc(var(--bottomnav-height) + var(--space-4));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - var(--space-8));
}

@media (min-width: 768px) {
  .toast-container {
    bottom: var(--space-4);
    left: calc(var(--sidebar-width) + var(--space-4));
    transform: none;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: calc(100vw - var(--space-8));
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  animation: slideUp var(--duration-base) var(--ease-out);
  pointer-events: auto;
}

.toast--success {
  border-color: rgba(46, 204, 113, 0.4);
  background: rgba(46, 204, 113, 0.1);
  color: var(--color-accent-green);
}

.toast--error {
  border-color: rgba(255, 71, 87, 0.4);
  background: rgba(255, 71, 87, 0.1);
  color: var(--color-accent-red);
}

.toast--info {
  border-color: rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.08);
  color: var(--color-accent-cyan);
}

.toast--warning {
  border-color: rgba(245, 197, 24, 0.3);
  background: rgba(245, 197, 24, 0.08);
  color: var(--color-accent-yellow);
}


/* =============================================================
   SKELETON LOADERS
   ============================================================= */

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--color-bg-elevated) 0%,
    var(--color-bg-surface) 50%,
    var(--color-bg-elevated) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton--text {
  height: 1em;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.skeleton--text:last-child {
  width: 70%;
}

.skeleton--avatar {
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton--card {
  height: 160px;
  border-radius: var(--radius-lg);
}


/* =============================================================
   ONLINE COUNT PILL
   ============================================================= */

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px var(--space-3);
  background: rgba(0, 212, 255, 0.1);
  color: var(--color-accent-cyan);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.online-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--color-accent-cyan);
  border-radius: 50%;
  animation: glow-pulse-cyan 2s ease-in-out infinite;
}


/* =============================================================
   CONNECTION BANNER
   ============================================================= */

.connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--color-accent-yellow);
  color: #0B121E;
  text-align: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  display: none;
}

.connection-banner.is-visible {
  display: block;
}


/* =============================================================
   ANDI MASCOT CONTAINER
   ============================================================= */

.andi-container {
  display: inline-block;
  flex-shrink: 0;
}

.andi-container--hero   { width: 120px; height: 120px; }
.andi-container--small  { width: 32px; height: 32px; }
.andi-container--medium { width: 64px; height: 64px; }

.andi-container--idle::after      { content: '🤖'; font-size: 2em; }
.andi-container--wave::after      { content: '👋'; font-size: 2em; }
.andi-container--excited::after   { content: '🎉'; font-size: 2em; }
.andi-container--thinking::after  { content: '🤔'; font-size: 2em; }
.andi-container--celebrate::after { content: '🥳'; font-size: 2em; }
.andi-container--consoling::after { content: '🫂'; font-size: 2em; }

.andi-container--hero.andi-container--idle::after,
.andi-container--hero.andi-container--wave::after,
.andi-container--hero.andi-container--excited::after,
.andi-container--hero.andi-container--thinking::after,
.andi-container--hero.andi-container--celebrate::after,
.andi-container--hero.andi-container--consoling::after {
  font-size: 5rem;
}


/* =============================================================
   GAME CHROME
   ============================================================= */

.game-timer {
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--text-xl);
  color: var(--color-text-primary);
  letter-spacing: 0.08em;
}

.game-timer--warning {
  color: var(--color-accent-yellow);
  animation: glow-pulse-yellow 1s ease-in-out infinite;
}

.game-timer--danger {
  color: var(--color-accent-red);
  animation: glow-pulse-red 0.5s ease-in-out infinite;
}

/* Countdown timer — Orbitron for event screens */
.countdown-timer {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: var(--fw-bold);
  color: var(--color-accent-cyan);
  letter-spacing: 0.1em;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.countdown-timer__segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.countdown-timer__value {
  animation: timer-tick 1s ease-in-out infinite;
}

.countdown-timer__label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-body);
}

.countdown-timer__sep {
  font-size: 0.6em;
  opacity: 0.5;
  margin-bottom: 1rem;
}

/* Tab row */
.tab-row {
  display: flex;
  border-bottom: 1px solid var(--color-border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--color-bg-panel);
}

.tab-row::-webkit-scrollbar {
  display: none;
}

.tab {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  font-family: var(--font-heading);
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  touch-action: manipulation;
  transition: color var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.tab:hover {
  color: var(--color-text-secondary);
}

.tab--active {
  color: var(--color-accent-yellow);
  border-bottom-color: var(--color-accent-yellow);
}


/* =============================================================
   MISSION ROW
   ============================================================= */

.mission-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
  touch-action: manipulation;
}

.mission-row:hover {
  background: var(--color-bg-elevated);
  border-color: rgba(0, 212, 255, 0.2);
  text-decoration: none;
}

.mission-row__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.mission-row__icon--yellow { background: rgba(245, 197, 24, 0.15); }
.mission-row__icon--cyan   { background: rgba(0, 212, 255, 0.1); }
.mission-row__icon--purple { background: rgba(155, 89, 255, 0.15); }
.mission-row__icon--red    { background: rgba(255, 71, 87, 0.1); }
.mission-row__icon--green  { background: rgba(46, 204, 113, 0.12); }

.mission-row__content {
  flex: 1;
  min-width: 0;
}

.mission-row__name {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mission-row__progress-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.mission-row__progress-track {
  width: 100%;
  height: 3px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-full);
  margin-top: 4px;
  overflow: hidden;
}

.mission-row__progress-fill {
  height: 100%;
  background: var(--gradient-deepsea);
  border-radius: var(--radius-full);
}

.mission-row__reward {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.mission-row__points {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  color: var(--color-accent-yellow);
}

.mission-row__check {
  color: var(--color-accent-green);
  font-size: 1.1rem;
}


/* =============================================================
   CHESS BOARD
   ============================================================= */

.chess-board {
  display: table;
  border-collapse: collapse;
  border: 3px solid var(--color-chess-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  width: min(100%, 480px);
  margin: 0 auto;
}

.chess-row { display: table-row; }

.chess-square {
  display: table-cell;
  width: 12.5%;
  aspect-ratio: 1;
  text-align: center;
  vertical-align: middle;
  font-size: clamp(1.2rem, 5vw, 2rem);
  cursor: pointer;
  transition: filter var(--duration-fast) var(--ease-out);
  touch-action: manipulation;
  user-select: none;
  position: relative;
}

.chess-square:hover { filter: brightness(0.85); }
.sq-light { background: var(--color-chess-light); }
.sq-dark  { background: var(--color-chess-dark); }

.chess-square--selected {
  background: rgba(0, 212, 255, 0.5) !important;
}

.chess-square--valid-move::after {
  content: '';
  position: absolute;
  inset: 30%;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
}

.chess-square--last-move {
  background: rgba(245, 197, 24, 0.35) !important;
}


/* =============================================================
   SUNGKA BOARD
   ============================================================= */

.sungka-board {
  background: var(--color-sungka-board);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  border: 4px solid #4A2518;
  max-width: 640px;
  margin: 0 auto;
}

.sungka-store {
  width: 72px;
  min-height: 140px;
  background: #4A2518;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #FDF6EC;
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--text-2xl);
  flex-shrink: 0;
  border: 2px solid #3A1A0A;
}

.sungka-store__label {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-body);
}

.sungka-pits {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sungka-row {
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
}

.sungka-pit {
  flex: 1;
  aspect-ratio: 1;
  max-width: 64px;
  background: #4A2518;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FDF6EC;
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--text-lg);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
  touch-action: manipulation;
  border: 2px solid #3A1A0A;
  user-select: none;
}

.sungka-pit:hover:not(:disabled) {
  background: #5C3020;
  transform: scale(1.05);
}

.sungka-pit--active {
  background: var(--color-accent-yellow);
  color: #0B121E;
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.5);
}

.sungka-pit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


/* =============================================================
   PIKO GRID
   ============================================================= */

.piko-grid {
  display: grid;
  grid-template-areas:
    "home home home"
    "s7 s8 s9"
    "s5 . s6"
    "s4 . ."
    "s2 s3 ."
    "s1 . .";
  gap: 4px;
  width: min(100%, 280px);
  margin: 0 auto;
}

.piko-square {
  background: var(--color-bg-surface);
  border: 2px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  font-size: var(--text-xl);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  touch-action: manipulation;
  user-select: none;
  color: var(--color-text-secondary);
}

.piko-square:hover {
  background: var(--color-bg-elevated);
}

.piko-square--active {
  background: var(--color-accent-yellow);
  color: #0B121E;
  border-color: rgba(245, 197, 24, 0.5);
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.4);
}

.piko-square--done {
  background: rgba(46, 204, 113, 0.12);
  color: var(--color-accent-green);
  border-color: rgba(46, 204, 113, 0.3);
}

.piko-square--home {
  grid-area: home;
  background: rgba(245, 197, 24, 0.08);
  border-color: rgba(245, 197, 24, 0.2);
  font-size: var(--text-2xl);
  color: var(--color-accent-yellow);
}

.piko-square[data-sq="1"] { grid-area: s1; }
.piko-square[data-sq="2"] { grid-area: s2; }
.piko-square[data-sq="3"] { grid-area: s3; }
.piko-square[data-sq="4"] { grid-area: s4; }
.piko-square[data-sq="5"] { grid-area: s5; }
.piko-square[data-sq="6"] { grid-area: s6; }
.piko-square[data-sq="7"] { grid-area: s7; }
.piko-square[data-sq="8"] { grid-area: s8; }
.piko-square[data-sq="9"] { grid-area: s9; }


/* =============================================================
   STAR / PARTICLE BACKGROUND (CSS-only, for event screens)
   ============================================================= */

.star-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: particle-float linear infinite;
}

/* Stars at varied positions and sizes — use inline style for variety */
.star--sm { width: 1px; height: 1px; opacity: 0.4; }
.star--lg { width: 3px; height: 3px; opacity: 0.8; }
.star--glow {
  box-shadow: 0 0 4px rgba(0, 212, 255, 0.8);
  background: var(--color-accent-cyan);
}
