:root {
            --guest-font-stack: system-ui, Segoe UI, Roboto, Inter, Arial, sans-serif;
            --guest-bg:#030711;
            --guest-text:#e4e8f5;
            --guest-subtle:#9ca3af;
            --guest-link:#93c5fd;
            --guest-panel:rgba(8,12,24,0.85);
            --guest-panel-strong:rgba(15,23,42,0.7);
            --guest-input-bg:rgba(2,6,23,0.85);
            --guest-input-text:#e2e8f0;
            --guest-chat-bg:rgba(4,7,15,0.9);
            --guest-modal-bg:rgba(8,12,24,0.97);
            --guest-modal-text:#c7d7f5;
            background:var(--guest-bg);
            color:var(--guest-text);
        }
        html[data-kira-theme-resolved="dark"] {
            color-scheme: dark;
        }
        html[data-kira-theme-resolved="light"] {
            color-scheme: light;
            --guest-bg:#f4f7fb;
            --guest-text:#102033;
            --guest-subtle:#516273;
            --guest-link:#1d4ed8;
            --guest-panel:rgba(255,255,255,0.92);
            --guest-panel-strong:rgba(255,255,255,0.86);
            --guest-input-bg:rgba(244,247,251,0.96);
            --guest-input-text:#102033;
            --guest-chat-bg:rgba(248,250,252,0.96);
            --guest-modal-bg:rgba(255,255,255,0.98);
            --guest-modal-text:#27384b;
        }
        body {
            margin:0;
            color:var(--guest-text);
            font:14px/1.5 var(--guest-font-stack);
            -webkit-font-smoothing:antialiased;
            text-rendering:optimizeLegibility;
        }
        button,
        input,
        select,
        textarea {
            font:inherit;
        }
        .page {
            max-width:1200px;
            width:100%;
            margin:0 auto;
            padding:2rem 1.5rem 3rem;
            position:relative;
            z-index:0;
        }
        header,
        header > *,
        .hero,
        .hero > *,
        .tile-grid,
        .tile-card {
            min-width:0;
        }
        header {
            display:flex;
            align-items:flex-start;
            justify-content:space-between;
            gap:1.5rem;
            flex-wrap:wrap;
        }
        .brand-title {
            font-size:1.8rem;
            font-weight:700;
            letter-spacing:.1em;
            text-shadow:0 2px 18px rgba(2,6,23,0.28);
        }
        .tls-badge {
            padding:.4rem .85rem;
            border-radius:999px;
            border:1px solid rgba(96,165,250,0.45);
            background:var(--guest-panel);
            font-size:.85rem;
            color:var(--guest-link);
            white-space:nowrap;
        }
        .header-actions{
            display:flex;
            align-items:center;
            gap:.75rem;
            flex-wrap:wrap;
        }
        .theme-toggle{
            display:inline-flex;
            align-items:center;
            gap:.5rem;
            padding:.55rem .85rem;
            border-radius:999px;
            border:1px solid rgba(96,165,250,0.35);
            background:var(--guest-panel);
            color:var(--guest-text);
            cursor:pointer;
            font-weight:600;
        }
        .footer-line{
            margin-top:1.25rem;
            padding:0.75rem 0;
            font-size:.78rem;
            color:var(--guest-subtle);
            display:flex;
            gap:.6rem;
            flex-wrap:wrap;
            align-items:center;
            justify-content:center;
        }
        .footer-line a{
            color:var(--guest-link);
            text-decoration:none;
        }
        .footer-line a:hover{ text-decoration:underline; }

        .legal-modal{
            position:fixed;
            inset:0;
            display:none;
            align-items:center;
            justify-content:center;
            padding:18px;
            background:rgba(0,0,0,0.55);
            z-index:9999;
        }
        .legal-modal.open{ display:flex; }
        .legal-modal-card{
            width:min(920px, 100%);
            max-height:min(78vh, 720px);
            overflow:hidden;
            border-radius:16px;
            border:1px solid rgba(59,67,90,0.7);
            background:var(--guest-modal-bg);
            box-shadow:0 24px 60px rgba(0,0,0,0.65);
        }
        .legal-modal-header{
            display:flex;
            align-items:center;
            justify-content:space-between;
            gap:10px;
            padding:12px 14px;
            border-bottom:1px solid rgba(59,67,90,0.5);
            color:var(--guest-text);
        }
        .legal-modal-header button{
            border:none;
            background:transparent;
            color:var(--guest-subtle);
            font-size:20px;
            cursor:pointer;
            padding:2px 8px;
            line-height:1;
        }
        .legal-modal-body{
            padding:14px;
            overflow:auto;
            max-height:min(70vh, 640px);
            color:var(--guest-modal-text);
            font-size:.9rem;
            line-height:1.6;
            white-space:pre-wrap;
        }

        .newyear-field{
            display:none;
            margin-top:1.5rem;
            padding:1.25rem 1.4rem;
            border-radius:20px;
            background:var(--guest-panel-strong);
            border:1px solid rgba(59,130,246,0.22);
            box-shadow:0 18px 35px rgba(2,6,23,0.55);
            position:relative;
            overflow:hidden;
        }
        .newyear-field::before,
        .newyear-field::after{
            content:"";
            position:absolute;
            inset:-40px;
            pointer-events:none;
            opacity:0;
            transition:opacity .25s ease;
        }
        .newyear-field.ny-done::before{
            opacity:1;
            background:
                radial-gradient(circle at 15% 35%, rgba(56,189,248,0.35), transparent 42%),
                radial-gradient(circle at 85% 30%, rgba(16,185,129,0.28), transparent 44%),
                radial-gradient(circle at 65% 80%, rgba(96,165,250,0.24), transparent 48%),
                radial-gradient(circle at 35% 75%, rgba(56,189,248,0.22), transparent 46%);
            filter:blur(0px);
            animation:ny-fireworks 1.25s ease-in-out infinite;
        }
        .newyear-field.ny-done::after{
            opacity:0.85;
            background:
                radial-gradient(circle at 25% 55%, rgba(186,230,253,0.18), transparent 40%),
                radial-gradient(circle at 75% 50%, rgba(186,230,253,0.14), transparent 45%);
            filter:blur(6px);
            animation:ny-glow 2.2s ease-in-out infinite;
        }

        @keyframes ny-fireworks{
            0%{ transform:scale(1) translateY(0); opacity:0.85; }
            50%{ transform:scale(1.06) translateY(-6px); opacity:1; }
            100%{ transform:scale(1) translateY(0); opacity:0.85; }
        }
        @keyframes ny-glow{
            0%,100%{ transform:scale(1); opacity:0.65; }
            50%{ transform:scale(1.03); opacity:0.95; }
        }

        @media (prefers-reduced-motion: reduce){
            .newyear-field.ny-done::before,
            .newyear-field.ny-done::after{ animation:none; }
        }
        .hero {
            margin-top:2rem;
            padding:clamp(1.5rem, 4vw, 3.25rem);
            border-radius:24px;
            background:color-mix(in srgb, var(--guest-panel) 90%, transparent);
            border:1px solid rgba(96,165,250,0.28);
            box-shadow:0 25px 60px rgba(2,6,23,0.38);
            backdrop-filter:blur(12px);
        }

        .newyear-banner{
            display:none;
            align-items:center;
            justify-content:flex-start;
            gap:.6rem;
            padding:1.05rem 1.1rem;
            border-radius:16px;
            border:1px solid rgba(96,165,250,0.35);
            background:rgba(8,12,24,0.55);
            color:#bae6fd;
            font-size:1.2rem;
            width:100%;
            flex-wrap:wrap;
            row-gap:.25rem;
            box-sizing:border-box;
            position:relative;
            z-index:1;
        }
        .newyear-banner .ny-label{font-weight:700; letter-spacing:.02em;}
        .newyear-banner.ny-done{color:#e4e8f5;}
        .newyear-banner .ny-title{font-weight:800;}
        .newyear-banner .ny-time{
            font-weight:900;
            font-size:2.2rem;
            letter-spacing:.06em;
            font-variant-numeric:tabular-nums;
        }
        .newyear-banner .ny-emojis{display:inline-flex; gap:.35rem; align-items:center;}
        .newyear-banner .ny-emoji{display:inline-block; transform-origin:center; animation:ny-float 1.2s ease-in-out infinite;}
        .newyear-banner .ny-emoji.delay1{animation-delay:.15s;}
        .newyear-banner .ny-emoji.delay2{animation-delay:.3s;}

        @keyframes ny-float{
            0%,100%{transform:translateY(0) rotate(0deg) scale(1);}
            50%{transform:translateY(-4px) rotate(6deg) scale(1.03);}
        }

        @media (prefers-reduced-motion: reduce){
            .newyear-banner .ny-emoji{animation:none;}
        }

        @media (max-width: 640px){
            .newyear-field{ padding:1.05rem 1rem; }
            .newyear-banner{ font-size:1.05rem; }
            .newyear-banner .ny-time{ font-size:1.85rem; }
        }
        .hero h1 {
            max-width:100%;
            font-size:clamp(1.75rem, 3vw, 2.6rem);
            font-weight:650;
            line-height:1.12;
            letter-spacing:-.02em;
            margin:.45rem 0 1rem;
            overflow-wrap:break-word;
        }
        .hero p {
            max-width:68ch;
            font-size:clamp(.94rem, 1.25vw, 1.02rem);
            font-weight:400;
            color:var(--guest-subtle);
            line-height:1.52;
            margin:0;
        }
        .hero-kicker {
            color:var(--guest-link);
            font-size:.78rem;
            font-weight:800;
            letter-spacing:.13em;
            text-transform:uppercase;
        }
        .content-grid {
            margin-top:2.5rem;
            display:grid;
            grid-template-columns:2fr 1fr;
            gap:1.5rem;
        }

        .tile-grid{
            margin-top:2rem;
            display:grid;
            grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));
            gap:1.25rem;
        }
        .tile-card{display:flex;flex-direction:column;gap:.65rem;min-height:190px}
        .tile-ico{font-size:1.65rem;line-height:1}
        .tile-title{margin:0;font-size:1.05rem}
        .tile-desc{margin:0;color:var(--guest-subtle);font-size:.92rem;line-height:1.45}
        .tile-actions{margin-top:auto;display:flex;gap:10px;flex-wrap:wrap}
        a.tile-btn{
            display:inline-block;
            text-decoration:none;
            padding:10px 12px;
            border-radius:12px;
            border:1px solid rgba(59,130,246,0.28);
            background:var(--guest-panel);
            color:var(--guest-text);
            font-weight:600;
            text-align:center;
            flex:1 1 auto;
        }
        a.tile-btn.primary{
            border-color:rgba(16,185,129,0.4);
            background:rgba(16,185,129,0.12);
        }
        @media (max-width: 1100px){
            .tile-grid{grid-template-columns:repeat(2, 1fr)}
        }
        @media (max-width: 640px){
            .tile-grid{grid-template-columns:1fr}
        }
        .card {
            border-radius:18px;
            background:color-mix(in srgb, var(--guest-panel) 92%, transparent);
            border:1px solid rgba(59,67,90,0.5);
            padding:1.5rem;
            box-shadow:0 18px 35px rgba(0,0,0,0.28);
            backdrop-filter:blur(10px);
        }

        .card label {
            font-size:.82rem;
            color:var(--guest-subtle);
            display:block;
            margin-bottom:.2rem;
        }
        .card input:not([type="hidden"]),
        .card select {
            width:100%;
            padding:.6rem .50rem;
            border-radius:.50rem;
            border:1px solid rgba(71,85,105,0.9);
            background:var(--guest-input-bg);
            color:var(--guest-input-text);
            margin-bottom:.9rem;
            outline:none;
        }
        .card input:not([type="hidden"]):focus,
        .card select:focus {
            border-color:#38bdf8;
            box-shadow:0 0 0 1px rgba(56,189,248,0.3);
        }
        #guest-chat-card.guest-disabled {
            opacity:0.65;
        }
        .card h2 {
            margin-top:0;
            font-size:1.1rem;
            letter-spacing:.08em;
            text-transform:uppercase;
            color:var(--guest-link);
        }
        .chat-log {
            height:260px;
            border-radius:12px;
            border:1px solid rgba(71,85,105,0.8);
            padding:1rem;
            margin-bottom:1rem;
            overflow-y:auto;
            background:var(--guest-chat-bg);
            font-size:.9rem;
            line-height:1.5;
        }
        .chat-entry {
            margin-bottom:.8rem;
        }
        .chat-entry strong {
            display:block;
            font-size:.75rem;
            letter-spacing:.08em;
            color:#94a3b8;
        }
        .chat-entry p {
            margin:.25rem 0 0;
            color:var(--guest-input-text);
        }
        .chat-entry.typing p {
            margin:.35rem 0 0;
        }
        .typing-indicator {
            display:inline-flex;
            gap:6px;
            align-items:center;
        }
        .typing-dot {
            width:6px;
            height:6px;
            border-radius:999px;
            background:#8ab4ff;
            opacity:.35;
            animation:typingPulse 1.2s infinite ease-in-out;
        }
        .typing-dot:nth-child(2) { animation-delay:.2s; }
        .typing-dot:nth-child(3) { animation-delay:.4s; }
        @keyframes typingPulse {
            0%, 80%, 100% { opacity:.25; transform:translateY(0); }
            40% { opacity:1; transform:translateY(-3px); }
        }
        textarea {
            width:100%;
            resize:none;
            min-height:90px;
            border-radius:12px;
            border:1px solid rgba(59,130,246,0.4);
            background:var(--guest-input-bg);
            color:var(--guest-input-text);
            padding:.85rem;
            font-size:.95rem;
            line-height:1.4;
            outline:none;
        }
        textarea:focus {
            border-color:#38bdf8;
            box-shadow:0 0 0 1px rgba(56,189,248,0.3);
        }
        button.primary {
            margin-top:.85rem;
            width:100%;
            border:none;
            border-radius:999px;
            padding:.9rem 1rem;
            font-size:.95rem;
            font-weight:600;
            letter-spacing:.08em;
            text-transform:uppercase;
            background:linear-gradient(135deg,#10b981,#38bdf8);
            color:#02111d;
            cursor:pointer;
        }
        button.primary:disabled {
            opacity:.4;
            cursor:default;
        }
        .login-card label {
            font-size:.82rem;
            color:var(--guest-subtle);
            display:block;
            margin-bottom:.2rem;
        }
        .login-card input {
            width:100%;
            padding:.6rem .50rem;
            border-radius:.50rem;
            border:1px solid rgba(71,85,105,0.9);
            background:var(--guest-input-bg);
            color:var(--guest-input-text);
            margin-bottom:.9rem;
        }
        .login-card button {
            width:100%;
            border-radius:999px;
            border:none;
            padding:.8rem;
            font-weight:600;
            letter-spacing:.08em;
            text-transform:uppercase;
            background:rgba(59,130,246,0.85);
            color:white;
            cursor:pointer;
        }
        .login-hint {
            font-size:.78rem;
            color:var(--guest-subtle);
            margin-top:.6rem;
        }

        .login-form{ display:flex; flex-direction:column; gap:10px; margin-top:10px; }
        .login-form input{
            width:100%;
            padding:10px 12px;
            border-radius:12px;
            border:1px solid rgba(59,130,246,0.22);
            background:var(--guest-panel-strong);
            color:var(--guest-text);
            outline:none;
        }
        .login-form input::placeholder{ color:var(--guest-subtle); }
        @media (max-width:960px) {
            .content-grid {
                grid-template-columns:1fr;
                display:flex;
                flex-direction:column;
            }
            /* Mobile UX: login section should appear higher than guest chat */
            .content-grid > .login-card { order:-1; }
            .content-grid > #guest-chat-card { order:0; }
        }
        @media (max-width:640px) {
            .page {
                padding:1rem .85rem 2rem;
            }
            header {
                align-items:center;
                gap:.75rem;
            }
            .brand-title {
                font-size:1.15rem;
                letter-spacing:.07em;
            }
            .theme-toggle {
                padding:.5rem .7rem;
                font-size:.82rem;
            }
            .hero {
                margin-top:1.25rem;
                padding:1.35rem;
                border-radius:18px;
                backdrop-filter:blur(16px);
            }
            .hero h1 {
                max-width:none;
                font-size:clamp(1.7rem, 7.3vw, 2.05rem);
                font-weight:620;
                line-height:1.14;
            }
            .hero p {
                font-size:.94rem;
                line-height:1.5;
            }
            .tile-grid {
                grid-template-columns:minmax(0, 1fr);
                gap:.9rem;
                margin-top:1rem;
            }
            .tile-card {
                min-height:0;
            }
            .card {
                padding:1.2rem;
            }
        }
/* Accessible guest landing; public login form and legal workflow untouched. */
body.kui-guest-home{min-width:0;max-width:100%;overflow-x:clip;}
body.kui-guest-home *,body.kui-guest-home *::before,body.kui-guest-home *::after{box-sizing:border-box;}
body.kui-guest-home .page{min-width:0;max-width:100%;}
body.kui-guest-home .login-form input{min-height:44px;max-width:100%;}
body.kui-guest-home :is(button,a,input,textarea,[tabindex="0"]):focus-visible{outline:3px solid var(--guest-link,#93c5fd);outline-offset:3px;}
body.kui-guest-home .tile-btn{min-height:44px;display:inline-flex;align-items:center;justify-content:center;text-align:center;}
body.kui-guest-home .login-form label{display:block;color:var(--guest-text);font-size:.83rem;margin-bottom:.2rem;}
body.kui-guest-home .login-form input{margin-bottom:0;}
/* The public shell positions its direct children relatively. The legal
   overlay must instead cover the viewport, independently of page scroll. */
body.kui-guest-home.public-shell > .legal-modal{position:fixed;inset:0;z-index:9999;}
body.kui-guest-home.legal-modal-open{overflow:hidden;}
body.kui-guest-home .legal-modal-card{display:flex;flex-direction:column;max-width:min(100%,640px);max-height:min(85dvh,720px);overflow:hidden;}
body.kui-guest-home .legal-modal-header{flex:none;}
body.kui-guest-home .legal-modal-header button{min-width:44px;min-height:44px;}
body.kui-guest-home .legal-modal-body{min-height:0;max-height:none;overflow-y:auto;overscroll-behavior:contain;overflow-wrap:anywhere;}
@media(max-width:640px){body.kui-guest-home .page{padding-left:max(.85rem,env(safe-area-inset-left,0px));padding-right:max(.85rem,env(safe-area-inset-right,0px));}body.kui-guest-home .tile-grid{grid-template-columns:minmax(0,1fr);}}
@media(prefers-reduced-motion:reduce){body.kui-guest-home *,body.kui-guest-home *::before,body.kui-guest-home *::after{animation-duration:0.01ms!important;transition-duration:0.01ms!important;}}
