/* =====================================================================
   VIBE — couche « Liquid Glass ».
   Chargée après vibe.css. Matériaux vitrés, échelle plus compacte et
   mouvements à ressort (courbes linear() calculées depuis un ressort
   amorti). Tout reste en transform/opacity côté animation.
   ===================================================================== */
:root {
  /* Encarts système : injectés par l'app Android (bord à bord), sinon env() du navigateur. */
  --sa-top: var(--sat, env(safe-area-inset-top, 0px));
  --sa-bottom: var(--sab, env(safe-area-inset-bottom, 0px));
  --top: calc(var(--sa-top) + 50px);
  --dock: calc(var(--sa-bottom) + 84px);

  /* Ressort critique (aucun rebond) et ressort léger (rebond ≈ 4 %), réponse 0,5 s. */
  --spring: linear(0, 0.067, 0.205, 0.358, 0.499, 0.619, 0.715, 0.79, 0.848, 0.89, 0.921, 0.944, 0.96, 0.972, 0.981, 0.986, 0.991, 0.993, 0.995, 0.997, 0.998, 0.999, 1);
  --spring-bounce: linear(0, 0.034, 0.118, 0.231, 0.356, 0.48, 0.596, 0.7, 0.788, 0.861, 0.918, 0.962, 0.994, 1.015, 1.029, 1.036, 1.038, 1.038, 1.035, 1.031, 1.026, 1.021, 1.016, 1.012, 1.009, 1.006, 1.004, 1.002, 1);
  --t-spring: 0.7s;

  /* Matériau verre */
  --glass: rgba(255, 255, 255, 0.075);
  --glass-strong: rgba(22, 17, 30, 0.72);
  --glass-sheet: rgba(17, 13, 24, 0.9);
  --glass-sheen: linear-gradient(155deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 32%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.06) 100%);
  --glass-blur: blur(26px) saturate(190%);
  --rim: inset 0 1px 0 rgba(255, 255, 255, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.075), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  --lift: 0 18px 44px -18px rgba(0, 0, 0, 0.8);
  --glow: 0 10px 28px -10px rgba(255, 46, 126, 0.65);
}

