/* ========================================================================
FAKECHAT — Cosmic Design System (Self-Contained)
Matches the ToolHub Cosmic template: glassmorphism, gradient accents,
frosted header, spring animations, indigo-violet palette.
Tech: PHP 8.x, HTML5, Vanilla JS, AJAX, CSS3 — NO frameworks
======================================================================== */

/* ── 1. COSMIC DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  /* ── Core palette ── */
  --c-indigo:   #6366f1;
  --c-violet:   #8b5cf6;
  --c-purple:   #a855f7;
  --c-emerald:  #10b981;
  --c-amber:    #f59e0b;
  --c-rose:     #f43f5e;
  --c-sky:      #0ea5e9;

  /* ── Gradients ── */
  --grad-primary: linear-gradient(135deg, var(--c-indigo), var(--c-violet));
  --grad-success: linear-gradient(135deg, var(--c-emerald), var(--c-sky));

  /* ── Surfaces ── */
  --bg-page:       #f8fafc;
  --bg-card:       rgba(255, 255, 255, 0.6);
  --bg-card-solid: #ffffff;
  --bg-surface:    #f1f5f9;

  /* ── Text ── */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  /* ── Borders ── */
  --border:       #e2e8f0;
  --border-strong:#cbd5e1;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.16);
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.25);

  /* ── Glassmorphism ── */
  --card-blur: 20px;

  /* ── Spacing ── */
  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-sm:  0.75rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* ── Radii ── */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* ── Layout ── */
  --max-width:     1200px;
  --header-height: 64px;

  /* ── Typography ── */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-xs:   clamp(0.7rem, 0.65rem + 0.25vw, 0.8rem);
  --text-sm:   clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.875rem, 0.8rem + 0.3vw, 1rem);
  --text-lg:   clamp(1rem, 0.9rem + 0.4vw, 1.125rem);
  --text-xl:   clamp(1.25rem, 1rem + 1vw, 1.5rem);
  --text-2xl:  clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem);
  --text-3xl:  clamp(1.875rem, 1.5rem + 1.5vw, 2.25rem);

  /* ── Motion ── */
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --ease-smooth:   cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Legacy compat (mapped) ── */
  --accent:       var(--c-indigo);
  --accent-hover: var(--c-violet);
  --success:      var(--c-emerald);
  --error:        var(--c-rose);
  --warm:         var(--c-amber);
  --radius:       var(--radius-xl);
}

/* ── 2. DARK MODE ──────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-page:       #0b1120;
    --bg-card:       rgba(17, 24, 39, 0.6);
    --bg-card-solid: #111827;
    --bg-surface:    #1e293b;
    --text-primary:  #f1f5f9;
    --text-secondary:#cbd5e1;
    --text-muted:    #64748b;
    --border:        #334155;
    --border-strong: #475569;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.3);
  }
}
html.theme-dark {
  --bg-page:       #0b1120;
  --bg-card:       rgba(17, 24, 39, 0.6);
  --bg-card-solid: #111827;
  --bg-surface:    #1e293b;
  --text-primary:  #f1f5f9;
  --text-secondary:#cbd5e1;
  --text-muted:    #64748b;
  --border:        #334155;
  --border-strong: #475569;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* ── 3. BASE & RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }
ul, ol { list-style: none; }

/* ── 4. LAYOUT & CONTAINERS ────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: var(--space-lg);
}

/* ── 5. FROSTED GLASS HEADER ───────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--bg-card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  transition: border-color var(--duration-base) var(--ease-smooth);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-primary);
  font-size: var(--text-lg);
  line-height: 1.2;
  transition: opacity var(--duration-base) var(--ease-smooth);
}
.logo:hover { opacity: 0.85; }
.logo-img {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: block;
  border-radius: var(--radius-sm);
}
.logo strong { font-weight: 700; letter-spacing: -0.02em; }

main { flex: 1; padding-block: var(--space-2xl); }

/* ── 6. TYPOGRAPHY & UTILITIES ─────────────────────────────────────────── */
h1, h2, h3, h4 {
  text-wrap: balance;
  line-height: 1.2;
  font-weight: 600;
}
h1 { font-size: var(--text-3xl); margin-bottom: var(--space-md); }
h2 { font-size: var(--text-2xl); margin-bottom: var(--space-lg); }
h3 { font-size: var(--text-xl); }

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── 7. LANGUAGE SWITCHER (Cosmic Pill) ────────────────────────────────── */
.lang-switch {
  display: inline-flex;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: 999px;
  gap: 4px;
  align-items: center;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  transition: all var(--duration-fast) var(--ease-smooth);
  white-space: nowrap;
  text-decoration: none;
}
.lang-btn:hover { color: var(--text-primary); }
.lang-btn[aria-current="true"],
.lang-btn.is-active {
  background: var(--bg-card-solid);
  color: var(--c-indigo);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ── 8. THEME TOGGLE ───────────────────────────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  display: grid; place-items: center;
  font-size: 1.1rem;
  transition: border-color var(--duration-fast) var(--ease-smooth),
              box-shadow var(--duration-fast) var(--ease-smooth);
}
.theme-toggle:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.theme-toggle .icon-moon,
.theme-toggle .icon-sun { display: none; }
html:not(.theme-dark) .theme-toggle .icon-moon { display: inline; }
html.theme-dark .theme-toggle .icon-sun { display: inline; }

