/* ========================================================================
   LOREM IPSUM GENERATOR - DESIGN SYSTEM
   Target: RO / DACH / EN | Warm Creative Theme + ToolHub Ecosystem
   ======================================================================== */

/* ═══════════════════════════════════════════════════════════════════════════
   1. VARIABLES & THEME
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Colors — Warm creative palette */
  --bg-page: #faf9f7;
  --bg-card: #ffffff;
  --bg-surface: #f3f1ee;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8a8aaa;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-light: #ede9fe;
  --warm: #d97706;
  --success: #10b981;
  --error: #ef4444;
  --border: #e5e2dd;
  --shadow-sm: 0 1px 3px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 4px 12px rgba(26, 26, 46, 0.1);
  --shadow-lg: 0 8px 24px rgba(26, 26, 46, 0.12);
  --focus-ring: 0 0 0 3px rgba(139, 92, 246, 0.25);
  --color-on-accent: #fff;
  --color-on-dark: #fff;
  --color-toggle-knob: #fff;
  --donate-bg: #FFDD00;
  --donate-text: #111;
  --donate-hover-shadow: 0 8px 16px rgba(255, 205, 0, 0.3);
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 20px 40px rgba(0, 0, 0, 0.15);
  --shadow-lang-active: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-toggle-knob: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-error-focus: 0 0 0 3px rgba(239, 68, 68, 0.2);
  --loader-border: rgba(255, 255, 255, 0.3);
  --loader-border-top: #fff;
  --print-bg: #fff;
  --print-text: #000;

  /* 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: 800px;
  --header-height: 64px;

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Merriweather", Georgia, "Times New Roman", 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);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-surface: #252542;
    --text-primary: #f0eef5;
    --text-secondary: #b8b5d0;
    --text-muted: #6e6b8a;
    --border: #333355;
    --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);
    --accent-light: #2d2060;
  }
}

/* Manual dark theme override (JS toggles .theme-dark on <html>) */
html.theme-dark {
  --bg-page: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-surface: #252542;
  --text-primary: #f0eef5;
  --text-secondary: #b8b5d0;
  --text-muted: #6e6b8a;
  --border: #333355;
  --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);
  --accent-light: #2d2060;
}

/* ═══════════════════════════════════════════════════════════════════════════
   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.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  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; }

/* ═══════════════════════════════════════════════════════════════════════════
   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;
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1200px;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   4. TYPOGRAPHY & UTILITY
   ═══════════════════════════════════════════════════════════════════════════ */
h1, h2, h3, h4 {
  text-wrap: balance;
  line-height: 1.25;
  font-weight: 600;
  color: var(--text-primary);
}

h1 { font-size: var(--text-2xl); margin-bottom: var(--space-sm); }
h2 { font-size: var(--text-xl); margin-bottom: var(--space-md); }
h3 { font-size: var(--text-lg); }

.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;
}

/* ═══════════════════════════════════════════════════════════════════════════
   5. COMPONENTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Logo ─────────────────────────────────────────────────────────────── */
.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.85; }

.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;
}

/* ─── Language Switcher ────────────────────────────────────────────────── */
.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: 4px;
  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;
  cursor: pointer;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-lang-active);
}

/* ─── 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);
}

/* ─── Sub-Site Banner ─────────────────────────────────────────────────── */
.subsite-banner {
  background: var(--accent);
  color: var(--color-on-dark);
  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: var(--color-on-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
}

/* ─── 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-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.subtitle {
  margin-bottom: var(--space-lg);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── 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: var(--color-on-accent);
  transition: var(--ease);
  white-space: nowrap;
}

.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn--outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}

.btn--outline:hover { background: var(--bg-surface); }

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  border-radius: var(--radius-xs);
}

.btn-danger {
  color: var(--error);
  border-color: var(--error);
}

.btn-danger:hover {
  background: var(--error);
  color: var(--color-on-accent);
}

.btn-success {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: var(--color-on-accent) !important;
}

/* Generate Button */
.btn-generate {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-lg);
  font-weight: 600;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--color-on-accent);
  position: relative;
  overflow: hidden;
}

.btn-generate:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-generate:active {
  transform: translateY(0);
}

/* Button loading spinner */
.btn-loader {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--loader-border);
  border-top-color: var(--loader-border-top);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ─── 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 {
  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);
  font-family: var(--font-sans);
  transition: var(--ease);
}

.form-input:focus-visible, .form-textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--accent);
}

/* Global focus-visible for interactive elements */
.btn:focus-visible,
.btn-generate:focus-visible,
.type-btn:focus-visible,
.count-btn:focus-visible,
.lang-btn:focus-visible,
.theme-toggle:focus-visible,
.modal-close:focus-visible,
.history-item:focus-visible,
.wordbank-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-input.is-error, .form-textarea.is-error {
  border-color: var(--error);
  box-shadow: var(--shadow-error-focus);
}

