@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  --bg-primary: #050a18;
  --bg-secondary: #0c1425;
  --bg-card: rgba(15, 23, 42, 0.6);
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.4);
  --text: #e2e8f0;
  --text-muted: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: rgba(99, 102, 241, 0.12);
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== BACKGROUND ANIMATED ===== */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse 600px 600px at 20% 20%, rgba(99,102,241,0.08), transparent),
    radial-gradient(ellipse 500px 500px at 80% 80%, rgba(139,92,246,0.06), transparent),
    radial-gradient(ellipse 400px 400px at 50% 50%, rgba(6,182,212,0.04), transparent);
  z-index: -1;
  animation: bgShift 15s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1.1) rotate(2deg); }
}

/* ===== GRID BACKGROUND ===== */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: -1;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black, transparent);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

/* ===== SCROLL ANIMATIONS ===== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }
.reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-right.visible { opacity: 1; transform: translateX(0); }
.reveal-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-scale.visible { opacity: 1; transform: scale(1); }

/* ===== NAVBAR ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 30px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(5, 10, 24, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s;
}
.navbar.scrolled {
  background: rgba(5, 10, 24, 0.95);
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  text-decoration: none;
}
.nav-brand .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 15px var(--accent-glow);
}
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.3s;
}
.nav-links a:hover { color: #fff; background: rgba(99,102,241,0.1); }

/* ===== BOUTONS 3D ===== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow:
    0 4px 0 #4338ca,
    0 6px 20px rgba(99,102,241,0.3);
  transform: translateY(0);
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 #4338ca,
    0 10px 30px rgba(99,102,241,0.4);
}
.btn:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 #4338ca,
    0 3px 10px rgba(99,102,241,0.2);
}

.btn-lg { padding: 16px 36px; font-size: 16px; border-radius: 14px; }

.btn-secondary {
  background: linear-gradient(135deg, #1e293b, #334155);
  box-shadow:
    0 4px 0 #0f172a,
    0 6px 20px rgba(0,0,0,0.3);
}
.btn-secondary:hover {
  box-shadow:
    0 6px 0 #0f172a,
    0 10px 30px rgba(0,0,0,0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow:
    0 4px 0 #991b1b,
    0 6px 20px rgba(239,68,68,0.3);
}
.btn-danger:hover {
  box-shadow:
    0 6px 0 #991b1b,
    0 10px 30px rgba(239,68,68,0.4);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow:
    0 4px 0 #065f46,
    0 6px 20px rgba(16,185,129,0.3);
}

.btn-sm { padding: 8px 16px; font-size: 12px; border-radius: 8px; box-shadow: 0 3px 0 #4338ca, 0 4px 12px rgba(99,102,241,0.2); }
.btn-sm.btn-danger { box-shadow: 0 3px 0 #991b1b, 0 4px 12px rgba(239,68,68,0.2); }
.btn-sm.btn-success { box-shadow: 0 3px 0 #065f46, 0 4px 12px rgba(16,185,129,0.2); }

.btn-ghost {
  background: transparent;
  color: var(--accent-light);
  box-shadow: none;
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: rgba(99,102,241,0.1);
  box-shadow: none;
  transform: translateY(0);
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all 0.3s;
}
.card:hover {
  border-color: rgba(99,102,241,0.25);
}
.card-glow {
  box-shadow: 0 0 40px rgba(99,102,241,0.06);
}
.card h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h2 .badge {
  background: rgba(99,102,241,0.15);
  color: var(--accent-light);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ===== CONTAINER ===== */
.container { max-width: 640px; margin: 0 auto; padding: 30px 20px; }
.container-lg { max-width: 1100px; margin: 0 auto; padding: 30px 20px; }
.stack > * + * { margin-top: 20px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15,23,42,0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: all 0.3s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input-code {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  letter-spacing: 12px;
  padding: 16px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: #fca5a5;
}
.alert-success {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  color: #6ee7b7;
}

/* ===== LINK ITEMS (dashboard) ===== */
.link-card {
  background: rgba(15,23,42,0.5);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.3s;
}
.link-card:hover {
  background: rgba(15,23,42,0.8);
  border-color: rgba(99,102,241,0.2);
  transform: translateX(4px);
}
.link-card-info { flex: 1; }
.link-card-title { font-weight: 600; margin-bottom: 4px; }
.link-card-url { font-size: 12px; color: var(--text-muted); word-break: break-all; }
.link-card-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
.link-card-actions { display: flex; gap: 6px; }
.link-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* ===== STATS GRID ===== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: rgba(15,23,42,0.5);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
}
.stat-card:hover { transform: translateY(-4px); border-color: rgba(99,102,241,0.3); }
.stat-value { font-size: 32px; font-weight: 800; background: linear-gradient(135deg,#a5b4fc,#818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* ===== PROFILE PAGE ===== */
.profile-wrapper { text-align: center; padding-top: 20px; }
.profile-avatar {
  width: 110px; height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid transparent;
  background-origin: border-box;
  background-clip: content-box, border-box;
  background-image: linear-gradient(var(--bg-secondary),var(--bg-secondary)), linear-gradient(135deg, #6366f1, #a855f7, #06b6d4);
  margin-bottom: 16px;
  animation: avatarFloat 6s ease-in-out infinite;
}
.profile-avatar-placeholder {
  width: 110px; height: 110px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  animation: avatarFloat 6s ease-in-out infinite;
}
@keyframes avatarFloat {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.profile-username { font-size: 24px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.profile-bio { color: var(--text-muted); font-size: 15px; margin-bottom: 30px; max-width: 400px; margin-left: auto; margin-right: auto; line-height: 1.6; }

/* ===== PROFILE LINK BUTTONS ===== */
.profile-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  margin: 14px 0;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 0 rgba(0,0,0,0.25), 0 8px 25px rgba(0,0,0,0.15);
  transform: translateY(0);
}
.profile-link::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s;
}
.profile-link:hover::before { left: 100%; }
.profile-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 0 rgba(0,0,0,0.25), 0 14px 35px rgba(0,0,0,0.2);
}
.profile-link:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.25), 0 3px 10px rgba(0,0,0,0.1);
}

