/* =========================================================
   WeLove · Modern 3D Design
   Dark glass + vibrant gradients + perspective transforms
   ========================================================= */

:root {
  /* Brand */
  --brand-1: #ec4899;
  --brand-2: #8b5cf6;
  --brand-3: #06b6d4;
  --brand-4: #f43f5e;

  /* Surfaces */
  --bg-0: #07061a;
  --bg-1: #0d0a26;
  --bg-2: #15113a;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* Text */
  --text: #f5f3ff;
  --text-dim: #c4c0e0;
  --muted: #8b87a8;

  /* States */
  --success: #10b981;
  --error: #f43f5e;

  /* Effects */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 10px 40px rgba(236, 72, 153, 0.35);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Tahoma, 'Cairo', 'Noto Sans Arabic', system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
  background: var(--bg-0);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-1); text-decoration: none; }
a:hover { text-decoration: none; }

/* ============== 3D Animated Background ============== */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse at top, #1a0f3a 0%, #07061a 60%),
    linear-gradient(180deg, #07061a 0%, #0a0820 100%);
}

.bg-scene::before,
.bg-scene::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.55;
  will-change: transform;
}

.bg-scene::before {
  width: 540px; height: 540px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  top: -120px; right: -120px;
  animation: float-a 18s ease-in-out infinite;
}

.bg-scene::after {
  width: 620px; height: 620px;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  bottom: -160px; left: -160px;
  animation: float-b 22s ease-in-out infinite;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  will-change: transform;
}
.bg-orb.o1 { width: 380px; height: 380px; background: #06b6d4; top: 40%; left: 20%; animation: float-c 16s ease-in-out infinite; }
.bg-orb.o2 { width: 280px; height: 280px; background: #f43f5e; top: 60%; right: 25%; animation: float-a 20s ease-in-out infinite reverse; }
.bg-orb.o3 { width: 320px; height: 320px; background: #8b5cf6; top: 20%; left: 50%; animation: float-b 24s ease-in-out infinite; }

@keyframes float-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 60px) scale(1.1); }
}
@keyframes float-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, -50px) scale(1.15); }
}
@keyframes float-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, -40px) scale(0.9); }
}

/* Subtle grain overlay */
.bg-scene .grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.4;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* ============== Layout ============== */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.main { padding: 32px 20px 80px; perspective: 1500px; }