.form-help {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.form-textarea {
  resize: vertical;
  min-height: 60px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   6. TOOL-SPECIFIC STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Control Panel ────────────────────────────────────────────────────── */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.control-actions {
  margin-top: var(--space-sm);
}

/* ─── Type Switcher ────────────────────────────────────────────────────── */
.type-switcher {
  display: flex;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.type-btn {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--ease);
  cursor: pointer;
}

.type-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.type-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ─── Count Control ───────────────────────────────────────────────────── */
.count-control {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.count-input {
  text-align: center;
  width: 100px;
  flex-shrink: 0;
  -moz-appearance: textfield;
}

.count-input::-webkit-outer-spin-button,
.count-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.count-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--ease);
  flex-shrink: 0;
}

.count-btn:hover {
  background: var(--bg-card);
  color: var(--accent);
  border-color: var(--accent);
}

.count-hint {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Toggle Switch ───────────────────────────────────────────────────── */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 999px;
  transition: var(--ease);
  flex-shrink: 0;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--color-toggle-knob);
  border-radius: 50%;
  transition: var(--ease);
  box-shadow: var(--shadow-toggle-knob);
}

.toggle-label input:checked + .toggle-switch {
  background: var(--accent);
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

.toggle-label input:focus-visible + .toggle-switch {
  box-shadow: var(--focus-ring);
}

/* ─── Output Section ──────────────────────────────────────────────────── */
.output-section {
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.output-actions {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.output-area {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  min-height: 180px;
  max-height: 500px;
  overflow-y: auto;
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--text-primary);
}

.output-paragraph {
  margin-bottom: var(--space-md);
  text-indent: 2em;
}

.output-paragraph:last-child {
  margin-bottom: 0;
}

.output-pre {
  font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
  font-size: var(--text-sm);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
}

.output-markdown p {
  margin-bottom: var(--space-md);
}

.placeholder-text {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

.error-text {
  color: var(--error);
  font-weight: 500;
  text-align: center;
  padding: var(--space-lg);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

/* ─── History Section ──────────────────────────────────────────────────── */
.history-section {
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
}

.history-details {
  border-radius: var(--radius-sm);
}

.history-details[open] .history-arrow {
  transform: rotate(90deg);
}

.history-summary {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-sm) 0;
  list-style: none;
}

.history-summary::-webkit-details-marker {
  display: none;
}

.history-arrow {
  transition: transform var(--ease);
  font-size: var(--text-xs);
}

.history-content {
  padding: var(--space-sm) 0;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--ease);
}

.history-item:hover {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}

.history-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.history-preview {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-footer {
  margin-top: var(--space-sm);
  text-align: right;
}

/* ─── Word Bank Section ───────────────────────────────────────────────── */
.wordbank-section {
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
}

.wordbank-content {
  padding: var(--space-sm) 0;
}

.wordbank-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.wordbanks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.wordbank-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
}

.wordbank-item-name {
  font-weight: 500;
  font-size: var(--text-sm);
  flex: 1;
}

.wordbank-item-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ─── 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);
}

.subsite-legal-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer-link-underline {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   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: var(--donate-bg);
  color: var(--donate-text);
  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: var(--donate-hover-shadow);
}

.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: var(--overlay-bg);
  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: var(--shadow-modal);
  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-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);
}

/* ═══════════════════════════════════════════════════════════════════════════
   9. ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Smooth output fade-in */
.output-paragraph,
.output-pre,
.output-markdown {
  animation: fadeIn 0.3s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════════════
   10. RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  :root {
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
  }

  .tool-card {
    padding: var(--space-md);
  }

  .container {
    padding-inline: var(--space-md);
  }

  .type-switcher {
    flex-direction: column;
  }

  .type-btn {
    padding: var(--space-xs) var(--space-sm);
  }

  .count-control {
    width: 100%;
  }

  .count-input {
    flex: 1;
  }

  .output-area {
    padding: var(--space-md);
    max-height: 350px;
  }

  .output-actions {
    width: 100%;
  }

  .output-actions .btn {
    flex: 1;
    font-size: var(--text-xs);
    padding: 4px 6px;
  }

  .lang-btn span { display: none; }
  .lang-btn { padding: 6px 8px; font-size: 1.2rem; }

  .sticky-donate-wrapper {
    bottom: 36px;
    right: 12px;
  }

  .sticky-donate-btn {
    padding: 8px 14px;
    font-size: var(--text-xs);
    border-radius: 999px;
  }

  .wordbank-item {
    flex-wrap: wrap;
  }

  .btn-generate {
    font-size: var(--text-base);
    padding: var(--space-sm) var(--space-md);
  }

  .subsite-banner {
    font-size: var(--text-xs);
  }
}

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

  .sticky-donate-wrapper,
  .sticky-donate-btn,
  .modal-overlay {
    transition: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   12. PRINT
   ═══════════════════════════════════════════════════════════════════════════ */
@media print {
  .site-header,
  .subsite-banner,
  .sticky-donate-wrapper,
  .subsite-legal-footer,
  .btn,
  .theme-toggle,
  .lang-switch,
  .control-panel,
  .history-section,
  .wordbank-section,
  .output-actions {
    display: none !important;
  }

  body {
    background: var(--print-bg);
    color: var(--print-text);
    padding-bottom: 0;
  }

  main {
    padding: 0;
  }

  .tool-card {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .output-area {
    border: none;
    background: var(--print-bg);
    max-height: none;
    overflow: visible;
    padding: 0;
  }
}