/* Profile link animations */
.anim-pulse { animation: linkPulse 3s ease-in-out infinite; }
.anim-bounce:hover { animation: linkBounce 0.6s; }
.anim-shake:hover { animation: linkShake 0.4s; }
.anim-glow { animation: linkGlow 2.5s ease-in-out infinite; }
.anim-slide { transition: transform 0.3s, padding-left 0.3s; }
.anim-slide:hover { padding-left: 36px; }

@keyframes linkPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.015)} }
@keyframes linkBounce { 0%,100%{transform:translateY(0)} 30%{transform:translateY(-12px)} 60%{transform:translateY(-4px)} }
@keyframes linkShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
@keyframes linkGlow { 0%,100%{box-shadow:0 4px 0 rgba(0,0,0,0.25),0 0 15px rgba(99,102,241,0.2)} 50%{box-shadow:0 4px 0 rgba(0,0,0,0.25),0 0 35px rgba(99,102,241,0.5)} }

/* ===== THEMES ===== */
.theme-light { background: #f1f5f9 !important; color: #0f172a !important; }
.theme-light::before { background: radial-gradient(ellipse at 30% 20%, rgba(99,102,241,0.08), transparent), radial-gradient(ellipse at 70% 80%, rgba(139,92,246,0.06), transparent); }
.theme-light .card { background: rgba(255,255,255,0.7) !important; border-color: rgba(99,102,241,0.1) !important; }
.theme-light .profile-username { color: #0f172a !important; }
.theme-light .profile-bio { color: #475569 !important; }

.theme-neon { background: #000 !important; }
.theme-neon::before { background: radial-gradient(ellipse at 50% 50%, rgba(255,0,255,0.06), transparent); }
.theme-neon .card { background: rgba(0,0,0,0.6) !important; border-color: rgba(255,0,255,0.2) !important; box-shadow: 0 0 50px rgba(255,0,255,0.05) !important; }
.theme-neon .profile-username { color: #00ffff !important; text-shadow: 0 0 20px rgba(0,255,255,0.5); }

/* ===== HERO ===== */
.hero { padding: 80px 20px 60px; text-align: center; }
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 30px;
  font-size: 13px;
  color: var(--accent-light);
  margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff, #a5b4fc, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 32px;
  line-height: 1.7;
}
.hero-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ===== FEATURES ===== */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 20px; padding: 20px; max-width: 900px; margin: 0 auto; }
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  transition: all 0.4s;
}
.feature-card:hover { transform: translateY(-6px); border-color: rgba(99,102,241,0.3); box-shadow: 0 20px 50px rgba(0,0,0,0.2); }
.feature-icon { font-size: 32px; margin-bottom: 14px; }
.feature-title { font-weight: 700; margin-bottom: 8px; }
.feature-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table td { padding: 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table tr:hover td { background: rgba(99,102,241,0.03); }
.badge-ok { display:inline-block; padding:2px 10px; border-radius:20px; font-size:11px; background:rgba(16,185,129,0.15); color:#6ee7b7; }
.badge-wait { display:inline-block; padding:2px 10px; border-radius:20px; font-size:11px; background:rgba(245,158,11,0.15); color:#fbbf24; }

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

/* ===== SEPARATOR ===== */
.sep { border: none; height: 1px; background: var(--border); margin: 30px 0; }

/* ===== COLOR INPUT ===== */
input[type="color"] { height: 44px; border-radius: 10px; padding: 4px; cursor: pointer; }
input[type="file"] { padding: 10px; }

/* ===== FLOATING PARTICLES ===== */
.particles { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.particle {
  position: absolute;
  width: 3px; height: 3px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.2;
  animation: particleUp linear infinite;
}
@keyframes particleUp {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  20% { opacity: 0.3; }
  80% { opacity: 0.1; }
  100% { transform: translateY(-10vh) scale(1.5); opacity: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .navbar { padding: 0 16px; }
  .card { padding: 22px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 24px; }
  .hero-actions { flex-direction: column; align-items: center; }
}

/* ===== EDITOR MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s;
}
.modal-overlay.open { display: flex; opacity: 1; }
.modal {
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow: auto;
  background: rgba(12, 20, 37, 0.95);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.08);
  animation: modalIn 0.35s cubic-bezier(0.16,1,0.3,1);
}
@keyframes modalIn {
  from { transform: translateY(24px) scale(0.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: rgba(12,20,37,0.95);
  z-index: 2;
}
.modal-head h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: #fff; cursor: pointer; font-size: 18px;
}
.modal-close:hover { background: rgba(239,68,68,0.2); }
.modal-body { display: grid; grid-template-columns: 1fr 280px; gap: 0; }
.modal-form { padding: 22px 24px; }
.modal-preview-col {
  padding: 22px 20px;
  border-left: 1px solid var(--border);
  background: rgba(5,10,24,0.5);
  position: sticky; top: 73px;
}
.preview-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); margin-bottom: 16px; font-weight: 700;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-val {
  min-width: 42px; text-align: right; font-size: 12px;
  color: var(--accent-light); font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.bg-type-pills { display: flex; gap: 8px; }
.bg-type-pills label {
  flex: 1; text-align: center; padding: 10px 8px;
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; font-size: 12px; font-weight: 600;
  transition: 0.2s; background: rgba(15,23,42,0.6);
}
.bg-type-pills input { display: none; }
.bg-type-pills input:checked + span,
.bg-type-pills label:has(input:checked) {
  background: rgba(99,102,241,0.2);
  border-color: var(--accent);
  color: #fff;
}
.current-bg {
  width: 100%; height: 72px; border-radius: 10px;
  background-size: cover; background-position: center;
  border: 1px solid var(--border); margin: 8px 0;
}
.icon-edit {
  width: 34px; height: 34px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; background: rgba(99,102,241,0.15);
  color: #c7d2fe; font-size: 14px;
}
.icon-edit:hover { background: rgba(99,102,241,0.3); }
.mini-preview {
  pointer-events: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px 18px; font-weight: 600;
}

@media (max-width: 760px) {
  .modal-body { grid-template-columns: 1fr; }
  .modal-preview-col { border-left: none; border-top: 1px solid var(--border); position: static; }
  .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ===== 3D PROFILE SCENE ===== */
.profile-3d-scene {
  perspective: 1400px;
  perspective-origin: 50% 35%;
  padding: 20px 0 40px;
  min-height: 70vh;
}
.profile-3d-card {
  transform-style: preserve-3d;
  transform: rotateX(6deg) translateZ(0);
  transition: transform 0.18s ease-out, box-shadow 0.18s;
  will-change: transform;
  position: relative;
}
.profile-3d-card::before {
  content: '';
  position: absolute;
  inset: 18px -10px -28px;
  background: radial-gradient(ellipse at 50% 100%, rgba(99,102,241,0.22), transparent 70%);
  filter: blur(22px);
  z-index: -1;
  transform: translateZ(-80px) rotateX(90deg);
  pointer-events: none;
}
.profile-3d-card .layer-avatar { transform: translateZ(56px); }
.profile-3d-card .layer-name { transform: translateZ(42px); }
.profile-3d-card .layer-bio { transform: translateZ(32px); }
.profile-3d-card .layer-links { transform-style: preserve-3d; }
.profile-3d-card .layer-foot { transform: translateZ(18px); }

.profile-avatar, .profile-avatar-placeholder {
  box-shadow:
    0 12px 30px rgba(0,0,0,0.45),
    0 0 0 4px rgba(99,102,241,0.25),
    0 0 40px rgba(99,102,241,0.25);
}

.profile-link {
  transform-style: preserve-3d;
  transform: translateZ(28px);
  backface-visibility: hidden;
}
.profile-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), transparent 40%, rgba(0,0,0,0.25));
  pointer-events: none;
  mix-blend-mode: overlay;
}
.profile-link:hover {
  transform: translateZ(52px) rotateX(-10deg) scale(1.03);
  filter: brightness(1.08);
}

/* 3D extrusion via stacked shadows */
.profile-link.extrude {
  box-shadow:
    0 1px 0 rgba(0,0,0,0.15),
    0 2px 0 rgba(0,0,0,0.15),
    0 3px 0 rgba(0,0,0,0.15),
    0 4px 0 rgba(0,0,0,0.15),
    0 8px 0 rgba(0,0,0,0.2),
    0 18px 35px rgba(0,0,0,0.35) !important;
}
.profile-link.extrude:active {
  transform: translateZ(12px) rotateX(4deg) !important;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.2),
    0 4px 12px rgba(0,0,0,0.25) !important;
}

.shine-sweep::before {
  animation: shineSweep 3.5s ease-in-out infinite;
}
@keyframes shineSweep {
  0% { left: -120%; }
  40%, 100% { left: 120%; }
}

/* ===== EXTRA ANIMATIONS ===== */
.anim-float { animation: aFloat 3.2s ease-in-out infinite; }
.anim-wiggle { animation: aWiggle 2.4s ease-in-out infinite; }
.anim-flip:hover { animation: aFlip 0.7s; }
.anim-jelly:hover { animation: aJelly 0.7s; }
.anim-heartbeat { animation: aHeart 1.2s ease-in-out infinite; }
.anim-glitch { animation: aGlitch 3s infinite; }
.anim-shine { position: relative; overflow: hidden; }
.anim-shine::before { animation: shineSweep 2.8s ease-in-out infinite; }
.anim-rubber:hover { animation: aRubber 0.7s; }
.anim-swing { animation: aSwing 2.8s ease-in-out infinite; transform-origin: top center; }
.anim-rainbow { animation: aHue 4s linear infinite; }
.anim-morph { animation: aMorph 3s ease-in-out infinite; }
.anim-neon { animation: aNeon 2s ease-in-out infinite; }
.anim-spin:hover { animation: aSpin 0.6s ease; }
.anim-wave { animation: aWave 2.2s ease-in-out infinite; }
.anim-pop:hover { animation: aPop 0.45s; }
.anim-tilt3d { transition: transform 0.25s; }
.anim-tilt3d:hover { transform: translateZ(56px) rotateX(-16deg) rotateY(10deg) scale(1.04); }
.anim-press3d { transform: translateZ(28px); }
.anim-press3d:hover { transform: translateZ(48px) rotateX(-8deg); }
.anim-press3d:active { transform: translateZ(8px) rotateX(6deg); }
.anim-lift:hover { transform: translateZ(70px) translateY(-8px) scale(1.04); }
.anim-elastic:hover { animation: aElastic 0.8s; }
.anim-blur:hover { animation: aBlur 0.6s; }
.anim-border-run { position: relative; }
.anim-border-run { animation: aBorder 2.5s linear infinite; }
.anim-sparkle { position: relative; overflow: hidden; }
.anim-sparkle::after {
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.8) 0 1px, transparent 2px),
    radial-gradient(circle at 60% 20%, rgba(255,255,255,0.7) 0 1.5px, transparent 3px);
  animation: aSpark 1.8s ease-in-out infinite;
  mix-blend-mode: screen;
  opacity: 0.7;
}
.anim-none { animation: none; }

@keyframes aFloat {
  0%,100% { transform: translateZ(28px) translateY(0); }
  50% { transform: translateZ(28px) translateY(-9px); }
}
@keyframes aWiggle {
  0%,100% { transform: translateZ(28px) rotate(-1.5deg); }
  50% { transform: translateZ(28px) rotate(1.5deg); }
}
@keyframes aFlip {
  0% { transform: translateZ(28px) rotateY(0); }
  50% { transform: translateZ(48px) rotateY(180deg); }
  100% { transform: translateZ(28px) rotateY(360deg); }
}
@keyframes aJelly {
  0% { transform: translateZ(28px) scale(1,1); }
  30% { transform: translateZ(40px) scale(1.12,0.88); }
  50% { transform: translateZ(40px) scale(0.9,1.12); }
  70% { transform: translateZ(36px) scale(1.06,0.94); }
  100% { transform: translateZ(28px) scale(1,1); }
}
@keyframes aHeart {
  0%,100% { transform: translateZ(28px) scale(1); }
  20% { transform: translateZ(40px) scale(1.07); }
  40% { transform: translateZ(28px) scale(1); }
  60% { transform: translateZ(44px) scale(1.1); }
}
@keyframes aGlitch {
  0%,90%,100% { transform: translateZ(28px); filter: none; }
  92% { transform: translateZ(28px) translateX(-3px); filter: hue-rotate(90deg); }
  94% { transform: translateZ(28px) translateX(3px); filter: hue-rotate(-90deg); }
  96% { transform: translateZ(28px) skewX(4deg); }
}
@keyframes aRubber {
  0% { transform: translateZ(28px) scaleX(1); }
  30% { transform: translateZ(40px) scaleX(1.2); }
  40% { transform: translateZ(40px) scaleX(0.85); }
  60% { transform: translateZ(36px) scaleX(1.08); }
  100% { transform: translateZ(28px) scaleX(1); }
}
@keyframes aSwing {
  0%,100% { transform: translateZ(28px) rotate(-4deg); }
  50% { transform: translateZ(28px) rotate(4deg); }
}
@keyframes aHue { 100% { filter: hue-rotate(360deg); } }
@keyframes aMorph {
  0%,100% { border-radius: 14px; }
  50% { border-radius: 28px 8px 28px 8px; }
}
@keyframes aNeon {
  0%,100% { filter: drop-shadow(0 0 4px currentColor); }
  50% { filter: drop-shadow(0 0 16px currentColor) drop-shadow(0 0 28px currentColor); }
}
@keyframes aSpin { 100% { transform: translateZ(40px) rotate(360deg); } }
@keyframes aWave {
  0%,100% { transform: translateZ(28px) rotateX(0) rotateY(0); }
  25% { transform: translateZ(36px) rotateX(6deg) rotateY(-6deg); }
  75% { transform: translateZ(36px) rotateX(-6deg) rotateY(6deg); }
}
@keyframes aPop {
  0% { transform: translateZ(28px) scale(1); }
  50% { transform: translateZ(60px) scale(1.12); }
  100% { transform: translateZ(28px) scale(1); }
}
@keyframes aElastic {
  0% { transform: translateZ(28px) scale(1); }
  30% { transform: translateZ(55px) scale(1.18); }
  50% { transform: translateZ(40px) scale(0.92); }
  70% { transform: translateZ(48px) scale(1.06); }
  100% { transform: translateZ(28px) scale(1); }
}
@keyframes aBlur {
  0% { filter: blur(0); transform: translateZ(28px); }
  40% { filter: blur(2px); transform: translateZ(50px) scale(1.05); }
  100% { filter: blur(0); transform: translateZ(28px); }
}
@keyframes aBorder {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.5), 0 8px 25px rgba(0,0,0,0.2); }
  70% { box-shadow: 0 0 0 10px rgba(255,255,255,0), 0 8px 25px rgba(0,0,0,0.2); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0), 0 8px 25px rgba(0,0,0,0.2); }
}
@keyframes aSpark {
  0%,100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 0.9; transform: translateY(-4px); }
}