/* ------------------------------------------------------------- base */
html, body { font-size: 14px; }
.app-container { isolation: isolate; }
/* Aurore lente derrière les écrans hors feed : le verre a quelque chose à réfracter. */
.app-container::before {
  content: ''; position: absolute; z-index: -1; inset: -20%; pointer-events: none;
  background:
    radial-gradient(38% 30% at 18% 12%, rgba(255, 46, 126, 0.32), transparent 70%),
    radial-gradient(34% 28% at 88% 30%, rgba(166, 61, 255, 0.28), transparent 70%),
    radial-gradient(40% 30% at 30% 88%, rgba(255, 46, 126, 0.16), transparent 70%),
    var(--bg);
  animation: aurora 26s ease-in-out infinite alternate;
}
@keyframes aurora { to { transform: translate3d(4%, 3%, 0) rotate(6deg) scale(1.06); } }
.view-screen:not(#viewFeed) { background: transparent; }

/* Typo : approche serrée sur les grands titres, normale sur le corps. */
.brand-name, .page-title, .screen-title, .profile-name, .price-amount, .pack-coins, .auth-hero h1,
.glass-paywall-card h3, .modal-header h2, .settings-top-bar h2, .feed-state h3, .age-gate-title, .stats-row strong, .wallet-card .wc-value {
  letter-spacing: -0.02em; font-weight: 800;
}
.brand-name { font-size: 18px; letter-spacing: 0.04em; font-weight: 900; }
.logo-badge { font-size: 9px; padding: 2px 5px; }
.page-title { font-size: 22px; }
.screen-title { font-size: 16px; }
.section-title-wrap h3, .section-title { font-size: 15px; }

/* -------------------------------------------------------- matériaux */
.dock-nav, .coin-badge, .nav-tabs, .icon-btn, .back-btn, .close-btn, .teaser-bar, .search-box,
.pill-btn, .round-btn, .toast-msg, .modal-card, .auth-card, .glass-paywall-card, .glass-section,
.composer input, .add-comment-box input, .net-banner {
  background-color: var(--glass); background-image: var(--glass-sheen);
  border: none; box-shadow: var(--rim), var(--lift);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
/* Panneaux posés dans un parent déjà flouté : remplissage + liseré, sans second flou. */
.wallet-card, .stats-row, .plan-card, .coin-pack, .gift-card, .role-card, .invoice-box, .announce-banner,
.chat-row.unread, .bubble.them, .auth-tabs, .form-input, .form-select, .form-textarea, .file-pick, .notice-box {
  background-color: var(--glass); background-image: var(--glass-sheen);
  border-color: transparent; box-shadow: var(--rim);
}
.dock-nav, .toast-msg { background-color: var(--glass-strong); }
.modal-card { background-color: var(--glass-sheet); }
.auth-card, .glass-paywall-card { background-color: rgba(20, 16, 28, 0.62); }
.icon-circle {
  background: rgba(255, 255, 255, 0.1) var(--glass-sheen); box-shadow: var(--rim);
  -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
}
.pill-btn.active, .auth-tab-btn.active, .coin-pack.active, .plan-card.featured, .role-card.active {
  box-shadow: var(--rim), var(--glow);
}
.coin-pack.active, .role-card.active, .plan-card.featured { background-color: rgba(255, 46, 126, 0.16); }
.btn-primary-gradient, .send-btn, .upload-btn, .pill.pink, .lock-icon-wrap, .bubble.me {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -1px 0 rgba(0, 0, 0, 0.15), var(--glow);
}
.btn-secondary { background: var(--glass) var(--glass-sheen) !important; border: none !important; box-shadow: var(--rim) !important; }
.form-input:focus, .form-select:focus, .form-textarea:focus { box-shadow: var(--rim), 0 0 0 3px rgba(255, 46, 126, 0.35); background-color: rgba(255, 255, 255, 0.1); }

/* --------------------------------------------- échelle plus compacte */
.btn-primary-gradient { min-height: 44px; padding: 0 20px; font-size: 14px; font-weight: 700; }
.btn-ghost { min-height: 36px; font-size: 12.5px; }
.form-input, .form-select { min-height: 44px; padding: 10px 14px; font-size: 14.5px; border-radius: 14px; }
.form-label { font-size: 11.5px; }
.search-box { height: 44px; padding: 0 14px; }
.search-box input { font-size: 14.5px; }
.pill-btn { padding: 7px 14px; font-size: 12.5px; }
.icon-btn, .back-btn { width: 36px; height: 36px; }
.icon-btn svg, .back-btn svg { width: 17px; height: 17px; }
.close-btn { width: 30px; height: 30px; font-size: 12px; }
.coin-badge { padding: 5px 6px 5px 9px; font-size: 12px; gap: 5px; }
.coin-badge .coin-svg-icon { width: 14px; height: 14px; }
.coin-plus { width: 16px; height: 16px; font-size: 12px; }
.nav-tabs { padding: 3px; }
.nav-tabs .tab-btn { padding: 5px 11px; font-size: 12px; }

.icon-circle { width: 42px; height: 42px; }
.icon-circle svg { width: 22px; height: 22px; }
.avatar-img { width: 44px; height: 44px; }
.follow-btn { width: 20px; height: 20px; font-size: 13px; bottom: -8px; }
.action-sidebar { gap: 13px; right: 8px; }
.action-btn .count { font-size: 11px; }
.username { font-size: 15px; }
.caption { font-size: 13px; }
.creator-meta { right: 70px; }
.glass-paywall-card { max-width: 270px; padding: 20px 18px; gap: 8px; border-radius: 26px; }
.glass-paywall-card h3 { font-size: 17px; }
.glass-paywall-card p { font-size: 12.5px; }
.lock-icon-wrap { width: 46px; height: 46px; }
.lock-icon-wrap svg { width: 21px; height: 21px; }
.price-amount { font-size: 28px; }
.teaser-bar { font-size: 11px; padding: 5px 10px; }

.c-name { font-size: 14.5px; }
.creator-card-small { border-radius: 20px; border: none; box-shadow: var(--rim), var(--lift); }
.chat-avatar-wrap img { width: 46px; height: 46px; }
.chat-name { font-size: 14px; }
.chat-preview { font-size: 12.5px; }
.bubble { font-size: 13.5px; padding: 9px 13px; }
.composer input, .add-comment-box input { height: 42px; border-radius: 21px; }
.send-btn { height: 42px; padding: 0 14px; font-size: 13px; }
.round-btn { width: 42px; height: 42px; font-size: 17px; }
.composer, .thread-head { border-color: rgba(255, 255, 255, 0.06); }

.profile-cover { height: 150px; }
.profile-head { margin-top: -48px; }
.profile-avatar img { width: 88px; height: 88px; border-width: 3px; }
.profile-name { font-size: 20px; margin-top: 10px; }
.profile-handle { font-size: 13px; }
.profile-bio { font-size: 13px; }
.wallet-card { padding: 12px; border-radius: 20px; }
.wallet-card .wc-icon { width: 36px; height: 36px; }
.wallet-card .wc-value { font-size: 16px; }
.wallet-card .btn-primary-gradient { min-height: 34px; padding: 0 14px; font-size: 12.5px; }
.stats-row { border-radius: 20px; }
.stats-row > div { padding: 10px 4px; }
.stats-row > div + div { border-left-color: rgba(255, 255, 255, 0.07); }
.stats-row strong { font-size: 17px; }
.stats-row span { font-size: 11px; }
.profile-tabs .tab-btn { padding: 10px; font-size: 13px; }
.plan-card { padding: 12px 14px; border-radius: 18px; }
.plan-title { font-size: 14px; }
.plan-card button { min-height: 32px; font-size: 12.5px; }

.glass-section { padding: 16px 14px; border-radius: 22px; }
.glass-section h3 { font-size: 15px; margin-bottom: 12px; }
.settings-top-bar h2 { font-size: 19px; }
.list-line { font-size: 13.5px; padding: 10px 0; border-color: rgba(255, 255, 255, 0.07); }
.avatar-edit img { width: 54px; height: 54px; }

.modal-card { padding: 8px 16px calc(var(--sa-bottom) + 18px); border-radius: 30px 30px 0 0; }
.modal-header h2 { font-size: 18px; }
.modal-desc { font-size: 12.5px; }
.pack-coins { font-size: 21px; }
.coin-pack { padding: 15px 8px 12px; border-radius: 20px; border: none; }
.gift-card { padding: 13px 8px; border-radius: 20px; border: none; }
.gift-svg { font-size: 29px; }
.sheet-item { padding: 13px 4px; font-size: 14px; border-color: rgba(255, 255, 255, 0.07); }

.auth-hero h1 { font-size: 28px; }
.auth-hero p { font-size: 14px; }
.auth-logo .brand-name { font-size: 26px; }
.auth-card { padding: 18px 16px; border-radius: 28px; }
.auth-tab-btn { height: 36px; font-size: 13px; }
.age-gate-mark { font-size: 46px; }
.age-gate-title { font-size: 19px; }

/* ----------------------------------------------- barre du haut (verre) */
.top-nav { height: var(--top); padding: var(--sa-top) 12px 0; background: none; border: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.top-nav::before {
  content: ''; position: absolute; z-index: -1; inset: 0 0 -22px 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 5, 9, 0.72), rgba(6, 5, 9, 0.2) 75%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(170%); backdrop-filter: blur(16px) saturate(170%);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent); mask-image: linear-gradient(180deg, #000 55%, transparent);
  transition: opacity 0.4s var(--spring);
}
.top-nav.over-feed { background: none; }
.top-nav.over-feed::before { background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent); -webkit-backdrop-filter: none; backdrop-filter: none; }
.screen-title { animation: title-in 0.5s var(--spring) both; }
@keyframes title-in { from { opacity: 0; transform: translateY(6px); } }
.net-banner { top: calc(var(--sa-top) + 8px); background-color: rgba(255, 77, 109, 0.85); }

/* --------------------------------------------- dock flottant + lentille */
.dock-nav {
  left: 14px; right: 14px; bottom: calc(var(--sa-bottom) + 10px); height: 60px; padding: 0 5px;
  border-radius: 30px; isolation: isolate;
}
.dock-lens {
  position: absolute; z-index: -1; top: 6px; bottom: 6px; left: 0; width: var(--lens-w, 0px);
  border-radius: 24px; pointer-events: none;
  background: rgba(255, 255, 255, 0.11) var(--glass-sheen); box-shadow: var(--rim), 0 6px 18px -8px rgba(255, 46, 126, 0.55);
  transform: translateX(var(--lens-x, 0px));
  transition: transform var(--t-spring) var(--spring-bounce), width var(--t-spring) var(--spring-bounce), opacity 0.3s;
}
.dock-nav:not(.lens-ready) .dock-lens { transition: none; opacity: 0; }
.dock-nav:active .dock-lens { transform: translateX(var(--lens-x, 0px)) scale(1.05, 1.1); }
.nav-item { color: rgba(255, 255, 255, 0.55); }
.nav-item svg { width: 21px; height: 21px; transition: transform 0.5s var(--spring-bounce), color 0.2s; }
.nav-label { font-size: 9.5px; font-weight: 700; }
.nav-item.active svg { transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 0 6px rgba(255, 46, 126, 0.65)); }
.nav-item:active svg { transform: scale(0.84); transition-duration: 0.12s; }
.upload-btn { width: 46px; height: 40px; border-radius: 20px; margin: 0 3px; }
.upload-btn svg { width: 21px; height: 21px; }
.dot-badge { top: 10px; box-shadow: 0 0 0 2px rgba(24, 19, 32, 1), 0 0 8px var(--pink); animation: dot-pulse 2.4s ease-in-out infinite; }
@keyframes dot-pulse { 50% { transform: scale(1.25); } }

