/* ========================================================================
   MEMESGEN — Meme Generator · Emoji Picker · Random Name/Address Generator
   ToolHub Sub-Site Design System
   Target: RO / DACH / EN | Psychology: Trust + Clarity + Playful Energy
   ======================================================================== */

/* 1. VARIABLES & THEME =================================================== */
:root {
  /* Colors */
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-surface: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --warm: #D97706;
  --success: #10B981;
  --error: #EF4444;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.08);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.12);
  --focus-ring: 0 0 0 3px rgba(37,99,235,0.25);
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  /* Layout */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --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.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
  --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 */
  --ease: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-slow: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  /* Meme-specific */
  --meme-canvas-bg: #1e293b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #0B1120;
    --bg-card: #111827;
    --bg-surface: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --border: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --meme-canvas-bg: #0f172a;
  }
}

html.theme-dark {
  --bg-page: #0B1120;
  --bg-card: #111827;
  --bg-surface: #1E293B;
  --text-primary: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #64748B;
  --border: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --meme-canvas-bg: #0f172a;
}

/* 2. 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;
  padding-bottom: 100px;
}
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; }
canvas { max-width: 100%; height: auto; }

/* 3. LAYOUT & CONTAINERS ================================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: var(--space-lg);
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.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(--ease);
}
.logo:hover { opacity: 0.9; }
.logo-img {
  width: 32px;
  height: 32px;
  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); }

/* 4. 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-xs { gap: var(--space-xs); }
.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;
}

/* 5. COMPONENTS ========================================================= */

/* Language Switcher - Pill Design */
.lang-switch {
  display: inline-flex;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: 999px;
  gap: 4px;
  align-items: center;
  width: auto;
}
.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 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}
.lang-btn:hover { color: var(--text-primary); }
.lang-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

/* 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: var(--ease);
}
.theme-toggle:hover { background: var(--bg-card); }

/* Tool Card */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  max-width: 960px;
  margin: 0 auto;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--space-lg);
  padding-bottom: 0;
  overflow-x: auto;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--ease);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-surface); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Tab Content */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  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(--accent);
  color: #fff;
  transition: var(--ease);
}
.btn:hover { background: var(--accent-hover); }
.btn--outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn--outline:hover { background: var(--bg-surface); }
.btn--success { background: var(--success); }
.btn--success:hover { background: #059669; }
.btn--sm { padding: var(--space-xs) var(--space-sm); font-size: var(--text-xs); }
.btn--warm { background: var(--warm); color: #fff; }
.btn--warm:hover { background: #B45309; }

/* Forms */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: var(--ease);
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--accent);
}
.form-input.is-error, .form-textarea.is-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}
.form-help { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-xs); }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Range Input */
input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--ease);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }

/* Color Input */
input[type="color"] {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 2px;
  background: var(--bg-card);
}

/* Inline Field Row */
.field-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-end;
  flex-wrap: wrap;
}
.field-row .form-group { flex: 1; min-width: 140px; }

/* 6. TOOL-SPECIFIC ====================================================== */

/* --- Meme Generator --- */
.meme-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: start;
}
.meme-controls { display: flex; flex-direction: column; gap: var(--space-md); }
/* Sticky preview column */
.meme-preview-col {
  position: sticky;
  top: calc(var(--header-height) + 52px);
  z-index: 10;
  max-height: calc(100vh - var(--header-height) - 72px);
  overflow: hidden;
}
.meme-preview {
  background: var(--meme-canvas-bg);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  position: relative;
}
.meme-preview canvas {
  border-radius: var(--radius-xs);
  max-height: 500px;
  object-fit: contain;
}
.meme-preview .meme-placeholder {
  color: var(--text-muted);
  text-align: center;
  font-size: var(--text-sm);
  padding: var(--space-xl);
}
.meme-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.meme-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: var(--space-sm);
}
.meme-template-item {
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-xs);
  cursor: pointer;
  transition: var(--ease);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  overflow: hidden;
}
.meme-template-item:hover { border-color: var(--accent); }
.meme-template-item.selected {
  border-color: var(--accent);
  background: rgba(37,99,235,0.08);
  color: var(--accent);
  font-weight: 600;
}
/* Meme Gallery */
.meme-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}
.gallery-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--ease);
}
.gallery-card:hover {
  box-shadow: var(--shadow-md);
}
.gallery-img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: var(--meme-canvas-bg);
  cursor: pointer;
}
.gallery-actions {
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Share Bar */
.share-bar {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-xs);
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: var(--ease);
  padding: 0;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }
.share-x { color: #000; }
html.theme-dark .share-x { color: #fff; }
.share-fb { color: #1877F2; }
.share-wa { color: #25D366; }
.share-tg { color: #0088CC; }
.share-reddit { color: #FF4500; }
.share-native { color: var(--accent); }
.share-dl { color: var(--success); }

/* Country Pills */
.country-pills {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}
.country-pill {
  padding: var(--space-xs) var(--space-md);
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--ease);
}
.country-pill:hover { border-color: var(--accent); color: var(--accent); }
.country-pill.active {
  border-color: var(--accent);
  background: rgba(37,99,235,0.08);
  color: var(--accent);
  font-weight: 600;
}

/* --- Emoji Picker --- */
.emoji-search-wrap {
  position: relative;
  margin-bottom: var(--space-md);
}
.emoji-search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-base);
  color: var(--text-muted);
  pointer-events: none;
}
.emoji-search-wrap input {
  padding-left: 36px;
}
.emoji-categories {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
}
.emoji-cat-btn {
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: var(--ease);
  white-space: nowrap;
}
.emoji-cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.emoji-cat-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: var(--space-xs);
}
.emoji-item {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--ease);
  border: 1px solid transparent;
  position: relative;
}
.emoji-item:hover {
  background: var(--bg-surface);
  border-color: var(--border);
  transform: scale(1.2);
  z-index: 2;
}
.emoji-item:active { transform: scale(0.95); }
.emoji-recent {
  margin-bottom: var(--space-lg);
}
.emoji-recent h4 {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}
.emoji-no-results {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-xl);
  font-size: var(--text-sm);
}
.emoji-copy-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin-top: var(--space-md);
  font-style: italic;
}

