        :root {
            --bg-color: #0b0c10;
            --card-bg: rgba(18, 18, 24, 0.75);
            --border-color: rgba(136, 57, 239, 0.3);
            --glow-color: rgba(136, 57, 239, 0.4);
            --primary: #8839ef;
            --primary-hover: #a15eff;
            --accent: #ffd8a8;
            --text-main: #e2e8f0;
            --text-muted: #94a3b8;
            --glass-blur: blur(16px);
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        /* NOTE: widget_preview.html's own `body{...}` rule (height:100vh, display:flex,
           centering, background) was deliberately dropped here — it existed only to
           stage the standalone preview/demo page and was clobbering every real page's
           layout (it made <body> a flex container, squashing page content to ~35% width).
           The actual site's body styling lives in app/globals.css. */

        /* Mock Website Background (markup not used in production — see components/Widget.jsx) */
        .mock-page {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            padding: 40px;
            pointer-events: none;
            opacity: 0.25;
            z-index: 1;
        }

        .mock-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            padding-bottom: 20px;
        }

        .mock-logo {
            font-family: 'Press Start 2P', cursive;
            font-size: 14px;
            color: var(--text-main);
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .mock-logo svg {
            width: 24px;
            height: 24px;
            fill: var(--primary);
        }

        .mock-nav {
            display: flex;
            gap: 30px;
            font-weight: 500;
        }

        .mock-content {
            margin-top: 15vh;
            max-width: 600px;
        }

        .mock-content h1 {
            font-size: 48px;
            font-weight: 700;
            line-height: 1.1;
            margin-bottom: 20px;
            background: linear-gradient(135deg, #ffffff 0%, #a3b3cc 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .mock-content p {
            font-size: 18px;
            line-height: 1.6;
            color: var(--text-muted);
        }

        /* Floating Widget Container */
        .widget-wrapper {
            position: fixed;
            bottom: calc(40px + env(safe-area-inset-bottom, 0px));
            right: calc(40px + env(safe-area-inset-right, 0px));
            z-index: 100;
            width: 60px;
            height: 60px;
            pointer-events: auto;
        }

        /* Floating Tooltip pointing to Launcher */
        .practice-tooltip {
            position: absolute;
            right: 76px;
            bottom: 12px;
            background: var(--accent);
            color: #0b0c10;
            padding: 9px 15px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 700;
            white-space: nowrap;
            box-shadow: 0 4px 18px rgba(255, 216, 168, 0.35);
            pointer-events: none;
            opacity: 1;
            transform: translateX(0);
            transition: opacity 0.3s ease, transform 0.3s ease;
            animation: practiceTooltipBob 1.5s infinite alternate ease-in-out;
        }

        .practice-tooltip::after {
            content: '';
            position: absolute;
            right: -6px;
            top: 50%;
            transform: translateY(-50%);
            border-width: 6px 0 6px 6px;
            border-style: solid;
            border-color: transparent transparent transparent var(--accent);
            display: block;
            width: 0;
        }

        .practice-tooltip.hidden {
            opacity: 0;
            transform: translateX(12px);
            pointer-events: none;
        }

        @keyframes practiceTooltipBob {
            0% { transform: translateY(0); }
            100% { transform: translateY(-6px); }
        }

        /* Launcher Button with pulsating background ring */
        .widget-launcher {
            -webkit-appearance: none;
            appearance: none;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary) 0%, #57209e 100%);
            border: 1px solid rgba(255, 255, 255, 0.25);
            box-shadow: 0 8px 32px var(--glow-color);
            color: #fff;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            z-index: 2;
            padding: 0;
            line-height: 1;
            touch-action: manipulation;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            -webkit-tap-highlight-color: transparent;
        }

        .widget-launcher::before {
            content: '';
            position: absolute;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            border: 2px solid var(--primary);
            opacity: 0.5;
            animation: pulsate 2s infinite ease-out;
            pointer-events: none;
        }

        @keyframes pulsate {
            0% { transform: scale(1); opacity: 0.8; }
            100% { transform: scale(1.4); opacity: 0; }
        }

        .widget-launcher:hover {
            transform: scale(1.06) translateY(-2px);
            box-shadow: 0 12px 40px rgba(136, 57, 239, 0.6);
        }

        .widget-launcher:active {
            transform: scale(0.96) translateY(1px);
            box-shadow: 0 6px 22px rgba(136, 57, 239, 0.55);
        }

        .widget-launcher svg {
            width: 26px;
            height: 26px;
            fill: white;
            transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        .widget-launcher.active svg {
            transform: rotate(90deg);
        }

        /* The Widget Card with animated gradient border glow */
        .widget-card {
            position: absolute;
            right: 0;
            bottom: 80px;
            z-index: 1;
            width: 380px;
            height: 500px;
            background: var(--card-bg);
            backdrop-filter: var(--glass-blur);
            -webkit-backdrop-filter: var(--glass-blur);
            border-radius: 24px;
            border: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transform: scale(0.85) translateY(40px);
            opacity: 0;
            pointer-events: none;
            transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
            transform-origin: bottom right;
            animation: glowPulse 8s infinite ease-in-out;
        }

        @keyframes glowPulse {
            0%, 100% { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 15px rgba(136, 57, 239, 0.15); }
            50% { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 35px rgba(255, 216, 168, 0.3); }
        }

        .widget-card.open {
            transform: scale(1) translateY(0);
            opacity: 1;
            pointer-events: auto;
        }

        /* Header */
        .widget-header {
            padding: 14px 20px;
            background: rgba(20, 20, 28, 0.55);
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .widget-logo-container {
            width: 44px;
            height: 34px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .widget-logo-container img {
            width: 100%;
            height: auto;
            image-rendering: pixelated;
            object-fit: contain;
        }

        .widget-header-title {
            font-size: 14.5px;
            font-weight: 700;
            color: white;
            letter-spacing: -0.1px;
        }

        .widget-header-status {
            font-size: 10px;
            color: var(--accent);
            display: flex;
            align-items: center;
            gap: 4px;
            margin-top: 2px;
        }

        .widget-header-status::before {
            content: '';
            display: inline-block;
            width: 5px;
            height: 5px;
            border-radius: 50%;
            background-color: var(--accent);
            box-shadow: 0 0 6px var(--accent);
        }

        /* Dimmed dot + text when Chad is likely away (evenings, weekends, asleep) */
        .widget-header-status.away { color: var(--text-muted); }
        .widget-header-status.away::before { background-color: var(--text-muted); box-shadow: none; }

        /* Sound/Audio toggle button */
        .practice-audio-toggle {
            background: transparent;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 6px;
            margin-left: auto;
            border-radius: 8px;
            outline: none;
            transition: background-color 0.2s ease;
        }

        .practice-audio-toggle:hover {
            background: rgba(255, 255, 255, 0.08);
        }

        .practice-audio-toggle svg {
            width: 18px;
            height: 18px;
            fill: var(--text-muted);
            transition: fill 0.2s ease;
        }

        .practice-audio-toggle:hover svg {
            fill: white;
        }

        /* Body & Scroll Area */
        .widget-body {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 16px;
            scroll-behavior: smooth;
        }

        /* Custom Scrollbar */
        .widget-body::-webkit-scrollbar {
            width: 5px;
        }

        .widget-body::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
        }

        /* Message wrappers for avatars */
        .practice-msg-container {
            display: flex;
            gap: 10px;
            align-items: flex-end;
            width: 100%;
            margin-bottom: 4px;
        }

        .practice-user-align {
            justify-content: flex-end;
        }

        .practice-agent-align {
            justify-content: flex-start;
        }

        .practice-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: rgba(136, 57, 239, 0.15);
            border: 1px solid rgba(136, 57, 239, 0.35);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            flex-shrink: 0;
            box-shadow: 0 0 8px rgba(136, 57, 239, 0.2);
        }

        .practice-avatar img {
            width: 24px;
            height: 32px;
            image-rendering: pixelated;
            object-fit: contain;
            transform: translateY(1px);
        }

        /* Messages with slide bounce */
        .msg-bubble {
            max-width: 78%;
            padding: 13px 15px;
            border-radius: 18px;
            font-size: 13.5px;
            line-height: 1.5;
            animation: slideBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
            color: var(--text-main);
        }

        @keyframes slideBounce {
            from { opacity: 0; transform: translateY(16px) scale(0.95); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }

        .msg-agent {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-bottom-left-radius: 4px;
        }

        .msg-agent h3 {
            font-size: 13px;
            font-weight: 700;
            margin-bottom: 5px;
            color: var(--accent);
        }

        .msg-user {
            background: var(--primary);
            border-bottom-right-radius: 4px;
            color: white;
            box-shadow: 0 4px 12px rgba(136, 57, 239, 0.2);
        }

        /* Options/Pills Container */
        .options-container {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 6px;
            width: 100%;
        }

        .option-pill {
            background: rgba(136, 57, 239, 0.06);
            border: 1px solid rgba(136, 57, 239, 0.3);
            border-radius: 12px;
            padding: 11px 16px;
            color: var(--text-main);
            font-size: 12.5px;
            font-weight: 500;
            text-align: left;
            cursor: pointer;
            transition: all 0.25s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            outline: none;
            animation: fadeIn 0.3s ease forwards;
            opacity: 0;
        }

        .option-pill:nth-child(1) { animation-delay: 0.05s; }
        .option-pill:nth-child(2) { animation-delay: 0.12s; }
        .option-pill:nth-child(3) { animation-delay: 0.19s; }
        .option-pill:nth-child(4) { animation-delay: 0.26s; }

        .option-pill:hover {
            background: rgba(136, 57, 239, 0.16);
            border-color: var(--primary);
            transform: translateX(4px);
            box-shadow: 0 4px 12px rgba(136, 57, 239, 0.2);
            color: white;
        }

        .option-pill svg {
            width: 12px;
            height: 12px;
            fill: var(--text-muted);
            transition: transform 0.2s ease, fill 0.2s ease;
        }

        .option-pill:hover svg {
            fill: white;
            transform: translateX(3px);
        }

        /* Privacy Disclaimer Footer */
        .widget-privacy-footer {
            padding: 12px 16px;
            background: rgba(20, 20, 28, 0.65);
            border-top: 1px solid rgba(255, 255, 255, 0.05);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-size: 11px;
            color: var(--text-muted);
            text-align: center;
        }

        .widget-privacy-footer svg {
            width: 12px;
            height: 12px;
            fill: var(--text-muted);
        }

        /* Animations */
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        /* ===== Box Breathing — calm "trace the square" guide ===== */
        .practice-breath-wrapper {
            width: 100%;
            display: flex; flex-direction: column;
            justify-content: center; align-items: center;
            margin: 22px 0 8px;
        }
        .breath-stage {
            position: relative; width: 172px; height: 172px;
            display: flex; align-items: center; justify-content: center;
        }
        .breath-orb {
            position: absolute; width: 118px; height: 118px; border-radius: 50%;
            background: radial-gradient(circle at 50% 42%, #ffe6c4 0%, var(--primary) 56%, rgba(136,57,239,0) 78%);
            box-shadow: 0 0 38px rgba(136,57,239,0.5);
            transform: scale(0.66); opacity: 0.6;
            will-change: transform, opacity;
        }
        .breath-svg {
            position: absolute; width: 172px; height: 172px; overflow: visible;
        }
        .breath-track {
            fill: none; stroke: rgba(255,255,255,0.10); stroke-width: 4;
        }
        .breath-trace {
            fill: none; stroke: url(#breathGrad); stroke-width: 5; stroke-linecap: round;
            stroke-dasharray: 13 100; stroke-dashoffset: 0;
            filter: drop-shadow(0 0 6px var(--accent));
            will-change: stroke-dashoffset;
        }
        .breath-center {
            position: relative; z-index: 2;
            display: flex; flex-direction: column; align-items: center;
            text-shadow: 0 2px 8px rgba(0,0,0,0.75);
        }
        .breath-label {
            font-size: 11px; text-transform: uppercase; letter-spacing: 2px;
            font-weight: 700; color: #fff; opacity: 0.92;
        }
        .breath-count {
            font-family: 'Press Start 2P', monospace;
            font-size: 21px; color: #fff; margin-top: 9px;
        }
        .breath-rounds { display: flex; gap: 8px; margin-top: 14px; }
        .breath-rounds span {
            width: 7px; height: 7px; border-radius: 50%;
            background: rgba(255,255,255,0.18);
            transition: background 0.4s ease, box-shadow 0.4s ease;
        }
        .breath-rounds span.done {
            background: var(--accent); box-shadow: 0 0 8px var(--accent);
        }
        .breath-caption {
            font-size: 10.5px; color: var(--text-muted);
            margin-top: 10px; text-align: center; max-width: 240px; line-height: 1.5;
        }

        /* ===== In-widget contact form (emails Chad via Web3Forms) ===== */
        .contact-form-wrapper { width: 100%; margin: 6px 0 4px; }
        .contact-form { display: flex; flex-direction: column; gap: 9px; }
        .cf-input {
            width: 100%;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(136, 57, 239, 0.3);
            border-radius: 12px;
            padding: 11px 13px;
            color: var(--text-main);
            font-family: inherit; font-size: 13px;
            outline: none;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
        }
        .cf-input::placeholder { color: var(--text-muted); }
        .cf-input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(136, 57, 239, 0.18);
        }
        .cf-area { resize: vertical; min-height: 62px; line-height: 1.4; }
        .cf-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
        .cf-send {
            align-self: flex-start;
            background: linear-gradient(135deg, var(--primary) 0%, #57209e 100%);
            color: #fff; border: none; border-radius: 12px;
            padding: 10px 18px; font-size: 13px; font-weight: 600;
            cursor: pointer; font-family: inherit;
            box-shadow: 0 4px 14px rgba(136, 57, 239, 0.3);
            transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
        }
        .cf-send:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(136, 57, 239, 0.45); }
        .cf-send:active:not(:disabled) {
            filter: brightness(1.14);
            transform: translateY(2px) scale(0.98);
            box-shadow: 0 2px 8px rgba(136, 57, 239, 0.34);
        }
        .cf-send:disabled { opacity: 0.6; cursor: default; transform: none; }
        .cf-note { font-size: 10.5px; color: var(--text-muted); line-height: 1.45; }
        .cf-status { font-size: 12px; }
        .cf-status.err { color: #ff9ba6; }
        .cf-done {
            background: rgba(159, 255, 206, 0.08);
            border: 1px solid rgba(159, 255, 206, 0.3);
            border-radius: 12px; padding: 14px;
            font-size: 13px; color: #d8ffe9; line-height: 1.5;
        }

        /* Inline pixel-sprite icons (retro game characters from the site's sprite set) */
        .pill-gif {
            height: 24px;
            width: auto;
            max-width: 46px;
            image-rendering: pixelated;
            display: inline-block;
            vertical-align: middle;
            margin-left: 8px;
            flex-shrink: 0;
        }

        /* "Chad is typing..." indicator */
        .practice-typing {
            display: inline-flex;
            gap: 5px;
            padding: 15px 16px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 18px;
            border-bottom-left-radius: 4px;
            align-items: center;
            animation: slideBounce 0.3s ease forwards;
        }

        .practice-typing span {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--text-muted);
            animation: typingBob 1.3s infinite ease-in-out;
        }

        .practice-typing span:nth-child(2) { animation-delay: 0.18s; }
        .practice-typing span:nth-child(3) { animation-delay: 0.36s; }

        @keyframes typingBob {
            0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
            30% { transform: translateY(-6px); opacity: 1; }
        }

        /* Respect users who are sensitive to motion (vestibular / grounding context) */
        @media (prefers-reduced-motion: reduce) {
            .breath-trace,
            .practice-tooltip,
            .widget-launcher::before,
            .widget-card { animation: none !important; }
            * { scroll-behavior: auto !important; }
        }

        /* =================================================================
           WOW LAYER — cozy living scene (resting) + arcade punctuation
           ================================================================= */
        .widget-card { isolation: isolate; }
        .widget-header, .widget-body { position: relative; z-index: 2; }

        /* --- Living background scene (behind the chat) --- */
        .widget-scene {
            position: absolute; inset: 0; z-index: 0;
            overflow: hidden; pointer-events: none; border-radius: 24px;
            transition: transform 0.25s ease-out;
        }
        .scene-aurora {
            position: absolute; inset: -20%;
            background:
                radial-gradient(40% 35% at 25% 16%, rgba(136,57,239,0.40) 0%, transparent 70%),
                radial-gradient(45% 40% at 82% 10%, rgba(255,150,200,0.22) 0%, transparent 70%),
                radial-gradient(55% 50% at 60% 98%, rgba(255,216,168,0.20) 0%, transparent 70%);
            animation: auroraDrift 18s ease-in-out infinite alternate;
        }
        @keyframes auroraDrift {
            0% { transform: translate(0,0) scale(1); }
            100% { transform: translate(-4%, 3%) scale(1.09); }
        }
        .scene-sun {
            position: absolute; left: 50%; bottom: 7%;
            width: 150px; height: 150px; margin-left: -75px; border-radius: 50%;
            background: linear-gradient(180deg, #ffd8a8 0%, #ff7eb3 55%, #8839ef 100%);
            opacity: 0.28;
            -webkit-mask-image: repeating-linear-gradient(180deg, #000 0 7px, transparent 7px 11px);
            mask-image: repeating-linear-gradient(180deg, #000 0 7px, transparent 7px 11px);
            animation: sunPulse 6s ease-in-out infinite alternate;
        }
        @keyframes sunPulse { 0% { transform: translateY(0); } 100% { transform: translateY(-7px); } }
        .scene-grid {
            position: absolute; left: -30%; right: -30%; bottom: -10px; height: 42%;
            background-image:
                linear-gradient(90deg, rgba(136,57,239,0.30) 1px, transparent 1px),
                linear-gradient(rgba(136,57,239,0.30) 1px, transparent 1px);
            background-size: 28px 28px;
            transform: perspective(220px) rotateX(70deg);
            transform-origin: bottom center; opacity: 0.30;
            -webkit-mask-image: linear-gradient(transparent 0%, #000 80%);
            mask-image: linear-gradient(transparent 0%, #000 80%);
            animation: gridScroll 4s linear infinite;
        }
        @keyframes gridScroll { from { background-position: 0 0, 0 0; } to { background-position: 0 28px, 0 28px; } }
        .scene-stars {
            position: absolute; top: 0; left: 0; width: 2px; height: 2px;
            background: transparent; opacity: 0.85;
            animation: starDrift 90s linear infinite;
        }
        @keyframes starDrift { from { transform: translateY(0); } to { transform: translateY(-520px); } }

        /* --- Sprite parade stage --- */
        .sprite-stage {
            position: absolute; left: 0; right: 0; bottom: 6px; height: 46px;
            z-index: 1; overflow: hidden; pointer-events: none;
        }
        .parade-sprite {
            position: absolute; bottom: 0; left: 0; height: 38px; width: auto;
            image-rendering: pixelated; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.5));
        }

        /* --- CRT overlay: scanlines + vignette (always on, subtle) --- */
        .widget-crt {
            position: absolute; inset: 0; z-index: 6; pointer-events: none;
            border-radius: 24px; overflow: hidden;
        }
        .widget-crt::before {
            content: ''; position: absolute; inset: 0;
            background: repeating-linear-gradient(0deg, rgba(0,0,0,0.16) 0 1px, transparent 1px 3px);
            mix-blend-mode: multiply; opacity: 0.45;
        }
        .widget-crt::after {
            content: ''; position: absolute; inset: 0; border-radius: 24px;
            box-shadow: inset 0 0 55px rgba(0,0,0,0.5);
        }

        /* --- Boot-up sequence (plays on open) --- */
        .widget-boot {
            position: absolute; inset: 0; z-index: 7; pointer-events: none;
            background: #05060a; border-radius: 24px; overflow: hidden;
            display: flex; align-items: center; justify-content: center;
        }
        .widget-boot .boot-line {
            position: absolute; left: 0; right: 0; top: 50%; height: 3px;
            background: #9fffce; box-shadow: 0 0 18px #9fffce, 0 0 42px #9fffce;
        }
        .widget-boot .boot-text {
            position: relative; font-family: 'Press Start 2P', monospace; font-size: 10px;
            color: #9fffce; text-shadow: 0 0 8px #9fffce; opacity: 0;
            letter-spacing: 1px; text-align: center; line-height: 1.9;
        }
        .widget-card:not(.booting) .widget-boot { display: none; }
        .widget-card.booting .widget-boot { animation: bootSeq 1.25s ease forwards; }
        .widget-card.booting .boot-line { animation: bootLine 1.25s ease forwards; }
        .widget-card.booting .boot-text { animation: bootTextFlash 1.25s steps(1) forwards; }
        @keyframes bootSeq {
            0%, 70% { opacity: 1; } 78% { opacity: 1; filter: brightness(2.2); }
            100% { opacity: 0; visibility: hidden; }
        }
        @keyframes bootLine {
            0% { transform: translateY(-50%) scaleY(0.3) scaleX(0); opacity: 0; }
            12% { transform: translateY(-50%) scaleY(0.3) scaleX(1); opacity: 1; }
            32% { transform: translateY(-50%) scaleY(50) scaleX(1); opacity: 0.9; }
            48% { transform: translateY(-50%) scaleY(150) scaleX(1); opacity: 0; }
            100% { opacity: 0; }
        }
        @keyframes bootTextFlash {
            0%, 20% { opacity: 0; } 24% { opacity: 1; } 32% { opacity: 0.15; }
            36% { opacity: 1; } 62% { opacity: 1; } 72% { opacity: 0; }
        }

        /* --- Word-by-word message reveal --- */
        .rw {
            display: inline-block; opacity: 0; transform: translateY(7px);
            animation: wordRise 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
        }
        @keyframes wordRise { to { opacity: 1; transform: none; } }

        /* --- Pixel-burst particles (spawned on document.body) --- */
        .pixel-burst {
            position: fixed; width: 7px; height: 7px; z-index: 100000;
            pointer-events: none; image-rendering: pixelated;
            animation: pixelFly 0.7s ease-out forwards;
        }
        @keyframes pixelFly {
            to { transform: translate(var(--dx), var(--dy)) scale(0.2) rotate(160deg); opacity: 0; }
        }

        /* --- Launcher visitor: a little sprite periodically walks up and knocks --- */
        .launcher-visitor {
            position: fixed;
            bottom: 40px;
            height: 40px;
            width: auto;
            z-index: 99;
            image-rendering: pixelated;
            pointer-events: none;
            filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45));
        }
        @keyframes launcherKnock {
            0%, 100% { transform: rotate(0) scale(1); }
            20% { transform: rotate(-9deg) scale(1.03); }
            40% { transform: rotate(8deg) scale(1.05); }
            60% { transform: rotate(-6deg) scale(1.03); }
            80% { transform: rotate(4deg) scale(1.02); }
        }
        .widget-launcher.knock { animation: launcherKnock 0.5s ease-in-out; }

        /* --- Truthful sky: the scene matches Chad's actual local time --- */
        .widget-card[data-scene="day"] .scene-stars { opacity: 0.15; }
        .widget-card[data-scene="dusk"] .scene-sun { opacity: 0.38; }
        .widget-card[data-scene="night"] .scene-sun {
            opacity: 0.34;
            background: linear-gradient(180deg, #e8f4ff 0%, #9fb8de 55%, #4d5f8f 100%);
        }
        .widget-card[data-scene="night"] .scene-aurora { opacity: 0.55; }
        .widget-card[data-scene="night"] .scene-stars { opacity: 1; }
        .widget-card[data-scene="night"] .scene-grid { opacity: 0.18; }
        .scene-zzz {
            position: absolute; right: 15%; top: 17%;
            font-family: 'Press Start 2P', monospace; font-size: 9px;
            color: #cfe3ff; opacity: 0.85; letter-spacing: 4px;
            text-shadow: 0 0 6px rgba(160, 200, 255, 0.8);
            animation: zzzFloat 4s ease-in-out infinite alternate;
        }
        @keyframes zzzFloat { from { transform: translateY(0); } to { transform: translateY(-9px); } }
        /* Weekend: a pixel controller resting on the horizon (box-shadow pixel art) */
        .scene-controller {
            position: absolute; left: 13%; bottom: 36%;
            width: 5px; height: 5px; opacity: 0.7; background: transparent;
            box-shadow:
                5px 0 #262b45, 10px 0 #262b45, 15px 0 #262b45, 20px 0 #262b45, 25px 0 #262b45, 30px 0 #262b45, 35px 0 #262b45, 40px 0 #262b45,
                0 5px #262b45, 5px 5px #262b45, 10px 5px #cfd6ff, 15px 5px #262b45, 20px 5px #262b45, 25px 5px #262b45, 30px 5px #262b45, 35px 5px #ff7eb3, 40px 5px #262b45, 45px 5px #262b45,
                0 10px #262b45, 5px 10px #cfd6ff, 10px 10px #cfd6ff, 15px 10px #cfd6ff, 20px 10px #262b45, 25px 10px #262b45, 30px 10px #9fffce, 35px 10px #262b45, 40px 10px #ff7eb3, 45px 10px #262b45,
                0 15px #262b45, 5px 15px #262b45, 10px 15px #cfd6ff, 15px 15px #262b45, 20px 15px #262b45, 25px 15px #262b45, 30px 15px #262b45, 35px 15px #ff7eb3, 40px 15px #262b45, 45px 15px #262b45,
                5px 20px #262b45, 10px 20px #262b45, 15px 20px #262b45, 20px 20px #262b45, 25px 20px #262b45, 30px 20px #262b45, 35px 20px #262b45, 40px 20px #262b45;
        }

        /* --- System map: "look at the board, not the piece" --- */
        .sysmap-wrapper { position: relative; z-index: 2; margin: 2px 0 14px; animation: sysmapIn 0.5s ease; }
        @keyframes sysmapIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
        .sysmap-stage {
            position: relative; height: 218px; border-radius: 14px;
            background: rgba(10, 8, 24, 0.55);
            border: 1px solid rgba(136, 57, 239, 0.35);
            overflow: hidden;
        }
        .sysmap-meter { position: absolute; left: 12px; right: 12px; top: 10px; z-index: 2; }
        .sysmap-meter-label {
            display: block; font-family: 'Press Start 2P', monospace; font-size: 7px;
            color: #ff9ba6; letter-spacing: 0.5px; margin-bottom: 5px;
            transition: color 0.4s ease;
        }
        .sysmap-stage.solved .sysmap-meter-label { color: #9fffce; }
        .sysmap-meter-bar {
            display: block; height: 8px;
            border: 1px solid rgba(255, 255, 255, 0.25);
            background: rgba(0, 0, 0, 0.4);
        }
        .sysmap-meter-bar i {
            display: block; height: 100%; width: 100%; background: #ff6b7a;
            transition: width 0.45s ease, background 0.45s ease;
        }
        .sysmap-stage.solved .sysmap-meter-bar i { background: #9fffce; }
        .sysmap-center {
            position: absolute; left: 50%; top: 58%;
            transform: translate(-50%, -50%); text-align: center; z-index: 1;
        }
        .sysmap-you { height: 34px; image-rendering: pixelated; display: block; margin: 0 auto 5px; }
        .sysmap-stage[data-stress="4"] .sysmap-you { animation: youShake 0.3s linear infinite; }
        .sysmap-stage[data-stress="3"] .sysmap-you { animation: youShake 0.5s linear infinite; }
        .sysmap-stage[data-stress="2"] .sysmap-you { animation: youShake 0.85s linear infinite; }
        .sysmap-stage[data-stress="1"] .sysmap-you { animation: youShake 1.5s linear infinite; }
        .sysmap-stage.solved .sysmap-you { animation: youProud 0.65s ease; }
        @keyframes youShake {
            0%, 100% { transform: translate(0, 0); }
            25% { transform: translate(-2px, 1px); }
            50% { transform: translate(2px, -1px); }
            75% { transform: translate(-1px, -1px); }
        }
        @keyframes youProud {
            0% { transform: scale(1); }
            40% { transform: scale(1.3) translateY(-7px); }
            100% { transform: scale(1); }
        }
        .sysmap-you-label { font-family: 'Press Start 2P', monospace; font-size: 8px; color: #ffd8a8; }
        .sysmap-arrow {
            position: absolute; z-index: 3;
            font-family: 'Press Start 2P', monospace; font-size: 7px; line-height: 1.6;
            color: #ffb3bb; background: rgba(40, 10, 20, 0.88);
            border: 1px solid #ff6b7a; border-radius: 4px;
            padding: 6px 7px; cursor: pointer; text-align: left;
            max-width: 118px;
            animation: arrowPulse 1.1s ease-in-out infinite, sysmapIn 0.4s ease;
        }
        @keyframes arrowPulse {
            0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 122, 0.5); }
            50% { box-shadow: 0 0 10px 2px rgba(255, 107, 122, 0.5); }
        }
        .sysmap-arrow::after {
            content: ''; position: absolute; width: 0; height: 0;
            border: 6px solid transparent; top: 50%; margin-top: -6px;
        }
        .sysmap-pos0 { left: 8px; top: 44px; }
        .sysmap-pos0::after { right: -12px; border-left-color: #ff6b7a; }
        .sysmap-pos1 { right: 8px; top: 52px; }
        .sysmap-pos1::after { left: -12px; border-right-color: #ff6b7a; }
        .sysmap-pos2 { left: 10px; bottom: 14px; }
        .sysmap-pos2::after { right: -12px; border-left-color: #ff6b7a; }
        .sysmap-pos3 { right: 10px; bottom: 10px; }
        .sysmap-pos3::after { left: -12px; border-right-color: #ff6b7a; }
        .sysmap-arrow.named {
            color: #b8ffd9; background: rgba(8, 32, 24, 0.88);
            border-color: #56d39a; animation: none; cursor: default;
        }
        .sysmap-arrow.named::after { display: none; }
        .sysmap-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
        .sysmap-caption {
            margin-top: 8px; font-size: 11px; color: #cbb8ff;
            font-style: italic; text-align: center;
        }

        /* --- Permission slip --- */
        .permission-slip {
            position: relative; z-index: 2;
            margin: 6px auto 14px; max-width: 250px;
            background: #f6e7c8; color: #4a2c14;
            border: 2px solid #b98a4e; border-radius: 3px;
            padding: 12px 14px; text-align: center;
            box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
            transform: rotate(-1.5deg);
            animation: slipStamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
        }
        @keyframes slipStamp {
            from { transform: rotate(-1.5deg) scale(1.6); opacity: 0; }
            to { transform: rotate(-1.5deg) scale(1); opacity: 1; }
        }
        .slip-head {
            font-family: 'Press Start 2P', monospace; font-size: 9px;
            letter-spacing: 1px; margin-bottom: 8px; color: #8a4b1d;
        }
        .slip-body { font-size: 13px; line-height: 1.45; }
        .slip-sig { margin-top: 8px; font-size: 11px; font-style: italic; color: #8a5a2d; }

        /* System map: live fire from unnamed pressures */
        .sysmap-shot {
            position: absolute; z-index: 2; width: 5px; height: 5px;
            background: #ff6b7a; image-rendering: pixelated;
            box-shadow: 0 0 6px rgba(255, 107, 122, 0.8);
            pointer-events: none;
        }
        .sysmap-you.hit { filter: brightness(2) saturate(1.6); }

        /* System map: the blame-or-truth choice */
        .sysmap-overlay {
            position: absolute; z-index: 5; left: 10px; right: 10px; top: 50%;
            transform: translateY(-50%);
            background: rgba(8, 5, 20, 0.96);
            border: 1px solid var(--accent, #8839ef); border-radius: 10px;
            padding: 12px; display: flex; flex-direction: column; gap: 8px;
            animation: sysmapIn 0.25s ease;
        }
        .sysmap-overlay.shake { animation: overlayShake 0.3s linear; }
        @keyframes overlayShake {
            0%, 100% { transform: translateY(-50%); }
            25% { transform: translateY(-50%) translateX(-4px); }
            50% { transform: translateY(-50%) translateX(4px); }
            75% { transform: translateY(-50%) translateX(-2px); }
        }
        .sysmap-overlay-title {
            font-family: 'Press Start 2P', monospace; font-size: 7px;
            color: #ffd8a8; line-height: 1.7; letter-spacing: 0.5px;
        }
        .sysmap-choice {
            font-size: 12.5px; line-height: 1.4; text-align: left;
            color: #efe6ff; background: rgba(136, 57, 239, 0.16);
            border: 1px solid rgba(136, 57, 239, 0.55); border-radius: 8px;
            padding: 9px 11px; cursor: pointer;
        }
        .sysmap-choice:hover { background: rgba(136, 57, 239, 0.3); }
        .sysmap-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
        .sysmap-choice.burned {
            color: #ff9ba6; border-color: #ff6b7a;
            background: rgba(255, 107, 122, 0.1);
            text-decoration: line-through; cursor: default;
        }
        .sysmap-overlay-note { font-size: 11px; font-style: italic; color: #ff9ba6; }
        .sysmap-meter-bar i.spike { background: #ff2e48; box-shadow: 0 0 8px rgba(255, 46, 72, 0.9); }

        /* Win flash + guided next move */
        .sysmap-clear {
            position: absolute; z-index: 6; left: 50%; top: 42%;
            transform: translate(-50%, -50%);
            font-family: 'Press Start 2P', monospace; font-size: 13px;
            color: #9fffce; text-shadow: 0 0 12px #9fffce;
            animation: clearPop 1.35s ease forwards;
            pointer-events: none;
        }
        @keyframes clearPop {
            0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
            18% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
            70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
            100% { transform: translate(-50%, -55%) scale(1); opacity: 0; }
        }
        .option-pill.pill-glow { animation: pillGlow 1.4s ease-in-out infinite; }
        @keyframes pillGlow {
            0%, 100% { box-shadow: 0 0 0 0 rgba(159, 255, 206, 0); }
            50% { box-shadow: 0 0 14px 2px rgba(159, 255, 206, 0.55); }
        }

        /* Quest-accept + hypothesis mini-game panels */
        .quest-panel, .hypo-panel {
            position: relative; z-index: 2; margin: 2px 0 14px;
            background: rgba(10, 8, 24, 0.6);
            border-radius: 12px; padding: 14px;
            animation: sysmapIn 0.4s ease;
        }
        .quest-panel { border: 1px solid rgba(255, 216, 168, 0.55); }
        .hypo-panel { border: 1px solid rgba(136, 57, 239, 0.5); }
        .quest-title {
            font-family: 'Press Start 2P', monospace; font-size: 8px;
            color: #ffd8a8; letter-spacing: 1px; margin-bottom: 9px;
        }
        .quest-name { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 6px; }
        .quest-meta { font-size: 12px; color: #cbb8ff; line-height: 1.65; margin-bottom: 12px; }
        .quest-actions { display: flex; gap: 8px; flex-wrap: wrap; }
        .quest-btn {
            font-family: 'Press Start 2P', monospace; font-size: 8px;
            padding: 10px 12px; border-radius: 8px; cursor: pointer;
        }
        .quest-accept {
            color: #071108; background: #9fffce; border: 1px solid #56d39a;
            box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
        }
        .quest-accept:hover { filter: brightness(1.08); }
        .quest-accept:active { transform: translateY(2px); box-shadow: none; }
        .quest-later { color: #cbb8ff; background: transparent; border: 1px solid rgba(136, 57, 239, 0.55); }
        .quest-note { margin-top: 10px; font-size: 11px; font-style: italic; color: #cbb8ff; }
        .hypo-title {
            font-family: 'Press Start 2P', monospace; font-size: 7px;
            color: #ffd8a8; letter-spacing: 0.5px; margin-bottom: 8px;
        }
        .hypo-claim { font-size: 13px; color: #efe6ff; line-height: 1.5; margin-bottom: 12px; }
        .hypo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
        .hypo-btn {
            font-size: 12.5px; color: #efe6ff;
            background: rgba(136, 57, 239, 0.16);
            border: 1px solid rgba(136, 57, 239, 0.55);
            border-radius: 8px; padding: 8px 12px; cursor: pointer;
        }
        .hypo-btn:hover { background: rgba(136, 57, 239, 0.3); }
        .hypo-reply { font-size: 12.5px; color: #b8ffd9; line-height: 1.5; }
        .quest-btn:focus-visible, .hypo-btn:focus-visible {
            outline: 2px solid var(--accent); outline-offset: 2px;
        }

        /* Parade sprites are pettable */
        .parade-sprite { pointer-events: auto; cursor: pointer; }

        @media (prefers-reduced-motion: reduce) {
            .scene-aurora, .scene-sun, .scene-grid, .scene-stars, .parade-sprite,
            .widget-card.booting .widget-boot, .widget-card.booting .boot-line,
            .widget-card.booting .boot-text, .widget-launcher.knock { animation: none !important; }
            .widget-boot { display: none !important; }
            .widget-card.booting .widget-boot { display: none !important; }
            .rw { opacity: 1 !important; transform: none !important; animation: none !important; }
            .pixel-burst { display: none !important; }
            .sysmap-you, .sysmap-arrow, .sysmap-wrapper, .scene-zzz, .permission-slip,
            .sysmap-overlay, .sysmap-clear, .option-pill.pill-glow,
            .quest-panel, .hypo-panel {
                animation: none !important;
            }
            .sysmap-shot { display: none !important; }
        }

        /* --- Accessibility: visible focus rings for keyboard users --- */
        .option-pill:focus-visible,
        .cf-send:focus-visible,
        .practice-audio-toggle:focus-visible,
        .widget-launcher:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 3px;
        }
        .cf-input:focus-visible {
            outline: none; /* handled by the box-shadow focus ring above */
        }
        /* Launcher stops pulsing once the widget is open */
        .widget-launcher.active::before { animation: none; opacity: 0; }

        @media (max-width: 480px) {
            .widget-wrapper {
                right: calc(20px + env(safe-area-inset-right, 0px));
                bottom: calc(24px + env(safe-area-inset-bottom, 0px));
            }

            .widget-card {
                width: min(360px, calc(100vw - 32px));
                height: min(500px, calc(100svh - 120px));
                bottom: 76px;
                border-radius: 20px;
            }

            .widget-body {
                padding: 16px;
            }
        }
