/* tokens.css
 * Extracted from the original inline <style> block.
 * Load order matters: see the <link> order in index.html.
 */
    :root { color-scheme: dark; }
    * { -webkit-font-smoothing: antialiased; }
    html, body { height: 100%; }
    body {
      font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
      background-color: #05060a;
      background-image:
        radial-gradient(60% 45% at 15% 0%, rgba(99,102,241,0.18) 0%, transparent 60%),
        radial-gradient(55% 40% at 85% 8%, rgba(236,72,153,0.12) 0%, transparent 60%),
        radial-gradient(60% 50% at 75% 100%, rgba(56,189,248,0.12) 0%, transparent 60%);
      background-attachment: fixed;
    }
    .glass {
      background: rgba(255, 255, 255, 0.045);
      backdrop-filter: blur(22px) saturate(140%);
      -webkit-backdrop-filter: blur(22px) saturate(140%);
      border: 1px solid rgba(255, 255, 255, 0.08);
    }
    .glass-strong {
      background: rgba(20, 22, 34, 0.55);
      backdrop-filter: blur(26px) saturate(150%);
      -webkit-backdrop-filter: blur(26px) saturate(150%);
      border: 1px solid rgba(255, 255, 255, 0.08);
    }
    .glow-border {
      border: 1px solid rgba(129, 140, 248, 0.35);
      box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.12), 0 0 45px -8px rgba(99, 102, 241, 0.45);
    }
    .field {
      background: rgba(10, 12, 20, 0.55);
      border: 1px solid rgba(255, 255, 255, 0.08);
      transition: all 0.22s ease;
    }
    .field:hover { border-color: rgba(255, 255, 255, 0.16); }
    .field:focus {
      outline: none;
      border-color: rgba(129, 140, 248, 0.7);
      box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
      background: rgba(10, 12, 20, 0.75);
    }
    select.field option { background-color: #0b0d16; color: #e5e7eb; }
    .nav-link { transition: all 0.22s ease; }
    .nav-link:hover { background: rgba(255, 255, 255, 0.06); }
    .nav-active {
      background: linear-gradient(135deg, rgba(99,102,241,0.28), rgba(236,72,153,0.14));
      border: 1px solid rgba(129, 140, 248, 0.4);
      box-shadow: 0 0 30px -12px rgba(99, 102, 241, 0.8);
    }
    .btn-glass { transition: all 0.22s ease; }
    .btn-glass:hover { transform: translateY(-1px); }
    .btn-glass:active { transform: translateY(0); }
    /* Roleplay message controls — revealed on hover / focus, always visible on touch */
    /* ================= PHASE 3: ACCESSIBILITY ================= */
    /* Visible focus ring for keyboard users on every interactive control.
       Mouse users never see it, so the glassmorphism look is preserved. */
    :focus-visible {
      outline: 2px solid rgba(129, 140, 248, 0.9);
      outline-offset: 2px;
      border-radius: 0.5rem;
    }
    .field:focus-visible { outline-offset: 0; }
    /* Respect the user's reduced-motion preference: keep state changes, drop
       purely decorative movement (fade-ins, bounce, hover lifts, transitions). */
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
      }
      .btn-glass:hover, .btn-glass:active { transform: none !important; }
      .fade-in { animation: none !important; }
      /* .chat-row sets its own `animation` shorthand, which resets duration and
         would otherwise win over the universal rule above. */
      .chat-row { animation: none !important; }
      .typing-dots span { animation: none !important; opacity: 0.75; }
    }
    /* Screen-reader-only utility for live announcements. */
    .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;
    }
    .rp-controls { opacity: 0; transition: opacity 0.15s ease; }
    .group:hover .rp-controls, .group:focus-within .rp-controls { opacity: 1; }
    .rp-edit-area textarea { max-height: 40vh; resize: vertical; }
    @media (hover: none) { .rp-controls { opacity: 1; } }
    .fade-in { animation: fadeIn 0.4s ease both; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
    .scrollbar-none::-webkit-scrollbar { display: none; }
    .scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }
    .label { display: block; margin-bottom: 0.5rem; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }
    input[type="range"] { cursor: pointer; }
    html, body { max-width: 100%; overflow-x: hidden; }
    body.font-arabic { font-family: 'Cairo', 'Tajawal', ui-sans-serif, system-ui, sans-serif; }
    body.bg-custom { background-size: cover; background-position: center; background-attachment: fixed; background-repeat: no-repeat; }
    body.theme-midnight { background-image: none !important; background-color: #07080d !important; }
    body.theme-midnight .glass { background: rgba(255,255,255,0.06); }
    body.theme-cyberpunk { background-image: radial-gradient(60% 50% at 20% 0%, rgba(34,211,238,0.22), transparent 60%), radial-gradient(55% 45% at 85% 10%, rgba(236,72,153,0.24), transparent 60%), linear-gradient(160deg,#05010f,#0b0420 60%,#05010f) !important; }
    body.theme-cyberpunk .glow-border { border-color: rgba(34,211,238,0.5); box-shadow: 0 0 45px -8px rgba(236,72,153,0.55); }
    body.theme-light { background-image: radial-gradient(60% 45% at 15% 0%, rgba(99,102,241,0.14), transparent 60%), radial-gradient(55% 40% at 85% 8%, rgba(236,72,153,0.10), transparent 60%), linear-gradient(160deg,#eef2ff,#e2e8f0 60%,#f8fafc) !important; color: #0f172a; }
    body.theme-light .text-white, body.theme-light .text-slate-100, body.theme-light .text-slate-200 { color: #0f172a !important; }
    body.theme-light .text-slate-300, body.theme-light .text-slate-400 { color: #334155 !important; }
    body.theme-light .text-slate-500 { color: #475569 !important; }
    body.theme-light .glass, body.theme-light .glass-strong { background: rgba(255,255,255,0.65); border-color: rgba(15,23,42,0.12); }
    body.theme-light .field { background: rgba(255,255,255,0.85); border-color: rgba(15,23,42,0.15); color: #0f172a; }
    body.theme-light .field::placeholder { color: #64748b; }
    [dir="rtl"] .text-left, [dir="rtl"] .label { text-align: right; }
    [dir="rtl"] .nav-link { text-align: right; }
    [dir="rtl"] .ml-auto { margin-left: 0; margin-right: auto; }
    [dir="rtl"] .mr-auto { margin-right: 0; margin-left: auto; }
    [dir="rtl"] .text-right { text-align: left; }
    .typing-dots { display: inline-flex; align-items: center; gap: 4px; }
    .typing-dots span { width: 7px; height: 7px; border-radius: 9999px; background: #a5b4fc; display: inline-block; animation: typingBounce 1.2s infinite ease-in-out; }
    .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
    .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
    @keyframes typingBounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }
    .prose h1, .prose h2, .prose h3, .prose h4 { font-weight: 600; color: #fff; margin: 0.6em 0 0.3em; }
    .prose p { margin: 0.35em 0; }
    .prose ul { list-style: disc; padding-left: 1.25em; margin: 0.35em 0; }
    .prose ol { list-style: decimal; padding-left: 1.25em; margin: 0.35em 0; }
    .prose li { margin: 0.15em 0; }
    .prose strong { font-weight: 700; color: #fff; }
    .prose code { background: rgba(0,0,0,0.4); padding: 0.1em 0.35em; border-radius: 0.35em; font-family: ui-monospace, monospace; font-size: 0.9em; }
    .prose pre { background: rgba(0,0,0,0.5); padding: 0.7em; border-radius: 0.5em; overflow-x: auto; margin: 0.5em 0; }
    .prose pre code { background: transparent; padding: 0; }
    .prose a { color: #a5b4fc; text-decoration: underline; }
    .prose blockquote { border-left: 3px solid rgba(165,180,252,0.6); padding-left: 0.75em; color: #cbd5e1; margin: 0.5em 0; }
    :root { --accent: #6366f1; --accent-2: #d946ef; }
    body.theme-midnight { --accent: #3b82f6; --accent-2: #6366f1; }
    body.theme-cyberpunk { --accent: #00f0ff; --accent-2: #ff2e97; }
    body.theme-light { --accent: #6366f1; --accent-2: #db2777; }
    body.theme-aurora { --accent: #6366f1; --accent-2: #22d3ee; background-image: radial-gradient(60% 45% at 15% 0%, rgba(99,102,241,0.28), transparent 60%), radial-gradient(55% 40% at 85% 8%, rgba(34,211,238,0.22), transparent 60%), radial-gradient(60% 50% at 75% 100%, rgba(16,185,129,0.20), transparent 60%) !important; }
    body.theme-oled { --accent: #3b82f6; --accent-2: #60a5fa; background-image: none !important; background-color: #000 !important; }
    body.theme-catppuccin { --accent: #cba6f7; --accent-2: #89b4fa; background-image: linear-gradient(160deg,#1e1e2e,#181825 60%,#11111b) !important; }
    body.theme-nord { --accent: #88c0d0; --accent-2: #b48ead; background-image: linear-gradient(160deg,#2e3440,#2b303b 60%,#242933) !important; }
    [class*="from-indigo-500"], [class*="from-violet-500"], [class*="from-pink-500"], [class*="from-fuchsia-500"] { background-image: linear-gradient(to right, var(--accent), var(--accent-2)) !important; }
    .nav-active { background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important; }
    .glow-border { border-color: var(--accent) !important; box-shadow: 0 0 0 1px var(--accent), 0 0 45px -8px var(--accent) !important; }
    [dir="rtl"] #themePopover { right: auto !important; left: 0 !important; }