.profile-username {
  text-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.orbit-ring {
  position: absolute;
  width: 140px; height: 140px;
  left: 50%; top: 8px;
  margin-left: -70px;
  border: 1px dashed rgba(165,180,252,0.35);
  border-radius: 50%;
  animation: orbit 12s linear infinite;
  pointer-events: none;
  transform: translateZ(50px);
}
.orbit-ring span {
  position: absolute;
  width: 8px; height: 8px;
  background: #818cf8;
  border-radius: 50%;
  top: -4px; left: 50%;
  box-shadow: 0 0 12px #818cf8;
}
@keyframes orbit { 100% { transform: translateZ(50px) rotate(360deg); } }

@media (max-width: 640px) {
  .profile-3d-scene { perspective: 900px; }
  .profile-3d-card { transform: none !important; }
}

.remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 18px;
}
.remember {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
.remember input { display: none; }
.remember .box {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  flex-shrink: 0;
}
.remember .box::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  transition: transform 0.15s;
}
.remember input:checked + .box {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  border-color: #6366f1;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}
.remember input:checked + .box::after { transform: rotate(-45deg) scale(1); }
.remember small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
}

/* ===== AVATAR PICKER ===== */
.avatar-live {
  width: 96px; height: 96px; border-radius: 50%;
  object-fit: cover; display: block; margin: 0 auto 16px;
  border: 3px solid transparent;
  background-image: linear-gradient(#0c1425,#0c1425), linear-gradient(135deg,#6366f1,#a855f7);
  background-origin: border-box; background-clip: content-box, border-box;
  box-shadow: 0 10px 30px rgba(99,102,241,0.25);
}
.avatar-live.emoji {
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; background: linear-gradient(135deg,#1e293b,#0f172a);
  border: 3px solid #6366f1;
}
.avatar-modes { display: flex; gap: 8px; margin-bottom: 16px; }
.avatar-modes label {
  flex: 1; text-align: center; padding: 10px 8px; border-radius: 10px;
  border: 1px solid var(--border); cursor: pointer; font-size: 12px; font-weight: 600;
  background: rgba(15,23,42,.6);
}
.avatar-modes input { display: none; }
.avatar-modes label:has(input:checked) {
  background: rgba(99,102,241,.2); border-color: var(--accent); color: #fff;
}
.avatar-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 10px 0 16px;
}
.avatar-grid img, .avatar-grid button {
  width: 100%; aspect-ratio: 1; border-radius: 12px; border: 2px solid transparent;
  cursor: pointer; background: #0f172a; object-fit: cover;
}
.avatar-grid img.sel, .avatar-grid button.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button {
  height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(15,23,42,.7); font-size: 20px; cursor: pointer;
}
.emoji-grid button.sel { border-color: var(--accent); background: rgba(99,102,241,.2); }

/* ===== COOKIE BAR ===== */
.cookie-bar {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 300;
  max-width: 720px; margin: 0 auto;
  display: none;
  align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 18px;
  background: rgba(12, 20, 37, 0.92);
  backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45), 0 0 40px rgba(251,191,36,.08);
  animation: cookieIn .45s cubic-bezier(.16,1,.3,1);
}
.cookie-bar.show { display: flex; }
@keyframes cookieIn {
  from { transform: translateY(24px) scale(.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.cookie-icon {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  box-shadow: 0 6px 0 #78350f, 0 10px 20px rgba(245,158,11,.35);
  animation: cookieSpin 4s ease-in-out infinite;
}
@keyframes cookieSpin {
  0%,100% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
}
.cookie-copy { flex: 1; min-width: 200px; }
.cookie-copy strong {
  display: block; font-size: 15px; font-weight: 800; letter-spacing: .2px;
}
.cookie-copy span { color: var(--text-muted); font-size: 12px; }
.cookie-actions { display: flex; gap: 8px; }
.btn-cookie {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 4px 0 #92400e, 0 8px 18px rgba(245,158,11,.3);
  color: #1c1005;
}
.btn-cookie:hover { box-shadow: 0 6px 0 #92400e, 0 12px 24px rgba(245,158,11,.4); }
.btn-cookie-ghost { color: #fde68a; border-color: rgba(251,191,36,.25); }

@media (max-width: 640px) {
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .cookie-bar { left: 10px; right: 10px; bottom: 10px; }
}

/* ===== COOKIE BAR v2 (clair) ===== */
.cookie-bar .cookie-legal {
  font-size: 11px; color: var(--text-muted); margin-top: 4px;
  display: block; line-height: 1.4;
}
.cookie-bar .cookie-copy strong { display: block; margin-bottom: 2px; }
.cookie-bar .cookie-title-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cookie-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .8px;
  padding: 2px 8px; border-radius: 20px;
  background: rgba(251,191,36,.18); color: #fde68a;
  border: 1px solid rgba(251,191,36,.3);
  text-transform: uppercase;
}
.cookie-more {
  color: var(--accent-light); text-decoration: underline;
  font-size: 11px; cursor: pointer; background: none; border: none; padding: 0;
}

/* ===== IMAGE CROP MODAL ===== */
.crop-modal {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(2,6,23,.85); backdrop-filter: blur(12px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.crop-modal.open { display: flex; }
.crop-box {
  width: 100%; max-width: 460px;
  background: rgba(12,20,37,.98);
  border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  animation: modalIn .35s cubic-bezier(.16,1,.3,1);
}
.crop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.crop-head h3 { font-size: 16px; font-weight: 700; }
.crop-stage {
  position: relative; width: 100%; aspect-ratio: 1;
  background:
    linear-gradient(45deg, #0a0f1e 25%, transparent 25%),
    linear-gradient(-45deg, #0a0f1e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0a0f1e 75%),
    linear-gradient(-45deg, transparent 75%, #0a0f1e 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  overflow: hidden; cursor: grab; touch-action: none;
  user-select: none;
}
.crop-stage:active { cursor: grabbing; }
.crop-img {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  transform-origin: center;
  max-width: none; pointer-events: none;
  will-change: transform;
}
.crop-mask {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(2,6,23,.65);
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,.35);
}
.crop-controls {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: grid; gap: 14px;
}
.crop-row {
  display: grid; grid-template-columns: 90px 1fr 48px; align-items: center; gap: 10px;
}
.crop-row label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); font-weight: 700;
}
.crop-row input[type=range] { accent-color: var(--accent); }
.crop-row .val { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent-light); }
.crop-btns {
  display: flex; gap: 8px; padding: 0 20px 20px;
}
.crop-btns > * { flex: 1; }
.pos-pad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 0 20px;
}
.pos-pad button {
  padding: 8px; border-radius: 8px; border: 1px solid var(--border);
  background: rgba(15,23,42,.6); color: var(--text-muted);
  cursor: pointer; font-size: 14px;
}
.pos-pad button:hover { background: rgba(99,102,241,.15); color: #fff; border-color: var(--accent); }

/* ===== APPLIED THEME (profile page) ===== */
.theme-applied {
  background:
    radial-gradient(ellipse 800px 600px at 20% 15%, var(--th-bg2), transparent 60%),
    radial-gradient(ellipse 700px 500px at 80% 85%, var(--th-bg2), transparent 65%),
    var(--th-bg1) !important;
  color: var(--th-text) !important;
}
.theme-applied .profile-wrapper.card { background: var(--th-card) !important; border-color: color-mix(in srgb, var(--th-accent) 25%, transparent) !important; }
.theme-applied .profile-username { color: var(--th-text) !important; text-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.theme-applied .profile-bio { color: color-mix(in srgb, var(--th-text) 70%, transparent) !important; }
.theme-applied .profile-avatar,
.theme-applied .profile-avatar-placeholder { border-color: var(--th-accent) !important; }
.theme-applied .particle { background: var(--th-accent) !important; }
.theme-applied .orbit-ring { border-color: color-mix(in srgb, var(--th-accent) 45%, transparent) !important; }
.theme-applied .orbit-ring span { background: var(--th-accent) !important; box-shadow: 0 0 12px var(--th-accent) !important; }

.tex-grid { background-image: linear-gradient(color-mix(in srgb, var(--th-accent) 12%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--th-accent) 12%, transparent) 1px, transparent 1px); background-size: 60px 60px; }
.tex-dots { background-image: radial-gradient(circle, color-mix(in srgb, var(--th-accent) 25%, transparent) 1px, transparent 1.5px); background-size: 26px 26px; }
.tex-waves { background-image: repeating-radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--th-accent) 10%, transparent) 0, color-mix(in srgb, var(--th-accent) 10%, transparent) 2px, transparent 2px, transparent 60px); }
.tex-stars {
  background-image:
    radial-gradient(1px 1px at 25% 30%, var(--th-text), transparent),
    radial-gradient(1px 1px at 60% 70%, var(--th-text), transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, var(--th-accent), transparent),
    radial-gradient(1px 1px at 40% 90%, var(--th-text), transparent),
    radial-gradient(1px 1px at 10% 60%, var(--th-accent), transparent);
  background-size: 300px 300px;
}
.tex-noise {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.tex-fixed { position: fixed; inset: 0; z-index: -1; pointer-events: none; mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black, transparent); opacity: 0.9; }

/* ===== THEME GALLERY ===== */
.theme-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin: 10px 0 4px;
}
.theme-tile {
  position: relative;
  aspect-ratio: 5 / 3;
  border-radius: 14px;
  border: 2px solid var(--border);
  cursor: pointer;
  overflow: hidden;
  transition: transform .25s, border-color .25s, box-shadow .25s;
  display: flex; align-items: flex-end;
}
.theme-tile input { position: absolute; opacity: 0; }
.theme-tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.theme-tile:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 12px 30px rgba(99,102,241,.35);
  transform: translateY(-2px);
}
.theme-tile .swatches {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: 1fr 1fr;
}
.theme-tile .sw1, .theme-tile .sw2 { width: 100%; height: 100%; }
.theme-tile .name {
  position: relative; z-index: 2;
  width: 100%;
  padding: 8px 10px;
  font-size: 12px; font-weight: 700;
  background: linear-gradient(0deg, rgba(0,0,0,0.65), transparent);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.theme-tile .ico {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.4); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff;
}
.theme-tile.custom .name::before {
  content: '★'; margin-right: 6px; color: #fbbf24;
}
.theme-tile.add {
  border-style: dashed; background: rgba(99,102,241,0.05);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-light); font-weight: 700; font-size: 13px;
  cursor: pointer;
}
.theme-tile.add:hover { background: rgba(99,102,241,0.12); }