/* --- Random Generator --- */
.rand-config {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.rand-results {
  overflow-x: auto;
}
.rand-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.rand-table th {
  background: var(--bg-surface);
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.rand-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.rand-table tr:hover td { background: var(--bg-surface); }
.rand-table .copy-cell {
  text-align: center;
  width: 40px;
}
.rand-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}

/* Radio group */
.radio-group {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  cursor: pointer;
  color: var(--text-secondary);
}
.radio-group input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 8px);
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  font-weight: 500;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: 320px;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}
.toast--success { border-left: 3px solid var(--success); }
.toast--error { border-left: 3px solid var(--error); }
.toast--info { border-left: 3px solid var(--accent); }

/* 7. STICKY DONATE ====================================================== */
.sticky-donate-wrapper {
  position: fixed;
  bottom: 44px;
  right: 24px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--ease), transform var(--ease);
  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: #FFDD00;
  color: #111;
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  border: none;
  text-decoration: none;
  transition: transform var(--ease), box-shadow var(--ease);
}
.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; }

/* 8. MODAL =============================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
}
.modal-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.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 0.2s ease;
}
.modal-close:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}
.modal-content {
  padding: var(--space-2xl);
  overflow-y: auto;
  max-height: 80vh;
}
.modal-loading {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

/* Sub-site banner */
.subsite-banner {
  background: var(--accent);
  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: 49;
}
.subsite-banner a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
}

/* Sub-site legal footer */
.subsite-legal-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  z-index: 9998;
  text-align: center;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}
.subsite-legal-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.admin-footer-sep {
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.admin-footer-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: var(--ease);
  font-family: inherit;
  font-weight: 500;
}
.admin-footer-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-card);
}
.admin-footer-btn.admin-active {
  color: #fff;
  background: var(--error);
  border-color: var(--error);
  font-weight: 600;
}

/* Admin FAB (floating action button) */
.admin-fab {
  position: fixed;
  bottom: 52px;
  left: 16px;
  z-index: 9998;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--ease);
}
.admin-fab:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.08);
}
.admin-fab.admin-active {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}
.admin-fab.admin-active:hover {
  background: #DC2626;
  transform: scale(1.08);
}

/* Admin setup banner */
.admin-setup-banner {
  background: #7C3AED;
  color: #fff;
  text-align: center;
  padding: 12px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--ease);
  position: sticky;
  top: calc(var(--header-height) + 36px);
  z-index: 48;
}
.admin-setup-banner:hover {
  opacity: 0.92;
}
.admin-setup-banner strong {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 9. ANIMATIONS ========================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* 10. RESPONSIVE ========================================================= */
@media (max-width: 640px) {
  :root {
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
  }
  .tool-card { padding: var(--space-md); }
  .meme-layout {
    grid-template-columns: 1fr;
  }
  .meme-preview-col {
    position: static;
    max-height: none;
  }
  .emoji-grid {
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  }
  .emoji-item {
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
  }
  .field-row { flex-direction: column; }
  .field-row .form-group { min-width: auto; }
  .lang-btn span { display: none; }
  .lang-btn { padding: 6px 8px; font-size: 1.2rem; }
  .tab-btn { font-size: var(--text-sm); padding: var(--space-xs) var(--space-sm); }
  .sticky-donate-wrapper { bottom: 40px; right: 16px; }
  .admin-fab { bottom: 48px; left: 12px; width: 40px; height: 40px; font-size: 1.1rem; }
  .sticky-donate-btn { padding: 8px 14px; font-size: var(--text-xs); }
  .rand-config { grid-template-columns: 1fr; }
  .meme-gallery { grid-template-columns: 1fr 1fr; }
  .gallery-img { height: 140px; }
  .share-bar { gap: 2px; }
  .share-btn { width: 28px; height: 28px; font-size: var(--text-xs); }
  .country-pills { gap: 4px; }
  .country-pill { padding: 4px 10px; font-size: var(--text-xs); }
  .rand-table { font-size: var(--text-xs); }
  .rand-table th, .rand-table td { padding: 4px 6px; }
}

/* 11. REDUCED MOTION ===================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .sticky-donate-wrapper, .sticky-donate-btn, .toast, .emoji-item {
    transition: none !important;
    animation: none !important;
  }
}

/* 12. PRINT ============================================================== */
@media print {
  .site-header, .subsite-banner, .btn, .theme-toggle, .lang-switch,
  .sticky-donate-wrapper, .subsite-legal-footer, .toast-container,
  .tab-nav, .meme-actions, .rand-actions, .emoji-search-wrap,
  .emoji-categories, .emoji-copy-hint, .admin-footer-btn,
  .admin-footer-sep, .admin-fab, .admin-setup-banner { display: none !important; }
  body { background: #fff; color: #000; padding-bottom: 0; }
  .tool-card { box-shadow: none; border: 1px solid #000; }
  .tab-panel { display: block !important; }
}
