  /* ── DARK THEME (default) ── */
  :root, [data-theme="dark"] {
    --bg:         #0e0e11;
    --bg2:        #16161a;
    --bg3:        #1e1e24;
    --border:     rgba(255,255,255,0.07);
    --border2:    rgba(255,255,255,0.12);
    --text:       #f0efe8;
    --text2:      #8a8a96;
    --text3:      #55555f;
    --accent:     #c8f060;
    --accent2:    #a8d040;
    --accent-dim: rgba(200,240,96,0.08);
    --accent-dim2:rgba(200,240,96,0.15);
    --header-bg:  rgba(14,14,17,0.85);
    --glow-color: rgba(200,240,96,0.06);
    --grid-line:  rgba(255,255,255,0.02);
    --serif:  'DM Serif Display', Georgia, serif;
    --sans:   'Instrument Sans', sans-serif;
    --mono:   'DM Mono', monospace;
    --radius: 10px;
    --radius-lg: 16px;
  }

  /* ── LIGHT THEME ── */
  [data-theme="light"] {
    --bg:         #f8f7f4;
    --bg2:        #ffffff;
    --bg3:        #f0eeea;
    --border:     rgba(0,0,0,0.07);
    --border2:    rgba(0,0,0,0.12);
    --text:       #1a1a18;
    --text2:      #6b6b72;
    --text3:      #a0a0a8;
    --accent:     #5a9e18;
    --accent2:    #477d12;
    --accent-dim: rgba(90,158,24,0.08);
    --accent-dim2:rgba(90,158,24,0.14);
    --header-bg:  rgba(248,247,244,0.90);
    --glow-color: rgba(90,158,24,0.05);
    --grid-line:  rgba(0,0,0,0.025);
  }

  /* ── THEME TRANSITION ── */
  *, *::before, *::after {
    transition: background-color .25s ease, border-color .25s ease, color .2s ease;
  }

  /* ── BASE RESET ── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  html { scroll-behavior: smooth; }

  body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
  }

  /* ── NOISE TEXTURE ── */
  body::before {
    content: '';
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    opacity: 0.025; pointer-events: none; z-index: 0;
  }

  /* ── GRID BG ── */
  body::after {
    content: '';
    position: fixed; inset: 0;
    background-image:
      linear-gradient(var(--grid-line) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none; z-index: 0;
  }

  /* ── GLOW ── */
  .glow-orb {
    position: fixed;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
    top: -200px; right: -100px;
    pointer-events: none; z-index: 0;
  }

  .wrap { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 0 24px; }

  /* ── HEADER ── */
  header {
    position: sticky; top: 0; z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
  }

  .nav {
    display: flex; align-items: center;
    justify-content: space-between; height: 58px;
  }

  .logo { display: flex; align-items: baseline; gap: 1px; text-decoration: none; }
  .logo-lorem { font-family: var(--serif); font-size: 20px; color: var(--text); font-style: italic; }
  .logo-ux {
    font-family: var(--mono); font-size: 13px; font-weight: 500;
    color: var(--accent);
    background: var(--accent-dim2);
    border: 1px solid rgba(200,240,96,0.2);
    border-radius: 4px; padding: 1px 6px; margin-left: 6px; letter-spacing: 0.05em;
  }

  .nav-links { display: flex; align-items: center; gap: 6px; }
  .nav-link {
    font-size: 13px; color: var(--text2); text-decoration: none;
    padding: 6px 12px; border-radius: 6px; transition: color .15s, background .15s;
  }
  .nav-link:hover { color: var(--text); background: var(--bg3); }
  .nav-badge {
    font-size: 10px; font-family: var(--mono);
    background: var(--accent-dim2); color: var(--accent);
    border: 1px solid rgba(200,240,96,0.2);
    border-radius: 4px; padding: 2px 7px; letter-spacing: 0.06em;
  }

  /* ── THEME TOGGLE ── */
  .theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background .2s, border-color .2s, transform .15s;
    flex-shrink: 0;
    line-height: 1;
  }
  .theme-toggle:hover {
    background: var(--bg2);
    border-color: var(--accent);
    transform: scale(1.05);
  }
  .theme-toggle:active { transform: scale(0.96); }

  /* ── HERO ── */
  .hero { padding: 72px 0 48px; text-align: center; }

  .hero-eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--mono); font-size: 11px; color: var(--accent);
    letter-spacing: 0.12em; text-transform: uppercase;
    background: var(--accent-dim);
    border: 1px solid rgba(200,240,96,0.15);
    border-radius: 20px; padding: 5px 14px; margin-bottom: 24px;
  }
  .hero-eyebrow::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent); animation: pulse 2s ease-in-out infinite;
  }
  @keyframes pulse {
    0%,100% { opacity:1; transform:scale(1); }
    50%      { opacity:.5; transform:scale(.8); }
  }

  .hero-title {
    font-family: var(--serif);
    font-size: clamp(42px,7vw,80px);
    line-height: 1.05; color: var(--text);
    margin-bottom: 20px; letter-spacing: -0.02em;
  }
  .hero-title em { font-style: italic; color: var(--accent); }

  .hero-sub {
    font-size: 17px; color: var(--text2);
    max-width: 520px; margin: 0 auto 40px; line-height: 1.65;
  }

  /* ── STATS ── */
  .stats-row {
    display: flex; align-items: center; justify-content: center;
    gap: 32px; margin-bottom: 56px; flex-wrap: wrap;
  }
  .stat { text-align: center; }
  .stat-val { font-family: var(--mono); font-size: 22px; font-weight: 500; color: var(--text); }
  .stat-label { font-size: 12px; color: var(--text3); margin-top: 2px; }
  .stat-sep { width: 1px; height: 28px; background: var(--border2); }

  /* ── GENERATOR ── */
  .generator {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 80px;
    box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 24px 80px rgba(0,0,0,.4);
  }

  /* Controls */
  .controls {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    flex-wrap: wrap; background: var(--bg3);
  }

  .ctrl-group {
    display: flex; align-items: center; gap: 4px;
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: 8px; padding: 3px;
  }

  .ctrl-btn {
    font-family: var(--sans); font-size: 12px; font-weight: 500;
    color: var(--text2); background: transparent; border: none;
    border-radius: 6px; padding: 5px 11px; cursor: pointer;
    transition: all .15s; white-space: nowrap;
  }
  .ctrl-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
  .ctrl-btn.active { color: var(--bg); background: var(--accent); font-weight: 600; }

  .ctrl-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
  .ctrl-spacer { flex: 1; }

  .ctrl-label {
    font-size: 11px; color: var(--text3); font-family: var(--mono);
    letter-spacing: 0.06em; text-transform: uppercase; padding: 0 4px;
  }

  .count-wrap {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: 8px; padding: 5px 12px;
  }
  .count-num { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--accent); min-width: 18px; text-align: center; }
  .count-btn { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; transition: color .15s; }
  .count-btn:hover { color: var(--accent); }

  .font-select {
    font-family: var(--sans); font-size: 12px; color: var(--text2);
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: 8px; padding: 6px 10px; cursor: pointer; outline: none;
    transition: border-color .15s;
  }
  .font-select:hover, .font-select:focus { border-color: var(--accent); color: var(--text); }

  /* Text display */
  .text-display { padding: 32px 36px; min-height: 260px; background: var(--bg2); }

  .generated-text {
    font-size: 16px; line-height: 1.85; color: var(--text);
    transition: font-family .3s, font-size .2s, line-height .2s;
  }
  .generated-text p { margin-bottom: 1.4em; }
  .generated-text p:last-child { margin-bottom: 0; }
  .generated-text.rtl { direction: rtl; text-align: right; }

  /* Typo panel */
  .typo-panel {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
  }
  .typo-label { font-size: 11px; color: var(--text3); font-family: var(--mono); }

  .size-slider {
    -webkit-appearance: none; height: 3px; border-radius: 2px;
    background: var(--border2); outline: none; width: 100px; cursor: pointer;
  }
  .size-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); cursor: pointer; border: none;
  }
  .size-val { font-family: var(--mono); font-size: 11px; color: var(--accent); min-width: 32px; }

  /* Format bar */
  .format-bar {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 16px; border-top: 1px solid var(--border); background: var(--bg);
  }
  .fmt-label { font-size: 11px; color: var(--text3); font-family: var(--mono); margin-right: 4px; }
  .fmt-btn {
    font-family: var(--mono); font-size: 11px;
    color: var(--text3); background: none;
    border: 1px solid transparent; border-radius: 5px; padding: 3px 9px;
    cursor: pointer; transition: all .15s; letter-spacing: 0.04em;
  }
  .fmt-btn:hover { color: var(--text2); border-color: var(--border2); }
  .fmt-btn.active { color: var(--accent); border-color: rgba(200,240,96,0.25); background: var(--accent-dim); }

  /* Bottom bar */
  .bottom-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-top: 1px solid var(--border);
    background: var(--bg3); flex-wrap: wrap; gap: 8px;
  }
  .word-count { font-family: var(--mono); font-size: 11px; color: var(--text3); }
  .word-count span { color: var(--text2); }
  .action-btns { display: flex; gap: 8px; }

  .btn {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--sans); font-size: 13px; font-weight: 500;
    padding: 8px 16px; border-radius: 8px; border: none;
    cursor: pointer; transition: all .15s; text-decoration: none;
  }
  .btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border2); }
  .btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); border-color: var(--border2); }
  .btn-primary { background: var(--accent); color: var(--bg); font-weight: 600; }
  .btn-primary:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(200,240,96,0.3); }
  .btn-primary:active { transform: translateY(0); }
  .btn-primary.copied { background: #4ade80; }

  /* ── FEATURES ── */
  .features { padding: 0 0 80px; }
  .section-label {
    font-family: var(--mono); font-size: 11px; color: var(--text3);
    letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 32px;
  }

  .feature-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }

  .feature-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    transition: border-color .2s, transform .2s;
  }
  .feature-card:hover { border-color: var(--border2); transform: translateY(-2px); }

  .feat-icon { font-size: 20px; margin-bottom: 12px; display: block; }
  .feat-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
  .feat-desc { font-size: 12px; color: var(--text2); line-height: 1.6; }

  /* ── TOOLS ── */
  .tools-section { padding: 0 0 80px; }
  .tools-title { font-family: var(--serif); font-size: 28px; color: var(--text); margin-bottom: 8px; }
  .tools-sub { font-size: 14px; color: var(--text2); margin-bottom: 28px; }
  .tools-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }

  .tool-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px;
    display: flex; align-items: center; gap: 14px;
    text-decoration: none; transition: border-color .2s, background .2s;
  }
  .tool-card:hover { border-color: var(--border2); background: var(--bg3); }
  .tool-emoji { font-size: 24px; flex-shrink: 0; }
  .tool-info { flex: 1; min-width: 0; }
  .tool-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
  .tool-desc { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tool-arrow { font-size: 14px; color: var(--text3); flex-shrink: 0; transition: color .15s, transform .15s; }
  .tool-card:hover .tool-arrow { color: var(--accent); transform: translateX(3px); }

  /* ── FOOTER ── */
  footer { border-top: 1px solid var(--border); padding: 32px 0; }
  .footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
  .footer-copy { font-size: 12px; color: var(--text3); }
  .footer-links { display: flex; gap: 20px; }
  .footer-link { font-size: 12px; color: var(--text3); text-decoration: none; transition: color .15s; }
  .footer-link:hover { color: var(--text2); }

  /* ── ANIMATIONS ── */
  @keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
  .generated-text.animating { animation: fadeIn .3s ease; }

  /* ── TOOLTIP ── */
  .tooltip-wrap { position: relative; }
  .tooltip {
    position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    background: var(--text); color: var(--bg);
    font-size: 11px; font-family: var(--mono); padding: 4px 10px; border-radius: 5px;
    white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s;
  }
  .tooltip-wrap:hover .tooltip { opacity: 1; }

  /* ── RESPONSIVE ── */
  @media (max-width: 700px) {
    .feature-grid, .tools-grid { grid-template-columns: 1fr; }
    .stats-row { gap: 20px; }
    .stat-sep { display: none; }
    .text-display { padding: 20px; }
    .hero-title { font-size: 38px; }
    .controls { gap: 6px; }
  }