/* ============== Topbar (Glass) ============== */
.topbar {
  position: sticky;
  top: 16px;
  z-index: 50;
  margin: 16px auto 0;
  max-width: 1120px;
  padding: 0 20px;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 18px;
  background: rgba(13, 10, 38, 0.55);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.brand {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6 50%, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav { display: flex; align-items: center; gap: 10px; }
.nav a {
  color: var(--text-dim);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.avatar-link { display: inline-flex; padding: 2px; border-radius: 50%; transition: transform .3s; }
.avatar-link:hover { transform: scale(1.05); }
.inline { display: inline; margin: 0; padding: 0; }
.link-btn {
  background: none; border: none; color: var(--text-dim);
  font: inherit; cursor: pointer; font-weight: 600;
  padding: 8px 14px; border-radius: 10px;
  transition: color .2s, background .2s;
}
.link-btn:hover { color: var(--text); background: var(--surface); }

/* ============== Buttons (3D Press) ============== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: transform .15s ease, box-shadow .25s ease, background .2s ease, border-color .2s ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 4px 12px rgba(0,0,0,0.25);
  text-decoration: none;
}
.btn:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.1);
  border-color: var(--border-strong);
  text-decoration: none;
}
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  color: #fff;
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 8px 24px rgba(236, 72, 153, 0.35);
}
.btn.primary:hover {
  transform: translateY(-3px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 14px 40px rgba(236, 72, 153, 0.5);
}
.btn.ghost { background: transparent; box-shadow: none; }
.btn.lg { padding: 14px 26px; font-size: 16px; border-radius: 14px; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

/* ============== Flash ============== */
.flash {
  padding: 12px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-weight: 600;
  border: 1px solid;
  backdrop-filter: blur(10px);
  animation: slide-down .4s ease;
}
.flash.success {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}
.flash.error {
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
}
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============== Glass Card (3D) ============== */
.card,
.glass {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transform-style: preserve-3d;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .25s, box-shadow .25s;
}
.card.hoverable:hover,
.glass.hoverable:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.card.empty { text-align: center; color: var(--muted); }
.card.empty.small { padding: 14px; }

/* Gradient border on cards (top accent) */
.card.accent::before,
.glass.accent::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ec4899, #8b5cf6, #06b6d4, transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* ============== Hero ============== */
.hero {
  position: relative;
  text-align: center;
  padding: 80px 20px 60px;
  perspective: 1500px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  margin: 0 0 18px;
  font-weight: 900;
  line-height: 1.15;
  background: linear-gradient(135deg, #fff 0%, #ec4899 50%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
  animation: title-in .8s ease;
}
.hero p {
  color: var(--text-dim);
  font-size: clamp(15px, 1.8vw, 18px);
  margin: 0 0 32px;
  max-width: 580px;
  margin-inline: auto;
  animation: title-in .8s ease .15s backwards;
}
.hero-cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  animation: title-in .8s ease .3s backwards;
}
@keyframes title-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Floating 3D shapes around hero */
.hero-stage {
  position: relative;
  height: 220px;
  margin: 30px auto 0;
  max-width: 600px;
  perspective: 1200px;
}
.shape {
  position: absolute;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(236,72,153,0.5), rgba(139,92,246,0.5));
  box-shadow: 0 20px 60px rgba(236,72,153,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  animation: float-shape 8s ease-in-out infinite;
  transform-style: preserve-3d;
}
.shape.s1 { width: 90px; height: 90px; top: 20px; left: 10%; background: linear-gradient(135deg, #ec4899, #8b5cf6); animation-delay: 0s; }
.shape.s2 { width: 70px; height: 70px; top: 60px; right: 15%; background: linear-gradient(135deg, #06b6d4, #8b5cf6); border-radius: 50%; animation-delay: 1.5s; }
.shape.s3 { width: 110px; height: 110px; bottom: 10px; left: 35%; background: linear-gradient(135deg, #f43f5e, #ec4899); transform: rotate(45deg); animation-delay: 3s; }
.shape.s4 { width: 60px; height: 60px; top: 130px; right: 35%; background: linear-gradient(135deg, #8b5cf6, #06b6d4); border-radius: 50%; animation-delay: 2s; }
.shape.s5 { width: 50px; height: 50px; bottom: 40px; left: 12%; background: linear-gradient(135deg, #ec4899, #06b6d4); animation-delay: 4s; }
@keyframes float-shape {
  0%, 100% { transform: translateY(0) rotate(0deg) translateZ(0); }
  50%      { transform: translateY(-30px) rotate(15deg) translateZ(40px); }
}
.shape.s3 { animation-name: float-shape-rot; }
@keyframes float-shape-rot {
  0%, 100% { transform: translateY(0) rotate(45deg) translateZ(0); }
  50%      { transform: translateY(-30px) rotate(60deg) translateZ(40px); }
}

/* ============== Features ============== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 40px;
  perspective: 1500px;
}
.feature {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: transform .4s cubic-bezier(.2,.7,.2,1), box-shadow .3s, border-color .3s;
  transform-style: preserve-3d;
}
.feature:hover {
  transform: translateY(-8px) rotateX(2deg);
  border-color: var(--border-strong);
  box-shadow: 0 30px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(236,72,153,0.2);
}
.feature .icon {
  width: 50px; height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(236,72,153,0.4);
}
.feature h3 { margin: 0 0 8px; font-size: 17px; }
.feature p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.6; }

/* ============== Auth (Glass + 3D) ============== */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  perspective: 1500px;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: rgba(13, 10, 38, 0.6);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  transform-style: preserve-3d;
  animation: card-in .6s cubic-bezier(.2,.7,.2,1);
}
.auth-card.wide { max-width: 620px; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) rotateX(-6deg); }
  to   { opacity: 1; transform: translateY(0) rotateX(0); }
}
.auth-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-card .sub {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 14px;
}
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; color: var(--text-dim); }
.auth-card input,
.auth-card select,
.auth-card textarea {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.auth-card input::placeholder,
.auth-card textarea::placeholder { color: var(--muted); }
.auth-card input:focus,
.auth-card select:focus,
.auth-card textarea:focus {
  border-color: rgba(236,72,153,0.6);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 4px rgba(236,72,153,0.15);
}
.auth-card select option { background: #15113a; color: var(--text); }
.auth-card textarea { resize: vertical; min-height: 80px; }
.auth-card .err { color: #fda4af; font-weight: 600; }
.muted { color: var(--muted); }
.muted.small { font-size: 13px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }
.auth-foot a { color: #f9a8d4; font-weight: 700; }

/* ============== Avatar (3D) ============== */
.avatar {
  display: block;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow:
    0 8px 24px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.2);
  flex: 0 0 auto;
  max-width: 100%;
  transition: transform .3s ease, box-shadow .3s ease;
}
.avatar.fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
}
.avatar.lg { width: 110px; height: 110px; font-size: 44px; }
.avatar.md { width: 64px; height: 64px; font-size: 26px; }
.avatar.sm { width: 38px; height: 38px; font-size: 16px; }
.avatar.ring {
  padding: 4px;
  background: conic-gradient(from 0deg, #ec4899, #8b5cf6, #06b6d4, #ec4899);
  border: none;
}
.avatar.ring > * { border-radius: 50%; display: block; }
.avatar.ring.lg { padding: 5px; }
.avatar.ring img,
.avatar.ring .fallback { width: 100%; height: 100%; object-fit: cover; background: var(--bg-1); }
.avatar.floatable { animation: avatar-float 6s ease-in-out infinite; }
@keyframes avatar-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* ============== Profile ============== */
.profile-header {
  display: flex;
  gap: 24px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  align-items: center;
  position: relative;
  overflow: hidden;
}
.profile-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ec4899, #8b5cf6, #06b6d4, transparent);
}
.profile-header h1 { margin: 0 0 4px; font-size: 28px; }
.profile-header p { margin: 4px 0; color: var(--text-dim); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(139, 92, 246, 0.3);
  transition: transform .2s, background .2s;
}
.tag:hover { background: rgba(139, 92, 246, 0.25); transform: translateY(-2px); }

.avatar-row { display: flex; gap: 20px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.avatar-row > * { flex: 0 0 auto; }
.avatar-hint {
  flex: 1 1 100%;
  font-size: 11px;
  margin-top: -4px;
  margin-inline-start: 90px;
  display: flex; align-items: center; gap: 4px;
}
.avatar-hint::before {
  content: '✨';
  font-size: 12px;
}
.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: background .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.file-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--border-strong); }
.file-btn input { display: none; }

/* ===== Edit profile new fields ===== */
.cover-section { margin-bottom: 16px; }
.cover-preview {
  position: relative;
  height: 160px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6, #06b6d4) center / cover;
  border-radius: 14px;
  overflow: hidden;
  transition: all .3s ease;
}
.cover-preview.flash {
  animation: cover-flash .6s ease;
}
@keyframes cover-flash {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(236,72,153,0); }
  30%  { transform: scale(1.02); box-shadow: 0 0 0 6px rgba(236,72,153,0.3); }
  60%  { transform: scale(0.99); box-shadow: 0 0 0 3px rgba(236,72,153,0.2); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(236,72,153,0); }
}
.cover-preview-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.cover-placeholder {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.cp-emoji { font-size: 36px; }
.cover-overlay {
  position: absolute;
  bottom: 10px; inset-inline-end: 10px;
  z-index: 2;
  display: flex; gap: 6px;
}
.cover-btn, .cover-remove {
  position: static;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  z-index: 2;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s;
}
.cover-btn:hover, .cover-remove:hover { background: rgba(0,0,0,0.8); }
.cover-btn input { display: none; }
.cover-remove { background: rgba(244,63,94,0.6); }
.cover-remove:hover { background: rgba(244,63,94,0.85); }
.cover-upload {
  display: flex; align-items: center; justify-content: center;
  height: 100px;
  border: 2px dashed rgba(236,72,153,0.4);
  border-radius: 12px;
  margin-bottom: 16px;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.cover-upload:hover { background: rgba(236,72,153,0.05); border-color: rgba(236,72,153,0.6); color: var(--text); }
.cover-upload input { display: none; }

/* Settings saved flash */
.settings-saved-flash {
  background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(16,185,129,0.2)) !important;
  border: 1px solid rgba(34,197,94,0.5) !important;
  color: #4ade80 !important;
  padding: 14px 20px !important;
  border-radius: 14px !important;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
  animation: settings-saved-in .5s ease;
}
@keyframes settings-saved-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.settings-saved-flash.fade-out { animation: settings-saved-out .5s ease forwards; }
@keyframes settings-saved-out {
  to { opacity: 0; transform: translateY(-8px); }
}

.ep-fieldset {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px;
  margin: 8px 0 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.ep-fieldset legend {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.ep-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .ep-grid-2 { grid-template-columns: 1fr; }
}

/* ===== Profile Page (modern) ===== */
.profile-page {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 0 40px;
}
.profile-cover {
  position: relative;
  height: 220px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6, #06b6d4);
  background-size: cover;
  background-position: center;
  border-radius: 0 0 24px 24px;
  overflow: hidden;
}
.profile-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.5));
}
.cover-edit {
  position: absolute;
  top: 12px; inset-inline-end: 12px;
  width: 38px; height: 38px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  text-decoration: none;
  transition: background .2s;
  z-index: 2;
}
.cover-edit:hover { background: rgba(0,0,0,0.7); }

.profile-head {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 20px;
  padding: 0 24px;
  margin-top: -55px;
  margin-bottom: 16px;
}
.profile-avatar-wrap {
  position: relative;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: rgba(20, 12, 30, 0.95);
  padding: 4px;
  box-shadow: 0 0 0 4px rgba(13, 6, 23, 0.5), 0 8px 24px rgba(0,0,0,0.4);
  z-index: 2;
  flex: 0 0 auto;
}
.profile-avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.profile-avatar.fallback {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  font-weight: 800;
  font-size: 52px;
  display: flex; align-items: center; justify-content: center;
}
.verified-badge {
  position: absolute;
  bottom: 4px; inset-inline-end: 4px;
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: 3px solid rgba(13, 6, 23, 0.95);
  border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  font-weight: 900;
}
.profile-head-info { padding-bottom: 12px; min-width: 0; }
.profile-name {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  display: flex; align-items: center; gap: 8px;
  word-wrap: break-word;
}
.profile-gender { color: var(--text-dim); font-weight: 600; font-size: 20px; }
.profile-job, .profile-loc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}
.profile-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.profile-head-actions .btn {
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
}
.follow-btn.pulse { animation: follow-pulse .4s ease; }
@keyframes follow-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.mutual-badge {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  color: #fff;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 18px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 24px 18px;
}
.stat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all .2s;
  display: block;
}
.stat-card:hover { background: rgba(255,255,255,0.08); transform: translateY(-2px); }
.stat-card strong { display: block; font-size: 22px; font-weight: 900; color: #fff; }
.stat-card span { font-size: 11px; color: var(--text-dim); font-weight: 600; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 0 24px;
}
@media (min-width: 700px) {
  .profile-grid { grid-template-columns: 1fr 1fr; }
}
.profile-section {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px 18px;
}
.profile-section .section-title { margin: 0 0 10px; font-size: 14px; }
.profile-bio { margin: 0; line-height: 1.6; font-size: 14px; }
.profile-looking { margin: 0; font-size: 18px; font-weight: 700; }
.profile-details {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.profile-details li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px;
  line-height: 1.5;
}
.pd-icon { flex: 0 0 24px; font-size: 16px; }



/* ===== Filter bar (browse page) ===== */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 -14px 14px;
  padding: 12px 14px;
  background: rgba(13, 6, 23, 0.85);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  border-radius: 0 0 18px 18px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  min-height: 40px;
}
.filter-tab:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.filter-tab.active {
  background: linear-gradient(135deg, rgba(236,72,153,0.3), rgba(139,92,246,0.3));
  border-color: rgba(236,72,153,0.6);
  color: #fff;
  box-shadow: 0 0 14px rgba(236,72,153,0.4);
}
.filter-tab .ft-emoji { font-size: 18px; line-height: 1; }
.filter-tab.active .ft-emoji { transform: scale(1.1); }

.filter-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  min-height: 34px;
  user-select: none;
}
.filter-pill:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.filter-pill.on {
  background: linear-gradient(135deg, rgba(34,197,94,0.25), rgba(59,130,246,0.25));
  border-color: rgba(34,197,94,0.5);
  color: #fff;
}
.filter-pill input { position: absolute; opacity: 0; pointer-events: none; }
.filter-pill .dot-online {
  width: 8px; height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16,185,129,0.25), 0 0 6px rgba(16,185,129,0.6);
  animation: dot-pulse 1.5s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.25); opacity: 0.7; }
}
.filter-select {
  padding: 7px 28px 7px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23c4c0e0' d='M5 6L0 0h10z'/></svg>");
  background-repeat: no-repeat;
  background-position: left 10px center;
  min-height: 34px;
  flex: 0 0 auto;
  color-scheme: dark;
}
.filter-select:focus { outline: none; border-color: rgba(236,72,153,0.6); }
.filter-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  background: rgba(244,63,94,0.12);
  border: 1px solid rgba(244,63,94,0.3);
  border-radius: 999px;
  color: #fda4af;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: all .2s;
  flex: 0 0 auto;
  min-height: 34px;
}
.filter-clear:hover { background: rgba(244,63,94,0.22); color: #fff; }

.stats-strip {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}
.stat-pill strong { color: #fff; font-weight: 800; }
.stat-pill .dot-online {
  width: 8px; height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
  animation: dot-pulse 1.5s ease-in-out infinite;
}

/* Online indicator on user tile */
.tile-online {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  width: 12px; height: 12px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid rgba(13, 6, 23, 0.85);
  box-shadow: 0 0 0 2px rgba(16,185,129,0.3), 0 0 10px rgba(16,185,129,0.6);
  animation: dot-pulse 1.5s ease-in-out infinite;
  z-index: 2;
}
.tile-photo { position: relative; }
.tile-gender {
  font-size: 12px;
  color: var(--text-dim);
  margin-inline-start: 4px;
  font-weight: 400;
  opacity: 0.7;
}

@media (max-width: 600px) {
  .filter-bar {
    margin: 0 -10px 12px;
    padding: 10px;
    border-radius: 0 0 14px 14px;
  }
  .filter-tab { padding: 6px 10px; font-size: 12px; min-height: 36px; }
  .filter-pill, .filter-select, .filter-clear { padding: 6px 10px; font-size: 11px; min-height: 32px; }
  .filter-tabs { margin: 0 -2px; padding: 0 2px; }
}

/* ===== Instant avatar preview ===== */
.avatar-preview-wrap {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .25s, transform .25s;
}
.avatar-preview-wrap:hover {
  box-shadow: 0 0 0 4px rgba(236,72,153,0.3), 0 0 20px rgba(236,72,153,0.4);
}
.avatar-preview-wrap .avatar-preview-img {
  transition: transform .35s, opacity .25s;
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
}
.avatar-preview-wrap.flash .avatar-preview-img {
  animation: avatar-flash .6s ease;
}
@keyframes avatar-flash {
  0%   { transform: scale(1);   filter: brightness(1); }
  30%  { transform: scale(1.08); filter: brightness(1.4) saturate(1.3); }
  60%  { transform: scale(0.98); }
  100% { transform: scale(1);   filter: brightness(1); }
}
.avatar-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 28px;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  border-radius: 50%;
}
.avatar-preview-wrap:hover .avatar-preview-overlay,
.avatar-preview-wrap.flash .avatar-preview-overlay { opacity: 1; }

/* ============== Browse (Grid) ============== */
.loc-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(236,72,153,0.15), rgba(139,92,246,0.15));
  border: 1px solid rgba(236,72,153,0.3);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.loc-banner.subtle {
  background: rgba(255,255,255,0.03);
  border-color: var(--border);
}
.loc-banner strong { color: var(--text); }
.loc-banner div { display: flex; flex-direction: column; gap: 2px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.grid-section { margin-bottom: 36px; }

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  perspective: 1500px;
}
.user-tile {
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .3s, box-shadow .3s;
  transform-style: preserve-3d;
}
.user-tile:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4), 0 0 0 1px rgba(236,72,153,0.3);
}
.tile-photo {
  position: relative;
  display: block;
  aspect-ratio: 1;
  background: var(--bg-1);
  overflow: hidden;
}
.tile-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.tile-fallback {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 64px;
  font-weight: 900;
}
.user-tile:hover .tile-img { transform: scale(1.05); }
.tile-distance {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
}
.tile-badge {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(236,72,153,0.4);
}
.tile-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.tile-body h3 { margin: 0 0 4px; font-size: 16px; }
.tile-body h3 a { color: var(--text); }
.tile-body h3 a:hover { color: #f9a8d4; }
.tile-bio { font-size: 13px; line-height: 1.5; margin: 4px 0 8px; min-height: 38px; }
.tile-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; min-height: 22px; }
.tag-sm {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(139,92,246,0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 999px;
  font-weight: 600;
}
.tile-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  margin-top: auto;
}
.tile-actions .btn { padding: 7px 8px; font-size: 12px; }
.tile-chat-btn { grid-column: 1; width: 100%; }
.tile-like-btn { font-size: 14px !important; }

.matches-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.match-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s, transform .2s;
}
.match-chip:hover { border-color: rgba(236,72,153,0.4); transform: translateY(-2px); text-decoration: none; }
.match-chip strong { display: block; font-size: 14px; }
.match-chip small { font-size: 11px; }

/* ============== Browse (Old list - kept for compat) ============== */
.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.section-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: '';
  width: 4px; height: 22px;
  background: linear-gradient(180deg, #ec4899, #8b5cf6);
  border-radius: 4px;
}