.theme-slot-info {
  font-size: 12px; color: var(--text-muted); margin-top: 8px;
  display: flex; align-items: center; gap: 6px;
}

/* ===== CUSTOM THEME EDITOR ===== */
.tex-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tex-pills label {
  padding: 8px 6px; border: 1px solid var(--border); border-radius: 8px;
  text-align: center; font-size: 12px; font-weight: 600; cursor: pointer;
  background: rgba(15,23,42,.6);
}
.tex-pills input { display: none; }
.tex-pills label:has(input:checked) { background: rgba(99,102,241,.2); border-color: var(--accent); color: #fff; }

.theme-preview-card {
  border-radius: 16px; padding: 24px; text-align: center;
  border: 1px solid rgba(255,255,255,.08); position: relative;
  overflow: hidden; min-height: 220px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.theme-preview-card .tp-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  border: 3px solid;
}
.theme-preview-card .tp-name { font-weight: 800; font-size: 16px; }
.theme-preview-card .tp-link {
  padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 13px;
  color: #fff; margin-top: 4px;
}

/* ===== LOGO INTEGRATION ===== */
.logo-icon-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 4px 12px rgba(99,102,241,0.25));
}
.nav-brand:hover .logo-icon-img {
  transform: rotate(15deg) scale(1.1);
}