/* ------------------------------------------- écrans : entrée à ressort */
.view-screen {
  transform: translate3d(0, 16px, 0) scale(0.985);
  transition: opacity 0.32s ease, transform var(--t-spring) var(--spring), visibility 0.32s, filter 0.4s ease;
}
.view-screen.active { transform: none; }

/* Feuille ouverte : l'écran recule et s'assombrit (comme iOS). */
.app-container:has(.modal-backdrop.open:not(.center):not(#viewerModal)) .view-screen.active {
  transform: translate3d(0, 10px, 0) scale(0.93); filter: brightness(0.55); border-radius: 28px; overflow: hidden;
}
.app-container:has(.modal-backdrop.open:not(.center):not(#viewerModal)) :is(.top-nav, .dock-nav) { opacity: 0; transition: opacity 0.25s; }
.top-nav, .dock-nav { transition: opacity 0.35s ease; }

/* ------------------------------------------------- feuilles & dialogues */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.38); -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px);
  transition: opacity 0.3s ease, visibility 0.3s, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease;
}
.modal-backdrop.open { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal-card { transform: translate3d(0, 105%, 0); transition: transform var(--t-spring) var(--spring); }
.modal-backdrop.open .modal-card { transform: none; }
.modal-card::before { width: 36px; height: 5px; background: rgba(255, 255, 255, 0.28); }
.modal-backdrop.center .modal-card { transform: scale(0.88); opacity: 0; border-radius: 28px; transition: transform var(--t-spring) var(--spring-bounce), opacity 0.25s ease; }
.modal-backdrop.center.open .modal-card { transform: none; opacity: 1; }
#viewerModal .modal-card, #viewerModal { -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ------------------------------------------------- retour au toucher */
:is(.btn-primary-gradient, .btn-ghost, .pill-btn, .coin-badge, .icon-btn, .back-btn, .close-btn, .round-btn, .send-btn,
    .chat-row, .creator-card-small, .media-tile, .plan-card, .coin-pack, .gift-card, .role-card, .wallet-card,
    .sheet-item, .tab-btn, .auth-tab-btn, .file-pick, .link-btn, .upload-btn, .plan-card button) {
  transition: transform 0.55s var(--spring-bounce), background-color 0.25s, box-shadow 0.25s, color 0.2s, opacity 0.2s, filter 0.2s;
}
:is(.btn-primary-gradient, .btn-ghost, .pill-btn, .coin-badge, .icon-btn, .back-btn, .close-btn, .round-btn, .send-btn,
    .chat-row, .creator-card-small, .media-tile, .plan-card, .coin-pack, .gift-card, .role-card, .wallet-card,
    .sheet-item, .tab-btn, .auth-tab-btn, .file-pick, .link-btn, .upload-btn, .plan-card button):active {
  transform: scale(0.955); transition-duration: 0.1s; filter: brightness(1.12);
}
.btn-primary-gradient:active { transform: scale(0.97); }
.creator-card-small:active, .wallet-card:active, .media-tile:active { transform: scale(0.97); }

/* --------------------------------------------- listes : arrivée en cascade */
:is(.creators-grid, .conversations-list, .media-grid, .plans-list, .coin-packs-grid, .gift-grid, .comments-list) > *,
.screen-content > .glass-section, .profile-head > * {
  animation: rise 0.7s var(--spring) both;
}
:is(.creators-grid, .conversations-list, .media-grid, .plans-list, .coin-packs-grid, .gift-grid, .comments-list) > *:nth-child(2),
.screen-content > .glass-section:nth-child(2), .profile-head > *:nth-child(2) { animation-delay: 0.04s; }
:is(.creators-grid, .conversations-list, .media-grid, .plans-list, .coin-packs-grid, .gift-grid, .comments-list) > *:nth-child(3),
.screen-content > .glass-section:nth-child(3), .profile-head > *:nth-child(3) { animation-delay: 0.08s; }
:is(.creators-grid, .conversations-list, .media-grid, .plans-list, .coin-packs-grid, .gift-grid, .comments-list) > *:nth-child(4),
.screen-content > .glass-section:nth-child(4), .profile-head > *:nth-child(4) { animation-delay: 0.12s; }
:is(.creators-grid, .conversations-list, .media-grid, .plans-list, .coin-packs-grid, .gift-grid, .comments-list) > *:nth-child(5),
.screen-content > .glass-section:nth-child(5), .profile-head > *:nth-child(5) { animation-delay: 0.16s; }
:is(.creators-grid, .conversations-list, .media-grid, .plans-list, .coin-packs-grid, .gift-grid, .comments-list) > *:nth-child(6),
.screen-content > .glass-section:nth-child(6), .profile-head > *:nth-child(6) { animation-delay: 0.2s; }
:is(.creators-grid, .conversations-list, .media-grid, .plans-list, .coin-packs-grid, .gift-grid, .comments-list) > *:nth-child(n+7),
.screen-content > .glass-section:nth-child(n+7), .profile-head > *:nth-child(n+7) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 14px, 0) scale(0.97); } }
.view-screen:not(.active) :is(.creators-grid, .conversations-list, .media-grid, .plans-list) > * { animation: none; }