.card-list { display: flex; flex-direction: column; gap: 12px; perspective: 1500px; }
.user-card {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .25s, box-shadow .25s;
  transform-style: preserve-3d;
}
.user-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(236,72,153,0.6), transparent);
  opacity: 0;
  transition: opacity .3s;
}
.user-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.user-card:hover::before { opacity: 1; }
.user-card-body { flex: 1; }
.user-card-body h4 { margin: 0 0 4px; font-size: 16px; }
.user-card-body h4 a { color: var(--text); }
.user-card-body h4 a:hover { color: #f9a8d4; }
.user-card-body p { margin: 0; }
.user-card-actions { display: flex; gap: 8px; }
.badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(139,92,246,0.2));
  color: #f9a8d4;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  margin-inline-start: 6px;
  font-weight: 700;
  border: 1px solid rgba(236,72,153,0.3);
}
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, transform .2s;
}
.user-row:hover { border-color: var(--border-strong); transform: translateX(-3px); }
.user-row a { flex: 1; color: var(--text); font-weight: 600; }
.user-row a:hover { color: #f9a8d4; }

/* ============== Match ============== */
.match-header {
  display: flex;
  gap: 28px;
  align-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
.match-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(236,72,153,0.15), transparent 60%);
  pointer-events: none;
}
.match-header h1 { margin: 0 0 4px; font-size: 24px; }
.match-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ============== Chat ============== */
.chat-shell {
  padding: 0;
  overflow: hidden;
  position: relative;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 10, 38, 0.4);
}
.chat-head h3 { margin: 0; font-size: 16px; }
.chat-head h3 a { color: var(--text); }
.chat-log {
  height: 480px;
  overflow-y: auto;
  padding: 20px;
  background: rgba(7, 6, 26, 0.4);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg { display: flex; flex-direction: column; max-width: 75%; animation: msg-in .3s ease; }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg .bubble {
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}
.msg.mine { align-self: flex-start; }
.msg.mine .bubble {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(236,72,153,0.3);
}
.msg.theirs { align-self: flex-end; }
.msg .ts { font-size: 11px; color: var(--muted); margin-top: 4px; }
.msg.mine .ts { text-align: start; }
.msg.theirs .ts { text-align: end; }
.chat-form {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: rgba(13, 10, 38, 0.4);
}
.chat-form input {
  flex: 1;
  font: inherit;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.chat-form input::placeholder { color: var(--muted); }
.chat-form input:focus { border-color: rgba(236,72,153,0.6); box-shadow: 0 0 0 4px rgba(236,72,153,0.15); }

/* ============== Game (legacy) ============== */
.game-shell { padding: 0; overflow: hidden; }
.game-area { padding: 28px; min-height: 200px; text-align: center; }
.game-area .empty p { color: var(--text-dim); margin-bottom: 18px; }
.game-panel { padding: 0 24px 24px; text-align: center; }

/* ============== Truth or Dare (modern, mobile-first) ============== */
.tod-body {
  background: linear-gradient(180deg, #0d0617 0%, #1a0a2e 100%);
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: 'Cairo', 'Inter', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tod-stage {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 0 env(safe-area-inset-bottom, 0);
}
.tod-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0) + 12px) 14px 12px;
  background: rgba(13, 6, 23, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tod-back, .tod-icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s, background .15s;
  flex: 0 0 auto;
}
.tod-back:hover, .tod-icon-btn:hover { background: rgba(255,255,255,0.14); transform: scale(1.05); }
.tod-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 17px;
  font-weight: 800;
}
.tod-emoji {
  font-size: 22px;
  filter: drop-shadow(0 0 6px rgba(236,72,153,0.5));
  animation: tod-emoji-spin 6s linear infinite;
}
@keyframes tod-emoji-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.tod-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 14px 24px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Hero (start) */
.tod-hero {
  margin: auto 0;
  text-align: center;
  padding: 30px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  animation: tod-fade-in .5s ease;
}
.tod-hero-emoji {
  font-size: 84px;
  filter: drop-shadow(0 8px 30px rgba(236,72,153,0.5));
  animation: tod-float 3s ease-in-out infinite;
}
@keyframes tod-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.tod-hero h1 {
  margin: 0;
  font-size: 32px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.tod-hero p { margin: 0; max-width: 360px; }
.tod-rules {
  display: flex; flex-direction: column; gap: 8px;
  margin: 16px 0 4px;
  width: 100%;
  max-width: 360px;
}
.tod-rule {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14px;
  text-align: right;
  font-weight: 600;
}
.tod-rule span:first-child { font-size: 22px; }

/* Score row */
.tod-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 4px;
  flex-wrap: wrap;
}
.score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
}
.score-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  min-width: 0;
  flex: 1 1 0;
  max-width: 160px;
  transition: all .25s;
}
.score-chip.mine {
  background: linear-gradient(135deg, rgba(236,72,153,0.15), rgba(139,92,246,0.15));
  border-color: rgba(236,72,153,0.4);
}
.score-chip.active {
  box-shadow: 0 0 0 2px rgba(236,72,153,0.5), 0 0 20px rgba(236,72,153,0.4);
  background: linear-gradient(135deg, rgba(236,72,153,0.25), rgba(139,92,246,0.25));
  border-color: rgba(236,72,153,0.7);
  transform: scale(1.03);
}
.score-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: #fff;
  flex: 0 0 auto;
  overflow: hidden;
}
.score-avatar img { width: 100%; height: 100%; object-fit: cover; }
.score-meta {
  display: flex; flex-direction: column; gap: 0; min-width: 0; flex: 1;
}
.score-meta strong {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}
.score-num {
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  line-height: 1;
}
.score-target {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  flex: 0 0 auto;
  font-weight: 600;
  max-width: 70px;
  line-height: 1.3;
}

/* Cards */
.tod-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  padding: 18px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: tod-fade-in .4s ease;
}
@keyframes tod-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Choose phase */
.tod-choose-card { text-align: center; }
.tod-prompt-mini {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #fda4af;
  background: rgba(244,63,94,0.15);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
  animation: tod-pulse 1.6s ease-in-out infinite;
}
@keyframes tod-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.05); opacity: 0.85; }
}
.tod-q {
  font-size: 28px;
  font-weight: 900;
  margin: 0 0 18px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.tod-cat-row {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 18px;
}
.tod-cat-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.tod-cat-pill:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.tod-cat-pill.active {
  background: linear-gradient(135deg, rgba(236,72,153,0.3), rgba(139,92,246,0.3));
  border-color: rgba(236,72,153,0.6);
  color: #fff;
  box-shadow: 0 0 12px rgba(236,72,153,0.3);
}
.tod-choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tod-choice {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 22px 14px;
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all .25s;
  -webkit-tap-highlight-color: transparent;
  min-height: 110px;
}
.tod-choice:hover { transform: translateY(-3px); }
.tod-choice:active { transform: translateY(0) scale(0.98); }
.tod-choice.truth {
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(139,92,246,0.12));
  border-color: rgba(139,92,246,0.4);
}
.tod-choice.truth:hover { box-shadow: 0 10px 30px rgba(139,92,246,0.3); }
.tod-choice.dare {
  background: linear-gradient(135deg, rgba(244,63,94,0.12), rgba(245,158,11,0.12));
  border-color: rgba(244,63,94,0.4);
}
.tod-choice.dare:hover { box-shadow: 0 10px 30px rgba(244,63,94,0.3); }
.tod-choice-emoji {
  font-size: 44px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
  line-height: 1;
}
.tod-choice-text { display: flex; flex-direction: column; gap: 2px; }
.tod-choice-text strong { font-size: 18px; font-weight: 900; }
.tod-choice-text small { font-size: 11px; color: var(--text-dim); font-weight: 600; }