/* ============================================
   ============= MOBILE FIRST FIX =============
   ============================================ */

/* ==== BASE FIXES ==== */
html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  padding-bottom: env(safe-area-inset-bottom);
}
img, video, canvas { max-width: 100%; height: auto; }
input, textarea, select, button { font-size: 16px; } /* évite le zoom iOS */

/* ==== NAVBAR MOBILE ==== */
@media (max-width: 720px) {
  .navbar {
    padding: 0 14px;
    height: 60px;
    padding-top: env(safe-area-inset-top);
    height: calc(60px + env(safe-area-inset-top));
  }
  .nav-brand { font-size: 16px; gap: 8px; }
  .logo-icon-img { width: 32px; height: 32px; }
  .nav-links { gap: 4px; }
  .nav-links a {
    padding: 8px 10px;
    font-size: 13px;
  }
  .nav-links a.btn { padding: 8px 12px; }
  /* cacher les liens texte, garder que le bouton principal */
  .nav-links .nav-only-desktop { display: none; }
}
@media (max-width: 420px) {
  .nav-brand span, .nav-brand { font-size: 15px; }
  .nav-links a:not(.btn) { display: none; }
}

/* ==== HERO / HOME ==== */
@media (max-width: 720px) {
  .hero { padding: 40px 16px 30px; }
  .hero-tag { font-size: 11px; padding: 5px 12px; }
  .hero-title { font-size: 34px; line-height: 1.15; }
  .hero-sub { font-size: 15px; padding: 0 6px; }
  .hero-actions { flex-direction: column; width: 100%; gap: 10px; }
  .hero-actions .btn { width: 100%; }
  .features { padding: 16px; gap: 14px; grid-template-columns: 1fr; }
  .feature-card { padding: 22px; }
}