/* Bulles de discussion : elles naissent depuis leur côté. */
.bubble { animation: bubble-in 0.55s var(--spring-bounce) both; }
.bubble.me { transform-origin: 100% 100%; }
.bubble.them { transform-origin: 0 100%; }
@keyframes bubble-in { from { opacity: 0; transform: scale(0.6); } }

/* --------------------------------------------------------- feed */
.video-card { transition: opacity 0.4s ease; }
.video-card.active .glass-paywall-card { animation: materialize 0.8s var(--spring-bounce) both 0.1s; }
@keyframes materialize { from { opacity: 0; transform: scale(0.86); filter: blur(10px); } }
.paywall-overlay { -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%); }
.play-state-indicator { width: 64px; height: 64px; background: rgba(255, 255, 255, 0.12) var(--glass-sheen); box-shadow: var(--rim); transition: transform 0.5s var(--spring-bounce), opacity 0.2s; }
.icon-circle { position: relative; transition: transform 0.5s var(--spring-bounce), color 0.2s; }
.action-btn:active .icon-circle { transform: scale(0.84); transition-duration: 0.1s; }
.like-btn.liked .icon-circle { animation: like-pop 0.6s var(--spring-bounce); }
.like-btn.liked .icon-circle::after {
  content: ''; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--pink); animation: like-ring 0.6s ease-out both;
}
@keyframes like-pop { 0% { transform: scale(0.6); } 45% { transform: scale(1.22); } 100% { transform: none; } }
@keyframes like-ring { from { opacity: 0.9; transform: scale(0.7); } to { opacity: 0; transform: scale(1.7); } }