/* ── 9. BUTTONS (Cosmic) ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--c-indigo);
  color: #fff;
  transition: background var(--duration-fast) var(--ease-smooth),
              transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-smooth);
}
.btn:hover {
  background: var(--c-violet);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn:active { transform: translateY(0); }

.btn--outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn--outline:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.btn--ghost {
  background: transparent;
  border: none;
  color: var(--c-indigo);
  padding: var(--space-xs) var(--space-sm);
}
.btn--ghost:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--c-violet);
}

.btn--danger {
  background: var(--c-rose);
  border-color: var(--c-rose);
}
.btn--danger:hover { background: #e11d48; }

.btn--success {
  background: var(--c-emerald);
  border-color: var(--c-emerald);
}
.btn--success:hover { background: #059669; }

/* ── 10. FORMS (Cosmic) ────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-2xs);
  color: var(--text-primary);
}
.form-input, .form-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card-solid);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  transition: border-color var(--duration-fast) var(--ease-smooth),
              box-shadow var(--duration-fast) var(--ease-smooth);
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--c-indigo);
}
.form-input.is-error, .form-textarea.is-error {
  border-color: var(--c-rose);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

/* ── Checkbox styled ── */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: var(--text-sm);
}
.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--c-indigo);
  cursor: pointer;
}

/* ── 11. BACK LINK (Cosmic) ────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--c-indigo);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-xl);
  transition: color var(--duration-fast) var(--ease-smooth);
}
.back-link:hover { color: var(--c-violet); }
.back-link svg {
  width: 16px; height: 16px;
  transition: transform var(--duration-base) var(--ease-spring);
}
.back-link:hover svg { transform: translateX(-3px); }

/* ── 12. SUB-SITE BANNER (Cosmic frosted) ──────────────────────────────── */
.subsite-banner {
  background: var(--grad-primary);
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.3px;
  position: sticky;
  top: var(--header-height);
  z-index: 45;
}
.subsite-banner a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
  transition: opacity var(--duration-fast) var(--ease-smooth);
}
.subsite-banner a:hover { opacity: 0.85; }

/* ── 13. TOOL PAGE HEADER (Cosmic gradient heading) ────────────────────── */
.tool-page-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}
.tool-page-icon {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.tool-page-header h1 {
  font-size: var(--text-3xl);
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--space-2xs);
}
.tool-page-header p {
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.5;
}

/* ── 14. GLASSMORPHISM CARD (Cosmic) ───────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  transition: border-color var(--duration-base) var(--ease-smooth),
              box-shadow var(--duration-base) var(--ease-smooth);
}
.glass-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.glass-card h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}
.glass-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}
.glass-card p {
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
}

/* ── 15. STAT BAR (Cosmic gradient numbers) ────────────────────────────── */
.stat-bar {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}
.stat-item { text-align: center; }
.stat-item .stat-num {
  display: block;
  font-size: var(--text-2xl);
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-item .stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* ── 16. CODE BLOCK (Cosmic) ───────────────────────────────────────────── */
.code-block {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  overflow-x: auto;
  font-family: "Sarasa Mono SC", "Fira Code", "Cascadia Code", monospace;
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-secondary);
  margin-top: var(--space-md);
}
html.theme-dark .code-block { background: rgba(0, 0, 0, 0.3); }
.code-block .kw  { color: var(--c-purple); }
.code-block .str { color: var(--c-emerald); }
.code-block .num { color: var(--c-amber); }
.code-block .cmt { color: var(--text-muted); font-style: italic; }