/* ==== CONTAINERS ==== */
@media (max-width: 720px) {
  .container, .container-lg { padding: 18px 14px; }
  .stack > * + * { margin-top: 14px; }
  .card { padding: 18px; border-radius: 14px; }
  .card h2 { font-size: 16px; margin-bottom: 14px; }
}

/* ==== FORMS MOBILE ==== */
@media (max-width: 720px) {
  .form-input, .form-select, .form-textarea {
    padding: 13px 14px;
    border-radius: 10px;
    font-size: 16px;
  }
  .form-label { font-size: 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; gap: 8px; }
  .form-input-code { font-size: 24px; letter-spacing: 8px; padding: 14px; }
  input[type="color"] { height: 46px; }
  input[type="file"] { font-size: 13px; }
}

/* ==== BUTTONS MOBILE ==== */
@media (max-width: 720px) {
  .btn {
    padding: 12px 20px;
    font-size: 14px;
    min-height: 44px;
  }
  .btn-lg { padding: 14px 24px; font-size: 15px; min-height: 48px; }
  .btn-sm { padding: 8px 14px; font-size: 12px; min-height: 36px; }
}

/* ==== LINK CARDS (dashboard) ==== */
@media (max-width: 720px) {
  .link-card {
    padding: 14px;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .link-icon { width: 40px; height: 40px; font-size: 18px; flex-shrink: 0; }
  .link-card-info { min-width: 0; flex: 1; overflow: hidden; }
  .link-card-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .link-card-url {
    font-size: 11px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
  }
  .link-card-stats { font-size: 10px; }
  .link-card-actions { flex-direction: column; gap: 4px; }
  .link-card-actions .btn-sm { padding: 6px 10px; font-size: 11px; }
  .icon-edit { width: 32px; height: 32px; }
}

/* ==== STATS ==== */
@media (max-width: 720px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 16px 12px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 10px; }
}