/* ------------------------------------------------------ profil */
.profile-avatar::before {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, var(--pink), var(--violet), #ff9bc6, var(--pink));
  animation: halo 7s linear infinite; filter: blur(0.5px);
}
.profile-avatar { isolation: isolate; }
.profile-avatar img { box-shadow: var(--glow); border-color: var(--bg); }
@keyframes halo { to { transform: rotate(360deg); } }
.profile-tabs { border-color: rgba(255, 255, 255, 0.07); }
.profile-tabs .tab-btn.active::after { transition: transform 0.5s var(--spring-bounce); animation: tab-ink 0.5s var(--spring-bounce); }
@keyframes tab-ink { from { transform: scaleX(0.2); opacity: 0; } }

/* ------------------------------------------------------ toast */
.toast-msg { bottom: calc(var(--sa-bottom) + 86px); font-size: 13px; padding: 10px 16px; transform: translate(-50%, 18px) scale(0.9); transition: transform 0.6s var(--spring-bounce), opacity 0.25s; }
.toast-msg.show { transform: translate(-50%, 0) scale(1); }

/* --------------------------------------------- remplacements des encarts */
.screen-content { padding: calc(var(--top) + 10px) 14px calc(var(--dock) + 14px); }
.screen-content.flush { padding-top: var(--top); }
#inboxThreadView { padding: calc(var(--top) + 4px) 0 calc(var(--sa-bottom) + 8px); }
#viewerHost .viewer-close { top: calc(var(--sa-top) + 10px); }
.auth-screen { padding-top: calc(var(--sa-top) + 24px); padding-bottom: calc(var(--sa-bottom) + 24px); }
.teaser-bar { top: calc(var(--top) + 6px); }
.sound-toggle { top: calc(var(--top) + 4px); }

/* ---------------------------------------------------- accessibilité */
@media (prefers-reduced-motion: reduce) {
  .app-container::before, .profile-avatar::before, .dot-badge { animation: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; }
  .view-screen, .modal-card, .modal-backdrop.center .modal-card { transform: none !important; transition: opacity 0.2s ease !important; }
  .app-container:has(.modal-backdrop.open) .view-screen.active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: rgba(34, 28, 44, 0.96); --glass-strong: rgba(24, 19, 32, 0.98); }
  .dock-nav, .modal-card, .auth-card, .glass-section, .top-nav::before { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* La porte d'âge masque complètement la page de connexion derrière elle. */
.modal-backdrop.age-gate { background: rgba(6, 5, 9, 0.9); }