/* Answer phase */
.tod-q-card { padding: 16px 18px; }
.tod-q-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.tod-q-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tod-q-tag.truth { background: rgba(139,92,246,0.2); color: #c4b5fd; }
.tod-q-tag.dare  { background: rgba(244,63,94,0.2); color: #fda4af; }
.tod-q-emoji { font-size: 14px; }
.tod-q-cat {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}
.tod-q-text {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.6;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  word-wrap: break-word;
  animation: tod-fade-in .4s ease;
}
.tod-q-actions { display: flex; justify-content: flex-end; }
.tod-mini-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.tod-mini-btn:hover:not(:disabled) { background: rgba(255,255,255,0.12); }
.tod-mini-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.tod-answer-card { padding: 14px 16px 16px; }
.tod-ans-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-dim);
}
.tod-ans-count { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tod-ans-wrap {
  position: relative;
  border-radius: 14px;
  background: rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.1);
  transition: border-color .2s, box-shadow .2s;
}
.tod-ans-wrap:focus-within {
  border-color: rgba(236,72,153,0.6);
  box-shadow: 0 0 0 4px rgba(236,72,153,0.15);
}
#answer-textarea {
  width: 100%;
  min-height: 96px;
  max-height: 200px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
  box-sizing: border-box;
  display: block;
  -webkit-appearance: none;
  appearance: none;
}
#answer-textarea::placeholder { color: var(--text-dim); }
.tod-ans-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 12px;
}
.tod-ans-actions .btn {
  min-width: 120px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 800;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.tod-ans-actions .btn.primary {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  box-shadow: 0 6px 18px rgba(236,72,153,0.4);
}
.tod-ans-actions .btn:active { transform: scale(0.97); }

/* Waiting phase */
.tod-waiting {
  text-align: center;
  padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.tod-wait-orb {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  position: relative;
  animation: tod-orb-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(236,72,153,0.5);
}
.tod-wait-orb::before, .tod-wait-orb::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%; border: 2px solid rgba(236,72,153,0.4);
  animation: tod-orb-ring 2s ease-out infinite;
}
.tod-wait-orb::after { animation-delay: 1s; }
@keyframes tod-orb-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
@keyframes tod-orb-ring {
  from { transform: scale(1); opacity: 1; }
  to   { transform: scale(1.8); opacity: 0; }
}
.tod-wait-title { margin: 0; font-size: 18px; font-weight: 700; }
.tod-wait-title strong { color: #fda4af; }

/* Last answer card */
.tod-last {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 14px;
  animation: tod-fade-in .4s ease;
}
.tod-last-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.tod-last-tag.truth { background: rgba(139,92,246,0.2); color: #c4b5fd; }
.tod-last-tag.dare  { background: rgba(244,63,94,0.2); color: #fda4af; }
.tod-last-q {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}
.tod-last-a {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* Modal */
.tod-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: tod-modal-in .25s ease;
}
@keyframes tod-modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.tod-modal-card {
  background: linear-gradient(180deg, #1a0a2e 0%, #0d0617 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: tod-modal-pop .3s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes tod-modal-pop {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.tod-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tod-modal-head strong { font-size: 16px; font-weight: 800; }
.tod-modal-body {
  flex: 1; overflow-y: auto;
  padding: 14px 20px 20px;
  -webkit-overflow-scrolling: touch;
}
.hist-item {
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  text-align: right;
}
.hist-item.mine { border-color: rgba(236,72,153,0.3); }
.hist-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}
.hist-tag {
  display: inline-block;
  font-size: 10px; font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}
.hist-tag.truth { background: rgba(139,92,246,0.2); color: #c4b5fd; }
.hist-tag.dare  { background: rgba(244,63,94,0.2); color: #fda4af; }
.hist-who { font-size: 12px; font-weight: 700; color: var(--text-dim); }
.hist-q { margin: 0 0 4px; font-size: 13px; color: var(--text-dim); font-weight: 600; }
.hist-a { margin: 0; font-size: 14px; line-height: 1.5; }

/* Win modal */
.tod-win-card {
  position: relative;
  background: linear-gradient(180deg, #1a0a2e 0%, #0d0617 100%);
  border: 2px solid rgba(236,72,153,0.5);
  border-radius: 22px;
  padding: 30px 26px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  overflow: hidden;
  animation: tod-modal-pop .4s cubic-bezier(.34, 1.56, .64, 1);
}
.tod-confetti {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.tod-confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px; height: 14px;
  border-radius: 2px;
  animation: tod-confetti-fall linear forwards;
}
@keyframes tod-confetti-fall {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}
.tod-trophy {
  font-size: 80px;
  margin-bottom: 8px;
  animation: tod-trophy-bounce 1.2s ease infinite;
  filter: drop-shadow(0 8px 24px rgba(245,158,11,0.5));
}
@keyframes tod-trophy-bounce {
  0%, 100% { transform: scale(1) translateY(0); }
  50%      { transform: scale(1.08) translateY(-6px); }
}
.tod-win-card h2 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.tod-win-card .muted { margin-bottom: 18px; }
.tod-win-actions { display: flex; flex-direction: column; gap: 10px; }

/* Shake */
.tod-ans-wrap.shake { animation: tod-shake .4s ease; }
@keyframes tod-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Mobile breakpoints */
@media (max-width: 480px) {
  .tod-main { padding: 10px 10px 20px; gap: 12px; }
  .tod-card { padding: 14px; border-radius: 18px; }
  .tod-q { font-size: 22px; }
  .tod-q-text { font-size: 16px; }
  .tod-choice { padding: 16px 10px; min-height: 100px; }
  .tod-choice-emoji { font-size: 36px; }
  .tod-choice-text strong { font-size: 16px; }
  .score-chip { padding: 4px 10px 4px 4px; }
  .score-avatar { width: 28px; height: 28px; font-size: 12px; }
  .score-meta strong { font-size: 11px; max-width: 70px; }
  .score-num { font-size: 14px; }
  .score-target { font-size: 9px; max-width: 56px; }
  .tod-ans-actions .btn { min-width: 100px; min-height: 46px; font-size: 14px; }
  .tod-hero h1 { font-size: 26px; }
  .tod-hero-emoji { font-size: 70px; }
}

@media (max-width: 360px) {
  .tod-choice-row { grid-template-columns: 1fr; }
  .tod-choice { flex-direction: row; gap: 12px; min-height: auto; padding: 12px 14px; }
  .tod-choice-emoji { font-size: 30px; }
  .tod-q { font-size: 20px; }
}

/* Landscape on small phones */
@media (max-height: 500px) and (orientation: landscape) {
  .tod-stage { min-height: 100dvh; }
  .tod-head { padding: 8px 14px; }
  .tod-main { padding: 8px; gap: 8px; }
  .tod-card { padding: 12px; }
  .tod-q { font-size: 20px; margin-bottom: 8px; }
  .tod-choice { min-height: 80px; padding: 10px; }
}

/* Larger screens: more breathing room */
@media (min-width: 768px) {
  .tod-stage { padding: 0 24px; }
  .tod-main { padding: 20px 24px 40px; }
  .tod-card { padding: 24px; border-radius: 24px; }
  .tod-q { font-size: 32px; }
  .tod-q-text { font-size: 20px; }
  .tod-choice { padding: 28px 18px; }
  .tod-choice-emoji { font-size: 52px; }
}

/* ============== 404 ============== */
.notfound {
  text-align: center;
  padding: 80px 20px;
}
.notfound h1 {
  font-size: 96px;
  margin: 0;
  background: linear-gradient(135deg, #ec4899, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
}

/* ============== Footer ============== */
.footer {
  text-align: center;
  color: var(--muted);
  padding: 20px 16px 30px;
  font-size: 13px;
}

/* ============== Reduced motion ============== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============== Notifications ============== */
.bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 18px;
  color: var(--text-dim);
  transition: background .2s, transform .2s;
}
.bell:hover { background: var(--surface); transform: scale(1.05); text-decoration: none; }
.bell.shake { animation: bell-shake .6s ease; }
@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(6deg); }
}
.bell-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: linear-gradient(135deg, #f43f5e, #ec4899);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0d0a26;
  box-shadow: 0 0 12px rgba(244,63,94,0.5);
  animation: badge-pop .3s ease;
}
@keyframes badge-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notif-item { border-radius: 12px; overflow: hidden; transition: background .2s, transform .2s; }
.notif-item:hover { transform: translateX(-3px); }
.notif-item.unread { background: linear-gradient(135deg, rgba(236,72,153,0.08), rgba(139,92,246,0.08)); border: 1px solid rgba(236,72,153,0.2); }
.notif-item.read { background: var(--surface); border: 1px solid var(--border); opacity: .7; }
.notif-item.read:hover { opacity: 1; }
.notif-link {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  align-items: center;
  color: var(--text);
}
.notif-link:hover { text-decoration: none; }
.notif-icon {
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(139,92,246,0.2));
  border: 1px solid rgba(236,72,153,0.3);
  border-radius: 12px;
  flex: 0 0 auto;
}
.notif-body { flex: 1; min-width: 0; }
.notif-body strong { display: block; font-size: 14px; }
.notif-body p { margin: 2px 0 4px; }
.dot {
  width: 10px; height: 10px;
  background: linear-gradient(135deg, #f43f5e, #ec4899);
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 8px rgba(244,63,94,0.6);
}

/* ============== Toast ============== */
.toast-stack {
  position: fixed;
  top: 90px;
  left: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: rgba(13, 10, 38, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: toast-in .35s cubic-bezier(.2,.7,.2,1);
  cursor: pointer;
  transition: transform .2s, border-color .2s;
}
.toast:hover { transform: translateX(4px); border-color: rgba(236,72,153,0.4); }
.toast.removing { animation: toast-out .3s ease forwards; }
.toast .ti {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, rgba(236,72,153,0.3), rgba(139,92,246,0.3));
  border-radius: 10px;
  flex: 0 0 auto;
}
.toast .tc { flex: 1; min-width: 0; }
.toast .tc strong { display: block; font-size: 14px; margin-bottom: 2px; }
.toast .tc p { margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.4; }
.toast.match   { border-color: rgba(236,72,153,0.4); }
.toast.message { border-color: rgba(6,182,212,0.4); }
.toast.game_turn { border-color: rgba(139,92,246,0.4); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-30px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(-30px) scale(0.95); }
}

/* ============== Fullscreen Chat ============== */
.chat-fullscreen-body {
  background: var(--bg-0) !important;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.chat-fs {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 900px;
  margin: 0 auto;
  background: rgba(7, 6, 26, 0.6);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-inline: 1px solid var(--border);
  position: relative;
}
.chat-fs-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(13, 10, 38, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  flex: 0 0 auto;
}
.chat-fs-head strong { display: block; font-size: 15px; }
.chat-fs-head small { font-size: 11px; }
.chat-fs-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: background .2s, transform .15s, border-color .2s;
  text-decoration: none;
  flex: 0 0 auto;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--border-strong); text-decoration: none; }
.icon-btn:active { transform: scale(0.95); }
.icon-btn.primary {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(236,72,153,0.35);
}
.icon-btn.danger { color: #fda4af; }

.chat-fs-log {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat-fs-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(13, 10, 38, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  align-items: center;
  flex: 0 0 auto;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.chat-fs-form input[type="text"] {
  flex: 1;
  font: inherit;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  min-width: 0;
}
.chat-fs-form input[type="text"]::placeholder { color: var(--muted); }
.chat-fs-form input[type="text"]:focus { border-color: rgba(236,72,153,0.6); box-shadow: 0 0 0 4px rgba(236,72,153,0.15); }

/* ===== Modern Voice Recorder ===== */
.voice-btn {
  position: relative;
  transition: all .2s ease;
}
.voice-btn.recording {
  background: linear-gradient(135deg, #f43f5e, #ec4899) !important;
  color: #fff !important;
  transform: scale(1.12);
  box-shadow: 0 0 0 0 rgba(244,63,94,0.6);
  animation: voice-pulse-ring 1.4s ease-in-out infinite;
}
.voice-btn.recording .voice-btn-icon {
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.6));
}
@keyframes voice-pulse-ring {
  0%   { box-shadow: 0 0 0 0   rgba(244,63,94,0.7); }
  70%  { box-shadow: 0 0 0 14px rgba(244,63,94,0); }
  100% { box-shadow: 0 0 0 0   rgba(244,63,94,0); }
}

.recorder-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(244,63,94,0.18), rgba(139,92,246,0.18));
  border-top: 1px solid rgba(244,63,94,0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  flex: 0 0 auto;
  animation: slide-up .25s ease;
  min-height: 64px;
}
.recorder-bar #rec-cancel {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(244,63,94,0.18);
  color: #fda4af;
  border: 1px solid rgba(244,63,94,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  cursor: pointer;
  flex: 0 0 auto;
}
.rec-content {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.rec-indicator {
  display: flex; align-items: center; gap: 8px;
  color: #fda4af; font-weight: 700; font-size: 13px;
}
.rec-dot {
  width: 10px; height: 10px;
  background: #f43f5e;
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(244,63,94,0.8);
}
.rec-waveform {
  height: 32px;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.rec-waveform canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.rec-right {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  flex: 0 0 auto;
}
.rec-timer {
  font-weight: 800; color: #fff;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  letter-spacing: 0.5px;
}
.rec-hint {
  font-size: 10px; color: #fda4af;
  font-weight: 600;
  white-space: nowrap;
  transition: color .2s;
}
.rec-hint.cancel { color: #fb7185; }
.rec-send {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(236,72,153,0.5);
  transition: transform .15s;
  flex: 0 0 auto;
}
.rec-send:hover { transform: scale(1.08); }
.rec-send:disabled { opacity: .5; cursor: not-allowed; }

@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 1;   }
  50%      { transform: scale(1.4); opacity: 0.55;}
}
@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ===== Recorder lock overlay ===== */
.rec-lock-overlay {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  animation: rec-lock-in .25s ease;
}
.rec-lock-card {
  background: rgba(20, 12, 30, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(244,63,94,0.4);
  border-radius: 24px;
  padding: 14px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(244,63,94,0.25);
  display: flex; flex-direction: column; gap: 8px;
  min-width: 280px;
}
.rec-lock-row {
  display: flex; align-items: center; gap: 14px;
}
.rec-lock-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  transition: transform .15s;
}
.rec-lock-btn:active { transform: scale(0.92); }
.rec-lock-btn.danger { background: rgba(244,63,94,0.2); color: #fda4af; border: 1px solid rgba(244,63,94,0.4); }
.rec-lock-btn.primary { background: linear-gradient(135deg, #ec4899, #8b5cf6); color: #fff; box-shadow: 0 6px 18px rgba(236,72,153,0.5); }
.rec-lock-waveform {
  flex: 1; height: 38px;
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
  overflow: hidden;
}
.rec-lock-waveform canvas { display: block; width: 100%; height: 100%; }
.rec-lock-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: #fda4af; font-weight: 700;
}
.rec-lock-dot {
  width: 8px; height: 8px;
  background: #f43f5e;
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}
#lock-timer { font-variant-numeric: tabular-nums; color: #fff; font-size: 14px; }
.rec-lock-hint { margin-right: auto; opacity: 0.8; }

@keyframes rec-lock-in {
  from { transform: translate(-50%, 30px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}
}

/* Media message styles */
.msg .bubble.media {
  padding: 4px;
  overflow: hidden;
  position: relative;
}
.msg .bubble.media.expired {
  padding: 14px 18px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-style: italic;
  text-align: center;
}
.msg .bubble.media.image img {
  display: block;
  max-width: 280px;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
  transition: opacity .3s;
}
.msg .bubble.media.image img.expired-img {
  opacity: 0.1;
  filter: blur(20px);
}
.msg .bubble.media.video {
  position: relative;
  background: #000;
}
.msg .bubble.media.video video {
  display: block;
  max-width: 280px;
  max-height: 320px;
  width: 100%;
  border-radius: 12px;
  background: #000;
}
.msg .bubble.media.video .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 36px;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  transition: opacity .2s;
}
.msg .bubble.media.video.playing .play-overlay { opacity: 0; pointer-events: none; }
.ephemeral-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
  backdrop-filter: blur(8px);
  z-index: 2;
}
.countdown-ring {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  border: 3px solid rgba(244,63,94,0.8);
  animation: ring-tick linear forwards;
}
@keyframes ring-tick {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Caption under media */
.msg .bubble.caption {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 500;
}

/* ===== Audio player (Telegram-style) ===== */
.msg .bubble.media.audio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  min-width: 230px;
  max-width: 280px;
  border-radius: 22px;
}
.msg.theirs .bubble.media.audio { background: rgba(255,255,255,0.08); }
.msg.mine    .bubble.media.audio { background: linear-gradient(135deg, rgba(236,72,153,0.85), rgba(139,92,246,0.85)); }

.audio-play {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  border: none;
  font-size: 14px;
  cursor: pointer;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(236,72,153,0.4);
  transition: transform .15s;
}
.audio-play:hover { transform: scale(1.06); }
.audio-play:active { transform: scale(0.95); }
.bubble.media.audio.playing .audio-play {
  background: linear-gradient(135deg, #f43f5e, #ec4899);
  animation: audio-pulse 1.6s ease-in-out infinite;
}
.audio-play-icon {
  font-size: 13px;
  margin-left: 2px;
  display: inline-block;
  line-height: 1;
}
.bubble.media.audio.playing .audio-play-icon { margin-left: 0; }
@keyframes audio-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(244,63,94,0.4); }
  50%      { box-shadow: 0 4px 22px rgba(244,63,94,0.8); }
}

.audio-wave {
  flex: 1; min-width: 0;
  position: relative;
  height: 32px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.audio-wave-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 1.5px;
  padding: 0 2px;
  direction: ltr;
}
.wave-bar {
  flex: 1;
  height: var(--h, 30%);
  background: rgba(255,255,255,0.4);
  border-radius: 2px;
  min-height: 3px;
  transition: background .15s, height .12s;
  transform-origin: center;
}
.msg.theirs .bubble.media.audio .wave-bar { background: rgba(255,255,255,0.35); }
.msg.mine    .bubble.media.audio .wave-bar { background: rgba(255,255,255,0.55); }
.bubble.media.audio.playing .wave-bar { animation: wave-bar 1s ease-in-out infinite; }
.bubble.media.audio.playing .wave-bar.played { background: #fff; }
@keyframes wave-bar {
  0%, 100% { transform: scaleY(0.6); }
  50%      { transform: scaleY(1.1); }
}
.audio-wave-progress {
  position: absolute;
  top: 0; bottom: 0;
  inset-inline-start: 0;
  width: 0;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 1.5px;
  padding: 0 2px;
  direction: ltr;
}
.audio-wave-progress::before {
  content: '';
  position: absolute;
  inset-inline-end: 0;
  top: 0; bottom: 0;
  width: 2px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255,255,255,0.8);
}
.audio-wave-progress .wave-bar { background: #fff !important; }

.audio-meta {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  flex: 0 0 auto;
  position: relative;
  padding: 0 2px;
}
.audio-duration {
  font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: inherit;
  opacity: 0.9;
  min-width: 30px;
  text-align: center;
}
.audio-speed {
  font-size: 10px; font-weight: 800;
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 2px 6px;
  cursor: pointer;
  min-width: 26px;
  transition: background .15s;
}
.audio-speed:hover { background: rgba(255,255,255,0.32); }
.audio-unread-dot {
  position: absolute;
  top: -3px; inset-inline-end: -3px;
  width: 10px; height: 10px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.2), 0 0 8px rgba(56,189,248,0.8);
  animation: pulse 1.5s ease-in-out infinite;
}

/* Media Preview Modal */
.media-preview {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in .2s ease;
  padding: 20px;
}
.media-preview[hidden] { display: none; }
.media-preview-inner {
  width: 100%;
  max-width: 540px;
  background: rgba(13, 10, 38, 0.95);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  animation: scale-in .25s cubic-bezier(.2,.7,.2,1);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.mp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.mp-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #000;
  min-height: 240px;
  max-height: 50vh;
  overflow: hidden;
}
.mp-body img,
.mp-body video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  display: block;
}
.mp-body video { width: 100%; }
.mp-timer {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  background: rgba(7, 6, 26, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mp-label { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.timer-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.timer-pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}
.timer-pill:hover { background: rgba(255,255,255,0.1); }
.timer-pill.active {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(236,72,153,0.4);
}
#mp-caption {
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
#mp-caption::placeholder { color: var(--muted); }
#mp-caption:focus { border-color: rgba(236,72,153,0.6); box-shadow: 0 0 0 3px rgba(236,72,153,0.15); }

/* View ephemeral (full screen) */
.view-ephemeral {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.view-ephemeral img,
.view-ephemeral video {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
}
.view-ephemeral .ve-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.view-ephemeral .ve-timer {
  position: absolute;
  top: 20px; left: 20px;
  background: rgba(244,63,94,0.9);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ============== Report Dropdown ============== */
.report-dropdown { position: relative; }
.report-dropdown summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.report-dropdown summary::-webkit-details-marker { display: none; }
.report-form {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  margin-top: 8px;
  width: 280px;
  background: rgba(13, 10, 38, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  box-shadow: var(--shadow-lg);
}
.report-form select,
.report-form textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  outline: none;
  font-size: 13px;
}
.report-form select option { background: #15113a; color: var(--text); }
.report-form textarea { resize: vertical; min-height: 50px; font-family: inherit; }
.report-form button { margin-top: 4px; }

/* ============== Games Hub ============== */
.hub-hero {
  text-align: center;
  padding: 40px 20px 20px;
}
.hub-hero h1 {
  font-size: 36px;
  margin: 0 0 8px;
  background: linear-gradient(135deg, #fff 0%, #ec4899 50%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
}
.hub-hero p { color: var(--text-dim); margin: 0; }

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 30px;
  perspective: 1500px;
}
.game-card {
  position: relative;
  display: block;
  padding: 28px 24px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform .4s cubic-bezier(.2,.7,.2,1), border-color .3s, box-shadow .3s;
}
.game-card:hover {
  transform: translateY(-6px) rotateX(2deg);
  border-color: var(--card-color, var(--border-strong));
  box-shadow: 0 30px 60px rgba(0,0,0,0.4), 0 0 0 1px var(--card-color);
  text-decoration: none;
}
.game-card-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, var(--card-color), transparent 60%);
  opacity: 0.15;
  pointer-events: none;
  transition: opacity .3s;
}
.game-card:hover .game-card-bg { opacity: 0.3; }
.game-icon {
  font-size: 56px;
  margin-bottom: 16px;
  display: inline-block;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
  transition: transform .3s;
}
.game-card:hover .game-icon { transform: scale(1.1) rotate(-5deg); }
.game-card h3 { margin: 0 0 8px; font-size: 20px; }
.game-card .game-body p { margin: 0 0 16px; line-height: 1.5; }
.game-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.game-mode {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.game-mode.solo { background: rgba(6,182,212,0.15); color: #67e8f9; border: 1px solid rgba(6,182,212,0.3); }
.game-mode.multi { background: rgba(139,92,246,0.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.3); }
.game-best { font-size: 12px; color: var(--text-dim); }
.game-best strong { color: var(--text); }
.game-play {
  display: inline-block;
  font-weight: 800;
  color: var(--card-color, var(--primary));
  font-size: 14px;
}

/* ============== Game Pages (Common) ============== */
.game-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 0 40px;
}
.game-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  margin-bottom: 16px;
}
.game-head h1 {
  flex: 1;
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.game-stats { display: flex; gap: 10px; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 14px;
  min-width: 80px;
}
.stat-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 16px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

.game-stage {
  background: rgba(13, 10, 38, 0.5);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  position: relative;
  overflow: hidden;
}
.game-stage::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ec4899, #8b5cf6, transparent);
}
.game-controls {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.game-win {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fade-in .25s ease;
}
.game-win[hidden] { display: none; }
.win-card {
  background: rgba(13, 10, 38, 0.95);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: scale-in .35s cubic-bezier(.2,.7,.2,1);
}
.win-emoji { font-size: 80px; margin-bottom: 12px; }
.win-card h2 { margin: 0 0 10px; font-size: 28px; }
.win-card p { margin: 0 0 20px; color: var(--text-dim); }
.win-card .btn { margin: 4px; }

/* ============== Memory Match ============== */
.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 480px;
  perspective: 1200px;
}
.mem-card {
  aspect-ratio: 1;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  border-radius: 12px;
}
.mem-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(.4,.2,.2,1.2);
}
.mem-card.flipped .mem-inner,
.mem-card.matched .mem-inner {
  transform: rotateY(180deg);
}
.mem-face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.mem-back {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  font-size: 28px;
}
.mem-front {
  background: rgba(255,255,255,0.05);
  transform: rotateY(180deg);
}
.mem-card.matched .mem-front {
  background: linear-gradient(135deg, rgba(16,185,129,0.2), rgba(6,182,212,0.2));
  border-color: rgba(16,185,129,0.4);
  box-shadow: 0 0 20px rgba(16,185,129,0.3);
}
.mem-card:active .mem-inner { transform: scale(0.95); }
.mem-card.flipped:active .mem-inner { transform: rotateY(180deg) scale(0.95); }

.memory-info {
  display: flex;
  gap: 18px;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
}
.memory-info strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ============== Reaction Test ============== */
.reaction-stage {
  width: 100%;
  max-width: 560px;
  height: 320px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #312e81);
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
  -webkit-user-select: none;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.reaction-stage.wait { background: linear-gradient(135deg, #b91c1c, #dc2626); }
.reaction-stage.ready { background: linear-gradient(135deg, #059669, #10b981); }
.reaction-stage.soon { background: linear-gradient(135deg, #b91c1c, #dc2626); }
.reaction-content { color: #fff; }
.reaction-state { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.reaction-sub { font-size: 14px; opacity: 0.85; }

/* ============== Snake ============== */
#snakeCanvas {
  border-radius: var(--radius);
  background: #0d0a26;
  max-width: 100%;
  height: auto;
  display: block;
}
.snake-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13,10,38,0.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  border-radius: var(--radius-lg);
  animation: fade-in .3s ease;
}
.snake-overlay[hidden] { display: none; }
.snake-overlay-inner { text-align: center; }
.snake-overlay h2 { margin: 8px 0; font-size: 26px; }
.snake-info { display: flex; gap: 14px; align-items: center; }
.snake-info strong { color: var(--text); font-variant-numeric: tabular-nums; font-size: 18px; }

/* ============== Tic-Tac-Toe ============== */
.ttt-lobby h2 { margin: 0 0 8px; font-size: 22px; }
.opp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 20px;
  width: 100%;
}
.opp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.opp-card:hover {
  transform: translateY(-3px);
  border-color: rgba(139,92,246,0.4);
  box-shadow: 0 12px 30px rgba(139,92,246,0.2);
}
.opp-card strong { font-size: 14px; }
.opp-challenge { width: 100%; }

.ttt-stage { padding: 20px; min-height: 380px; }
.ttt-status {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1;
}
.ttt-cell {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 56px;
  font-weight: 900;
  color: var(--text);
  cursor: pointer;
  transition: background .2s, transform .15s, border-color .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.ttt-cell:hover:not(.taken) {
  background: rgba(255,255,255,0.08);
  border-color: var(--border-strong);
}
.ttt-cell:active:not(.taken) { transform: scale(0.95); }
.ttt-cell.x { color: #ec4899; }
.ttt-cell.o { color: #06b6d4; }
.ttt-cell.win {
  background: linear-gradient(135deg, rgba(16,185,129,0.3), rgba(6,182,212,0.3));
  border-color: rgba(16,185,129,0.5);
  animation: win-pulse 1s ease infinite;
}
@keyframes win-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

/* ============== Game Fullscreen Layout ============== */
.game-fs-body {
  background: var(--bg-0) !important;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: filter .3s;
}
.game-fs-body.blurred { filter: blur(20px) brightness(0.3); }
.game-fs-body.hide-on-shot > * { opacity: 0 !important; transition: opacity .1s; }
.game-fs-body .wm-layer { display: none !important; }

.no-select, .no-select * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.game-fs {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.game-fs-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(13, 10, 38, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  z-index: 10;
}
.game-fs-head h1 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-fs-stats {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 10px;
  min-width: 56px;
  flex-shrink: 0;
}
.stat-pill span {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-pill strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.game-fs-foot {
  padding: 14px 18px;
  text-align: center;
  background: rgba(13, 10, 38, 0.5);
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.game-fs-foot p { margin: 0; }

/* Memory fullscreen */
.memory-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}
.memory-stage .memory-board {
  width: 100%;
  max-width: 480px;
}

/* Reaction fullscreen */
.reaction-fs .reaction-stage {
  flex: 1 1 auto;
  height: auto;
  min-height: 280px;
  max-width: 560px;
  margin: 20px auto;
  width: calc(100% - 40px);
}

/* Snake fullscreen */
.snake-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 12px;
  overflow: hidden;
  min-height: 0;
}
#snakeCanvas {
  border-radius: var(--radius);
  background: #0d0a26;
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: none;
}
.snake-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13,10,38,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  border-radius: 0;
  animation: fade-in .3s ease;
}
.snake-overlay[hidden] { display: none; }
.snake-overlay-inner { text-align: center; }
.snake-overlay h2 { margin: 8px 0; font-size: 26px; }
.snake-paused {
  position: absolute;
  inset: 0;
  background: rgba(13,10,38,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  z-index: 4;
  color: #fff;
  border-radius: var(--radius);
}

/* D-Pad */
.dpad-wrap {
  padding: 12px 18px 18px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}
.dpad {
  display: grid;
  grid-template-columns: 60px 60px 60px;
  grid-template-rows: 60px 60px 60px;
  gap: 6px;
}
.dpad-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s, transform .1s, border-color .15s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.dpad-btn:hover { background: rgba(255,255,255,0.1); }
.dpad-btn:active { transform: scale(0.93); background: rgba(236,72,153,0.2); border-color: rgba(236,72,153,0.5); }
.dpad-btn.up    { grid-column: 2; grid-row: 1; }
.dpad-btn.left  { grid-column: 1; grid-row: 2; }
.dpad-btn.center {
  grid-column: 2; grid-row: 2;
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(236,72,153,0.2));
  border-color: rgba(139,92,246,0.4);
  font-size: 18px;
}
.dpad-btn.right { grid-column: 3; grid-row: 2; }
.dpad-btn.down  { grid-column: 2; grid-row: 3; }
.dpad-side { display: flex; flex-direction: column; gap: 8px; }

/* Tic-Tac-Toe fullscreen */
.ttt-fs .ttt-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 0;
}
.ttt-fs .ttt-status {
  margin-bottom: 18px;
  font-size: 18px;
}
.ttt-fs .ttt-board {
  width: 100%;
  max-width: 360px;
}

/* Watermark layer */
.wm-layer {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  overflow: hidden;
}
.wm-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  transform: rotate(-30deg);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  padding: 0 8px;
}

/* ============== Multi-Games Lobby ============== */
.lobby-fs .lobby-stage {
  flex: 1 1 auto;
  padding: 20px;
  overflow-y: auto;
  text-align: center;
}
.lobby-fs .lobby-stage h2 { margin: 0 0 6px; font-size: 22px; }
.lobby-fs .lobby-stage .muted { margin-bottom: 16px; display: block; }

/* ============== RPS (Rock Paper Scissors) ============== */
.rps-fs .rps-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.rps-versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  width: 100%;
  max-width: 480px;
}
.rps-side { text-align: center; }
.rps-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 600;
}
.rps-pick {
  font-size: 80px;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 2px solid var(--border);
  border-radius: 50%;
  margin: 0 auto;
  transition: transform .3s, border-color .3s;
}
.rps-pick:not(:empty) {
  background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(139,92,246,0.2));
  border-color: rgba(236,72,153,0.5);
  animation: pop-in .4s cubic-bezier(.2,.7,.2,1.4);
}
@keyframes pop-in {
  from { transform: scale(0.5) rotate(-30deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
.rps-vs {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary);
  text-shadow: 0 0 20px rgba(236,72,153,0.5);
}
.rps-status {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding: 10px 16px;
  flex: 0 0 auto;
}
.rps-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 12px 18px;
  flex: 0 0 auto;
}
.rps-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 8px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform .15s, background .2s, border-color .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.rps-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--border-strong); }
.rps-btn:active { transform: scale(0.95); }
.rps-btn:disabled { opacity: .4; cursor: not-allowed; }
.rps-emoji { font-size: 44px; }
.rps-name { font-size: 13px; font-weight: 700; }
.rps-next {
  padding: 12px 18px;
  text-align: center;
  flex: 0 0 auto;
}

/* ============== Connect 4 ============== */
.c4-fs { padding-bottom: 0; }
.c4-status {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding: 10px 16px;
  flex: 0 0 auto;
}
.c4-arrows {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 0 14px 10px;
  flex: 0 0 auto;
  transition: opacity .2s;
}
.c4-arrow {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 22px;
  padding: 8px 0;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.c4-arrow:hover { background: rgba(236,72,153,0.2); }
.c4-arrow:active { transform: scale(0.9); }
.c4-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 14px;
  background: linear-gradient(135deg, #1e3a8a, #312e81);
  border-radius: 16px 16px 0 0;
  margin: 0 14px;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.4);
  flex: 0 0 auto;
  max-width: calc(100vw - 28px);
}
.c4-cell {
  aspect-ratio: 1;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
}
.c4-disc {
  width: 80%;
  height: 80%;
  border-radius: 50%;
  background: transparent;
  transition: background .3s, transform .3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.c4-disc.red {
  background: linear-gradient(135deg, #f43f5e, #ec4899);
  animation: drop-in .4s cubic-bezier(.4,1.4,.6,1);
}
.c4-disc.yellow {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  animation: drop-in .4s cubic-bezier(.4,1.4,.6,1);
}
.c4-disc.win {
  box-shadow: 0 0 16px 4px rgba(255,255,255,0.7), 0 0 30px rgba(255,255,255,0.4);
  animation: win-glow 1s ease infinite alternate;
}
@keyframes drop-in {
  from { transform: translateY(-200%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes win-glow {
  from { box-shadow: 0 0 16px 4px rgba(255,255,255,0.7); }
  to { box-shadow: 0 0 24px 6px rgba(255,255,255,1); }
}

/* ============== Word Chain ============== */
.wc-fs .wc-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 16px;
}
.wc-status {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
}
.wc-target {
  font-size: 64px;
  font-weight: 900;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wc-letter {
  display: inline-block;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  width: 100px;
  height: 100px;
  line-height: 100px;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(236,72,153,0.5);
  text-align: center;
  font-size: 56px;
  animation: pulse-letter 1.5s ease infinite;
}
@keyframes pulse-letter {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.wc-form {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 420px;
}
.wc-form input {
  flex: 1;
  font: inherit;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
  font-size: 18px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 1px;
}
.wc-form input:focus { border-color: rgba(236,72,153,0.6); }
.wc-form input:disabled { opacity: 0.4; }
.wc-error {
  color: #fda4af;
  font-size: 14px;
  font-weight: 600;
  min-height: 20px;
  text-align: center;
}
.wc-chain {
  background: rgba(13,10,38,0.5);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  flex: 0 0 auto;
  max-height: 140px;
  overflow-y: auto;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.wc-chain-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.wc-chain-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wc-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  animation: chip-in .3s ease;
}
.wc-chip.me {
  background: linear-gradient(135deg, rgba(236,72,153,0.3), rgba(139,92,246,0.3));
  border-color: rgba(236,72,153,0.5);
}
.wc-chip.opp {
  background: rgba(6,182,212,0.15);
  border-color: rgba(6,182,212,0.3);
}
@keyframes chip-in {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============== Snake Touch-Optimized ============== */
.snake-fs {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}
.snake-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(13, 10, 38, 0.6);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.snake-stats {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.snake-stats::-webkit-scrollbar { display: none; }
.snake-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 8px;
  min-width: 50px;
  flex-shrink: 0;
}
.snake-stat span {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.snake-stat strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.snake-stat.best strong { color: #fbbf24; }

.snake-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 8px;
  overflow: hidden;
  min-height: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#snakeCanvas {
  border-radius: var(--radius);
  background: #0d0a26;
  display: block;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.snake-flash {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(236,72,153,0.5), transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  z-index: 4;
  transition: transform .3s ease, opacity .3s ease;
}
.snake-flash.show {
  transform: translate(-50%, -50%) scale(2);
  opacity: 1;
  transition: transform .15s ease-out, opacity .15s ease-out;
}

.snake-overlay-btn {
  position: absolute;
  inset: 8px;
  background: rgba(13,10,38,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity .2s, transform .2s;
}
.snake-overlay-btn[hidden] { display: none; }
.snake-overlay-btn:active { transform: scale(0.98); }
.big-emoji { font-size: 72px; }
.big-label {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
}
.hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Floating D-pad with absolute positioning - RTL safe */
.dpad-fixed {
  position: absolute;
  bottom: 16px;
  inset-inline-end: 16px;
  width: 180px;
  height: 180px;
  z-index: 10;
  pointer-events: none;
}
.dpad-pos {
  position: absolute;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 50%;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s, border-color .15s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.dpad-pos:active {
  transform: scale(0.85);
  background: linear-gradient(135deg, rgba(236,72,153,0.4), rgba(139,92,246,0.4));
  border-color: rgba(236,72,153,0.6);
}
.dpad-pos.up    { top: 0;    left: 50%; transform: translateX(-50%); }
.dpad-pos.down  { bottom: 0; left: 50%; transform: translateX(-50%); }
.dpad-pos.left  { top: 50%; left: 0;   transform: translateY(-50%); }
.dpad-pos.right { top: 50%; right: 0;  transform: translateY(-50%); }
.dpad-pos.up:active    { transform: translateX(-50%) scale(0.85); }
.dpad-pos.down:active  { transform: translateX(-50%) scale(0.85); }
.dpad-pos.left:active  { transform: translateY(-50%) scale(0.85); }
.dpad-pos.right:active { transform: translateY(-50%) scale(0.85); }

.snake-controls-floating {
  position: absolute;
  bottom: 16px;
  inset-inline-start: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}
.ctrl-btn {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 50%;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  touch-action: manipulation;
}
.ctrl-btn:active { transform: scale(0.9); background: rgba(236,72,153,0.3); }
.ctrl-btn.playing { background: linear-gradient(135deg, #f43f5e, #ec4899); }

@media (max-width: 480px) {
  .dpad-fixed { width: 156px; height: 156px; }
  .dpad-pos { font-size: 20px; }
  .snake-controls-floating { bottom: 12px; inset-inline-start: 12px; }
  .ctrl-btn { width: 42px; height: 42px; font-size: 16px; }
}
@media (max-width: 380px) {
  .dpad-fixed { width: 138px; height: 138px; bottom: 10px; }
}

/* ============== Mobile tweaks ============== */
@media (max-width: 600px) {
  .topbar { top: 8px; padding: 0 12px; }
  .topbar-inner { padding: 0 12px; height: 56px; }
  .nav { gap: 6px; }
  .nav a, .link-btn { padding: 6px 10px; font-size: 14px; }
  .hero { padding: 50px 12px 30px; }
  .hero-stage { height: 160px; }
  .feature { padding: 18px; }
  .user-card { flex-wrap: wrap; }
  .user-card-actions { width: 100%; }
  .auth-card { padding: 28px 22px; }
  .toast-stack { left: 12px; right: 12px; max-width: none; }
  .bell { width: 36px; height: 36px; }
  .game-stage { padding: 18px; min-height: 280px; }
  .game-head h1 { font-size: 18px; }
  .mem-face { font-size: 28px; }
  .ttt-cell { font-size: 42px; border-radius: 10px; }
  .opp-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .game-card { padding: 20px; }
  .hub-hero { padding: 30px 12px 10px; }
  .hub-hero h1 { font-size: 28px; }
  .game-fs-head h1 { font-size: 16px; }
  .stat-pill { min-width: 48px; padding: 3px 8px; }
  .stat-pill strong { font-size: 13px; }
  .dpad { grid-template-columns: 56px 56px 56px; }
  .dpad-btn { font-size: 20px; }
  .users-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

/* ============== Floating Mobile Nav (pill, with hide toggle + FAB) ============== */
.floating-nav,
.bn-toggle { display: none; }

@media (max-width: 768px) {
  .topbar { display: none !important; }
  .container.main,
  .main { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0)) !important; }
  .toast-stack {
    top: 14px !important;
    bottom: auto !important;
    left: 12px !important;
    right: 12px !important;
    max-width: none !important;
  }

  /* Floating pill nav */
  .floating-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(14px + env(safe-area-inset-bottom, 0));
    margin: 0 auto;
    transform: translateY(0);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px;
    background: rgba(20, 12, 30, 0.78);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 22px;
    box-shadow:
      0 16px 40px rgba(0,0,0,0.5),
      0 0 0 1px rgba(255,255,255,0.05) inset,
      0 0 30px rgba(236,72,153,0.12);
    width: fit-content;
    max-width: calc(100vw - 24px);
    transition: transform .35s cubic-bezier(.4,1.4,.5,1), opacity .25s;
  }
  .floating-nav.hidden-bar {
    transform: translateY(calc(100% + 80px));
    opacity: 0;
    pointer-events: none;
  }

  .fn-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 6px 8px;
    min-width: 52px;
    min-height: 54px;
    border-radius: 16px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    transition: color .2s, background .25s, transform .15s;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    background: transparent;
    border: none;
    font-family: inherit;
    flex: 0 0 auto;
  }
  .fn-item:active { transform: scale(0.92); }
  .fn-icon {
    font-size: 20px;
    line-height: 1;
    display: inline-block;
    transition: transform .25s;
  }
  .fn-icon-wrap {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
  }
  .fn-avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    font-weight: 800;
    font-size: 11px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    object-fit: cover;
  }
  .fn-avatar.fallback { color: #fff; }
  .fn-label {
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0;
    margin-top: 1px;
    line-height: 1.1;
  }
  .fn-item.active {
    color: #fff;
  }
  .fn-item.active .fn-icon-wrap {
    background: linear-gradient(135deg, rgba(236,72,153,0.35), rgba(139,92,246,0.35));
    box-shadow: 0 0 12px rgba(236,72,153,0.4);
  }
  .fn-item.active .fn-icon { transform: scale(1.08); }
  .fn-item.active .fn-label { color: #fff; }

  /* The center notification button (FAB-like, raised) */
  .fn-item-fab {
    position: relative;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    min-width: 56px;
    min-height: 56px;
    border-radius: 18px;
    margin: -8px 2px;
    box-shadow: 0 6px 18px rgba(236,72,153,0.5);
    z-index: 2;
  }
  .fn-item-fab .fn-icon { font-size: 22px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
  .fn-item-fab .fn-label { color: #fff; font-weight: 800; }
  .fn-item-fab:active { transform: scale(0.94); }

  .fn-badge {
    position: absolute;
    top: 2px; inset-inline-end: 2px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #f43f5e, #be123c);
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(20,12,30,0.95);
    animation: bn-badge-pop .3s ease;
  }
  @keyframes bn-badge-pop {
    from { transform: scale(0.4); }
    60%  { transform: scale(1.2); }
    to   { transform: scale(1); }
  }

  /* Pulse ring on the FAB when there are unread notifications */
  .fn-pulse {
    position: absolute;
    inset: -2px;
    border-radius: 22px;
    pointer-events: none;
    border: 2px solid rgba(236,72,153,0.6);
    animation: fn-pulse 1.8s ease-out infinite;
  }
  .floating-nav:not(:has(#fnNotifBadge:not([hidden]))) .fn-pulse { display: none; }
  @keyframes fn-pulse {
    0%   { transform: scale(1);   opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
  }

  /* Hide/show toggle button (chevron above the bar) */
  .bn-toggle {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(78px + env(safe-area-inset-bottom, 0));
    margin: 0 auto;
    z-index: 59;
    width: 44px; height: 22px;
    background: rgba(20, 12, 30, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.12);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    transition: bottom .35s cubic-bezier(.4,1.4,.5,1), opacity .25s, transform .25s;
    line-height: 1;
  }
  .bn-toggle:active { transform: scale(0.92); }
  .bn-toggle.collapsed {
    bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
  }
  .bn-toggle-arrow {
    display: inline-flex;
    align-items: center; justify-content: center;
    transition: transform .3s;
    line-height: 1;
    width: 16px; height: 16px;
  }
  .bn-toggle-arrow::before {
    content: '';
    display: block;
    width: 8px; height: 8px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(2px, 2px);
  }
  .bn-toggle.collapsed .bn-toggle-arrow::before {
    transform: rotate(-135deg) translate(-2px, -2px);
  }

  /* Smaller phones — tighter bar */
  @media (max-width: 360px) {
    .floating-nav {
      padding: 5px;
      gap: 1px;
      border-radius: 18px;
    }
    .fn-item {
      min-width: 46px;
      min-height: 50px;
      padding: 5px 6px;
      border-radius: 14px;
    }
    .fn-icon { font-size: 18px; }
    .fn-icon-wrap { width: 24px; height: 24px; }
    .fn-avatar { width: 22px; height: 22px; font-size: 10px; }
    .fn-label { font-size: 8.5px; }
    .fn-item-fab {
      min-width: 50px;
      min-height: 50px;
      margin: -6px 1px;
    }
    .fn-item-fab .fn-icon { font-size: 20px; }
    .bn-toggle {
      width: 38px; height: 22px;
      bottom: calc(72px + env(safe-area-inset-bottom, 0));
    }
    .bn-toggle.collapsed { bottom: 12px; }
  }
  @media (max-width: 320px) {
    .fn-item { min-width: 42px; padding: 4px 4px; }
    .fn-label { font-size: 8px; }
  }
}

@media (min-width: 769px) {
  .floating-nav,
  .bn-toggle { display: none !important; }
}

/* Adjust content padding for mobile when bar is hidden */
@media (max-width: 768px) {
  body.nav-hidden .container.main,
  body.nav-hidden .main {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0)) !important;
  }
  body.nav-hidden .toast-stack {
    top: 14px !important;
  }
}

/* Chats page */
.chats-page { max-width: 720px; margin: 0 auto; padding: 12px 14px 30px; }
.chats-head { text-align: center; margin: 10px 0 18px; }
.chats-head h1 {
  margin: 0 0 4px;
  font-size: 26px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.chats-head p { font-size: 13px; margin: 0; }
.chat-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column;
  gap: 6px;
}
.chat-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  overflow: hidden;
  transition: background .2s, transform .15s, border-color .2s;
}
.chat-item.unread { background: rgba(236,72,153,0.08); border-color: rgba(236,72,153,0.3); }
.chat-item:active { transform: scale(0.98); }
.chat-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
}
.chat-avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  flex: 0 0 auto;
  object-fit: cover;
  overflow: hidden;
}
.chat-avatar.fallback { color: #fff; }
.chat-body { flex: 1; min-width: 0; }
.chat-row1 {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 4px;
}
.chat-name { font-size: 15px; font-weight: 800; }
.chat-time { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.chat-row2 {
  display: flex; align-items: center; gap: 8px;
  justify-content: space-between;
}
.chat-preview {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.chat-item.unread .chat-preview { color: var(--text); font-weight: 600; }
.chat-unread {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 22px; height: 22px;
  border-radius: 11px;
  padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(13,6,23,0.5);
}
.chats-empty {
  text-align: center;
  padding: 60px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.ce-emoji {
  font-size: 80px;
  filter: drop-shadow(0 4px 12px rgba(236,72,153,0.3));
  animation: ce-float 3s ease-in-out infinite;
}
@keyframes ce-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* Notification popup (shared) */
.notif-popup {
  position: fixed;
  z-index: 80;
  background: rgba(20, 12, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transition: opacity .2s, transform .2s;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.notif-popup.open { opacity: 1; transform: translateY(0) scale(1); }
@media (min-width: 769px) {
  .notif-popup {
    top: 70px;
    inset-inline-end: 20px;
    width: 380px;
    max-height: 70vh;
  }
}
@media (max-width: 768px) {
  .notif-popup {
    bottom: calc(82px + env(safe-area-inset-bottom, 0));
    inset-inline-start: 12px;
    inset-inline-end: 12px;
    max-height: 60vh;
    border-radius: 18px;
  }
}
.notif-popup-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}
.notif-popup-head strong { font-size: 15px; font-weight: 800; }
.notif-popup-actions { display: flex; align-items: center; gap: 8px; }
.notif-popup-actions .link-btn { font-size: 11px; }
.link-btn.sm { font-size: 11px; padding: 4px 8px; }
.notif-popup-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  transition: background .15s;
}
.notif-popup-close:hover { background: rgba(255,255,255,0.16); }
.notif-popup-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
}
.notif-popup-loading, .notif-popup-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.notif-popup-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
  position: relative;
  margin-bottom: 2px;
}
.notif-popup-item:hover, .notif-popup-item:active { background: rgba(255,255,255,0.06); }
.notif-popup-item.read { opacity: 0.65; }
.npi-icon {
  font-size: 22px;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.notif-popup-item.match .npi-icon { background: rgba(236,72,153,0.18); }
.notif-popup-item.message .npi-icon { background: rgba(59,130,246,0.18); }
.notif-popup-item.game_turn .npi-icon { background: rgba(139,92,246,0.18); }
.notif-popup-item.game_challenge .npi-icon { background: rgba(245,158,11,0.18); }
.notif-popup-item.broadcast .npi-icon { background: rgba(34,197,94,0.18); }
.npi-body {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1; min-width: 0;
}
.npi-body strong {
  font-size: 13px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.npi-body span {
  font-size: 12px; color: var(--text-dim);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word;
}
.npi-body small {
  font-size: 10px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.npi-dot {
  width: 8px; height: 8px;
  background: #ec4899;
  border-radius: 50%;
  box-shadow: 0 0 8px #ec4899;
  flex: 0 0 auto;
  margin-top: 6px;
  animation: bn-badge-pop .4s ease;
}
.notif-popup-more {
  display: block; text-align: center;
  padding: 12px;
  font-size: 13px; font-weight: 700;
  color: var(--text-dim);
  text-decoration: none;
  border-top: 1px solid rgba(255,255,255,0.05);
  transition: color .15s;
}
.notif-popup-more:hover { color: #fff; }

/* Topbar bell — desktop */
.nav-bell {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .15s;
  flex: 0 0 auto;
}
.nav-bell:hover { background: rgba(255,255,255,0.12); }
.nav-bell.active { background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(139,92,246,0.2)); border-color: rgba(236,72,153,0.5); }
.nav-bell.shake { animation: bell-shake .55s ease; }
@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-12deg); }
  40%, 80% { transform: rotate(12deg); }
}
.bell-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(236,72,153,0.4);
  animation: bell-pulse 1.2s ease-out infinite;
}
@keyframes bell-pulse {
  from { transform: scale(1); opacity: 0.6; }
  to   { transform: scale(1.6); opacity: 0; }
}

.nav-icon-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 17px;
  text-decoration: none;
  transition: background .2s;
}
.nav-icon-link:hover { background: rgba(255,255,255,0.12); }
.nav-icon-link.active { background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(139,92,246,0.2)); border-color: rgba(236,72,153,0.5); }

.nav a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(139,92,246,0.2));
  border-radius: 999px;
}

/* Toast close button */
.toast {
  position: relative;
  cursor: pointer;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 36px 12px 14px !important;
}
.toast .ti { font-size: 20px; flex: 0 0 auto; margin-top: 1px; }
.toast .tc { flex: 1; min-width: 0; }
.toast .toast-x {
  position: absolute;
  top: 6px; inset-inline-end: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s, background .15s;
}
.toast:hover .toast-x { opacity: 1; }
.toast .toast-x:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ===== Settings page ===== */
.settings-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 30px 20px 80px;
}
.settings-head {
  text-align: center;
  margin-bottom: 28px;
}
.settings-head h1 {
  font-size: 32px;
  margin: 0 0 6px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.settings-head p { font-size: 14px; }
.settings-saved {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  background: rgba(34,197,94,0.18);
  border: 1px solid rgba(34,197,94,0.4);
  color: #4ade80;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
  animation: settings-saved-in .4s ease;
}
@keyframes settings-saved-in {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.settings-form { display: flex; flex-direction: column; gap: 18px; }
.settings-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 18px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity .25s, filter .25s;
}
.settings-card.dim { opacity: 0.5; filter: grayscale(0.4); }
.settings-card h2 {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.setting-row:last-child { border-bottom: none; }
.setting-row.column {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.setting-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.setting-text strong { font-size: 14px; color: var(--text); }
.setting-text .muted { font-size: 12px; }

/* Switch toggle */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex: 0 0 auto; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 14px;
  transition: background .25s;
}
.switch-slider::before {
  content: '';
  position: absolute;
  top: 3px; inset-inline-start: 3px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s, background .25s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.switch input:checked + .switch-slider { background: linear-gradient(135deg, #ec4899, #8b5cf6); }
.switch input:checked + .switch-slider::before { transform: translateX(-22px); background: #fff; }
.switch input:focus-visible + .switch-slider { box-shadow: 0 0 0 3px rgba(236,72,153,0.4); }

/* Volume slider */
.vol-row {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 0;
}
.vol-icon { font-size: 18px; flex: 0 0 auto; }
.vol-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  outline: none;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(236,72,153,0.5);
  border: 2px solid #fff;
}
.vol-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
}
.vol-slider:focus { outline: none; }

/* Sound grid */
.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.sound-option {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  cursor: pointer;
  transition: all .2s;
}
.sound-option:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.15); }
.sound-option.selected {
  background: rgba(236,72,153,0.12);
  border-color: rgba(236,72,153,0.6);
  box-shadow: 0 0 0 3px rgba(236,72,153,0.18);
}
.sound-option input { position: absolute; opacity: 0; pointer-events: none; }
.sound-icon { font-size: 26px; flex: 0 0 auto; }
.sound-meta { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sound-meta strong { font-size: 13px; }
.sound-meta small { font-size: 11px; }
.sound-test {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  border: none;
  font-size: 11px;
  cursor: pointer;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.sound-test:hover { transform: scale(1.08); }
.sound-test.pulse, .test-btn.pulse { animation: settings-pulse .4s ease; }
@keyframes settings-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}
.test-btn { margin-top: 6px; }
.test-btn.pulse { animation: settings-pulse .4s ease; }

/* Time pickers */
.time-row {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 0;
}
.time-pick {
  display: flex; flex-direction: column; gap: 4px; flex: 1;
  font-size: 12px;
  color: var(--text-dim);
}
.time-pick input {
  padding: 10px 12px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color-scheme: dark;
}
.time-pick input:focus { outline: none; border-color: rgba(236,72,153,0.6); }
.time-arrow { color: var(--text-dim); font-size: 18px; flex: 0 0 auto; }

/* Settings actions */
.settings-actions {
  display: flex; gap: 12px; justify-content: center;
  margin-top: 8px;
}
.btn.big { padding: 14px 32px; font-size: 16px; }
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
}

@media (max-width: 600px) {
  .settings-page { padding: 18px 12px 60px; }
  .settings-head h1 { font-size: 24px; }
  .sound-grid { grid-template-columns: 1fr; }
  .setting-row { flex-direction: row; gap: 10px; }
  .setting-text strong { font-size: 13px; }
  .setting-text .muted { font-size: 11px; }
}
/* ===== Tanks Battle CSS ===== */

/* ===== PWA Online Status + Install ===== */
.online-status {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: inline-block;
}
.online-status.online { color: #10b981; }
.online-status.offline { color: #ef4444; }
#pwaInstallBtn {
  position: fixed;
  bottom: 100px;
  right: 20px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(236, 72, 153, 0.4);
  cursor: pointer;
  z-index: 999;
  font-family: inherit;
}
#pwaInstallBtn:hover { transform: translateY(-2px); }

/* ===== Friends Page ===== */
.friends-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
.friends-header {
  text-align: center;
  margin-bottom: 24px;
}
.friends-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.friends-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ft-tab {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.ft-tab:hover { color: white; }
.ft-tab.active {
  color: #ec4899;
  border-bottom-color: #ec4899;
}
.ft-pane { display: none; }
.ft-pane.active { display: block; }
.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.friend-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: all 0.2s;
}
.friend-card:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }
.friend-card.pending { border-color: rgba(245, 158, 11, 0.3); }
.fc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  flex-shrink: 0;
}
.fc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fc-avatar-fallback {
  font-size: 16px;
  font-weight: 700;
  color: white;
}
.fc-info { flex: 1; min-width: 0; }
.fc-name {
  display: block;
  font-weight: 600;
  color: white;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
}
.fc-name:hover { color: #ec4899; }
.fc-meta { font-size: 11px; color: rgba(255, 255, 255, 0.5); }
.fc-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.fc-actions .btn {
  padding: 4px 10px;
  font-size: 12px;
  min-height: 28px;
}

/* ===== Tanks Battle Profile Stats ===== */
.profile-tanks-stats {
  margin: 20px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}
.pts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.pts-header .section-title { margin: 0; }
.pts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.pts-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
  transition: transform 0.2s;
}
.pts-card:hover { transform: translateY(-2px); }
.pts-rank {
  background: linear-gradient(135deg, var(--rank-color, #94a3b8) 0%, rgba(0,0,0,0.4) 100%);
  border-color: var(--rank-color, #94a3b8);
  color: white;
  font-weight: 700;
}
.pts-rank-emoji { font-size: 36px; line-height: 1; }
.pts-rank-name { font-size: 14px; margin: 4px 0; }
.pts-rating { font-size: 18px; }
.pts-highest { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.pts-icon { font-size: 24px; line-height: 1; }
.pts-value { font-size: 22px; font-weight: 800; margin: 6px 0 2px; color: var(--accent, #ec4899); }
.pts-label { font-size: 11px; color: rgba(255, 255, 255, 0.6); }
.pts-win .pts-value { color: #10b981; }
.pts-loss .pts-value { color: #ef4444; }
.pts-achievements { margin-top: 16px; }
.pts-achievements h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--accent, #ec4899);
}
.pts-ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}
.pts-ach-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  transition: transform 0.2s;
}
.pts-ach-card:hover { transform: scale(1.05); }
.pts-ach-icon { font-size: 28px; line-height: 1; }
.pts-ach-name {
  font-size: 11px;
  margin-top: 4px;
  font-weight: 600;
}

/* ===== Search Page ===== */
.search-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
.search-header {
  text-align: center;
  margin-bottom: 20px;
}
.search-header h1 {
  margin: 0 0 16px;
  font-size: 26px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.search-bar {
  display: flex;
  gap: 8px;
  max-width: 500px;
  margin: 0 auto 12px;
}
.search-bar input {
  flex: 1;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-family: inherit;
}
.search-bar input:focus {
  outline: none;
  border-color: #ec4899;
}
.search-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
}
.search-filters label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
}
.search-filters select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  border-radius: 8px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
}
.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.search-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  text-decoration: none;
  color: white;
  transition: all 0.2s;
}
.search-card:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }
.sc-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  flex-shrink: 0;
}
.sc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sc-fallback { font-size: 20px; font-weight: 700; color: white; }
.sc-info { flex: 1; min-width: 0; }
.sc-name { font-weight: 700; font-size: 14px; }
.sc-meta { font-size: 11px; color: rgba(255, 255, 255, 0.6); margin-bottom: 4px; }
.sc-bio { font-size: 12px; color: rgba(255, 255, 255, 0.7); margin-bottom: 4px; }
.sc-interests { display: flex; flex-wrap: wrap; gap: 4px; }
.sc-int {
  background: rgba(236, 72, 153, 0.15);
  color: #f9a8d4;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px;
}

/* ===== Emoji Avatars ===== */
.emoji-avatar {
  font-size: 32px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
}
.profile-avatar.emoji-avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  font-size: 64px;
}
.sc-fallback.emoji-avatar { font-size: 28px; }
.fc-avatar-fallback.emoji-avatar { font-size: 22px; }
.tg-pill-emoji {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