/* ==== TABLE ADMIN → CARDS SUR MOBILE ==== */
@media (max-width: 720px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    background: rgba(15,23,42,0.5);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
  }
  .table td {
    padding: 6px 0;
    border-bottom: none;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px;
    gap: 10px;
  }
  .table td::before {
    content: attr(data-label);
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); font-weight: 700;
    flex-shrink: 0;
  }
  .table td:last-child { justify-content: flex-end; }
  .table tr:hover td { background: transparent; }
}

/* ==== MODAL PLEIN ÉCRAN SUR MOBILE ==== */
@media (max-width: 720px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%; width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    animation: modalSlideUp 0.35s cubic-bezier(0.16,1,0.3,1);
  }
  .modal-head { padding: 14px 18px; }
  .modal-head h3 { font-size: 16px; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-form { padding: 16px; }
  .modal-preview-col {
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 16px;
    position: static;
  }
}
@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ==== AVATAR PICKER MOBILE ==== */
@media (max-width: 720px) {
  .avatar-live { width: 84px; height: 84px; }
  .avatar-live.emoji { font-size: 42px; }
  .avatar-modes { flex-wrap: wrap; }
  .avatar-modes label { flex: 1 1 30%; padding: 10px 4px; font-size: 11px; }
  .avatar-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); gap: 5px; }
  .emoji-grid button { height: 44px; font-size: 22px; }
}
@media (max-width: 400px) {
  .avatar-grid { grid-template-columns: repeat(3, 1fr); }
  .emoji-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ==== THEME GALLERY MOBILE ==== */
@media (max-width: 720px) {
  .theme-gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .theme-tile .name { font-size: 11px; padding: 6px 8px; }
  .theme-tile .name button { padding: 2px 6px !important; font-size: 10px !important; }
}
@media (max-width: 380px) {
  .theme-gallery { grid-template-columns: 1fr; }
}

/* ==== CROP EDITOR MOBILE ==== */
@media (max-width: 720px) {
  .crop-modal { padding: 0; align-items: flex-end; }
  .crop-box {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 95vh;
    overflow-y: auto;
  }
  .crop-head { padding: 12px 16px; }
  .crop-head h3 { font-size: 15px; }
  .crop-controls, .pos-pad, .crop-btns { padding-left: 14px; padding-right: 14px; }
  .crop-row { grid-template-columns: 70px 1fr 44px; gap: 8px; }
  .crop-row label { font-size: 10px; }
  .pos-pad button { padding: 12px; font-size: 16px; min-height: 44px; }
  .crop-btns { flex-direction: column; }
}

/* ==== COOKIE BAR MOBILE ==== */
@media (max-width: 720px) {
  .cookie-bar {
    left: 8px; right: 8px; bottom: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 14px;
    gap: 12px;
    flex-direction: column;
    text-align: center;
    align-items: stretch;
  }
  .cookie-icon { margin: 0 auto; width: 44px; height: 44px; font-size: 22px; }
  .cookie-copy strong { font-size: 14px; }
  .cookie-copy span { font-size: 11px; }
  .cookie-copy .cookie-legal { font-size: 10px; }
  .cookie-title-row { justify-content: center; }
  .cookie-actions { justify-content: stretch; }
  .cookie-actions .btn { flex: 1; font-size: 12px; padding: 10px 8px; }
}

/* ==== PROFILE 3D MOBILE ==== */
@media (max-width: 720px) {
  .profile-3d-scene {
    perspective: 900px;
    padding: 10px 0 30px;
    min-height: auto;
  }
  .profile-3d-card {
    transform: none !important;
    padding: 22px !important;
  }
  .profile-avatar, .profile-avatar-placeholder {
    width: 90px; height: 90px;
  }
  .profile-avatar-placeholder { font-size: 36px !important; }
  .profile-username { font-size: 20px; }
  .profile-bio { font-size: 14px; padding: 0 4px; }
  .profile-link {
    padding: 14px 18px;
    font-size: 14px !important;
    margin: 10px 0;
    transform: none !important;
  }
  .profile-link:hover { transform: scale(1.02) !important; }
  .profile-link.extrude {
    box-shadow:
      0 2px 0 rgba(0,0,0,0.15),
      0 4px 0 rgba(0,0,0,0.2),
      0 8px 20px rgba(0,0,0,0.3) !important;
  }
  .orbit-ring { width: 110px; height: 110px; margin-left: -55px; }
}

/* ==== BG-TYPE PILLS MOBILE ==== */
@media (max-width: 720px) {
  .bg-type-pills label { padding: 10px 4px; font-size: 11px; }
  .tex-pills label { padding: 8px 4px; font-size: 11px; }
}

/* ==== ALERT MOBILE ==== */
@media (max-width: 720px) {
  .alert { padding: 12px 14px; font-size: 13px; }
}

/* ==== REMEMBER CHECKBOX ==== */
@media (max-width: 720px) {
  .remember { font-size: 13px; gap: 8px; }
  .remember small { font-size: 10px; }
}

/* ==== GRID BG MOBILE (allègement) ==== */
@media (max-width: 720px) {
  .grid-bg { background-size: 40px 40px; opacity: 0.6; }
}

/* ==== SCROLLBAR MOBILE ==== */
@media (max-width: 720px) {
  ::-webkit-scrollbar { width: 3px; }
}

/* ==== DÉSACTIVER TILT SUR TACTILE ==== */
@media (hover: none) {
  .tilt { transform: none !important; }
  .anim-tilt3d:hover, .anim-lift:hover, .anim-flip:hover { transform: none !important; }
}

/* ==== ORIENTATION LANDSCAPE PHONE ==== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding: 30px 16px; }
  .hero-title { font-size: 28px; }
  .profile-3d-scene { padding-top: 20px; }
  .card { padding: 16px; }
}

/* ==== LARGE PHONES / SMALL TABLETS ==== */
@media (min-width: 721px) and (max-width: 900px) {
  .container-lg { padding: 24px 20px; }
  .stats-row { grid-template-columns: repeat(4, 1fr); }
  .theme-gallery { grid-template-columns: repeat(3, 1fr); }
}

/* ==== FIX FOCUS VISIBLE ==== */
input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==== POINTER PAD MOBILE (crop 3x3) ==== */
@media (max-width: 380px) {
  .pos-pad button { padding: 10px; font-size: 14px; }
}