/* ── 17. FEATURE LIST (Cosmic) ─────────────────────────────────────────── */
.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}
.feature-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: var(--text-base);
  color: var(--text-secondary);
}
.feature-item .feature-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── 18. TOOL FOOTER NAV (Cosmic) ──────────────────────────────────────── */
.tool-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}
.tool-footer-nav a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--c-indigo);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color var(--duration-fast) var(--ease-smooth);
}
.tool-footer-nav a:hover { color: var(--c-violet); }

/* ══════════════════════════════════════════════════════════════════════════
FAKECHAT-SPECIFIC STYLES
Phone Frame, Chat Bubbles, Platform Colors, Sender Toggle, Share Buttons
══════════════════════════════════════════════════════════════════════════ */

/* ── FakeChat App Layout ── */
.fakechat-layout {
  display: flex;
  gap: var(--space-xl);
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Controls Panel (Glassmorphism Card) ── */
.fakechat-controls {
  flex: 0 0 380px;
  background: var(--bg-card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: border-color var(--duration-base) var(--ease-smooth),
              box-shadow var(--duration-base) var(--ease-smooth);
}
.fakechat-controls:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.fakechat-controls h2 {
  font-size: var(--text-xl);
  margin-bottom: 0;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Platform Selector (Cosmic pill buttons) ── */
.platform-selector {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}
.platform-btn {
  flex: 1;
  padding: var(--space-2xs) var(--space-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  text-align: center;
  white-space: nowrap;
}
.platform-btn:hover {
  color: var(--text-primary);
  border-color: var(--c-indigo);
  transform: translateY(-1px);
}
.platform-btn.is-active {
  background: var(--grad-primary);
  border-color: var(--c-indigo);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ── Sender Toggle (Cosmic) ── */
.sender-toggle {
  display: flex;
  gap: var(--space-sm);
}
.sender-option {
  flex: 1;
  padding: var(--space-sm) var(--space-2xs);
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--duration-fast) var(--ease-spring);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sender-option:hover { border-color: var(--border); }
.sender-option.is-active {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--c-indigo);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
html.theme-dark .sender-option.is-active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--c-indigo);
}
.sender-option input[type="radio"] { display: none; }

/* ── Action Buttons Row ── */
.action-row {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.action-row .btn {
  flex: 1;
  min-width: 0;
}

/* ── Social Share ── */
.social-share {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}
.share-btn {
  flex: 1 0 auto;
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--radius-full);
  border: none;
  font-weight: 600;
  font-size: var(--text-xs);
  cursor: pointer;
  color: white;
  transition: transform var(--duration-fast) var(--ease-spring),
              opacity var(--duration-fast) var(--ease-smooth);
  text-align: center;
  white-space: nowrap;
}
.share-btn:hover { opacity: 0.85; transform: translateY(-2px); }
.share-btn.is-whatsapp { background: #25D366; }
.share-btn.is-telegram { background: #0088cc; }
.share-btn.is-twitter  { background: #000000; }
.share-btn.is-facebook { background: #1877F2; }
.share-btn.is-reddit   { background: #FF4500; }
.share-btn.is-instagram {
  background: radial-gradient(circle at 30% 110%, #ffdb7e, #f9ce34, #e94057, #b83b8e, #6a1b9a);
}

/* ── Phone Frame ── */
.phone-frame {
  width: 380px;
  height: 780px;
  background: #efeae2;
  border-radius: 42px;
  box-shadow: 0 30px 50px rgba(0,0,0,0.5), 0 0 0 8px #2c2c2c, 0 0 0 12px #1a1a1a;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  flex-shrink: 0;
}
.phone-frame::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 28px;
  background: #1a1a1a;
  border-radius: 20px;
  z-index: 200;
}
.phone-status-bar {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px 6px;
  color: white;
  font-size: 0.8rem;
}

/* ── Chat Header ── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: white;
}
.chat-header .back-arrow { font-size: 1.5rem; }
.chat-header .contact-block {
  display: flex;
  gap: 12px;
  flex: 1;
}
.chat-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold;
  font-size: var(--text-lg);
}
.chat-contact-name { font-weight: 600; font-size: var(--text-base); }
.chat-contact-status { font-size: 0.7rem; opacity: 0.85; }
.chat-header .more-icon { font-size: 1.3rem; }

/* ── Chat Container ── */
.chat-container {
  flex: 1;
  background: #efeae2;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-image: radial-gradient(circle at 10% 30%, rgba(209,215,219,0.2) 2%, transparent 2.5%);
  background-size: 28px 28px;
}

/* ── Message Bubbles ── */
.chat-msg {
  display: flex;
  max-width: 82%;
  animation: fadeIn var(--duration-base) var(--ease-smooth);
}
.chat-msg.is-them { align-self: flex-start; }
.chat-msg.is-me   { align-self: flex-end; }
.chat-bubble {
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 0.9rem;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.08);
  position: relative;
}
.chat-msg.is-them .chat-bubble {
  background: white;
  border-top-left-radius: 4px;
}
.chat-msg.is-me .chat-bubble {
  background: #dcf8c6;
  border-top-right-radius: 4px;
}
.msg-content { display: flex; flex-direction: column; }
.msg-text { word-break: break-word; }
.msg-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  margin-top: 4px;
  justify-content: flex-end;
}
.msg-timestamp { color: #8696a0; font-size: 0.65rem; }
.msg-ticks { font-size: 0.7rem; margin-left: 3px; }
.msg-ticks.is-read { color: #53bdeb; }

/* ── Chat Input Fake ── */
.chat-input-fake {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: #f0f2f5;
  border-top: 1px solid #e0e0e0;
}
.fake-input-text {
  flex: 1;
  background: white;
  padding: 8px 14px;
  border-radius: 28px;
  color: #667781;
  font-size: var(--text-sm);
}

/* ── Placeholder ── */
.chat-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: #8696a0;
}

/* ── Hint Box (Cosmic styled) ── */
.hint-box {
  font-size: var(--text-xs);
  margin-top: var(--space-sm);
  color: var(--c-indigo);
  background: rgba(99, 102, 241, 0.08);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid rgba(99, 102, 241, 0.15);
}
html.theme-dark .hint-box {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

/* ── Sub-site Legal Footer ── */
.subsite-legal-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card-solid);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  z-index: 9998;
  text-align: center;
  font-size: var(--text-sm);
}
.subsite-legal-footer a {
  color: var(--c-indigo);
  font-weight: 600;
  transition: color var(--duration-fast) var(--ease-smooth);
}
.subsite-legal-footer a:hover { color: var(--c-violet); }
.subsite-legal-footer a span {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Platform Colors ── */
.platform-whatsapp  { --platform-color: #075E54; }
.platform-telegram  { --platform-color: #2AABEE; }
.platform-messenger { --platform-color: #0084FF; }
.platform-imessage  { --platform-color: #34C759; }

/* ══════════════════════════════════════════════════════════════════════════
STICKY DONATION BUTTON (Cosmic)
══════════════════════════════════════════════════════════════════════════ */
.sticky-donate-wrapper {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-base) var(--ease-smooth),
              transform var(--duration-base) var(--ease-spring);
  pointer-events: none;
}
.sticky-donate-wrapper.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.sticky-donate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #FFDD00 0%, #FFC107 100%);
  color: #111;
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  border: none;
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-smooth);
}
.sticky-donate-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 16px rgba(255, 205, 0, 0.3);
}
.sticky-donate-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.donate-icon { font-size: 1.2em; }
.sticky-donate-dismiss {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  align-self: flex-end;
}

/* ══════════════════════════════════════════════════════════════════════════
MODAL (Cosmic)
══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease-smooth),
              visibility var(--duration-base) var(--ease-smooth);
}
.modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
}
.modal-container {
  background: var(--bg-card-solid);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: scale(0.95);
  transition: transform var(--duration-base) var(--ease-spring);
}
.modal-overlay.is-active .modal-container {
  transform: scale(1);
}
.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  z-index: 1;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background var(--duration-fast) var(--ease-smooth),
              color var(--duration-fast) var(--ease-smooth);
}
.modal-close:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}
.modal-content {
  padding: var(--space-2xl);
  overflow-y: auto;
  max-height: 80vh;
}
.modal-content .modal-title {
  margin-top: 0;
  margin-bottom: var(--space-lg);
  font-size: var(--text-2xl);
  color: var(--text-primary);
}
.modal-loading {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════════════════════
DONATE WIDGET (Cosmic)
══════════════════════════════════════════════════════════════════════════ */
.donate-widget {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
  width: 100%;
  margin: 0;
}
.donate-widget .widget-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.donate-widget .widget-sub {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0 0 20px;
}
.donate-widget .prim-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.donate-widget .widget-btn-bmc {
  background: #FFDD00;
  color: #000;
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 600;
  transition: transform var(--duration-fast) var(--ease-spring);
}
.donate-widget .widget-btn-bmc:hover { transform: translateY(-1px); }
.donate-widget .widget-btn-pp,
.donate-widget .widget-btn-rev {
  justify-content: center;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 600;
  color: white;
  transition: transform var(--duration-fast) var(--ease-spring);
}
.donate-widget .widget-btn-pp { background: var(--c-indigo); }
.donate-widget .widget-btn-pp:hover { transform: translateY(-1px); }
.donate-widget .widget-btn-rev { background: #1e3a8a; width: 100%; font-size: 0.85rem; margin-bottom: 10px; }
.donate-widget .widget-btn-rev:hover { transform: translateY(-1px); }
.donate-widget .alt-toggle {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  color: var(--c-indigo);
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--duration-fast) var(--ease-smooth);
}
.donate-widget .alt-toggle:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
}
.donate-widget .alt-content {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.donate-widget .alt-content.show {
  display: block;
  animation: fadeIn var(--duration-base) var(--ease-smooth);
}
.donate-widget .copy-box {
  background: var(--bg-surface);
  padding: 10px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.donate-widget .copy-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.donate-widget .copy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.donate-widget .copy-val {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-primary);
  word-break: break-all;
  flex: 1;
}
.donate-widget .btn-copy {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  white-space: nowrap;
}
.donate-widget .btn-copy:hover {
  border-color: var(--c-indigo);
  color: var(--c-indigo);
  transform: scale(1.02);
}
.donate-widget .qr-wrap { text-align: center; margin-bottom: 12px; }
.donate-widget .qr-img {
  width: 110px; height: 110px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.donate-widget .qr-text { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.donate-widget .widget-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════════════════
ANIMATIONS
══════════════════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

.shimmer {
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
html.theme-dark .shimmer {
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.05) 50%, transparent 100%);
  background-size: 200% 100%;
}
.badge-pulse { animation: pulse 2s infinite; }

/* ── Focus visible ── */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════════════════════
RESPONSIVE
══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .fakechat-layout {
    flex-direction: column;
    align-items: center;
  }
  .fakechat-controls {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .phone-frame {
    margin: 0 auto;
  }
  .tool-page-header {
    flex-direction: column;
    text-align: center;
  }
  .tool-page-header h1 {
    font-size: var(--text-2xl);
  }
  .stat-bar {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  :root {
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
  }
  .lang-btn span { display: none; }
  .lang-btn { padding: 6px 8px; font-size: 1.2rem; }
  .sticky-donate-wrapper { bottom: 16px; right: 16px; }
  .sticky-donate-btn { padding: 8px 14px; font-size: var(--text-xs); }
  .sticky-donate-btn .donate-text { display: inline-flex !important; }
  .donate-widget .copy-row { flex-direction: column; align-items: stretch; }
  .donate-widget .btn-copy { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
  .phone-frame {
    width: 100%;
    max-width: 380px;
    height: 680px;
    border-radius: 32px;
  }
  .phone-frame::before {
    width: 100px;
    height: 22px;
  }
}

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

@media print {
  .site-header, .filters, .btn, .theme-toggle, .lang-switch,
  .subsite-banner, .sticky-donate-wrapper, .subsite-legal-footer { display: none; }
  body { background: #fff; color: #000; }
}
