:root {
    --bg-color: #060B18;
    --text-primary: #ffffff;
    --text-secondary: #8e8c95;
    --text-muted: #6b6972;
    --accent-yellow: #F8D878;

    --aurora-bg-black: #060B18;
    --aurora-bg-main: #0A1024;
    --aurora-midnight: #10162F;
    --aurora-blue: #74E5FF;
    --aurora-violet: #8A78FF;
    --aurora-purple: #667EEA;
    --aurora-pink: #F093FB;
    --glass-aurora: rgba(10, 16, 36, 0.58);
    --glass-aurora-strong: rgba(16, 22, 47, 0.74);
    --scroll-depth: 0;

    --btn-gradient: linear-gradient(135deg, #74E5FF 0%, #667EEA 36%, #8A78FF 68%, #F093FB 100%);
    --btn-hover-gradient: linear-gradient(135deg, #93EEFF 0%, #818CF8 34%, #A78BFA 66%, #F472B6 100%);
    --btn-shadow: 0 12px 32px rgba(102, 126, 234, 0.32), 0 0 36px rgba(116, 229, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    --btn-glow: 0 16px 40px rgba(116, 229, 255, 0.26), 0 0 48px rgba(240, 147, 251, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.26);
    --glass-button-bg: rgba(255, 255, 255, 0.055);
    --glass-button-border: rgba(116, 229, 255, 0.18);
    --glass-button-hover: rgba(116, 229, 255, 0.1);
    --status-gold: #F8D878;

    --title-gradient: linear-gradient(90deg, #b09fff 0%, #8093ff 56%, #74E5FF 100%);
    --workspace-left-width: 320px;
    --workspace-right-width: 360px;
    --workspace-gutter: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: linear-gradient(180deg, var(--aurora-midnight) 0%, var(--aurora-bg-main) 42%, var(--aurora-bg-black) 100%);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* 3 层视差背景结?*/
.bg-layer {
    position: fixed;
    /* Actually fixed is much safer for background layers so they don't cause scrollbars */
    border-radius: 50%;
    pointer-events: none;
    transition: none;
    will-change: transform;
    z-index: -3;
}

/* 最远层：紫蓝色，右上角 */
.bg-far {
    top: -18%;
    right: -12%;
    width: 960px;
    height: 960px;
    background: radial-gradient(circle, rgba(116, 229, 255, 0.13) 0%, transparent 70%);
    animation: float1 8s ease-in-out infinite;
}

/* 中间层：金黄色，左下?*/
.bg-mid {
    bottom: -30%;
    left: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(246, 200, 95, 0.052) 0%, transparent 70%);
    animation: float2 12s ease-in-out infinite;
}

/* 最近层：淡紫色，中间偏?*/
.bg-near {
    top: 30%;
    right: 20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(240, 147, 251, 0.14) 0%, transparent 70%);
    filter: blur(40px);
    animation: float3 10s ease-in-out infinite;
}

/* 新增：左侧紫色星?*/
.bg-left {
    top: 10%;
    left: -15%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(138, 120, 255, 0.16) 0%, rgba(102, 126, 234, 0.09) 40%, transparent 70%);
    filter: blur(60px);
    animation: float4 14s ease-in-out infinite;
}

@keyframes float4 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    40% {
        transform: translate(20px, 30px) scale(1.06);
    }

    70% {
        transform: translate(-10px, -20px) scale(0.97);
    }
}

@keyframes float1 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-20px, 10px) scale(1.05);
    }

    66% {
        transform: translate(10px, -15px) scale(0.98);
    }
}

@keyframes float2 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(15px, -10px) scale(1.02);
    }

    75% {
        transform: translate(-10px, 5px) scale(1.03);
    }
}

@keyframes float3 {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(-30px, 20px);
    }
}




/* Starlight Effect */
.starlight-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    pointer-events: none;
    z-index: -2;
    overflow: hidden;
    animation: starViewportDrift 90s ease-in-out infinite alternate;
    will-change: transform;
}

.starlight-container::before,
.starlight-container::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(220, 246, 255, 0.9), rgba(116, 229, 255, 0));
    opacity: 0;
    filter: drop-shadow(0 0 8px rgba(116, 229, 255, 0.58));
    transform: rotate(-22deg);
    animation: meteorDrift 13s linear infinite;
    will-change: transform, opacity;
}

.starlight-container::before {
    top: 12vh;
    left: 82vw;
}

.starlight-container::after {
    top: 38vh;
    left: 68vw;
    width: 120px;
    animation-duration: 17s;
    animation-delay: -8s;
}

.starlight {
    position: absolute;
    border-radius: 50%;
    background: #f5f7ff;
    opacity: 0;
    animation: twinkle ease-in-out infinite;
    will-change: transform, opacity;
    box-shadow: 0 0 10px rgba(116, 229, 255, 0.72), 0 0 20px rgba(138, 120, 255, 0.34);
}

@keyframes twinkle {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(0.5);
    }

    50% {
        opacity: 1;
        transform: translate3d(calc(var(--drift-x, 0px) * 0.5), calc(var(--drift-y, 0px) * 0.5), 0) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate3d(var(--drift-x, 0px), var(--drift-y, 0px), 0) scale(0.62);
    }
}

@keyframes starViewportDrift {
    0% {
        transform: translate3d(-10px, -6px, 0) scale(1.015);
    }

    50% {
        transform: translate3d(14px, 10px, 0) scale(1.025);
    }

    100% {
        transform: translate3d(-4px, 18px, 0) scale(1.018);
    }
}

@keyframes meteorDrift {
    0%,
    76% {
        opacity: 0;
        transform: translate3d(0, 0, 0) rotate(var(--meteor-angle, -18deg));
    }

    80% {
        opacity: 0.9;
    }

    100% {
        opacity: 0;
        transform: translate3d(-560px, 170px, 0) rotate(-22deg);
    }
}


/* 扫描线动?*/
@media (prefers-reduced-motion: reduce) {
    .starlight-container,
    .starlight-container::before,
    .starlight-container::after,
    .starlight,
    body::after {
        animation: none !important;
    }

    .starlight-container {
        transform: none;
    }

    body::after {
        opacity: 0.46;
    }
}

.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            transparent 50%,
            rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 100;
    opacity: 0.6;
}

/* ===== 探照灯效?===== */
.spotlight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle at 50% 50%,
            transparent 0%,
            transparent 120px,
            rgba(18, 16, 23, 0.2) 250px,
            rgba(18, 16, 23, 0.4) 100%);
    transition: background 0.1s ease-out;
}

.spotlight-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(circle at 50% 50%,
            rgba(129, 140, 248, 0.15) 0%,
            rgba(129, 140, 248, 0.05) 80px,
            transparent 180px);
    opacity: 0;
    transition: opacity 0.3s ease, background 0.1s ease-out;
    mix-blend-mode: screen;
}

body:hover .spotlight-glow {
    opacity: 1;
}

.spotlight-ripple {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(129, 140, 248, 0.3);
    pointer-events: none;
    z-index: 3;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
}


/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 4rem;
    position: relative;
    z-index: 10;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.header-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
    padding: 1.5rem 2.5rem;
    margin: -1.5rem -2.5rem;
    border-radius: 8px;
}

.header-link:hover {
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settings-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.24s ease;
}

.settings-btn::after {
    content: '';
    position: absolute;
    top: 7px;
    right: 7px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent-yellow);
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.75);
}

.settings-btn.is-configured::after {
    background: #22c55e;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.7);
}

.settings-btn:hover {
    background: var(--btn-gradient);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 28px rgba(102, 126, 234, 0.28);
    transform: translateY(-1px);
}

.frontend-sign-in-btn {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    padding: 0.65rem 1rem;
    min-height: 40px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.22s ease;
}

.frontend-sign-in-btn:hover,
.frontend-sign-in-btn.is-signed-in {
    background: color-mix(in srgb, var(--accent-purple) 22%, rgba(255, 255, 255, 0.05));
    border-color: rgba(164, 130, 255, 0.38);
    color: #fff;
    box-shadow: 0 10px 28px rgba(102, 126, 234, 0.2);
}

.frontend-sign-in-btn.is-signed-in {
    background: linear-gradient(180deg, rgba(66, 133, 244, 0.95), rgba(26, 115, 232, 0.9));
    border-color: rgba(138, 180, 248, 0.72);
    color: #fff;
    box-shadow: 0 12px 30px rgba(66, 133, 244, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Main Hero Section */
.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 2rem;
    position: relative;
    z-index: 10;
    margin-top: -5vh;
    /* Slight adjustment to center visually */
}

.home-view .hero {
    flex: 0 0 auto;
    min-height: calc(100vh - 96px);
}



.badge {
    background: rgba(31, 28, 39, 0.8);
    color: var(--accent-yellow);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 0.5rem 1.25rem;
    border-radius: 100px;
    margin-bottom: 2rem;
    border: 1px solid rgba(250, 204, 21, 0.1);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.05);
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform;
    display: inline-block;
}

.title {
    font-size: clamp(3.5rem, 8vw, 6.5rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform;
}

.gradient-text {
    background: var(--title-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 400;
    max-width: 600px;
    margin-bottom: 3rem;
    line-height: 1.5;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform;
}

/* Form */
.waitlist-form {
    display: flex;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.75rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 640px;
    margin-bottom: 2rem;
    position: relative;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    align-items: center;
    flex-wrap: wrap;
    /* 允许内部元素换行 */
}

.waitlist-form.input-error {
    border-color: rgba(239, 68, 68, 0.82);
    box-shadow:
        0 0 0 1px rgba(239, 68, 68, 0.34),
        0 0 22px rgba(239, 68, 68, 0.22),
        inset 0 0 10px rgba(239, 68, 68, 0.1);
}

.char-count-warning {
    width: 100%;
    padding: 0 1.5rem 0.5rem 1.5rem;
    font-size: 0.75rem;
    color: var(--accent-yellow);
    display: none;
    order: 10;
    /* 确保在最后显?*/
    animation: fadeIn 0.3s ease;
    text-align: left;
}

.waitlist-form:focus-within {
    border-color: rgba(184, 155, 255, 0.8);
    box-shadow: 0 0 20px rgba(135, 128, 255, 0.4), inset 0 0 10px rgba(135, 128, 255, 0.2);
    transform: translateY(-2px);
}

.email-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-weight: 500;
    font-size: 1.125rem;
    padding: 1rem 1.5rem;
    outline: none;
    transition: all 0.3s ease;
    resize: none;
    overflow: hidden;
    line-height: 1.5;
    font-family: inherit;
    min-height: 56px;
}

.email-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

/* Back Button */
.back-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -1.25rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.back-btn:hover {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Success State Container */
.success-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 640px;
    margin: 0 auto 3rem auto;
    text-align: center;
    animation: fadeIn 0.6s ease forwards;
}

.success-message-large {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.new-idea-btn {
    background: transparent;
    border: 2px solid rgba(164, 130, 255, 0.5);
    box-shadow: none;
}

.new-idea-btn:hover {
    background: rgba(164, 130, 255, 0.1);
    border-color: rgba(164, 130, 255, 0.8);
    box-shadow: 0 0 20px rgba(135, 128, 255, 0.3);
}

/* Progress Bar */
.progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    gap: 2rem;
    text-align: center;
    position: relative;
    min-height: 400px;
    animation: fadeIn 0.5s ease forwards;
}

.progress-bar-bg {
    width: 100%;
    max-width: 500px;
    height: 5px;
    background: rgba(30, 20, 50, 0.8);
    border-radius: 999px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.6),
        0 0 0 0.5px rgba(100, 70, 180, 0.2);
    overflow: visible;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,
            rgba(80, 40, 160, 0.3) 0%,
            rgba(130, 80, 220, 0.7) 50%,
            #c0a0ff 100%);
    border-radius: 999px;
    position: relative;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 0 8px rgba(180, 140, 255, 0.5),
        0 0 16px rgba(164, 130, 255, 0.25);
}

/* Shimmer leading edge */
.progress-bar-fill::before {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 5px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55));
    border-radius: 999px;
    filter: blur(1.5px);
}

/* Glowing dot at leading edge */
.progress-bar-fill::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #fff 0%, #d8b8ff 45%, rgba(164, 130, 255, 0) 100%);
    border-radius: 50%;
    box-shadow:
        0 0 5px #fff,
        0 0 10px rgba(210, 170, 255, 0.9),
        0 0 20px rgba(164, 130, 255, 0.6);
    z-index: 3;
}



#plexusCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 300px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
}

.progress-text {
    font-size: 6rem;
    font-weight: 900;
    background: linear-gradient(180deg, #FFFFFF 30%, #a482ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(164, 130, 255, 0.4)) drop-shadow(0 0 30px rgba(164, 130, 255, 0.2));
    margin: 0;
    letter-spacing: -0.04em;
    font-family: 'Inter', sans-serif;
    line-height: 1;
    z-index: 2;
    position: relative;
    transition: all 0.3s ease;
}

.data-wave-container {
    display: none;
}

#dataWaveCanvas {
    width: 100%;
    height: 100%;
}

/* Purple lens-flare divider */
.progress-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    margin: 0;
    width: 100%;
    max-width: 500px;
    z-index: 2;
}

.progress-logo span {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.35em;
    color: rgba(255, 255, 255, 0.45);
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
}

.logo-sparkle {
    width: 100%;
    height: 1px;
    position: relative;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(120, 80, 200, 0.25) 30%,
            rgba(160, 100, 255, 0.5) 50%,
            rgba(120, 80, 200, 0.25) 70%,
            transparent 100%);
}

/* Lens-flare glow centered on the line */
.logo-sparkle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 12px;
    background: radial-gradient(ellipse at center,
            rgba(190, 150, 255, 0.7) 0%,
            rgba(150, 100, 255, 0.35) 40%,
            transparent 70%);
    filter: blur(3px);
}

/* Bright center point of the lens flare */
.logo-sparkle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, #fff 0%, #c0a0ff 50%, transparent 100%);
    border-radius: 50%;
    box-shadow:
        0 0 4px #fff,
        0 0 10px rgba(200, 160, 255, 0.8),
        0 0 20px rgba(160, 120, 255, 0.5);
}

@keyframes breathing {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.98);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

.progress-message {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    line-height: 1.5;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease forwards;
}

.submit-btn {
    background: var(--btn-gradient);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 10px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--btn-shadow);
    position: relative;
    overflow: hidden;
}

/* 按钮呼吸光效 */
.submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.submit-btn:hover::before {
    opacity: 1;
    animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

.submit-btn:hover {
    background: var(--btn-hover-gradient);
    transform: translateY(-2px);
    box-shadow: var(--btn-glow);
}

.submit-btn:active {
    transform: translateY(1px);
}

/* Stats */
.stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.joined-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.joined-count strong {
    color: var(--text-primary);
    font-weight: 600;
}

.limited-slots {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

/* Generation Steps Animation */
.generation-steps {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    padding-left: 0;
    align-items: flex-start;
}

.step {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    border: none !important;
    backdrop-filter: none !important;
    position: relative;
    z-index: 2;
}

/* 鼠标悬停至对应区域才给浮现出?*/
.progress-container:hover .step {
    opacity: 0.4;
}

.step.active {
    opacity: 1;
    animation: activeBreathing 2s ease-in-out infinite;
}

.step.completed {
    opacity: 1 !important;
    animation: none !important;
}

/* Pending steps breathing */
.step:not(.active):not(.completed) {
    animation: pendingBreathing 3s ease-in-out infinite;
}

@keyframes pendingBreathing {

    0%,
    100% {
        opacity: 0.15;
    }

    50% {
        opacity: 0.45;
    }
}

@keyframes activeBreathing {

    0%,
    100% {
        opacity: 0.7;
        transform: translateX(0);
    }

    50% {
        opacity: 1;
        transform: translateX(4px);
    }
}

.step-icon {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-right: 0.75rem;
}

.step.active .step-icon {
    border-color: #a482ff;
    box-shadow: 0 0 15px rgba(164, 130, 255, 0.4);
}

.step.active .step-icon::after {
    content: none; /* Hollow for active/waiting steps per user request */
}

.step.completed .step-icon {
    border-color: #a482ff;
}

.step.completed .step-icon::after {
    content: '';
    width: 12px;
    height: 12px;
    background: #a482ff;
    border-radius: 50%;
}

.step-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.step.active .step-text {
    color: #fff;
}


/* Inspire Section Wrapper */
.inspire-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.inspire-text {
    font-size: 1.15rem;
    font-weight: 800;
    font-style: italic;
    background: linear-gradient(135deg, #ffffff 20%, #a482ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.02em;
    margin-right: 0.2rem;
    text-shadow: 0 4px 15px rgba(164, 130, 255, 0.2);
}

/* Inspire Entry Button */
.inspire-entry-btn {
    background: var(--btn-gradient);
    border: none;
    color: #fff;
    padding: 0.6rem 1.4rem;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}

.inspire-entry-btn .sparkle-icon {
    color: #fff;
    transition: transform 0.4s ease;
}

.inspire-entry-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.5);
    transform: translateY(-2px) scale(1.02);
}

.inspire-entry-btn:hover .sparkle-icon {
    transform: scale(1.15) rotate(15deg);
}

.quick-tags {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
}

.quick-tag {
    background: linear-gradient(180deg, rgba(16, 22, 47, 0.72), rgba(10, 16, 36, 0.54));
    border: 1px solid rgba(138, 120, 255, 0.28);
    padding: 0.85rem 1.5rem;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: fit-content;
    min-width: 160px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
    animation: tagSlideIn 0.3s ease forwards;
    opacity: 0;
}

.quick-tag:nth-child(1) {
    animation-delay: 0s;
}

.quick-tag:nth-child(2) {
    animation-delay: 0.06s;
}

.quick-tag:nth-child(3) {
    animation-delay: 0.12s;
}

@keyframes tagSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.quick-tag:hover {
    background: linear-gradient(135deg, rgba(116, 229, 255, 0.18), rgba(138, 120, 255, 0.26) 52%, rgba(240, 147, 251, 0.18));
    border-color: rgba(116, 229, 255, 0.46);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(116, 229, 255, 0.16), 0 0 26px rgba(240, 147, 251, 0.14);
}

.quick-tag-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    flex: 0 0 1.55rem;
    border-radius: 50%;
    background: rgba(116, 229, 255, 0.12);
    border: 1px solid rgba(116, 229, 255, 0.2);
    color: #bff7ff;
    font-size: 0.88rem;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.quick-tag.selected {
    background: linear-gradient(135deg, rgba(116, 229, 255, 0.22), rgba(102, 126, 234, 0.34) 48%, rgba(240, 147, 251, 0.22));
    border-color: rgba(116, 229, 255, 0.62);
    color: #fff;
}

.quick-tag:active {
    transform: scale(0.97);
}

.quick-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(180deg, rgba(16, 22, 47, 0.68), rgba(10, 16, 36, 0.5));
    border: 1px solid rgba(138, 120, 255, 0.3);
    padding: 0.6rem 1.25rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: 0.02em;
    width: fit-content;
    min-width: 160px;
    justify-content: center;
    opacity: 0;
    animation: tagSlideIn 0.3s ease forwards;
}

.quick-more-btn:hover {
    background: linear-gradient(135deg, rgba(116, 229, 255, 0.16), rgba(138, 120, 255, 0.28) 58%, rgba(240, 147, 251, 0.16));
    border-color: rgba(116, 229, 255, 0.5);
    color: #fff;
    box-shadow: 0 0 18px rgba(116, 229, 255, 0.14), 0 0 22px rgba(240, 147, 251, 0.12);
}

.inspire-recommendation-more {
    margin-top: 0.9rem;
    opacity: 1;
    animation: none;
}

/* Setting Card Style for Step 3 */
.setting-card {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start !important;
    padding: 1.25rem 1.75rem !important;
    background: #15121c !important;
    /* Dark background like in image */
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 16px !important;
    width: 100% !important;
    max-width: 480px;
    min-width: unset !important;
    text-align: left !important;
    color: #fff !important;
    height: auto !important;
}

.setting-card .card-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: #fff;
}

.setting-card .card-desc {
    font-size: 0.95rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    pointer-events: none;
}

.setting-card:hover {
    background: #1e1a26 !important;
    border-color: rgba(164, 130, 255, 0.3) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

.quick-more-btn svg {
    transition: transform 0.4s ease;
}

.quick-more-btn.spinning svg {
    transform: rotate(360deg);
}

/* Inspire Chat View */
.inspire-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background:
        radial-gradient(circle at 18% 14%, rgba(116, 229, 255, 0.08), transparent 30%),
        radial-gradient(circle at 82% 12%, rgba(138, 120, 255, 0.12), transparent 34%),
        radial-gradient(circle at 50% 96%, rgba(240, 147, 251, 0.055), transparent 34%),
        linear-gradient(180deg, #10162F 0%, #0A1024 44%, #060B18 100%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease forwards;
}

.inspire-view::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 22%, rgba(116, 229, 255, 0.08), transparent 34%),
        radial-gradient(circle at 50% 74%, rgba(240, 147, 251, 0.045), transparent 36%),
        radial-gradient(ellipse at center, transparent 0 54%, rgba(0, 0, 0, 0.22) 100%);
}

.chat-profile-sidebar {
    position: absolute;
    top: 4.3rem;
    right: 1rem;
    bottom: 6.4rem;
    width: min(330px, calc(100vw - 2rem));
    z-index: 218;
    overflow-y: auto;
    padding: 0.15rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.inspire-view.has-profile-sidebar .chat-history {
    --chat-stage-width: min(880px, calc(100vw - 48px));
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    gap: 1rem;
}

.model-selector-wrap {
    margin-left: auto;
    position: relative;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.home-view {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    z-index: -5;
    background:
        url("assets/aurora-bg.webp"),
        radial-gradient(ellipse at 24% calc(4% + (var(--scroll-depth) * 0.018px)), rgba(116, 229, 255, 0.16), transparent 34%),
        radial-gradient(ellipse at 78% calc(8% + (var(--scroll-depth) * -0.012px)), rgba(138, 120, 255, 0.18), transparent 38%),
        radial-gradient(ellipse at 18% calc(76% + (var(--scroll-depth) * 0.01px)), rgba(246, 200, 95, 0.055), transparent 32%),
        radial-gradient(ellipse at 82% calc(84% + (var(--scroll-depth) * 0.016px)), rgba(240, 147, 251, 0.08), transparent 34%),
        linear-gradient(180deg, #10162F 0%, #0A1024 44%, #060B18 100%);
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
    background-size: cover, auto, auto, auto, auto, auto;
    background-position:
        center calc(-70px + (var(--scroll-depth) * -0.018px)),
        center,
        center,
        center,
        center,
        center;
    filter: saturate(1.08) contrast(1.04) brightness(0.92);
}

body::after {
    z-index: -4;
    opacity: 0.72;
    background-image:
        radial-gradient(circle, rgba(245, 247, 255, 0.62) 0 1px, transparent 1.4px),
        radial-gradient(circle, rgba(116, 229, 255, 0.42) 0 1px, transparent 1.35px),
        radial-gradient(circle, rgba(240, 147, 251, 0.36) 0 1px, transparent 1.3px);
    background-size: 156px 156px, 224px 224px, 312px 312px;
    background-position:
        0 calc(var(--scroll-depth) * -0.035px),
        44px calc(80px + (var(--scroll-depth) * -0.055px)),
        108px calc(36px + (var(--scroll-depth) * -0.025px));
    animation: cosmicStarfieldDrift 48s linear infinite;
    will-change: background-position, opacity;
}

@keyframes cosmicStarfieldDrift {
    0% {
        opacity: 0.52;
        background-position:
            0 calc(var(--scroll-depth) * -0.035px),
            44px calc(80px + (var(--scroll-depth) * -0.055px)),
            108px calc(36px + (var(--scroll-depth) * -0.025px));
    }

    50% {
        opacity: 0.82;
        background-position:
            38px calc(24px + (var(--scroll-depth) * -0.035px)),
            8px calc(126px + (var(--scroll-depth) * -0.055px)),
            162px calc(10px + (var(--scroll-depth) * -0.025px));
    }

    100% {
        opacity: 0.54;
        background-position:
            156px calc(64px + (var(--scroll-depth) * -0.035px)),
            -180px calc(214px + (var(--scroll-depth) * -0.055px)),
            420px calc(-96px + (var(--scroll-depth) * -0.025px));
    }
}

.home-view {
    flex: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.input-model-selector {
    margin-left: 0;
    flex-shrink: 0;
}

.model-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 148px;
    justify-content: center;
    border: 1px solid rgba(138, 120, 255, 0.38);
    border-color: color-mix(in srgb, var(--model-color, #8A78FF) 52%, rgba(116, 229, 255, 0.14));
    background: linear-gradient(180deg, rgba(16, 22, 47, 0.78), rgba(10, 16, 36, 0.56));
    color: #fff;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.22s ease;
    backdrop-filter: blur(14px);
}

.model-icon {
    display: none;
}

.input-model-selector .model-selector {
    min-width: 166px;
    max-width: 190px;
    height: 36px;
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.model-selector:hover,
.model-selector[aria-expanded="true"] {
    background: color-mix(in srgb, var(--model-color, #8A78FF) 18%, rgba(16, 22, 47, 0.72));
    box-shadow: 0 10px 32px color-mix(in srgb, var(--model-color, #8A78FF) 22%, rgba(116, 229, 255, 0.08));
}

.model-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.6rem);
    width: 310px;
    padding: 0.7rem;
    border-radius: 14px;
    background:
        radial-gradient(circle at 20% 0%, rgba(164, 130, 255, 0.13), transparent 42%),
        rgba(18, 16, 23, 0.96);
    border: 1px solid rgba(184, 155, 255, 0.18);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.48), 0 0 40px rgba(102, 126, 234, 0.12);
    z-index: 220;
    backdrop-filter: blur(18px);
}

.input-model-selector .model-dropdown {
    top: auto;
    bottom: calc(100% + 0.65rem);
    z-index: 260;
}

.model-dropdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.model-provider-group {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 0.35rem 0.45rem;
    align-items: stretch;
    padding: 0.35rem;
    border-radius: 12px;
    background: color-mix(in srgb, var(--model-color, #a482ff) 8%, rgba(255, 255, 255, 0.035));
    border: 1px solid color-mix(in srgb, var(--model-color, #a482ff) 22%, rgba(255, 255, 255, 0.06));
}

.model-provider-heading {
    grid-row: 1 / span 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    min-height: 42px;
    padding: 0.55rem 0.45rem;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: lowercase;
    letter-spacing: 0;
}

.model-provider-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--model-color, #a482ff) 32%, rgba(255, 255, 255, 0.08));
    border: 1px solid color-mix(in srgb, var(--model-color, #a482ff) 42%, transparent);
    font-size: 0.64rem;
}

.model-option,
.model-config-link,
.model-empty {
    width: 100%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    border-radius: 8px;
    padding: 0.62rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    text-align: left;
}

.model-provider-group .model-option {
    min-height: 34px;
    background: rgba(0, 0, 0, 0.13);
}

.model-empty {
    justify-content: center;
    cursor: default;
    color: rgba(255, 255, 255, 0.42);
}

.model-option small {
    margin-left: auto;
    color: var(--accent-yellow);
    font-size: 0.7rem;
}

.model-option:hover,
.model-config-link:hover {
    background: color-mix(in srgb, var(--model-color, #a482ff) 18%, rgba(255, 255, 255, 0.05));
    color: #fff;
}

.model-config-link {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 0.35rem;
    justify-content: center;
    color: rgba(255, 255, 255, 0.65);
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.chat-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Premium Minimalist Scrollbar (Global) */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar:horizontal {
    display: none;
    height: 0;
}

html:hover::-webkit-scrollbar-thumb,
body:hover::-webkit-scrollbar-thumb,
.chat-history:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

.chat-history {
    --chat-stage-width: min(880px, calc(100vw - 48px));
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.4rem 3rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.05) transparent;
}

body.game-edit-workspace-active .chat-history {
    --chat-stage-width: min(1180px, calc(100vw - 144px));
    padding-left: 4.5rem;
    padding-right: 4.5rem;
}

.chat-message {
    width: var(--chat-stage-width);
    max-width: 100%;
    animation: slideUpFade 0.3s ease forwards;
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-left: auto;
    margin-right: auto;
}

.chat-history.is-generating {
    padding-top: 1rem;
    transition: padding 0.8s ease;
}

.chat-message.bot {
    align-self: center;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    max-width: 100%;
}

.chat-content-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.22rem;
    max-width: 100%;
}

.chat-history .bot-model-badge,
.chat-history .chat-content-stack .bot-model-badge {
    display: none !important;
}

.bot-avatar {
    display: none;
}

.bot-worked-time {
    color: rgba(255, 255, 255, 0.46);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
}

.chat-bubble {
    padding: 0.78rem 1.1rem;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.42;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow-wrap: break-word;
    word-break: normal;
    white-space: pre-wrap;
    max-width: 100%;
    width: fit-content;
}

.bot .chat-bubble {
    align-self: flex-start;
}

.highlight-text {
    display: inline-flex;
    align-items: center;
    min-height: 1.65em;
    padding: 0.08rem 0.42rem;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(116, 229, 255, 0.18), rgba(138, 120, 255, 0.12)),
        rgba(5, 8, 18, 0.42);
    border: 1px solid rgba(116, 229, 255, 0.38);
    color: #9befff;
    font-weight: 900;
    font-size: 1.05em;
    line-height: 1.2;
    text-shadow: 0 0 12px rgba(116, 229, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: 'Inter', sans-serif;
    margin: 0 0.28rem;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 18px rgba(116, 229, 255, 0.1);
}

/* Optional: Add scanline texture overlay */
.highlight-text::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 1px,
            rgba(255, 255, 255, 0.08) 1px,
            rgba(255, 255, 255, 0.08) 2px);
    pointer-events: none;
}

/* Removed conflicting old chat input styles */

.bot .chat-bubble {
    background:
        linear-gradient(90deg, rgba(116, 229, 255, 0.08), rgba(138, 120, 255, 0.035) 42%, transparent),
        rgba(255, 255, 255, 0.012);
    color: #fff;
    padding: 0.18rem 0 0.18rem 0.82rem;
    border-left: 2px solid rgba(116, 229, 255, 0.42);
    border-radius: 0;
    margin-top: 0.04rem;
    box-shadow: none;
    white-space: normal;
}



.chat-message.user {
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user .chat-bubble {
    max-width: min(70%, 620px);
    background:
        linear-gradient(135deg, rgba(116, 229, 255, 0.12), rgba(138, 120, 255, 0.2) 54%, rgba(240, 147, 251, 0.1)),
        rgba(26, 22, 37, 0.78);
    color: #fff;
    border-radius: 100px;
    padding: 0.8rem 1.5rem;
    border: 1px solid rgba(138, 120, 255, 0.2);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chat-message.user.has-attachments .chat-bubble {
    border-radius: 20px;
    min-width: min(320px, 100%);
}

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.7rem;
}

.message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 260px;
    padding: 0.35rem 0.45rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-attachment-thumb {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.78);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
}

.message-attachment-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.message-attachment-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
    font-size: 0.78rem;
    font-weight: 700;
}

.message-attachment-meta small {
    color: rgba(255, 255, 255, 0.42);
    font-size: 0.68rem;
}

.chat-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.4rem;
    padding-right: 0.5rem;
}

.chat-options-container {
    width: var(--chat-stage-width);
    max-width: 100%;
    padding: 0;
    margin-left: auto;
    margin-right: auto;
    margin-top: -0.35rem;
    margin-bottom: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    animation: slideUpFade 0.4s ease forwards;
}

.chat-options-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
}

.chat-options-footer {
    display: flex;
    justify-content: flex-start;
}

.model-switch-notice {
    align-self: center;
    width: min(720px, calc(100% - 3rem));
    margin: 0.4rem auto 0;
    padding: 0.8rem 1rem;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(102, 126, 234, 0.14), rgba(240, 147, 251, 0.08)),
        rgba(18, 16, 23, 0.86);
    border: 1px solid rgba(164, 130, 255, 0.28);
    box-shadow: 0 10px 36px rgba(102, 126, 234, 0.18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-size: 0.9rem;
    animation: slideUpFade 0.26s ease forwards;
    backdrop-filter: blur(14px);
}

.model-switch-notice span {
    color: var(--accent-yellow);
    font-weight: 800;
}

.model-switch-notice small {
    color: rgba(255, 255, 255, 0.62);
}

.model-switch-notice.is-hiding {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

/* Removed old chat mockup styles to prevent conflicts */
@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(18, 16, 23, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
}

.modal-content {
    background: rgba(31, 28, 39, 0.9);
    border: 1px solid rgba(184, 155, 255, 0.3);
    border-radius: 24px;
    padding: 3rem 2rem;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(135, 128, 255, 0.2);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
}

.modal-text {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
}



.modal-close-btn {
    background: var(--btn-gradient);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: var(--btn-hover-gradient);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(135, 128, 255, 0.4);
}

/* Homepage second page embed */
.roll-embed-section {
    position: relative;
    z-index: 10;
    --roll-embed-page-count: 3;
    width: 100%;
    height: calc(var(--roll-embed-page-count, 6) * 100vh);
    min-height: calc(var(--roll-embed-page-count, 6) * 100vh);
    background: transparent;
    overflow: hidden;
    box-shadow: none;
}

.roll-embed-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: transparent;
    overflow: hidden;
}

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 4rem;
    position: relative;
    z-index: 10;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.copyright {
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-block;
    padding: 0.75rem 1.25rem;
    margin: -0.75rem -1.25rem;
    border-radius: 8px;
}

.footer-links a:hover {
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.badge {
    animation: fadeIn 0.8s ease forwards;
}

.title {
    animation: fadeIn 0.8s ease 0.1s forwards;
    opacity: 0;
}

.subtitle {
    animation: fadeIn 0.8s ease 0.2s forwards;
    opacity: 0;
}

.inspire-section {
    animation: fadeIn 0.8s ease 0.3s forwards;
    opacity: 0;
}

.waitlist-form {
    animation: fadeIn 0.8s ease 0.4s forwards;
    opacity: 0;
}

.stats {
    animation: fadeIn 0.8s ease 0.5s forwards;
    opacity: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1.25rem 1rem;
        gap: 1rem;
        max-width: 100%;
        overflow: hidden;
    }

    .header-actions {
        min-width: 0;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .header-link {
        max-width: 100%;
    }

    .home-view .hero {
        min-height: calc(100vh - 84px);
    }

    .roll-embed-section {
        min-height: calc(var(--roll-embed-page-count, 6) * 100dvh);
    }

    .footer {
        flex-direction: column;
        gap: 1.5rem;
        padding: 2rem;
        text-align: center;
    }

    .waitlist-form {
        flex-direction: column;
        background: transparent;
        border: none;
        padding: 0;
    }

    .email-input {
        background: rgba(26, 24, 34, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.05);
        padding: 1.25rem 1.5rem;
        border-radius: 12px;
        margin-bottom: 0.5rem;
        width: 100%;
    }

    .submit-btn {
        width: 100%;
        padding: 1.25rem;
        border-radius: 12px;
    }
}

/* History Sidebar */
.history-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 320px;
    background:
        radial-gradient(circle at 0% 12%, rgba(116, 229, 255, 0.08), transparent 34%),
        rgba(10, 16, 36, 0.94);
    backdrop-filter: blur(18px);
    border-right: 1px solid rgba(116, 229, 255, 0.12);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.history-sidebar.open {
    transform: translateX(0);
}

.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -48px;
    transform: translateY(-50%);
    width: 48px;
    height: 64px;
    background: rgba(18, 16, 23, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    border-radius: 0 16px 16px 0;
    backdrop-filter: blur(12px);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    transition: all 0.3s ease;
    z-index: 49;
}

.history-sidebar.open .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar-toggle:hover {
    background: rgba(31, 28, 39, 0.95);
    color: var(--accent-yellow);
}

.sidebar-header {
    padding: 2rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.05em;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
    line-height: 0;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

@media (max-width: 768px) {
    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.history-item {
    min-height: 74px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
        rgba(5, 8, 18, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 10px;
    padding: 0.78rem 2.1rem 0.78rem 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    /* Add for absolute positioning of close button */
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(164, 130, 255, 0.4);
    transform: translateY(-2px);
}

.history-delete-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0;
    /* Hide by default, show on hover */
}

.history-item:hover .history-delete-btn {
    opacity: 1;
}

.history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    /* Subtle red bg */
    color: #ef4444;
    /* Red icon on hover */
}

.history-item-date {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 0.36rem;
}

.history-item-text {
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.36;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .history-sidebar {
        width: 100vw;
    }
}



/* ===== Pill-style Chat Input Bar ===== */
.chat-input-wrapper {
    padding: 0.9rem 2rem 1.35rem;
    background:
        linear-gradient(180deg, rgba(11, 14, 18, 0.58), rgba(9, 10, 14, 0.92)),
        rgba(13, 11, 20, 0.88);
    backdrop-filter: blur(18px);
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

body.game-edit-workspace-active .chat-input-wrapper {
    padding-left: 4.5rem;
    padding-right: 4.5rem;
}

.chat-input-bar.unified-pill {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 880px;
    margin: 0 auto;
    width: 100%;
    background:
        radial-gradient(circle at 18% 0%, rgba(116, 229, 255, 0.12), transparent 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
        rgba(5, 8, 18, 0.82);
    border-radius: 14px;
    padding: 0.65rem 0.75rem;
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.42), 0 0 42px rgba(116, 229, 255, 0.08);
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(116, 229, 255, 0.18);
    backdrop-filter: blur(12px);
}

body.game-edit-workspace-active .chat-input-bar.unified-pill {
    max-width: 1180px;
}

.chat-input-bar.unified-pill:focus-within {
    box-shadow: 0 18px 52px rgba(14, 165, 233, 0.16), 0 0 0 1px rgba(72, 187, 255, 0.28);
    border-color: rgba(72, 187, 255, 0.38);
}

.chat-composer-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.chat-file-input {
    display: none;
}

.chat-upload-limit-note {
    max-width: 880px;
    width: 100%;
    margin: 0.45rem auto 0;
    color: #ff4d5e;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
}

.chat-upload-limit-note.is-error {
    color: #ff2438;
}

.chat-attachment-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
    padding: 0.2rem 0.1rem 0.35rem;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    max-width: min(280px, 100%);
    min-height: 42px;
    padding: 0.35rem 0.45rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: rgba(255, 255, 255, 0.86);
}

.attachment-thumb {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.68rem;
    font-weight: 800;
}

.attachment-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.attachment-name {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 700;
}

.attachment-size {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.42);
}

.attachment-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.66);
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.attachment-remove:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #fff;
}

.chat-real-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1rem;
    padding: 0.75rem 0.5rem;
    outline: none;
    font-weight: 400;
    min-width: 0;
    resize: none;
    line-height: 1.5;
    max-height: 250px;
    font-family: inherit;
    overflow-y: hidden;
    align-self: center;
}

.chat-real-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chat-char-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    padding: 0 0.75rem;
    font-variant-numeric: tabular-nums;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 0.5rem;
    height: 36px;
    display: flex;
    align-items: center;
    align-self: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.icon-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    align-self: center;
}

.icon-btn:not(.mic-btn):hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.right-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    align-self: center;
}

.mic-btn,
.mic-btn:hover,
.mic-btn.is-listening,
.mic-btn.is-transcribing {
    background: rgba(66, 133, 244, 0.22);
    color: #8ab4f8;
    box-shadow: 0 0 0 1px rgba(138, 180, 248, 0.32), 0 0 18px rgba(66, 133, 244, 0.24);
}

.mic-btn.is-transcribing {
    cursor: progress;
    opacity: 0.78;
}

.thinking-text {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
    /* 强制在一?*/
}

.thinking-text:hover {
    color: #fff;
}

.chat-send-btn.black-circle {
    background: linear-gradient(135deg, #74E5FF 0%, #667EEA 48%, #F093FB 100%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    align-self: center;
    box-shadow: 0 10px 22px rgba(116, 229, 255, 0.18), 0 0 20px rgba(240, 147, 251, 0.12);
}

.chat-send-btn.black-circle:hover {
    background: linear-gradient(135deg, #93EEFF 0%, #818CF8 48%, #F472B6 100%);
    transform: scale(1.05);
    box-shadow: 0 12px 26px rgba(116, 229, 255, 0.22), 0 0 24px rgba(240, 147, 251, 0.16);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px !important;
    min-width: 60px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #a482ff;
    border-radius: 50%;
    opacity: 0.4;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

.bot .chat-bubble.ai-work-bubble {
    padding: 0 !important;
    border-left: 0;
    background: transparent;
}

.ai-work-card {
    position: relative;
    width: min(520px, 100%);
    overflow: hidden;
    border-radius: 14px;
    padding: 1rem 1rem 1.1rem;
    background:
        radial-gradient(circle at 12% 0%, rgba(116, 229, 255, 0.13), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
        rgba(5, 8, 18, 0.78);
    border: 1px solid rgba(116, 229, 255, 0.18);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34), 0 0 34px rgba(116, 229, 255, 0.07);
}

.ai-work-head {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.ai-work-orb {
    width: 0.82rem;
    height: 0.82rem;
    border-radius: 50%;
    background: var(--accent-yellow);
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.58);
    animation: aiOrbPulse 1.6s ease-in-out infinite;
}

.ai-work-head strong {
    display: block;
    color: #fff;
    font-size: 0.92rem;
}

.ai-work-head small {
    display: block;
    margin-top: 0.18rem;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.78rem;
}

.ai-work-steps {
    display: grid;
    gap: 0.42rem;
    margin-top: 0.85rem;
}

.ai-work-step {
    display: flex;
    align-items: center;
    gap: 0.48rem;
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.78rem;
    animation: aiStepGlow 3.6s ease-in-out infinite;
    animation-delay: calc(var(--step-index) * 0.8s);
}

.ai-work-step span {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: rgba(116, 229, 255, 0.34);
}

.ai-work-shimmer {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0.72rem;
    height: 2px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.ai-work-shimmer::before {
    content: "";
    position: absolute;
    inset: 0;
    width: 38%;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, rgba(116, 229, 255, 0.92), rgba(240, 147, 251, 0.7), transparent);
    animation: aiShimmer 1.8s ease-in-out infinite;
}

@keyframes aiOrbPulse {
    50% { transform: scale(1.28); opacity: 0.76; }
}

@keyframes aiStepGlow {
    0%, 72%, 100% { color: rgba(255, 255, 255, 0.52); }
    24%, 48% { color: #fff; }
}

@keyframes aiShimmer {
    from { transform: translateX(-120%); }
    to { transform: translateX(280%); }
}

/* In-chat Progress Overrides */
.chat-history .progress-container {
    margin: 1.5rem auto;
    padding: 1.2rem;
    background: transparent;
    border-radius: 12px;
    border: none;
    width: 90%;
    max-width: 500px;
    align-self: center;
}

.chat-history .generation-steps {
    margin: 0.5rem 0 1.5rem 0;
    padding-left: 2rem;
}


@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Email Modal Styles --- */
.email-modal-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-top: 1.5rem;
    width: 100%;
}

.modal-email-input {
    width: 100%;
    background: rgba(16, 15, 23, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 16px;
    color: #fff;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

.modal-email-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px rgba(164, 130, 255, 0.2);
    background: rgba(16, 15, 23, 0.8);
}

.modal-submit-btn {
    width: 100%;
    margin: 0;
}

.settings-panel {
    width: min(920px, calc(100vw - 2rem));
    max-width: 920px;
    text-align: left;
    padding: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 0%, rgba(164, 130, 255, 0.18), transparent 34%),
        radial-gradient(circle at 100% 10%, rgba(240, 147, 251, 0.1), transparent 32%),
        rgba(22, 19, 30, 0.94);
    border-color: rgba(184, 155, 255, 0.24);
}

.admin-auth-panel {
    width: min(520px, calc(100vw - 2rem));
    background:
        radial-gradient(circle at 18% 0%, rgba(164, 130, 255, 0.18), transparent 40%),
        rgba(22, 19, 30, 0.95);
    border-color: rgba(184, 155, 255, 0.24);
}

.admin-auth-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1.2rem;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.settings-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: -0.4rem;
}

.settings-close-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-close-btn:hover {
    background: var(--btn-gradient);
}

.settings-status {
    margin: 0 1.5rem 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
    color: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(138, 120, 255, 0.24);
    font-size: 0.88rem;
    line-height: 1.45;
}

.settings-status[data-tone="success"] {
    border-color: rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}

.settings-status[data-tone="warning"] {
    border-color: rgba(250, 204, 21, 0.35);
    color: #fde68a;
}

.settings-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    padding: 0 1.5rem 1.5rem;
}

.provider-list,
.provider-editor {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.provider-card {
    border: 1px solid rgba(138, 120, 255, 0.24);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
    color: #fff;
    border-radius: 14px;
    padding: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.22s ease;
}

.provider-card:hover,
.provider-card.active {
    border-color: var(--model-color);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    background: color-mix(in srgb, var(--model-color) 14%, rgba(255, 255, 255, 0.04));
}

.provider-card.configured {
    box-shadow: inset 3px 0 0 var(--model-color);
}

.provider-icon {
    font-size: 1.2rem;
}

.provider-card span:last-child {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.provider-card small {
    color: rgba(255, 255, 255, 0.48);
    font-size: 0.75rem;
}

.field-row,
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.inspire-profile-panel {
    padding: 1rem 1.25rem 0;
}

.inspire-profile-card {
    background:
        linear-gradient(180deg, rgba(116, 229, 255, 0.09), rgba(138, 120, 255, 0.05)),
        rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(116, 229, 255, 0.16);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.26);
}

.chat-profile-sidebar .inspire-profile-card {
    padding: 0.85rem;
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(116, 229, 255, 0.08), rgba(138, 120, 255, 0.045)),
        rgba(7, 12, 26, 0.82);
    backdrop-filter: blur(16px);
}

.inspire-profile-card-compact {
    padding: 0.8rem;
}

.profile-compact-current,
.profile-context-status {
    display: grid;
    gap: 0.22rem;
    padding: 0.68rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.075);
}

.profile-compact-current small,
.profile-context-status small {
    color: var(--accent-yellow);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.profile-compact-current strong,
.profile-context-status strong {
    color: #fff;
    font-size: 0.84rem;
    line-height: 1.25;
}

.profile-compact-current span {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.72rem;
    line-height: 1.35;
}

.profile-compact-details,
.profile-edit-details {
    margin-top: 0.72rem;
}

.profile-compact-details summary,
.profile-edit-details summary {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.74rem;
    font-weight: 800;
}

.profile-context-row {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.55rem;
}

.profile-context-row span {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 800;
}

.profile-context-row strong {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.76rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inspire-profile-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.04em;
    margin-bottom: 0.7rem;
}

.inspire-profile-row {
    margin-top: 0.65rem;
}

.chat-profile-sidebar .inspire-profile-row {
    margin-top: 0.55rem;
}

.inspire-profile-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.inspire-profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.inspire-profile-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    border-radius: 999px;
    padding: 0.32rem 0.55rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.74rem;
    line-height: 1;
}

.profile-mood-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 1.15rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.09);
    color: currentColor;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
}

.profile-sidebar-empty {
    color: rgba(255, 255, 255, 0.48);
    font-size: 0.76rem;
    line-height: 1.4;
}

.profile-sidebar-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.34rem;
}

.profile-sidebar-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 0.32rem 0.52rem;
    background: rgba(255, 255, 255, 0.055);
    color: rgba(255, 255, 255, 0.7);
    font: inherit;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.profile-sidebar-chip:hover {
    color: #fff;
    border-color: rgba(116, 229, 255, 0.32);
    background: rgba(116, 229, 255, 0.1);
    transform: translateY(-1px);
}

.profile-sidebar-chip.selected {
    color: #180f08;
    background: #d68070;
    border-color: rgba(255, 196, 157, 0.48);
}

.profile-sidebar-chip.selected .profile-mood-icon,
.inspire-profile-chip.selected .profile-mood-icon {
    background: rgba(24, 15, 8, 0.12);
}

.inspire-profile-current {
    margin-top: 0.8rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(250, 204, 21, 0.08);
    border: 1px solid rgba(250, 204, 21, 0.16);
}

.inspire-profile-current strong {
    display: block;
    color: #fff;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}

.inspire-profile-current span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.74rem;
    line-height: 1.45;
}

.gamespec-sidebar-card {
    border-color: rgba(116, 229, 255, 0.2);
    background:
        linear-gradient(180deg, rgba(116, 229, 255, 0.08), rgba(138, 120, 255, 0.045)),
        rgba(255, 255, 255, 0.03);
    box-shadow:
        0 18px 44px rgba(10, 16, 36, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.gamespec-sidebar-subtitle {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.76rem;
    line-height: 1.45;
    margin-bottom: 0.2rem;
}

.gamespec-sidebar-desc {
    margin-top: 0.35rem;
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.73rem;
    line-height: 1.42;
}

.inspire-profile-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.inspire-profile-actions button {
    flex: 1;
    border: 0;
    border-radius: 9px;
    padding: 0.55rem 0.65rem;
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
}

.inspire-profile-actions button.primary {
    color: #081018;
    background: var(--accent-yellow);
}

.inspire-mode-grid,
.inspire-profile-grid,
.inspire-recommendation-list {
    display: grid;
    gap: 0.55rem;
    white-space: normal;
}

.inspire-mode-question {
    margin-bottom: 0.65rem;
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
}

.inspire-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 560px;
}

.inspire-mode-btn,
.inspire-profile-chip,
.inspire-profile-control,
.inspire-recommendation-card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.inspire-mode-btn {
    min-height: 74px;
    padding: 0.7rem 0.78rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.inspire-mode-btn strong,
.inspire-recommendation-card strong {
    display: block;
    font-size: 0.88rem;
    margin-bottom: 0.22rem;
    line-height: 1.2;
    white-space: normal;
}

.inspire-mode-btn span,
.inspire-recommendation-card span,
.inspire-recommendation-card small {
    display: block;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.76rem;
    line-height: 1.34;
    white-space: normal;
}

.inspire-mode-btn:hover,
.inspire-profile-chip:hover,
.inspire-profile-control:hover,
.inspire-recommendation-card:hover {
    transform: translateY(-1px);
    border-color: rgba(116, 229, 255, 0.4);
    background: rgba(116, 229, 255, 0.09);
}

.inspire-profile-grid {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    margin-top: 0.75rem;
}

.inspire-profile-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.34rem;
    padding: 0.65rem 0.8rem;
    font-size: 0.86rem;
    text-align: center;
}

.inspire-profile-chip.selected {
    color: #081018;
    background: var(--accent-yellow);
    border-color: rgba(250, 204, 21, 0.82);
}

.inspire-profile-chip.limit-disabled,
.profile-sidebar-chip.limit-disabled {
    opacity: 0.38;
    cursor: not-allowed;
    filter: saturate(0.65);
}

.profile-selection-count {
    margin-top: 0.55rem;
    color: rgba(255, 255, 255, 0.48);
    font-size: 0.74rem;
    font-weight: 800;
    text-align: right;
}

.limit-shake {
    animation: limitShake 0.24s ease;
}

@keyframes limitShake {
    0%, 100% { transform: translateX(0); }
    33% { transform: translateX(-3px); }
    66% { transform: translateX(3px); }
}

.inspire-profile-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.inspire-profile-control {
    padding: 0.6rem 0.85rem;
    font-weight: 700;
}

.inspire-profile-control.primary {
    color: #081018;
    background: var(--accent-yellow);
    border-color: rgba(250, 204, 21, 0.85);
}

.inspire-profile-kicker {
    color: var(--accent-yellow);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.inspire-recommendation-card {
    padding: 1rem;
    text-align: left;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
        rgba(5, 8, 18, 0.62);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.inspire-recommendation-card.rec-stable {
    border-color: rgba(116, 229, 255, 0.28);
}

.inspire-recommendation-card.rec-surprise {
    border-color: rgba(240, 147, 251, 0.32);
}

.inspire-recommendation-card.rec-contrast {
    border-color: rgba(250, 204, 21, 0.34);
}

.inspire-recommendation-card .rec-type {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 0.45rem;
    padding: 0.24rem 0.48rem;
    border-radius: 999px;
    background: rgba(250, 204, 21, 0.12);
    color: var(--accent-yellow);
    font-size: 0.72rem;
    font-weight: 800;
}

.inspire-recommendation-card small {
    margin-top: 0.45rem;
}

.rec-why {
    margin-top: 0.72rem;
    padding-top: 0.68rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.rec-dna {
    margin-top: 0.58rem;
    color: rgba(116, 229, 255, 0.78);
    font-size: 0.72rem;
    line-height: 1.35;
}

.inspire-recommendation-card em {
    display: inline-flex;
    margin-top: 0.75rem;
    padding: 0.42rem 0.62rem;
    border-radius: 8px;
    background: var(--accent-yellow);
    color: #081018;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 900;
}

@media (max-width: 640px) {
    .inspire-mode-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .inspire-profile-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .chat-profile-sidebar {
        display: none !important;
    }

    .inspire-view.has-profile-sidebar .chat-history {
        --chat-stage-width: min(1360px, calc(100vw - 2rem));
    }
}

.toggle-row {
    justify-content: flex-start;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.85rem;
    font-weight: 700;
}

.settings-field input,
.settings-field select {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(12, 10, 18, 0.72);
    color: #fff;
    padding: 0.85rem 0.9rem;
    font: inherit;
    outline: none;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.settings-field input:focus,
.settings-field select:focus {
    border-color: rgba(164, 130, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(164, 130, 255, 0.14);
}

.settings-grid,
.usage-panel,
.settings-actions {
    display: grid;
    gap: 0.75rem;
}

.settings-grid {
    grid-template-columns: 1fr 160px;
}

.usage-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.usage-panel > div {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.9rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
}

.usage-model-list {
    display: grid;
    gap: 0.45rem;
}

.usage-model-row,
.usage-empty {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.55rem;
    min-height: 38px;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.065);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
}

.usage-empty {
    display: flex;
    justify-content: center;
    color: rgba(255, 255, 255, 0.42);
}

.usage-model-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--model-color, #a482ff) 18%, rgba(255, 255, 255, 0.05));
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
}

.usage-model-name,
.usage-model-tokens,
.usage-model-cost {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.usage-model-name {
    color: #fff;
    font-weight: 700;
}

.usage-model-cost {
    color: var(--accent-yellow);
    font-weight: 800;
}

.usage-label {
    display: block;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}

.settings-actions {
    grid-template-columns: 1.3fr 1fr 0.8fr;
}

.secondary-action {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

@media (max-width: 768px) {
    .header-actions {
        gap: 0.55rem;
    }

    .frontend-sign-in-btn {
        max-width: 118px;
        padding: 0.55rem 0.75rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.74rem;
    }

    .chat-header {
        gap: 0.7rem;
        padding: 0.85rem 1rem;
    }

    .chat-header > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.95rem;
    }

    .model-selector {
        min-width: 0;
        max-width: 148px;
        padding: 0.5rem 0.7rem;
        font-size: 0.78rem;
    }

    .input-model-selector .model-selector {
        width: 118px;
        min-width: 118px;
        max-width: 118px;
        padding: 0.45rem 0.55rem;
    }

    .model-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .model-dropdown {
        right: -0.25rem;
        width: min(320px, calc(100vw - 1.5rem));
    }

    .input-model-selector .model-dropdown {
        right: -3.1rem;
    }

    .model-provider-group {
        grid-template-columns: 1fr;
    }

    .model-provider-heading {
        grid-row: auto;
        flex-direction: row;
        justify-content: flex-start;
    }

    .chat-input-wrapper {
        padding: 0.85rem 0.75rem 1rem;
    }

    .chat-input-bar.unified-pill {
        padding: 0.45rem 0.55rem;
        border-radius: 20px;
    }

    .chat-composer-row,
    .right-actions {
        gap: 0.35rem;
    }

    .icon-btn,
    .chat-send-btn.black-circle {
        width: 34px;
        height: 34px;
    }

    .chat-char-count {
        padding: 0 0.45rem;
        margin-right: 0.15rem;
        font-size: 0.68rem;
    }

    .chat-real-input {
        font-size: 0.92rem;
        padding: 0.65rem 0.25rem;
    }

    .model-switch-notice {
        width: calc(100% - 1.5rem);
        margin-top: 0.25rem;
        padding: 0.7rem 0.8rem;
        justify-content: flex-start;
        gap: 0.35rem 0.6rem;
        font-size: 0.78rem;
    }

    .model-switch-notice small {
        width: 100%;
    }

    .chat-message {
        width: 100%;
        max-width: 100%;
    }

    .settings-layout,
    .settings-grid,
    .usage-panel,
    .settings-actions {
        grid-template-columns: 1fr;
    }

    .settings-panel {
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }

    .settings-header,
    .settings-layout {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .settings-status {
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .admin-auth-actions {
        grid-template-columns: 1fr;
    }

    .provider-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .provider-card {
        padding: 0.75rem;
    }
}

/* Shared action button language. Excludes choice chips, More options, and setting cards. */
.submit-btn,
.inspire-entry-btn,
.modal-close-btn,
.back-btn,
.chat-action-btn {
    background: var(--btn-gradient);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.8rem 1.6rem;
    min-height: 44px;
    min-width: 150px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--btn-shadow);
    transition: transform 0.24s cubic-bezier(0.23, 1, 0.32, 1),
        box-shadow 0.24s ease,
        filter 0.24s ease,
        background 0.24s ease;
}

.submit-btn::before,
.inspire-entry-btn::before,
.modal-close-btn::before,
.back-btn::before,
.chat-action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.35), transparent 62%);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.24s ease, transform 0.24s ease;
    pointer-events: none;
}

.submit-btn:hover,
.inspire-entry-btn:hover,
.modal-close-btn:hover,
.back-btn:hover,
.chat-action-btn:hover {
    background: var(--btn-hover-gradient);
    filter: brightness(1.08);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--btn-glow);
    color: #fff;
    text-shadow: none;
}

.submit-btn:hover::before,
.inspire-entry-btn:hover::before,
.modal-close-btn:hover::before,
.back-btn:hover::before,
.chat-action-btn:hover::before {
    opacity: 1;
    transform: scale(1.1);
}

.submit-btn:active,
.inspire-entry-btn:active,
.modal-close-btn:active,
.back-btn:active,
.chat-action-btn:active,
.chat-action-btn.selected {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.45), 0 12px 36px rgba(102, 126, 234, 0.36);
}

.chat-action-btn {
    width: fit-content;
    animation: tagSlideIn 0.3s ease forwards;
    opacity: 0;
}

.chat-action-edit {
    background: linear-gradient(135deg, #38bdf8 0%, #6366f1 54%, #a855f7 100%);
    box-shadow: 0 12px 32px rgba(56, 189, 248, 0.24), 0 0 24px rgba(99, 102, 241, 0.24);
}

.chat-action-edit:hover {
    background: linear-gradient(135deg, #67e8f9 0%, #818cf8 52%, #c084fc 100%);
    box-shadow: 0 16px 40px rgba(56, 189, 248, 0.34), 0 0 30px rgba(168, 85, 247, 0.28);
}

.chat-action-edit.selected {
    box-shadow: 0 0 0 2px rgba(103, 232, 249, 0.48), 0 14px 34px rgba(99, 102, 241, 0.34);
}

.chat-action-exit {
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(248, 113, 113, 0.5);
    color: #fecaca;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28), 0 0 20px rgba(248, 113, 113, 0.12);
}

.chat-action-exit::before {
    background: radial-gradient(circle at 50% 40%, rgba(248, 113, 113, 0.32), transparent 62%);
}

.chat-action-exit:hover {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.22), rgba(236, 72, 153, 0.24));
    border-color: rgba(252, 165, 165, 0.78);
    box-shadow: 0 14px 36px rgba(248, 113, 113, 0.2), 0 0 28px rgba(236, 72, 153, 0.16);
    color: #fff;
}

.chat-action-exit.selected {
    box-shadow: 0 0 0 2px rgba(252, 165, 165, 0.42), 0 14px 34px rgba(248, 113, 113, 0.22);
}

.chat-action-btn:nth-child(1) {
    animation-delay: 0s;
}

.chat-action-btn:nth-child(2) {
    animation-delay: 0.07s;
}

.chat-action-btn:nth-child(3) {
    animation-delay: 0.14s;
}

.modal-submit-btn,
.modal-close-btn {
    width: 100%;
}

.email-modal-form + .modal-close-btn {
    margin-top: 1rem;
}

.new-idea-btn {
    background: var(--btn-gradient);
    border: none;
    box-shadow: var(--btn-shadow);
}

.chat-close-btn,
.icon-btn,
.sidebar-toggle,
.sidebar-close-btn {
    border-color: rgba(255, 255, 255, 0.14);
}

.chat-close-btn:hover,
.icon-btn:not(.mic-btn):hover,
.sidebar-toggle:hover,
.sidebar-close-btn:hover {
    background: var(--btn-gradient);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.28);
}
/* Selection Summary Card */
.selection-summary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    margin: 0.5rem 0;
    width: 100%;
    white-space: normal;
}

.summary-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--accent-yellow);
}

.summary-item {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.85);
}

.summary-item strong {
    color: #fff;
    margin-right: 4px;
}

.ai-plan-summary {
    background:
        linear-gradient(180deg, rgba(164, 130, 255, 0.08), rgba(255, 255, 255, 0.025));
    border-color: rgba(164, 130, 255, 0.16);
}

.summary-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.6rem;
    line-height: 1.25;
}

/* ===== Premium aurora visual refinement layer ===== */
:root {
    --ui-bg-0: #050716;
    --ui-bg-1: #080B1F;
    --ui-bg-2: #0B1028;
    --ui-text: #F6F8FF;
    --ui-text-soft: rgba(220, 225, 255, 0.68);
    --ui-text-muted: rgba(170, 180, 220, 0.48);
    --ui-cyan: #5EE7FF;
    --ui-blueviolet: #7C6DFF;
    --ui-violet: #8B5CF6;
    --ui-gold: #F6C85F;
    --ui-border: rgba(120, 140, 255, 0.22);
    --ui-glass: rgba(8, 12, 32, 0.62);
    --btn-gradient: linear-gradient(135deg, #5EE7FF 0%, #7C6DFF 48%, #C77DFF 100%);
    --btn-hover-gradient: linear-gradient(135deg, #8EF2FF 0%, #8B7CFF 48%, #E7A2FF 100%);
    --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 12px 36px rgba(94, 231, 255, 0.13), 0 8px 28px rgba(124, 109, 255, 0.15);
    --btn-glow: inset 0 1px 0 rgba(255, 255, 255, 0.26), 0 0 26px rgba(94, 231, 255, 0.2), 0 0 34px rgba(139, 92, 246, 0.16);
}

body {
    color: var(--ui-text);
    background:
        radial-gradient(circle at 19% 8%, rgba(94, 231, 255, 0.12), transparent 28%),
        radial-gradient(circle at 76% 7%, rgba(139, 92, 246, 0.16), transparent 34%),
        linear-gradient(180deg, var(--ui-bg-2) 0%, var(--ui-bg-1) 42%, var(--ui-bg-0) 100%);
    font-family: 'Inter', 'Sora', 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
    filter: saturate(1.08) contrast(1.05) brightness(0.88);
}

body::after {
    opacity: 0.58;
    mix-blend-mode: screen;
}

.header {
    padding-inline: clamp(2rem, 4vw, 4rem);
}

.logo {
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-shadow: 0 0 18px rgba(124, 109, 255, 0.28);
}

.header-actions {
    gap: 1.1rem;
}

.frontend-sign-in-btn {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
        rgba(8, 12, 32, 0.58);
    border: 1px solid rgba(120, 140, 255, 0.28);
    color: rgba(236, 240, 255, 0.82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 26px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
}

.frontend-sign-in-btn:hover,
.frontend-sign-in-btn.is-signed-in {
    background:
        linear-gradient(180deg, rgba(94, 231, 255, 0.13), rgba(124, 109, 255, 0.08)),
        rgba(8, 12, 32, 0.66);
    border-color: rgba(94, 231, 255, 0.46);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 24px rgba(94, 231, 255, 0.14), 0 10px 28px rgba(0, 0, 0, 0.24);
}

.header-link {
    color: rgba(230, 235, 255, 0.72);
    transition: color 0.22s ease, text-shadow 0.22s ease;
}

.header-link:hover {
    color: #fff;
    text-shadow: 0 0 16px rgba(124, 109, 255, 0.36);
}

.badge {
    background:
        linear-gradient(180deg, rgba(246, 200, 95, 0.08), rgba(246, 200, 95, 0.025)),
        rgba(8, 12, 32, 0.68);
    color: var(--ui-gold);
    border: 1px solid rgba(246, 200, 95, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 240, 180, 0.13), 0 0 24px rgba(246, 200, 95, 0.08);
    backdrop-filter: blur(14px);
}

.title {
    color: #fff;
    font-weight: 900;
    letter-spacing: -0.018em;
    text-shadow: 0 6px 30px rgba(0, 0, 0, 0.34), 0 0 30px rgba(124, 109, 255, 0.18);
}

.gradient-text {
    background: linear-gradient(135deg, #5EE7FF 0%, #67B7FF 22%, #7C6DFF 48%, #C77DFF 76%, #F093FB 100%);
    -webkit-background-clip: text;
    background-clip: text;
    filter:
        saturate(1.2)
        drop-shadow(0 0 14px rgba(94, 231, 255, 0.3))
        drop-shadow(0 0 20px rgba(124, 109, 255, 0.24));
}

.subtitle {
    color: var(--ui-text-soft);
    font-size: clamp(1.05rem, 1.7vw, 1.38rem);
    font-weight: 400;
    text-shadow: 0 3px 18px rgba(0, 0, 0, 0.32);
}

.inspire-text {
    color: rgba(246, 248, 255, 0.9);
}

.inspire-entry-btn {
    min-height: 38px;
    min-width: 138px;
    padding: 0.66rem 1.18rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.95), rgba(124, 109, 255, 0.92) 48%, rgba(199, 125, 255, 0.92));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 28px rgba(124, 109, 255, 0.22);
}

.inspire-entry-btn:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 24px rgba(94, 231, 255, 0.22), 0 12px 30px rgba(124, 109, 255, 0.2);
}

.waitlist-form {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
        rgba(8, 12, 32, 0.62);
    border: 1px solid rgba(120, 140, 255, 0.28);
    border-radius: 18px;
    backdrop-filter: blur(16px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 54px rgba(0, 0, 0, 0.28);
}

.waitlist-form:focus-within {
    border-color: rgba(94, 231, 255, 0.64);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 1px rgba(94, 231, 255, 0.12), 0 0 36px rgba(94, 231, 255, 0.17), 0 18px 54px rgba(0, 0, 0, 0.32);
    transform: translateY(-1px);
}

.email-input {
    color: #fff;
    font-weight: 500;
}

.email-input::placeholder {
    color: rgba(230, 235, 255, 0.46);
}

.submit-btn {
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: linear-gradient(135deg, #5EE7FF 0%, #7C6DFF 52%, #C77DFF 100%);
    color: #fff;
    font-weight: 800;
    box-shadow: var(--btn-shadow);
}

.submit-btn::before {
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.36) 42%, transparent 70%);
    transform: translateX(-120%);
}

.submit-btn:hover::before {
    transform: translateX(120%);
}

.stats {
    color: rgba(220, 225, 255, 0.56);
}

.joined-count {
    color: rgba(220, 225, 255, 0.62);
}

.joined-count strong {
    color: rgba(246, 248, 255, 0.88);
}

.limited-slots {
    color: rgba(170, 180, 220, 0.46);
    letter-spacing: 0.22em;
}

/* ===== Unified title language ===== */
:root {
    --title-display-gradient: linear-gradient(180deg, #FFFFFF 0%, #F6F8FF 44%, #EAF1FF 67%, #BFEFFF 86%, #C5B9FF 100%);
    --title-glow: drop-shadow(0 0 10px rgba(94, 231, 255, 0.13)) drop-shadow(0 0 16px rgba(124, 109, 255, 0.1));
    --title-scanline-opacity: 0.11;
    --title-scanline: repeating-linear-gradient(
        180deg,
        rgba(255, 255, 255, var(--title-scanline-opacity)) 0 1px,
        rgba(255, 255, 255, 0) 1px 4px
    );
    --title-font-stack: 'Space Grotesk', 'Sora', 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.title {
    font-family: var(--title-font-stack);
    font-weight: 900;
    line-height: 0.94;
    letter-spacing: -0.04em;
    background:
        var(--title-scanline),
        var(--title-display-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: var(--title-glow);
    text-shadow: none;
    -webkit-text-stroke: 0;
}

.gradient-text {
    background:
        var(--title-scanline),
        linear-gradient(180deg, #5EE7FF 0%, #5EE7FF 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #5EE7FF;
    filter: drop-shadow(0 0 10px rgba(94, 231, 255, 0.16));
}

.title-ai-accent {
    background:
        var(--title-scanline),
        linear-gradient(135deg, #67B7FF 0%, #7C6DFF 48%, #B56DFF 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #7C6DFF;
    filter: drop-shadow(0 0 12px rgba(124, 109, 255, 0.24));
}


/* ===== Generated GameSpec Preview ===== */
.generation-result {
    display: grid;
    gap: 0.72rem;
    width: min(560px, 100%);
}

.chat-message.has-game-workspace {
    width: var(--chat-stage-width);
    min-width: 0;
}

.chat-message.has-game-workspace .chat-bubble {
    width: 100%;
}

.chat-message.has-game-workspace .generation-result {
    width: 100%;
}

.generation-status {
    width: fit-content;
    padding: 0.24rem 0.55rem;
    border-radius: 7px;
    background: rgba(16, 163, 127, 0.14);
    border: 1px solid rgba(16, 163, 127, 0.32);
    color: #88f3d2;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.generation-title {
    color: #fff;
    font-size: 1.08rem;
    font-weight: 800;
}

.generation-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.generation-meta span {
    padding: 0.28rem 0.55rem;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.78rem;
}

.generation-preview {
    display: grid;
    grid-template-columns: minmax(180px, 0.85fr) 1fr;
    gap: 0.85rem;
    align-items: stretch;
}

.playable-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.82rem;
    align-items: start;
}

.generated-game-page {
    display: block;
    min-height: 0;
}

.change-history-sidebar,
.game-edit-sidebar,
.game-preview-column {
    min-width: 0;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.022)),
        rgba(5, 8, 24, 0.72);
    border: 1px solid rgba(120, 140, 255, 0.22);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 18px 54px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px);
}

.change-history-sidebar,
.game-edit-sidebar {
    position: fixed;
    top: 4.4rem;
    bottom: 7.2rem;
    z-index: 260;
    padding: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
    transition: transform 0.36s cubic-bezier(0.175, 0.885, 0.32, 1.05), box-shadow 0.24s ease;
}

.change-history-sidebar {
    left: 0;
    width: var(--workspace-left-width);
    border-left: 0;
    border-radius: 0 16px 16px 0;
    background:
        radial-gradient(circle at 0% 12%, rgba(116, 229, 255, 0.08), transparent 34%),
        rgba(10, 16, 36, 0.94);
    border-color: rgba(116, 229, 255, 0.14);
    transform: translateX(-100%);
}

.game-edit-sidebar {
    right: 0;
    width: var(--workspace-right-width);
    border-right: 0;
    border-radius: 16px 0 0 16px;
    transform: translateX(100%);
}

.change-history-sidebar.open,
.game-edit-sidebar.open {
    transform: translateX(0);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 22px 70px rgba(0, 0, 0, 0.46);
}

.workspace-panel-toggle {
    position: absolute;
    top: 50%;
    width: 48px;
    height: 64px;
    transform: translateY(-50%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(18, 16, 23, 0.95);
    color: var(--text-primary);
    backdrop-filter: blur(12px);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    transition: all 0.25s ease;
}

.workspace-panel-toggle:hover {
    background: rgba(31, 28, 39, 0.95);
    color: var(--accent-yellow);
}

.workspace-panel-toggle-left {
    right: -48px;
    border-left: none;
    border-radius: 0 16px 16px 0;
}

.workspace-panel-toggle-right {
    left: -48px;
    border-right: none;
    border-radius: 16px 0 0 16px;
}

.change-history-sidebar.open .workspace-panel-toggle-left,
.game-edit-sidebar.open .workspace-panel-toggle-right {
    color: rgba(155, 239, 255, 0.92);
}

.game-preview-column {
    width: 100%;
    min-width: 0;
    margin: 0 auto;
    padding: 0.82rem;
    display: block;
}

.workspace-panel-head {
    display: grid;
    gap: 0.18rem;
}

.workspace-panel-head span {
    color: #f6f8ff;
    font-size: 0.86rem;
    font-weight: 900;
}

.workspace-panel-head small {
    color: rgba(220, 225, 255, 0.55);
    font-size: 0.72rem;
    line-height: 1.35;
}

.change-history-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    overflow: auto;
    padding-right: 0.15rem;
}

.change-history-empty {
    min-height: 160px;
    display: grid;
    place-items: center;
    padding: 0.85rem;
    border-radius: 12px;
    border: 1px dashed rgba(120, 140, 255, 0.22);
    color: rgba(220, 225, 255, 0.52);
    font-size: 0.78rem;
    line-height: 1.45;
    text-align: center;
}

.change-history-record {
    width: 100%;
    display: grid;
    gap: 0.38rem;
    padding: 0.65rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.065);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
        rgba(5, 8, 18, 0.38);
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.change-history-record:hover {
    border-color: rgba(164, 130, 255, 0.4);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.change-record-top {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
}

.change-record-top strong {
    color: #fff;
    font-size: 0.76rem;
    font-weight: 900;
}

.change-record-top em {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 0.34rem;
    margin-right: 0.28rem;
    border-radius: 999px;
    background: rgba(94, 231, 255, 0.1);
    border: 1px solid rgba(94, 231, 255, 0.18);
    color: #9befff;
    font-style: normal;
    font-size: 0.58rem;
    font-weight: 950;
}

.change-record-top small,
.change-record-meta {
    color: rgba(220, 225, 255, 0.48);
    font-size: 0.66rem;
}

.change-record-prompt {
    color: rgba(246, 248, 255, 0.78);
    font-size: 0.72rem;
    line-height: 1.35;
}

.game-edit-category {
    border-radius: 13px;
    border: 1px solid rgba(120, 140, 255, 0.14);
    background: rgba(8, 12, 32, 0.48);
    overflow: hidden;
}

.game-edit-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 0.16rem;
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.024)),
        rgba(5, 8, 24, 0.72);
    border: 1px solid rgba(120, 140, 255, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 28px rgba(0, 0, 0, 0.18);
}

.game-edit-tab {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(220, 225, 255, 0.68);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 900;
    cursor: pointer;
}

.game-edit-tab.active {
    background:
        linear-gradient(135deg, rgba(94, 231, 255, 0.24), rgba(124, 109, 255, 0.26) 52%, rgba(199, 125, 255, 0.18)),
        rgba(255, 255, 255, 0.055);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 10px 24px rgba(94, 231, 255, 0.1);
}

.game-edit-module {
    display: none;
    flex-direction: column;
    gap: 0.72rem;
    min-height: 0;
}

.game-edit-module.active {
    display: flex;
}

.game-edit-category-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.68rem;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.game-edit-category-head strong {
    display: block;
    color: #f6f8ff;
    font-size: 0.78rem;
    font-weight: 900;
}

.game-edit-category-head small {
    display: block;
    margin-top: 0.14rem;
    color: rgba(220, 225, 255, 0.5);
    font-size: 0.66rem;
    line-height: 1.25;
}

.game-edit-category-count {
    min-width: 1.55rem;
    height: 1.55rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9befff;
    background: rgba(94, 231, 255, 0.1);
    border: 1px solid rgba(94, 231, 255, 0.2);
    font-size: 0.68rem;
    font-weight: 900;
}

.game-edit-item-grid {
    display: none;
    grid-template-columns: 1fr;
    gap: 0.48rem;
    padding: 0 0.55rem 0.62rem;
}

.game-edit-category.active .game-edit-item-grid {
    display: grid;
}

.game-edit-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.56rem;
    padding: 0.45rem;
    border-radius: 11px;
    border: 1px solid rgba(120, 140, 255, 0.13);
    background: rgba(255, 255, 255, 0.035);
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.game-edit-asset-count {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(94, 231, 255, 0.12);
    border: 1px solid rgba(94, 231, 255, 0.26);
    color: #9befff;
    font-size: 0.88rem;
    font-weight: 900;
}

.media-thumb-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0 0.15rem 0.42rem;
}

.media-thumb-card {
    min-width: 0;
    position: relative;
    display: grid;
    gap: 0.26rem;
    border-radius: 9px;
    padding: 0.32rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
        rgba(8, 12, 32, 0.76);
    border: 1px solid rgba(120, 140, 255, 0.16);
    overflow: hidden;
}

.media-thumb-art {
    display: block;
    aspect-ratio: 1 / 1;
    border-radius: 7px;
    background:
        radial-gradient(circle at 48% 26%, rgba(246, 200, 95, 0.34), transparent 12%),
        linear-gradient(90deg, transparent 42%, rgba(40, 24, 18, 0.95) 43% 57%, transparent 58%),
        radial-gradient(ellipse at 50% 86%, rgba(90, 52, 36, 0.9), transparent 36%),
        radial-gradient(circle at 30% 20%, rgba(94, 231, 255, 0.26), transparent 34%),
        linear-gradient(145deg, rgba(58, 48, 88, 0.85), rgba(13, 18, 42, 0.95));
}

.media-thumb-card strong {
    color: #fff;
    font-size: 0.58rem;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-thumb-card > span:last-child {
    position: absolute;
    right: 0.24rem;
    bottom: 0.18rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.code-workspace-panel {
    min-height: 510px;
    display: grid;
    grid-template-columns: minmax(178px, 0.42fr) minmax(0, 1fr);
    border-radius: 13px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
        rgba(5, 8, 24, 0.9);
    border: 1px solid rgba(120, 140, 255, 0.18);
}

.code-workspace-panel.compact {
    min-height: 300px;
    max-height: 430px;
    grid-template-columns: minmax(0, 1fr);
}

.code-workspace-panel.compact .code-file-tree {
    max-height: 250px;
    border-right: 0;
    border-bottom: 1px solid rgba(120, 140, 255, 0.12);
}

.code-compact-summary {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(86px, 1fr) auto;
    gap: 0.55rem;
    padding: 0.62rem;
}

.code-compact-summary .code-editor-titlebar {
    margin: -0.62rem -0.62rem 0;
    border-radius: 0;
}

.code-compact-preview {
    max-height: 150px;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.code-open-modal-btn {
    justify-self: stretch;
}

.code-file-tree {
    display: flex;
    flex-direction: column;
    gap: 0.36rem;
    min-width: 0;
    overflow: auto;
    padding: 0.72rem 0.52rem;
    background: rgba(8, 12, 32, 0.72);
    border-right: 1px solid rgba(120, 140, 255, 0.12);
}

.code-tree-root {
    min-width: 0;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.42rem;
    color: rgba(246, 248, 255, 0.82);
    font-size: 0.66rem;
    font-weight: 900;
    padding: 0.28rem 0.34rem 0.5rem;
    border-bottom: 1px solid rgba(120, 140, 255, 0.12);
}

.code-tree-root span:nth-child(2) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.code-tree-root small {
    color: rgba(151, 164, 198, 0.9);
    font-size: 0.58rem;
}

.code-tree-list,
.code-tree-children {
    min-width: 0;
    display: grid;
    gap: 0.12rem;
}

.code-tree-folder {
    min-width: 0;
}

.code-tree-folder summary {
    min-height: 30px;
    display: grid;
    grid-template-columns: 14px 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.32rem;
    padding: 0.24rem 0.34rem 0.24rem calc(0.18rem + (var(--depth, 0) * 0.7rem));
    border-radius: 8px;
    color: rgba(231, 236, 255, 0.78);
    cursor: pointer;
    font-size: 0.67rem;
    font-weight: 900;
    list-style: none;
}

.code-tree-folder summary::-webkit-details-marker {
    display: none;
}

.code-tree-folder summary:hover,
.code-tree-folder summary.active {
    background: rgba(94, 231, 255, 0.08);
    color: #fff;
}

.code-tree-folder summary.active {
    border: 1px solid rgba(94, 231, 255, 0.18);
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.1), rgba(124, 109, 255, 0.12));
}

.code-tree-folder summary small {
    color: rgba(151, 164, 198, 0.72);
    font-size: 0.55rem;
}

.code-tree-caret::before {
    content: ">";
    display: inline-block;
    transform: rotate(0deg);
    color: rgba(94, 231, 255, 0.95);
    font-size: 0.98rem;
    line-height: 1;
    transition: transform 0.16s ease;
}

.code-tree-folder[open] > summary .code-tree-caret::before {
    transform: rotate(90deg);
}

.code-tree-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.code-file-icon {
    width: 28px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    color: rgba(246, 248, 255, 0.92);
    background: rgba(94, 231, 255, 0.1);
    border: 1px solid rgba(94, 231, 255, 0.18);
    font-size: 0.46rem;
    font-weight: 950;
    letter-spacing: 0;
}

.code-file-icon.folder {
    color: #65e7ff;
    background: rgba(94, 231, 255, 0.08);
    border-color: rgba(94, 231, 255, 0.24);
}

.code-file-icon.html {
    color: #ffd19b;
    background: rgba(255, 141, 84, 0.16);
    border-color: rgba(255, 177, 105, 0.26);
}

.code-file-icon.js {
    color: #fff0a3;
    background: rgba(246, 200, 95, 0.16);
    border-color: rgba(246, 200, 95, 0.28);
}

.code-file-icon.css {
    color: #9eeeff;
    background: rgba(62, 190, 255, 0.14);
    border-color: rgba(62, 190, 255, 0.28);
}

.code-file-icon.json,
.code-file-icon.manifest,
.code-file-icon.spec,
.code-file-icon.report {
    color: #d9c7ff;
    background: rgba(167, 125, 255, 0.15);
    border-color: rgba(167, 125, 255, 0.3);
}

.code-file-icon.image {
    color: #b6ffd7;
    background: rgba(105, 234, 173, 0.14);
    border-color: rgba(105, 234, 173, 0.28);
}

.code-file-icon.audio {
    color: #ffc7ea;
    background: rgba(255, 125, 208, 0.14);
    border-color: rgba(255, 125, 208, 0.28);
}

.code-file-icon.asset,
.code-file-icon.file,
.code-file-icon.doc {
    color: rgba(235, 240, 255, 0.86);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.14);
}

.code-file {
    min-height: 30px;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: rgba(246, 248, 255, 0.72);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 800;
    text-align: left;
    padding: 0.28rem 0.34rem;
    cursor: pointer;
}

.code-tree-file {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.34rem;
    padding-left: calc(1.02rem + (var(--depth, 0) * 0.7rem));
}

.code-tree-file small {
    color: rgba(151, 164, 198, 0.72);
    font-size: 0.52rem;
    font-weight: 900;
}

.code-file:hover,
.code-file.active,
.code-file.selected {
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.12), rgba(124, 109, 255, 0.14));
    border-color: rgba(94, 231, 255, 0.18);
    color: #fff;
}

.code-editor-pane {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.code-editor-titlebar {
    min-width: 0;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.54rem;
    padding: 0.58rem 0.72rem;
    color: rgba(246, 248, 255, 0.92);
    background: rgba(17, 22, 46, 0.84);
    border-bottom: 1px solid rgba(120, 140, 255, 0.16);
}

.code-editor-titlebar strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 950;
}

.code-editor-titlebar small {
    color: rgba(151, 164, 198, 0.82);
    font-size: 0.56rem;
    font-weight: 900;
    white-space: nowrap;
}

.code-preview {
    margin: 0;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 0.72rem;
    color: rgba(230, 235, 255, 0.86);
    font-size: 0.62rem;
    line-height: 1.55;
    font-family: "Cascadia Code", Consolas, monospace;
    white-space: pre;
}

.workspace-code-modal {
    position: fixed;
    inset: 0;
    z-index: 520;
    display: none;
    padding: min(5vh, 42px) min(4vw, 56px);
}

.workspace-code-modal.open {
    display: grid;
    place-items: center;
}

.workspace-code-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(14px);
}

.workspace-code-modal-shell {
    position: relative;
    z-index: 1;
    width: min(1280px, calc(100vw - 48px));
    height: min(860px, calc(100vh - 56px));
    min-height: 520px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98));
    box-shadow: 0 32px 120px rgba(0, 0, 0, 0.56);
}

.workspace-code-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.82rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.86);
}

.workspace-code-modal-head div {
    min-width: 0;
    display: grid;
    gap: 0.08rem;
}

.workspace-code-modal-head span {
    color: rgba(94, 231, 255, 0.84);
    font-size: 0.66rem;
    font-weight: 950;
    text-transform: uppercase;
}

.workspace-code-modal-head strong {
    color: #f8fafc;
    font-size: 0.96rem;
    font-weight: 950;
}

.workspace-code-modal-close {
    min-height: 34px;
    padding: 0 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.055);
    color: rgba(248, 250, 252, 0.86);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 900;
    cursor: pointer;
}

.game-edit-tab small {
    min-width: 1.28rem;
    height: 1.28rem;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.075);
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.58rem;
    font-weight: 950;
}

.game-edit-tab.active small {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.workspace-code-modal-close:hover {
    border-color: rgba(94, 231, 255, 0.36);
    color: #fff;
}

.workspace-code-modal .code-workspace-panel {
    min-height: 0;
    height: 100%;
    border: 0;
    border-radius: 0;
    grid-template-columns: minmax(260px, 0.32fr) minmax(0, 1fr);
}

body.workspace-code-modal-open {
    overflow: hidden;
}

.game-edit-item:hover,
.game-edit-item.selected {
    border-color: rgba(124, 109, 255, 0.72);
    box-shadow: 0 0 0 1px rgba(94, 231, 255, 0.16), 0 12px 26px rgba(124, 109, 255, 0.12);
}

.game-edit-item-preview {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 28% 24%, rgba(94, 231, 255, 0.55), transparent 35%),
        linear-gradient(135deg, rgba(94, 231, 255, 0.24), rgba(124, 109, 255, 0.26) 52%, rgba(199, 125, 255, 0.2)),
        rgba(8, 12, 32, 0.88);
    border: 1px solid rgba(94, 231, 255, 0.22);
    overflow: hidden;
}

.game-edit-item-preview.audio {
    background:
        repeating-linear-gradient(90deg, rgba(94, 231, 255, 0.26) 0 3px, transparent 3px 8px),
        linear-gradient(135deg, rgba(124, 109, 255, 0.24), rgba(199, 125, 255, 0.18)),
        rgba(8, 12, 32, 0.88);
}

.game-edit-item-preview.number {
    background:
        linear-gradient(90deg, rgba(246, 200, 95, 0.72) 0 58%, rgba(255, 255, 255, 0.08) 58%),
        rgba(8, 12, 32, 0.88);
}

.game-edit-item-preview span {
    color: #fff;
    font-size: 0.68rem;
    font-weight: 900;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.game-edit-item-copy {
    min-width: 0;
    display: grid;
    gap: 0.12rem;
}

.game-edit-item-copy strong {
    color: rgba(246, 248, 255, 0.88);
    font-size: 0.74rem;
    font-weight: 900;
}

.game-edit-item-copy small {
    color: rgba(220, 225, 255, 0.46);
    font-size: 0.66rem;
}

.droi-game-tools-panel {
    display: grid;
    gap: 0.62rem;
    padding: 0.68rem;
    border-radius: 8px;
    border: 1px solid rgba(94, 231, 255, 0.2);
    background:
        linear-gradient(135deg, rgba(94, 231, 255, 0.08), rgba(124, 109, 255, 0.08)),
        rgba(8, 12, 32, 0.64);
}

.production-assets-sidebar .droi-game-tools-panel {
    margin-bottom: 0.72rem;
}

.droi-game-tools-head {
    display: grid;
    gap: 0.16rem;
}

.droi-game-tools-head span {
    color: #f6f8ff;
    font-size: 0.78rem;
    font-weight: 900;
}

.droi-game-tools-head small {
    color: rgba(220, 225, 255, 0.52);
    font-size: 0.66rem;
    line-height: 1.32;
}

.droi-game-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.44rem;
}

.droi-game-tools-subhead {
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.66rem;
    font-weight: 950;
    letter-spacing: 0;
    text-transform: uppercase;
}

.droi-game-tool-card {
    min-width: 0;
    min-height: 74px;
    display: grid;
    align-content: start;
    gap: 0.22rem;
    padding: 0.52rem;
    border: 1px solid rgba(120, 140, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.droi-game-tool-card:hover,
.droi-game-tool-card:focus-visible {
    border-color: rgba(94, 231, 255, 0.58);
    background: rgba(94, 231, 255, 0.08);
    outline: none;
}

.droi-game-tool-card.recommended {
    border-color: rgba(94, 231, 255, 0.34);
    background:
        linear-gradient(135deg, rgba(94, 231, 255, 0.12), rgba(124, 109, 255, 0.1)),
        rgba(255, 255, 255, 0.045);
}

.droi-game-tools-more {
    display: grid;
    gap: 0.48rem;
}

.droi-game-tools-more summary {
    cursor: pointer;
    color: rgba(203, 213, 225, 0.72);
    font-size: 0.66rem;
    font-weight: 900;
}

.droi-game-tools-help {
    margin: 0;
    color: rgba(203, 213, 225, 0.58);
    font-size: 0.62rem;
    line-height: 1.45;
}

.droi-game-tools-help code {
    color: #9befff;
}

.droi-game-tool-card strong {
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1.22;
}

.droi-game-tool-card small {
    color: rgba(220, 225, 255, 0.52);
    font-size: 0.62rem;
    line-height: 1.3;
}

.droi-tool-overlay {
    position: fixed;
    inset: 0;
    z-index: 980;
    display: grid;
    place-items: center;
    padding: 1.2rem;
    background: rgba(2, 4, 14, 0.72);
    backdrop-filter: blur(12px);
}

.droi-tool-shell {
    width: min(1280px, 100%);
    height: min(820px, calc(100vh - 2.4rem));
    min-height: 520px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(94, 231, 255, 0.22);
    background: #060b18;
    box-shadow: 0 28px 100px rgba(0, 0, 0, 0.5);
}

.droi-tool-shell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.72rem 0.82rem;
    background:
        linear-gradient(90deg, rgba(94, 231, 255, 0.1), rgba(124, 109, 255, 0.08)),
        rgba(8, 12, 32, 0.92);
    border-bottom: 1px solid rgba(94, 231, 255, 0.16);
}

.droi-tool-shell-head span {
    min-width: 0;
    display: grid;
    gap: 0.14rem;
}

.droi-tool-shell-head strong {
    color: #fff;
    font-size: 0.86rem;
    font-weight: 900;
}

.droi-tool-shell-head small {
    color: rgba(220, 225, 255, 0.58);
    font-size: 0.7rem;
}

.droi-tool-close {
    min-height: 34px;
    padding: 0 0.78rem;
    border-radius: 8px;
    border: 1px solid rgba(94, 231, 255, 0.24);
    background: rgba(94, 231, 255, 0.08);
    color: #f6f8ff;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 900;
    cursor: pointer;
}

.droi-tool-close:hover,
.droi-tool-close:focus-visible {
    border-color: rgba(94, 231, 255, 0.58);
    background: rgba(94, 231, 255, 0.14);
    outline: none;
}

.droi-tool-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #060b18;
}

.droi-tool-exports-panel {
    display: grid;
    gap: 0.56rem;
    padding: 0.68rem;
    border-radius: 8px;
    border: 1px solid rgba(120, 140, 255, 0.18);
    background: rgba(255, 255, 255, 0.032);
}

.droi-tool-exports-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.62rem;
}

.droi-tool-exports-head span {
    color: #f6f8ff;
    font-size: 0.76rem;
    font-weight: 900;
}

.droi-tool-exports-head small {
    color: rgba(220, 225, 255, 0.52);
    font-size: 0.66rem;
}

.droi-tool-export-list {
    display: grid;
    gap: 0.45rem;
    max-height: 280px;
    overflow: auto;
    padding-right: 0.16rem;
}

.droi-tool-export-empty {
    color: rgba(220, 225, 255, 0.5);
    font-size: 0.66rem;
    line-height: 1.35;
}

.droi-tool-export-item {
    display: grid;
    gap: 0.36rem;
    padding: 0.54rem;
    border-radius: 8px;
    border: 1px solid rgba(94, 231, 255, 0.12);
    background: rgba(6, 10, 28, 0.58);
}

.droi-tool-export-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
}

.droi-tool-export-title strong {
    min-width: 0;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
}

.droi-tool-export-title small {
    color: rgba(155, 239, 255, 0.72);
    font-size: 0.62rem;
    white-space: nowrap;
}

.droi-tool-export-item p {
    margin: 0;
    color: rgba(220, 225, 255, 0.56);
    font-size: 0.64rem;
    line-height: 1.32;
}

.droi-tool-export-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.32rem;
}

.droi-tool-export-file {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.24rem 0.42rem;
    border-radius: 7px;
    border: 1px solid rgba(94, 231, 255, 0.18);
    background: rgba(94, 231, 255, 0.07);
    color: rgba(246, 248, 255, 0.86);
    font-size: 0.62rem;
    font-weight: 800;
    text-decoration: none;
}

.droi-tool-export-file:hover,
.droi-tool-export-file:focus-visible {
    border-color: rgba(94, 231, 255, 0.54);
    background: rgba(94, 231, 255, 0.13);
    color: #fff;
    outline: none;
}

.droi-tool-integration-summary {
    display: grid;
    gap: 0.42rem;
    padding-top: 0.52rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.droi-tool-integration-summary span {
    color: rgba(220, 225, 255, 0.56);
    font-size: 0.64rem;
    line-height: 1.32;
}

.droi-tool-integration-summary a {
    width: fit-content;
    max-width: 100%;
    padding: 0.3rem 0.48rem;
    border-radius: 7px;
    border: 1px solid rgba(155, 239, 255, 0.22);
    background: rgba(155, 239, 255, 0.08);
    color: rgba(246, 248, 255, 0.9);
    font-size: 0.63rem;
    font-weight: 900;
    text-decoration: none;
}

.droi-tool-integration-summary a[aria-disabled="true"] {
    opacity: 0.48;
    pointer-events: none;
}

.droi-tool-integration-summary a:hover,
.droi-tool-integration-summary a:focus-visible {
    border-color: rgba(155, 239, 255, 0.58);
    background: rgba(155, 239, 255, 0.14);
    color: #fff;
    outline: none;
}

.workspace-edit-chat {
    display: none;
}

/*
Legacy inner workspace chat styles are kept for older generated messages,
but the current workspace uses the fixed global chat input below the preview.
*/
.workspace-edit-chat {
    display: none;
    gap: 0.5rem;
    padding: 0.72rem;
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
        rgba(8, 12, 32, 0.74);
    border: 1px solid rgba(120, 140, 255, 0.24);
}

.workspace-edit-context {
    color: rgba(155, 239, 255, 0.86);
    font-size: 0.72rem;
    font-weight: 800;
}

.workspace-edit-input {
    width: 100%;
    min-height: 58px;
    resize: vertical;
    border: 1px solid rgba(120, 140, 255, 0.2);
    border-radius: 12px;
    background: rgba(5, 8, 24, 0.72);
    color: #f6f8ff;
    padding: 0.72rem;
    font: inherit;
    line-height: 1.4;
    outline: none;
}

.workspace-edit-input:focus {
    border-color: rgba(94, 231, 255, 0.52);
    box-shadow: 0 0 0 3px rgba(94, 231, 255, 0.08);
}

.workspace-edit-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: center;
}

.workspace-edit-actions span {
    color: rgba(220, 225, 255, 0.45);
    font-size: 0.7rem;
}

.workspace-edit-submit {
    min-height: 34px;
    padding: 0 0.92rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: var(--btn-gradient);
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: var(--btn-shadow);
}

.workspace-edit-submit:hover {
    background: var(--btn-hover-gradient);
    box-shadow: var(--btn-glow);
}

.generated-web-card,
.generated-files-card {
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.generated-workspace-topbar {
    width: 100%;
}

.workspace-aux-panel {
    position: fixed;
    left: 50%;
    bottom: 6.15rem;
    transform: translateX(-50%);
    z-index: 245;
    width: min(620px, calc(100vw - 9rem));
    display: grid;
    gap: 0.52rem;
    pointer-events: none;
}

.workspace-aux-toggle {
    justify-self: center;
    min-height: 34px;
    padding: 0 0.92rem;
    border-radius: 999px;
    border: 1px solid rgba(116, 229, 255, 0.22);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
        rgba(5, 8, 24, 0.82);
    color: rgba(246, 248, 255, 0.84);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 900;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
}

.workspace-aux-panel .workspace-aux-card {
    pointer-events: auto;
    display: none;
}

.workspace-aux-panel.open .workspace-aux-card {
    display: block;
}

.workspace-save-dock {
    position: fixed;
    top: 0.85rem;
    right: 1rem;
    z-index: 270;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.52rem;
    max-width: min(360px, calc(100vw - 2rem));
    padding: 0.42rem;
    border-radius: 999px;
    border: 1px solid rgba(162, 255, 203, 0.18);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.028)),
        rgba(5, 8, 24, 0.78);
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(16px);
}

.workspace-aux-panel .generated-web-card,
.workspace-aux-panel .generated-files-card {
    min-height: 0;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.022)),
        rgba(5, 8, 24, 0.78);
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.34);
}

.workspace-aux-panel .generated-files-title {
    margin-bottom: 0.36rem;
    font-size: 0.76rem;
}

.workspace-aux-panel .generated-file-row {
    padding: 0.42rem 0 0;
}

.workspace-aux-panel .generated-web-icon,
.workspace-aux-panel .generated-file-icon {
    width: 2rem;
    height: 2rem;
    flex-basis: 2rem;
}

.workspace-aux-panel .generated-web-main strong,
.workspace-aux-panel .generated-file-main strong {
    font-size: 0.82rem;
}

.workspace-aux-panel .generated-web-main small,
.workspace-aux-panel .generated-file-main small {
    font-size: 0.68rem;
}

.generated-web-card {
    min-height: 68px;
    padding: 0.7rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.generated-web-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.generated-web-icon {
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(116, 229, 255, 0.12);
    border: 1px solid rgba(116, 229, 255, 0.18);
}

.generated-web-main strong,
.generated-file-main strong,
.generated-files-title {
    display: block;
    color: #fff;
    font-weight: 800;
}

.generated-web-main small,
.generated-file-main small {
    display: block;
    margin-top: 0.18rem;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.78rem;
    line-height: 1.35;
}

.generated-web-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
}

.generated-save-status {
    max-width: 180px;
    color: rgba(162, 255, 203, 0.82);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: right;
}

.generated-save-status.warning {
    color: rgba(250, 204, 21, 0.9);
}

.generated-save-status.error {
    color: rgba(255, 126, 126, 0.92);
}

.generated-save-btn {
    min-width: 82px;
    border-color: rgba(162, 255, 203, 0.22);
    background: rgba(34, 197, 94, 0.12);
}

.generated-save-btn:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(162, 255, 203, 0.38);
}

.generated-save-btn:disabled {
    cursor: wait;
    opacity: 0.74;
}

.generated-save-btn[data-save-state="saved"] {
    color: #082014;
    background: linear-gradient(135deg, #a2ffcb, #5eead4);
    border-color: rgba(162, 255, 203, 0.62);
}

.generated-save-btn[data-save-state="failed"] {
    background: rgba(248, 113, 113, 0.16);
    border-color: rgba(248, 113, 113, 0.44);
}

/* ===== AI Game Editor Workbench ===== */
body.game-edit-workspace-active .chat-history {
    --chat-stage-width: min(1440px, calc(100vw - 64px));
    padding: 1.25rem 2rem 1.5rem;
}

body.game-edit-workspace-active {
    --workspace-left-width: 280px;
    --workspace-right-width: 360px;
    --workspace-gap: 16px;
    --workspace-outer-padding: 16px;
}

body.game-edit-workspace-active .chat-message.has-game-workspace {
    width: min(1440px, calc(100vw - 64px));
}

body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble {
    padding: 0.75rem;
    background: rgba(5, 8, 24, 0.72);
    border: 1px solid rgba(116, 229, 255, 0.16);
    border-radius: 22px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

body.game-edit-workspace-active .generation-result {
    width: 100%;
    gap: 0.55rem;
}

body.game-edit-workspace-active .scanline {
    opacity: 0.12;
}

body.game-edit-workspace-active .spotlight-overlay,
body.game-edit-workspace-active .spotlight-glow {
    opacity: 0.32;
}

.generated-game-page {
    --workspace-left-width: 280px;
    --workspace-right-width: 360px;
    --workspace-gap: 16px;
    --workspace-outer-padding: 16px;
    min-height: min(760px, calc(100vh - 190px));
    max-height: calc(100vh - 170px);
    display: grid;
    grid-template-rows: 58px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 18px;
    background:
        radial-gradient(circle at 18% 0%, rgba(94, 231, 255, 0.08), transparent 28%),
        radial-gradient(circle at 86% 8%, rgba(139, 92, 246, 0.1), transparent 30%),
        #070a12;
    color: #f8fafc;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.workspace-header {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1rem 0 1.1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(7, 10, 18, 0.86);
    backdrop-filter: blur(18px);
}

.workspace-title-block {
    min-width: 0;
    display: grid;
    gap: 0.08rem;
}

.workspace-kicker {
    color: rgba(94, 231, 255, 0.82);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.workspace-title-block strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f8fafc;
    font-size: 0.94rem;
    font-weight: 950;
}

.workspace-title-block small {
    color: #94a3b8;
    font-size: 0.66rem;
    font-weight: 800;
}

.workspace-status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.18rem;
}

.workspace-status-pill {
    min-height: 20px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.42rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.55rem;
    font-weight: 950;
}

.workspace-status-pill.success {
    border-color: rgba(34, 197, 94, 0.24);
    background: rgba(34, 197, 94, 0.09);
    color: #86efac;
}

.workspace-header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.46rem;
}

.workspace-header-btn,
.workspace-mini-btn {
    min-height: 34px;
    padding: 0 0.72rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.055);
    color: #f8fafc;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 900;
    cursor: pointer;
}

.workspace-header-btn:hover,
.workspace-mini-btn:hover {
    border-color: rgba(94, 231, 255, 0.36);
    background: rgba(94, 231, 255, 0.1);
}

.workspace-header-btn.is-muted {
    color: rgba(226, 232, 240, 0.66);
}

.workspace-save-state {
    min-width: 86px;
    max-width: 160px;
}

.workspace-body {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: var(--workspace-left-width) minmax(640px, 1fr) var(--workspace-right-width);
    gap: var(--workspace-gap);
    padding: var(--workspace-outer-padding);
    overflow: hidden;
}

.generated-game-page .change-history-sidebar,
.generated-game-page .game-edit-sidebar,
.generated-game-page .game-preview-column {
    position: relative;
    inset: auto;
    z-index: auto;
    width: auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    max-height: none;
    transform: none;
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
    padding: 0.85rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.78);
    box-shadow: none;
    backdrop-filter: blur(18px);
}

.generated-game-page .change-history-sidebar,
.generated-game-page .game-edit-sidebar {
    bottom: auto;
    top: auto;
}

.generated-game-page .change-history-sidebar {
    left: auto;
    border-left: 1px solid rgba(148, 163, 184, 0.16);
    border-color: rgba(116, 229, 255, 0.14);
    background:
        radial-gradient(circle at 0% 12%, rgba(116, 229, 255, 0.07), transparent 34%),
        rgba(8, 13, 30, 0.74);
}

.generated-game-page .game-edit-sidebar {
    right: auto;
    border-right: 1px solid rgba(148, 163, 184, 0.16);
    border-color: rgba(167, 139, 250, 0.18);
    background:
        radial-gradient(circle at 100% 0%, rgba(167, 139, 250, 0.08), transparent 34%),
        rgba(12, 16, 36, 0.78);
}

.generated-game-page .workspace-panel-toggle {
    display: none;
}

.workspace-panel-head {
    flex: 0 0 auto;
}

.change-history-list,
.production-assets-sidebar,
.game-edit-sidebar > .game-edit-module,
.game-edit-sidebar .production-code-group,
.game-edit-sidebar .code-workspace-panel {
    min-height: 0;
}

.change-history-list,
.production-assets-sidebar {
    overflow: auto;
}

.generated-game-page .game-preview-column {
    padding: 0;
    border-color: rgba(94, 231, 255, 0.28);
    background: rgba(3, 7, 18, 0.9);
    box-shadow: inset 0 0 0 1px rgba(94, 231, 255, 0.06);
}

.playable-shell {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-rows: minmax(300px, 48%) minmax(0, 1fr);
    gap: 0.85rem;
}

.game-preview-card {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.8rem;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.88), rgba(15, 23, 42, 0.92));
}

.game-preview-card-head {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.game-preview-card-head span {
    min-width: 0;
    display: grid;
    gap: 0.08rem;
}

.game-preview-card-head small {
    color: #94a3b8;
    font-size: 0.64rem;
    font-weight: 900;
}

.game-preview-card-head strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f8fafc;
    font-size: 0.88rem;
    font-weight: 950;
}

.game-preview-card-actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}

.game-preview-card-actions .game-preview-btn {
    min-width: 78px;
}

.game-preview-card .game-preview-viewport {
    min-height: 0;
    height: 100%;
    aspect-ratio: auto;
}

.game-preview-chat-panel {
    min-height: 0;
    overflow: auto;
    padding: 0.85rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(2, 6, 23, 0.52);
}

.workspace-prompt-card,
.workspace-breakdown-card,
.workspace-file-summary {
    display: grid;
    gap: 0.62rem;
    padding: 0.72rem;
    border-radius: 11px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(2, 6, 23, 0.42);
}

.workspace-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
}

.workspace-section-title span {
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 950;
}

.workspace-section-title small {
    color: #64748b;
    font-size: 0.6rem;
    font-weight: 900;
}

.workspace-prompt-card p,
.workspace-file-summary p {
    margin: 0;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.66rem;
    line-height: 1.42;
}

.workspace-prompt-card p {
    max-height: 132px;
    overflow: auto;
}

.workspace-prompt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
}

.workspace-selected-target,
.workspace-meta-collapse {
    flex: 0 0 auto;
    display: grid;
    gap: 0.58rem;
    padding: 0.72rem;
    border-radius: 11px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(2, 6, 23, 0.38);
}

.workspace-selected-target strong {
    color: #f8fafc;
    font-size: 0.82rem;
    font-weight: 950;
}

.workspace-selected-target p {
    margin: 0;
    color: rgba(226, 232, 240, 0.68);
    font-size: 0.72rem;
    line-height: 1.42;
}

.workspace-meta-collapse {
    max-height: min(36vh, 420px);
    overflow: auto;
}

.workspace-meta-collapse > summary {
    cursor: pointer;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.72rem;
    font-weight: 900;
    list-style-position: outside;
}

.workspace-meta-collapse[open] > summary {
    color: #f8fafc;
}

.workspace-meta-collapse-body {
    display: grid;
    gap: 0.62rem;
    padding-top: 0.62rem;
}

.workspace-breakdown-list {
    display: grid;
    gap: 0.42rem;
}

.workspace-breakdown-item {
    display: grid;
    gap: 0.14rem;
    padding: 0.48rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

.workspace-breakdown-item span {
    color: #94a3b8;
    font-size: 0.58rem;
    font-weight: 900;
}

.workspace-breakdown-item strong {
    color: rgba(248, 250, 252, 0.9);
    font-size: 0.64rem;
    line-height: 1.32;
}

.workspace-file-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.38rem;
}

.workspace-file-stats span {
    display: grid;
    gap: 0.08rem;
    padding: 0.45rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-size: 0.56rem;
    font-weight: 900;
    text-align: center;
}

.workspace-file-stats strong {
    color: #5ee7ff;
    font-size: 0.84rem;
}

.workspace-mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    padding: 0.16rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.54);
}

.workspace-mode-btn {
    min-height: 30px;
    border: 0;
    border-radius: 999px;
    padding: 0 0.72rem;
    background: transparent;
    color: rgba(226, 232, 240, 0.68);
    font: inherit;
    font-size: 0.66rem;
    font-weight: 950;
    cursor: pointer;
}

.workspace-mode-btn.active {
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.22), rgba(124, 109, 255, 0.24));
    color: #fff;
    box-shadow: 0 10px 24px rgba(94, 231, 255, 0.1);
}

.workspace-mode-guide {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.52rem;
}

.workspace-mode-guide-card {
    display: grid;
    gap: 0.18rem;
    padding: 0.68rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background:
        linear-gradient(135deg, rgba(94, 231, 255, 0.08), rgba(124, 109, 255, 0.045)),
        rgba(2, 6, 23, 0.42);
}

.workspace-mode-guide-card span {
    color: #9befff;
    font-size: 0.58rem;
    font-weight: 950;
    text-transform: uppercase;
}

.workspace-mode-guide-card strong {
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 950;
}

.workspace-mode-guide-card small {
    color: rgba(203, 213, 225, 0.68);
    font-size: 0.66rem;
    line-height: 1.38;
}

.generated-game-page.is-beginner-mode .workspace-mode-guide-card.advanced,
.generated-game-page.is-advanced-mode .workspace-mode-guide-card.beginner {
    display: none;
}

.generated-game-page.is-beginner-mode [data-edit-module-tab="media"],
.generated-game-page.is-beginner-mode [data-edit-module-tab="code"],
.generated-game-page.is-beginner-mode [data-edit-module-tab="tools"],
.generated-game-page.is-beginner-mode [data-edit-module="media"],
.generated-game-page.is-beginner-mode [data-edit-module="code"],
.generated-game-page.is-beginner-mode [data-edit-module="tools"],
.generated-game-page.is-beginner-mode .workspace-meta-collapse {
    display: none !important;
}

.generated-game-page.is-beginner-mode .workspace-inspector-panel {
    gap: 0.74rem;
}

.game-edit-item-wrap {
    display: grid;
    gap: 0.36rem;
}

.game-edit-item-wrap .numeric-edit-controls {
    display: none;
}

.game-edit-item-wrap:has(.game-edit-item.selected) .numeric-edit-controls,
.game-edit-item-wrap .game-edit-item.selected + .numeric-edit-controls {
    display: grid;
}

.numeric-edit-controls {
    gap: 0.44rem;
    padding: 0.52rem;
    border-radius: 10px;
    border: 1px solid rgba(94, 231, 255, 0.14);
    background:
        linear-gradient(180deg, rgba(94, 231, 255, 0.055), rgba(124, 109, 255, 0.035)),
        rgba(2, 6, 23, 0.42);
}

.numeric-edit-controls span {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.68rem;
    font-weight: 800;
}

.numeric-edit-controls strong {
    color: #5ee7ff;
}

.numeric-edit-controls input[type="range"] {
    width: 100%;
    accent-color: #5ee7ff;
}

.numeric-edit-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.32rem;
}

.numeric-edit-actions button {
    min-height: 28px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
    color: rgba(248, 250, 252, 0.82);
    font: inherit;
    font-size: 0.62rem;
    font-weight: 900;
    cursor: pointer;
}

.numeric-edit-actions button:hover {
    border-color: rgba(94, 231, 255, 0.36);
    background: rgba(94, 231, 255, 0.1);
    color: #fff;
}

.workspace-numeric-panel,
.workspace-media-panel {
    display: grid;
    gap: 0.7rem;
}

.workspace-numeric-head,
.workspace-media-head,
.workspace-media-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.68rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(2, 6, 23, 0.46);
}

.workspace-numeric-head div,
.workspace-media-head div,
.workspace-media-detail-head div {
    min-width: 0;
    display: grid;
    gap: 0.16rem;
}

.workspace-numeric-head strong,
.workspace-media-head strong,
.workspace-media-detail-head strong {
    color: #f8fafc;
    font-size: 0.82rem;
    font-weight: 950;
}

.workspace-numeric-head small,
.workspace-media-head small,
.workspace-media-detail-head small {
    color: rgba(203, 213, 225, 0.62);
    font-size: 0.68rem;
    line-height: 1.35;
}

.workspace-numeric-head > span,
.workspace-media-head > span {
    flex: 0 0 auto;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(94, 231, 255, 0.2);
    background: rgba(94, 231, 255, 0.08);
    color: #9befff;
    font-size: 0.62rem;
    font-weight: 950;
}

.workspace-numeric-grid {
    display: grid;
    gap: 0.58rem;
}

.workspace-numeric-card {
    display: grid;
    gap: 0.58rem;
    padding: 0.66rem;
    border-radius: 13px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.016)),
        rgba(8, 12, 32, 0.64);
}

.workspace-numeric-card.selected {
    border-color: rgba(94, 231, 255, 0.42);
    box-shadow: inset 0 0 0 1px rgba(94, 231, 255, 0.08), 0 14px 32px rgba(94, 231, 255, 0.08);
}

.workspace-numeric-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: start;
}

.workspace-numeric-card-head div {
    min-width: 0;
    display: grid;
    gap: 0.12rem;
}

.workspace-numeric-card-head strong {
    color: #f8fafc;
    font-size: 0.76rem;
    font-weight: 950;
}

.workspace-numeric-card-head small {
    color: rgba(203, 213, 225, 0.6);
    font-size: 0.64rem;
    line-height: 1.32;
}

.workspace-numeric-card-head output {
    min-width: 58px;
    text-align: right;
    color: #5ee7ff;
    font-size: 0.78rem;
    font-weight: 950;
}

.workspace-numeric-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 0.5rem;
    align-items: center;
}

.workspace-numeric-row input[type="range"] {
    width: 100%;
    accent-color: #5ee7ff;
}

.workspace-numeric-row input[type="number"] {
    width: 100%;
    min-height: 31px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(2, 6, 23, 0.58);
    color: #f8fafc;
    padding: 0 0.45rem;
    font: inherit;
    font-size: 0.68rem;
    font-weight: 850;
}

.workspace-numeric-presets,
.workspace-numeric-actions,
.workspace-media-asset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.34rem;
}

.workspace-numeric-presets button,
.workspace-numeric-actions button,
.workspace-media-asset-actions button,
.workspace-media-asset-detail button,
.workspace-media-asset-detail a {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.54rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(248, 250, 252, 0.82);
    font: inherit;
    font-size: 0.62rem;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.workspace-numeric-actions button.primary {
    border-color: rgba(94, 231, 255, 0.32);
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.18), rgba(124, 109, 255, 0.18));
    color: #fff;
}

.workspace-numeric-presets button:hover,
.workspace-numeric-actions button:hover,
.workspace-media-asset-actions button:hover,
.workspace-media-asset-detail button:hover,
.workspace-media-asset-detail a:hover {
    border-color: rgba(94, 231, 255, 0.36);
    color: #fff;
}

.workspace-media-root,
.workspace-media-group-list {
    display: grid;
    gap: 0.7rem;
}

.workspace-media-group {
    display: grid;
    gap: 0.52rem;
    padding: 0.66rem;
    border-radius: 13px;
    border: 1px solid rgba(148, 163, 184, 0.13);
    background: rgba(8, 12, 32, 0.58);
}

.workspace-media-group header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: start;
}

.workspace-media-group header div {
    min-width: 0;
    display: grid;
    gap: 0.12rem;
}

.workspace-media-group header strong {
    color: #f8fafc;
    font-size: 0.76rem;
    font-weight: 950;
}

.workspace-media-group header small {
    color: rgba(203, 213, 225, 0.56);
    font-size: 0.63rem;
    line-height: 1.32;
}

.workspace-media-group header > span,
.workspace-media-category-card > span {
    min-width: 28px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(94, 231, 255, 0.1);
    border: 1px solid rgba(94, 231, 255, 0.18);
    color: #9befff;
    font-size: 0.62rem;
    font-weight: 950;
}

.workspace-media-category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.44rem;
}

.workspace-media-category-card {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.12rem 0.45rem;
    align-items: center;
    padding: 0.56rem;
    border-radius: 11px;
    border: 1px solid rgba(148, 163, 184, 0.13);
    background: rgba(255, 255, 255, 0.035);
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.workspace-media-category-card:hover {
    border-color: rgba(94, 231, 255, 0.34);
    background: rgba(94, 231, 255, 0.075);
}

.workspace-media-category-card strong,
.workspace-media-category-card small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-media-category-card strong {
    color: rgba(248, 250, 252, 0.9);
    font-size: 0.68rem;
    font-weight: 950;
}

.workspace-media-category-card small {
    grid-column: 1 / 2;
    color: rgba(203, 213, 225, 0.52);
    font-size: 0.56rem;
}

.workspace-media-detail-head {
    align-items: center;
}

.workspace-media-asset-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.52rem;
}

.workspace-media-asset {
    min-width: 0;
    display: grid;
    gap: 0.45rem;
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(8, 12, 32, 0.6);
}

.workspace-media-asset.selected {
    border-color: rgba(94, 231, 255, 0.42);
    box-shadow: inset 0 0 0 1px rgba(94, 231, 255, 0.08);
}

.workspace-media-asset-main {
    min-width: 0;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 0.48rem;
    align-items: center;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    padding: 0;
    cursor: pointer;
}

.workspace-media-thumb {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid rgba(94, 231, 255, 0.18);
    background:
        radial-gradient(circle at 32% 22%, rgba(94, 231, 255, 0.24), transparent 35%),
        linear-gradient(135deg, rgba(124, 109, 255, 0.16), rgba(2, 6, 23, 0.86));
    overflow: hidden;
}

.workspace-media-thumb.audio {
    background:
        repeating-linear-gradient(90deg, rgba(94, 231, 255, 0.24) 0 3px, transparent 3px 8px),
        rgba(2, 6, 23, 0.86);
}

.workspace-media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.workspace-media-thumb b {
    color: #9befff;
    font-size: 0.54rem;
    font-weight: 950;
}

.workspace-media-asset-main strong,
.workspace-media-asset-main small {
    min-width: 0;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-media-asset-main strong {
    color: #f8fafc;
    font-size: 0.66rem;
    font-weight: 950;
}

.workspace-media-asset-main small {
    margin-top: 0.12rem;
    color: rgba(203, 213, 225, 0.52);
    font-size: 0.55rem;
}

.workspace-media-asset-detail,
.workspace-media-empty {
    display: grid;
    gap: 0.34rem;
    padding: 0.54rem;
    border-radius: 10px;
    border: 1px dashed rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.36);
    color: rgba(226, 232, 240, 0.66);
    font-size: 0.62rem;
    line-height: 1.34;
}

.workspace-media-empty {
    min-height: 130px;
    place-items: center;
    text-align: center;
}

.workspace-media-empty.compact {
    min-height: 76px;
}

.workspace-media-empty strong {
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 950;
}

.game-edit-sidebar > .droi-game-tools-panel,
.game-edit-sidebar > .droi-tool-exports-panel,
.game-edit-sidebar > .game-edit-tabs,
.game-edit-sidebar > .workspace-prompt-card,
.game-edit-sidebar > .workspace-breakdown-card,
.game-edit-sidebar > .workspace-file-summary {
    flex: 0 0 auto;
}

.game-edit-sidebar .production-assets-sidebar,
.game-edit-sidebar > .game-edit-module {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.game-edit-sidebar .production-assets-sidebar {
    display: grid;
    gap: 0.7rem;
}

.game-edit-sidebar .code-workspace-panel {
    min-height: 420px;
    grid-template-columns: minmax(150px, 0.44fr) minmax(0, 1fr);
}

body.game-edit-workspace-active .chat-input-wrapper {
    width: min(calc(100vw - var(--workspace-left-width, 280px) - var(--workspace-right-width, 380px) - 56px), 920px);
    margin-left: calc(var(--workspace-left-width, 280px) + 28px);
    padding: 0.62rem 0 0.85rem;
    background: transparent;
    border-top: 0;
    backdrop-filter: none;
}

body.game-edit-workspace-active .chat-input-bar.unified-pill {
    max-width: 100%;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.92));
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.34);
}

.game-preview-viewport {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: none;
    overflow: hidden;
    border-radius: 12px;
    background: #071018;
    border: 1px solid rgba(120, 185, 255, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 18px 36px rgba(0, 0, 0, 0.28);
}

.mobile-game-preview-toggle {
    display: none;
}

.game-preview-canvas {
    width: 100%;
    height: 100%;
    max-height: none;
    display: block;
    background: #071018;
    border: 0;
    border-radius: 0;
    object-fit: contain;
    outline: none;
}

.game-preview-canvas[data-orientation="portrait"] {
    max-height: none;
}

.game-preview-canvas:focus {
    border-color: rgba(136, 243, 210, 0.48);
    box-shadow: inset 0 0 0 1px rgba(136, 243, 210, 0.12), 0 0 0 2px rgba(136, 243, 210, 0.14), 0 18px 36px rgba(0, 0, 0, 0.28);
}

.game-preview-chat-panel {
    max-height: clamp(220px, 32vh, 360px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.68rem;
    padding: 1rem 1.05rem;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
        radial-gradient(circle at 88% 20%, rgba(138, 120, 255, 0.14), transparent 34%),
        rgba(5, 8, 24, 0.68);
    border: 1px solid rgba(120, 140, 255, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.preview-chat-title-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #fff;
    font-size: clamp(0.98rem, 1.4vw, 1.2rem);
    font-weight: 900;
    line-height: 1.2;
}

.preview-chat-lead,
.game-preview-chat-panel p,
.preview-chat-points {
    margin: 0;
    color: rgba(246, 248, 255, 0.88);
    font-size: 0.88rem;
    line-height: 1.55;
}

.preview-chat-points {
    padding-left: 1rem;
}

.game-preview-chat-panel strong {
    color: #fff;
    font-weight: 900;
}

.preview-chat-points li + li {
    margin-top: 0.36rem;
}

.preview-chat-user-bubble {
    align-self: flex-end;
    max-width: 78%;
    padding: 0.66rem 0.85rem;
    border-radius: 14px 14px 4px 14px;
    background:
        linear-gradient(135deg, rgba(116, 229, 255, 0.12), rgba(138, 120, 255, 0.2) 54%, rgba(240, 147, 251, 0.1)),
        rgba(26, 22, 37, 0.82);
    border: 1px solid rgba(138, 120, 255, 0.2);
    color: #fff;
    font-size: 0.84rem;
    line-height: 1.4;
}

.preview-chat-time {
    align-self: flex-end;
    margin-top: -0.42rem;
    color: rgba(220, 225, 255, 0.46);
    font-size: 0.68rem;
}

.preview-chat-assistant-note {
    border-left: 2px solid rgba(116, 229, 255, 0.38);
    padding-left: 0.7rem;
    color: rgba(246, 248, 255, 0.9) !important;
    text-wrap: pretty;
}

.preview-chat-edit-status {
    color: rgba(155, 239, 255, 0.86);
    font-size: 0.72rem;
    font-weight: 800;
}

.game-preview-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}

.game-orientation-tip {
    color: rgba(250, 204, 21, 0.82) !important;
}

.game-preview-btn {
    border: 1px solid rgba(120, 185, 255, 0.18);
    border-radius: 8px;
    min-height: 34px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
}

.game-preview-btn:hover {
    background: rgba(16, 163, 127, 0.2);
    border-color: rgba(16, 163, 127, 0.36);
}

.web-preview-trigger {
    min-width: 108px;
}

.generated-files-card {
    padding: 0.8rem;
}

.generated-files-title {
    font-size: 0.88rem;
    margin-bottom: 0.62rem;
}

.generated-file-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.68rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.generated-file-icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(250, 204, 21, 0.12);
    border: 1px solid rgba(250, 204, 21, 0.18);
    color: var(--accent-yellow);
    font-size: 0.72rem;
    font-weight: 900;
}

.generated-file-delta {
    color: #37d995;
    font-size: 0.82rem;
    font-weight: 800;
}

/* Aurora action color system: primary = blue/violet/pink, yellow = small status accent only. */
.submit-btn,
.inspire-entry-btn,
.chat-action-primary,
.inspire-profile-actions button.primary,
.inspire-profile-control.primary,
.inspire-recommendation-card em,
.web-preview-trigger {
    background: var(--btn-gradient) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: var(--btn-shadow) !important;
    text-shadow: none !important;
}

.submit-btn:hover,
.inspire-entry-btn:hover,
.chat-action-primary:hover,
.inspire-profile-actions button.primary:hover,
.inspire-profile-control.primary:hover,
.inspire-recommendation-card:hover em,
.web-preview-trigger:hover {
    background: var(--btn-hover-gradient) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    box-shadow: var(--btn-glow) !important;
    transform: translateY(-1px);
}

.quick-more-btn,
.chat-action-edit,
.chat-action-exit,
.modal-close-btn,
.back-btn,
.inspire-profile-actions button,
.inspire-profile-control,
.game-preview-btn {
    background: var(--glass-button-bg) !important;
    color: rgba(255, 255, 255, 0.78) !important;
    border: 1px solid var(--glass-button-border) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.18) !important;
}

.quick-more-btn:hover,
.chat-action-edit:hover,
.chat-action-exit:hover,
.modal-close-btn:hover,
.back-btn:hover,
.inspire-profile-actions button:hover,
.inspire-profile-control:hover,
.game-preview-btn:hover {
    background: var(--glass-button-hover) !important;
    color: #fff !important;
    border-color: rgba(116, 229, 255, 0.36) !important;
    box-shadow: 0 12px 28px rgba(116, 229, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.inspire-profile-chip.selected,
.profile-sidebar-chip.selected {
    color: #fff !important;
    background: linear-gradient(135deg, rgba(116, 229, 255, 0.24), rgba(102, 126, 234, 0.24) 48%, rgba(240, 147, 251, 0.18)) !important;
    border-color: rgba(116, 229, 255, 0.46) !important;
    box-shadow: 0 8px 24px rgba(116, 229, 255, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.profile-sidebar-chip.selected .profile-mood-icon,
.inspire-profile-chip.selected .profile-mood-icon {
    background: rgba(255, 255, 255, 0.12);
}

.inspire-recommendation-card.rec-stable .rec-type {
    background: rgba(116, 229, 255, 0.1);
    border: 1px solid rgba(116, 229, 255, 0.32);
    color: #9BEFFF;
}

.inspire-recommendation-card.rec-surprise .rec-type {
    background: rgba(240, 147, 251, 0.1);
    border: 1px solid rgba(240, 147, 251, 0.32);
    color: #F6B6FF;
}

.inspire-recommendation-card.rec-contrast .rec-type {
    background: rgba(250, 204, 21, 0.08);
    border: 1px solid rgba(250, 204, 21, 0.22);
    color: var(--status-gold);
}

.inspire-profile-kicker,
.profile-compact-current small,
.profile-context-status small {
    color: var(--status-gold);
    text-shadow: 0 0 14px rgba(250, 204, 21, 0.16);
}

.generation-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(116, 229, 255, 0.18);
    color: rgba(255, 255, 255, 0.82);
}

.generation-status::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--status-gold);
    box-shadow: 0 0 14px rgba(250, 204, 21, 0.38);
}

.game-orientation-tip,
.rec-dna,
.generated-file-icon {
    color: rgba(116, 229, 255, 0.82) !important;
}

.generated-file-icon {
    background: rgba(116, 229, 255, 0.1);
    border-color: rgba(116, 229, 255, 0.18);
}

.game-preview-btn.web-preview-trigger {
    background: var(--btn-gradient) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: var(--btn-shadow) !important;
}

.game-preview-btn.web-preview-trigger:hover {
    background: var(--btn-hover-gradient) !important;
    color: #fff !important;
    box-shadow: var(--btn-glow) !important;
}

.template-preview-frame {
    width: 100%;
    height: clamp(420px, 58vh, 760px);
    min-height: 420px;
    display: block;
    border: 0;
    border-radius: 12px;
    background: #030614;
}

.production-assets-sidebar {
    display: grid;
    gap: 0.85rem;
}

.production-sidebar-summary,
.asset-group,
.production-validation {
    border: 1px solid rgba(116, 229, 255, 0.14);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.014)),
        rgba(6, 10, 28, 0.68);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.production-sidebar-summary {
    display: grid;
    gap: 0.18rem;
    padding: 0.85rem;
}

.production-sidebar-summary strong,
.asset-group-title span,
.production-validation strong {
    color: #fff;
    font-size: 0.86rem;
    font-weight: 900;
}

.production-sidebar-summary small,
.asset-group-title small,
.asset-category summary small,
.asset-node-main small {
    color: rgba(225, 232, 255, 0.56);
    font-size: 0.7rem;
}

.asset-group {
    overflow: hidden;
}

.asset-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.72rem 0.82rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.asset-category {
    padding: 0.1rem 0.55rem 0.55rem;
}

.asset-category + .asset-category {
    border-top: 1px solid rgba(255, 255, 255, 0.055);
}

.asset-category summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 2.2rem;
    list-style: none;
    cursor: pointer;
    color: rgba(246, 248, 255, 0.86);
    font-size: 0.78rem;
    font-weight: 850;
}

.asset-category summary::-webkit-details-marker {
    display: none;
}

.asset-node-list {
    display: grid;
    gap: 0.42rem;
}

.asset-node {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.54rem;
    border: 1px solid rgba(116, 229, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    color: inherit;
    text-align: left;
}

.asset-node:hover {
    border-color: rgba(116, 229, 255, 0.32);
    background: rgba(116, 229, 255, 0.07);
}

.asset-node-thumb {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(116, 229, 255, 0.16), rgba(138, 120, 255, 0.16));
    border: 1px solid rgba(116, 229, 255, 0.18);
    color: #9befff;
    font-size: 0.62rem;
    font-weight: 950;
}

.asset-node-main {
    min-width: 0;
    display: grid;
    gap: 0.12rem;
}

.asset-node-main strong,
.asset-node-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-node-main strong {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.74rem;
    font-weight: 850;
}

.asset-status {
    padding: 0.18rem 0.36rem;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.045);
    font-size: 0.58rem;
    font-weight: 900;
    white-space: nowrap;
}

.asset-status-inherited {
    color: #9befff;
    background: rgba(116, 229, 255, 0.08);
    border-color: rgba(116, 229, 255, 0.22);
}

.asset-status-patched,
.asset-status-generated-prompt {
    color: #f6b6ff;
    background: rgba(240, 147, 251, 0.08);
    border-color: rgba(240, 147, 251, 0.22);
}

.asset-status-missing-fallback,
.asset-status-needs-review {
    color: var(--status-gold);
    background: rgba(250, 204, 21, 0.07);
    border-color: rgba(250, 204, 21, 0.2);
}

.production-validation {
    display: grid;
    gap: 0.45rem;
    padding: 0.8rem;
}

.production-validation span {
    color: rgba(230, 236, 255, 0.72);
    font-size: 0.7rem;
    line-height: 1.35;
}

.production-validation span.ok {
    color: rgba(155, 239, 255, 0.78);
}

.production-validation span.warn {
    color: var(--status-gold);
}

.submit-btn:active,
.inspire-entry-btn:active,
.back-btn:active,
.chat-action-btn:active,
.chat-action-btn.selected {
    box-shadow: 0 0 0 2px rgba(116, 229, 255, 0.28), 0 12px 36px rgba(102, 126, 234, 0.34) !important;
}

@media (max-width: 720px) {
    body.game-edit-workspace-active .chat-history,
    body.game-edit-workspace-active .chat-input-wrapper {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    body.game-edit-workspace-active .chat-history {
        --chat-stage-width: min(100%, calc(100vw - 24px));
    }

    .chat-message.has-game-workspace {
        width: min(100%, calc(100vw - 24px));
        min-width: 0;
    }

    .change-history-sidebar,
    .game-edit-sidebar {
        top: 4rem;
        bottom: 6.3rem;
        width: min(86vw, 340px);
    }

    .workspace-aux-panel {
        width: min(92vw, 420px);
        bottom: 5.8rem;
    }

    .workspace-aux-panel .generated-files-card {
        display: none;
    }

    .workspace-panel-toggle {
        width: 40px;
        height: 58px;
        font-size: 1.35rem;
    }

    .workspace-panel-toggle-left {
        right: -40px;
    }

    .workspace-panel-toggle-right {
        left: -40px;
    }

    .generation-result {
        width: 100%;
    }

    .generated-game-page {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .game-preview-column {
        order: 1;
    }

    .game-edit-sidebar {
        order: 2;
    }

    .droi-game-tools-grid {
        grid-template-columns: 1fr;
    }

    .droi-tool-overlay {
        padding: 0;
    }

    .droi-tool-shell {
        width: 100%;
        height: 100vh;
        min-height: 0;
        border-radius: 0;
    }

    .change-history-sidebar {
        order: 3;
        max-height: 320px;
    }

    .generated-web-card {
        align-items: stretch;
        flex-direction: column;
    }

    .web-preview-trigger {
        width: 100%;
    }

    .mobile-game-preview-toggle {
        width: 100%;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(116, 229, 255, 0.24);
        border-radius: 12px;
        background:
            linear-gradient(135deg, rgba(116, 229, 255, 0.18), rgba(138, 120, 255, 0.22) 52%, rgba(240, 147, 251, 0.16)),
            rgba(5, 8, 24, 0.72);
        color: #fff;
        font: inherit;
        font-size: 0.86rem;
        font-weight: 900;
        cursor: pointer;
        box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
    }

    .game-preview-viewport {
        display: none;
        width: 100%;
        max-height: min(48vh, 420px);
        margin: 0;
    }

    .playable-shell.preview-open .game-preview-viewport {
        display: block;
    }

    .playable-shell.preview-open .game-preview-chat-panel {
        display: none;
    }

    .game-preview-chat-panel {
        max-height: calc(100dvh - 15rem);
        min-height: min(56vh, 420px);
        padding: 0.95rem;
        overscroll-behavior: contain;
    }

    .preview-chat-lead,
    .game-preview-chat-panel p,
    .preview-chat-points {
        font-size: 0.9rem;
        line-height: 1.55;
    }

    .game-preview-actions {
        display: none;
        grid-template-columns: 1fr;
    }

    .playable-shell.preview-open .game-preview-actions {
        display: grid;
    }
}

@media (max-width: 1439px) and (min-width: 1024px) {
    body.game-edit-workspace-active {
        --workspace-left-width: 240px;
        --workspace-right-width: 320px;
    }

    .workspace-body {
        grid-template-columns: var(--workspace-left-width) minmax(520px, 1fr) var(--workspace-right-width);
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(calc(100vw - var(--workspace-left-width) - var(--workspace-right-width) - 56px), 820px);
        margin-left: calc(var(--workspace-left-width) + 28px);
    }

    .workspace-header-actions {
        gap: 0.34rem;
    }

    .workspace-header-btn {
        padding: 0 0.58rem;
    }
}

@media (max-width: 1023px) {
    body.game-edit-workspace-active .chat-history {
        --chat-stage-width: min(100%, calc(100vw - 24px));
        padding: 0.65rem 0.75rem 0.9rem;
    }

    body.game-edit-workspace-active .chat-message.has-game-workspace {
        width: min(100%, calc(100vw - 24px));
    }

    .generated-game-page {
        min-height: auto;
        max-height: none;
        overflow: visible;
        grid-template-rows: auto auto;
    }

    .workspace-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 0.75rem;
    }

    .workspace-header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .workspace-body {
        grid-template-columns: minmax(0, 1fr);
        grid-auto-rows: auto;
    }

    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar,
    .generated-game-page .game-preview-column {
        position: relative;
        inset: auto;
        width: auto;
        max-height: none;
        transform: none;
    }

    .game-preview-column {
        order: 1;
    }

    .game-edit-sidebar {
        order: 2;
    }

    .change-history-sidebar {
        order: 3;
    }

    .playable-shell {
        grid-template-rows: auto auto;
    }

    .game-preview-card {
        min-height: 360px;
    }

    .game-preview-card .game-preview-viewport {
        min-height: 280px;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: auto;
        margin-left: 0;
        padding: 0.7rem 0.75rem 0.9rem;
    }
}

/* ===== P2 Workspace Polish: calmer inspector, version timeline, stronger preview ===== */
.generated-game-page {
    --workspace-panel-radius: 16px;
}

.generated-game-page .game-edit-sidebar {
    gap: 0.56rem;
    padding: 0.72rem;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(8, 13, 30, 0.86));
}

.generated-game-page .workspace-panel-head {
    padding-bottom: 0.42rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.11);
}

.generated-game-page .workspace-panel-head span {
    font-size: 0.78rem;
}

.generated-game-page .workspace-panel-head small {
    font-size: 0.64rem;
    color: rgba(203, 213, 225, 0.5);
}

.workspace-header-btn {
    border-color: rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.038);
    color: rgba(226, 232, 240, 0.78);
    box-shadow: none;
}

.workspace-header-btn:hover {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.07);
}

.workspace-header-btn.active.is-mode {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(148, 163, 184, 0.11);
    color: #f8fafc;
    box-shadow: none;
}

.workspace-header-btn.primary-action {
    border-color: rgba(94, 231, 255, 0.42);
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.28), rgba(124, 109, 255, 0.3));
    color: #fff;
    box-shadow: 0 10px 28px rgba(94, 231, 255, 0.16);
}

.workspace-header-btn.primary-action:hover {
    border-color: rgba(94, 231, 255, 0.62);
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.34), rgba(124, 109, 255, 0.36));
}

.workspace-save-state {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.38);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: rgba(203, 213, 225, 0.62);
    font-size: 0.62rem;
    font-weight: 850;
}

.game-edit-tabs {
    min-height: 36px;
    padding: 0.14rem;
    background: rgba(2, 6, 23, 0.48);
    box-shadow: none;
}

.game-edit-tab {
    min-height: 32px;
    font-size: 0.74rem;
}

.game-edit-tab.active {
    background: rgba(94, 231, 255, 0.12);
    box-shadow: none;
}

.game-edit-tab small {
    width: auto;
    min-width: 1.08rem;
    height: 1.08rem;
    font-size: 0.52rem;
}

.workspace-numeric-panel,
.workspace-media-panel {
    gap: 0.52rem;
}

.workspace-numeric-head,
.workspace-media-head,
.workspace-media-detail-head,
.workspace-numeric-card,
.workspace-media-group,
.workspace-media-asset,
.workspace-media-empty,
.workspace-code-compact {
    border-color: rgba(148, 163, 184, 0.1);
    background: rgba(2, 6, 23, 0.32);
}

.workspace-numeric-head,
.workspace-media-head,
.workspace-media-detail-head {
    padding: 0.56rem;
}

.workspace-numeric-card,
.workspace-media-group {
    padding: 0.54rem;
}

.workspace-numeric-card-head strong,
.workspace-media-group header strong,
.workspace-media-head strong,
.workspace-media-detail-head strong {
    font-size: 0.72rem;
}

.workspace-numeric-card-head small,
.workspace-media-group header small,
.workspace-media-head small,
.workspace-media-detail-head small {
    font-size: 0.6rem;
}

.workspace-numeric-row {
    grid-template-columns: minmax(0, 1fr) 62px;
}

.workspace-numeric-presets button,
.workspace-numeric-actions button,
.workspace-media-asset-actions button {
    min-height: 26px;
    font-size: 0.58rem;
}

.change-history-list {
    position: relative;
    gap: 0.62rem;
    padding-left: 0.78rem;
}

.change-history-list::before {
    content: "";
    position: absolute;
    left: 0.28rem;
    top: 0.3rem;
    bottom: 0.3rem;
    width: 1px;
    background: linear-gradient(180deg, rgba(94, 231, 255, 0.42), rgba(124, 109, 255, 0.18), transparent);
}

.change-history-record {
    position: relative;
    padding: 0.62rem 0.64rem;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.36);
}

.change-history-record::before {
    content: "";
    position: absolute;
    left: -0.73rem;
    top: 0.84rem;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #5ee7ff;
    box-shadow: 0 0 0 4px rgba(94, 231, 255, 0.11);
}

.change-record-top strong {
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    font-size: 0.72rem;
}

.change-record-top em {
    min-width: 2.1rem;
    justify-content: center;
    margin-right: 0;
}

.change-record-prompt {
    color: rgba(226, 232, 240, 0.68);
    font-size: 0.66rem;
}

.change-record-meta {
    font-size: 0.6rem;
}

.playable-shell {
    grid-template-rows: auto minmax(320px, 48%) minmax(0, 1fr);
}

.generated-preview-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.08rem 0.8rem;
    align-items: center;
    padding: 0.82rem 0.92rem;
    border-radius: 16px;
    border: 1px solid rgba(94, 231, 255, 0.22);
    background:
        radial-gradient(circle at 8% 12%, rgba(94, 231, 255, 0.16), transparent 34%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(30, 27, 75, 0.72));
    box-shadow: 0 18px 50px rgba(2, 6, 23, 0.28);
}

.generated-preview-hero span {
    grid-column: 1 / 3;
    color: #5ee7ff;
    font-size: 0.62rem;
    font-weight: 950;
    text-transform: uppercase;
}

.generated-preview-hero strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 950;
}

.generated-preview-hero small {
    color: rgba(203, 213, 225, 0.68);
    font-size: 0.66rem;
    font-weight: 750;
    text-align: right;
}

.game-preview-viewport {
    border: 1px solid rgba(94, 231, 255, 0.24);
    background:
        linear-gradient(180deg, rgba(2, 6, 23, 0.58), rgba(2, 6, 23, 0.88)),
        rgba(15, 23, 42, 0.78);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 20px 68px rgba(0, 0, 0, 0.34),
        0 0 0 1px rgba(124, 109, 255, 0.08);
}

.game-preview-chat-panel {
    border-color: rgba(148, 163, 184, 0.1);
    background: rgba(2, 6, 23, 0.38);
}

@media (max-width: 1023px) {
    .playable-shell {
        grid-template-rows: auto auto auto;
    }

    .generated-preview-hero {
        grid-template-columns: 1fr;
    }

    .generated-preview-hero span,
    .generated-preview-hero strong,
    .generated-preview-hero small {
        grid-column: auto;
        text-align: left;
    }
}

/* ===== Workspace Composer Alignment ===== */
body.game-edit-workspace-active {
    --workspace-shell-width: min(1440px, calc(100vw - 64px));
    --workspace-center-width: calc(
        var(--workspace-shell-width)
        - var(--workspace-left-width, 280px)
        - var(--workspace-right-width, 360px)
        - (var(--workspace-gap, 16px) * 2)
        - (var(--workspace-outer-padding, 16px) * 2)
    );
    --workspace-center-offset: calc(
        ((100vw - var(--workspace-shell-width)) / 2)
        + var(--workspace-outer-padding, 16px)
        + var(--workspace-left-width, 280px)
        + var(--workspace-gap, 16px)
    );
}

body.game-edit-workspace-active .chat-input-wrapper {
    width: max(360px, var(--workspace-center-width));
    margin-left: var(--workspace-center-offset);
    margin-right: 0;
    padding: 0.62rem 0 0.85rem;
}

body.game-edit-workspace-active .chat-input-bar.unified-pill {
    width: 100%;
    max-width: none;
    margin: 0;
}

@media (max-width: 1439px) and (min-width: 1024px) {
    .generated-game-page {
        --workspace-left-width: 240px;
        --workspace-right-width: 320px;
    }
}

@media (max-width: 1023px) {
    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(100%, calc(100vw - 24px));
        margin-left: auto;
        margin-right: auto;
        padding: 0.7rem 0 0.9rem;
    }

    body.game-edit-workspace-active .chat-input-bar.unified-pill {
        width: 100%;
        margin: 0 auto;
    }
}

/* ===== Generated Game Page IA: Playable / Editable / Exportable ===== */
.generated-game-page {
    --workspace-left-width: 270px;
    --workspace-right-width: 360px;
}

.generated-game-page .generated-page-header {
    min-height: 76px;
    padding: 0.72rem 1rem;
    align-items: center;
}

.generated-game-page .workspace-title-block {
    gap: 0.14rem;
}

.generated-game-page .workspace-title-block > small {
    color: rgba(94, 231, 255, 0.86);
    font-size: 0.62rem;
    font-weight: 950;
    text-transform: uppercase;
}

.generated-game-page .workspace-title-block > span {
    color: rgba(203, 213, 225, 0.72);
    font-size: 0.68rem;
    font-weight: 760;
}

.workspace-status-pill.warn {
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(245, 158, 11, 0.08);
    color: #fbbf24;
}

.generated-game-page .workspace-header-actions {
    gap: 0.42rem;
}

.workspace-header-btn.secondary-action {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.048);
    color: rgba(226, 232, 240, 0.82);
    box-shadow: none;
}

.generated-game-page .workspace-mode-switch {
    margin-left: 0.2rem;
}

.generated-game-page .workspace-body {
    grid-template-columns: var(--workspace-left-width) minmax(680px, 1fr) var(--workspace-right-width);
}

.generated-game-page .version-history-panel {
    background:
        radial-gradient(circle at 0% 12%, rgba(116, 229, 255, 0.06), transparent 34%),
        rgba(8, 13, 30, 0.68);
}

.generated-game-page .game-workspace-panel {
    background:
        radial-gradient(circle at 50% 0%, rgba(94, 231, 255, 0.08), transparent 34%),
        rgba(3, 7, 18, 0.94);
    border-color: rgba(94, 231, 255, 0.32);
}

.generated-game-page .edit-tools-panel {
    background:
        radial-gradient(circle at 100% 0%, rgba(167, 139, 250, 0.08), transparent 34%),
        rgba(12, 16, 36, 0.76);
}

.generated-game-page .playable-shell {
    grid-template-rows: minmax(420px, 58%) minmax(0, 1fr);
    gap: 0.9rem;
}

.playable-preview-card {
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 0.58rem;
    padding: 0.72rem;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(94, 231, 255, 0.22);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(2, 6, 23, 0.9)),
        rgba(2, 6, 23, 0.8);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 18px 54px rgba(0, 0, 0, 0.28);
}

.playable-preview-card .generated-preview-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    box-shadow: none;
}

.preview-hero-badges {
    grid-column: 2 / 3;
    grid-row: 1 / 4;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.28rem;
}

.preview-hero-badges b {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.48rem;
    border-radius: 999px;
    border: 1px solid rgba(94, 231, 255, 0.22);
    background: rgba(94, 231, 255, 0.08);
    color: #9befff;
    font-size: 0.58rem;
    font-weight: 950;
}

.preview-card-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.playable-preview-card .game-preview-viewport {
    min-height: 0;
    height: 100%;
}

.preview-card-hint {
    margin: 0;
    color: rgba(203, 213, 225, 0.58);
    font-size: 0.64rem;
    font-weight: 760;
    line-height: 1.36;
}

.generated-game-page .game-preview-chat-panel {
    display: grid;
    align-content: start;
    gap: 0.54rem;
}

.preview-chat-edit-status {
    display: grid;
    gap: 0.12rem;
    padding: 0.52rem 0.62rem;
    border-radius: 11px;
    border: 1px solid rgba(94, 231, 255, 0.14);
    background: rgba(94, 231, 255, 0.055);
}

.preview-chat-edit-status strong {
    color: #e0faff;
}

.preview-chat-edit-status small {
    color: rgba(203, 213, 225, 0.58);
    font-size: 0.62rem;
}

@media (max-width: 1439px) and (min-width: 1024px) {
    .generated-game-page {
        --workspace-left-width: 240px;
        --workspace-right-width: 320px;
    }

    .generated-game-page .workspace-body {
        grid-template-columns: var(--workspace-left-width) minmax(520px, 1fr) var(--workspace-right-width);
    }
}

@media (max-width: 1023px) {
    .generated-game-page .workspace-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .generated-game-page .playable-shell {
        grid-template-rows: auto auto;
    }

    .playable-preview-card {
        min-height: 420px;
    }

    .preview-hero-badges {
        grid-column: auto;
        grid-row: auto;
        justify-content: flex-start;
    }
}

/* ===== Generated Page Final Layout Guard ===== */
@media (min-width: 1024px) {
    .generated-game-page .workspace-body {
        grid-template-columns: var(--workspace-left-width, 270px) minmax(640px, 1fr) var(--workspace-right-width, 360px);
    }

    .generated-game-page .change-history-sidebar {
        order: 1;
    }

    .generated-game-page .game-preview-column {
        order: 2;
    }

    .generated-game-page .game-edit-sidebar {
        order: 3;
    }
}

@media (max-width: 1023px) {
    .generated-game-page {
        max-height: calc(100dvh - 164px);
        overflow: auto;
        overscroll-behavior: contain;
    }

    .generated-game-page .workspace-body {
        padding-bottom: 1rem;
    }

    .generated-game-page .game-preview-column {
        order: 1;
    }

    .generated-game-page .game-edit-sidebar {
        order: 2;
        max-height: none;
    }

    .generated-game-page .change-history-sidebar {
        order: 3;
        max-height: none;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(100%, calc(100vw - 24px));
        margin-left: auto;
        margin-right: auto;
        padding: 0.62rem 0 0.78rem;
    }
}

/* ===== Generated Page Mobile Scroll Correction ===== */
@media (max-width: 1023px) {
    .generated-game-page {
        display: block;
        max-height: calc(100dvh - 150px);
        overflow: auto;
        overscroll-behavior: contain;
    }

    .generated-game-page .workspace-body {
        height: auto;
        min-height: 0;
        overflow: visible;
        align-content: start;
    }

    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar,
    .generated-game-page .game-preview-column {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .generated-game-page .game-preview-column {
        min-height: 520px;
    }

    .generated-game-page .game-edit-sidebar {
        min-height: 560px;
    }

    .generated-game-page .change-history-sidebar {
        min-height: 220px;
    }

    .generated-game-page .playable-shell {
        height: auto;
    }
}

/* ===== Chat Option Badge Clarity ===== */
.chat-option-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.68rem;
    min-height: 50px;
    max-width: min(520px, 100%);
    padding: 0.45rem 1.05rem 0.45rem 0.52rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(8, 13, 30, 0.9));
    color: rgba(248, 250, 252, 0.92);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 900;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.chat-option-btn:hover {
    border-color: rgba(94, 231, 255, 0.42);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.92));
    transform: translateY(-1px);
}

.chat-option-btn .quick-tag-icon {
    min-width: 54px;
    height: 34px;
    padding: 0 0.58rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(94, 231, 255, 0.12);
    border: 1px solid rgba(94, 231, 255, 0.18);
    color: #bff7ff;
    font-size: 0.68rem;
    font-weight: 950;
    letter-spacing: 0;
    white-space: nowrap;
}

/* ===== Quick Option Badge Readability ===== */
.quick-tag {
    justify-content: flex-start;
    padding-left: 0.52rem;
    padding-right: 1.2rem;
    min-width: 220px;
}

.quick-tag-icon {
    width: auto;
    min-width: 54px;
    height: 1.85rem;
    flex: 0 0 auto;
    padding: 0 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 950;
    letter-spacing: 0;
    white-space: nowrap;
}

/* ===== Animal Island inspired option icons ===== */
.animal-option-icon,
.animal-profile-icon {
    position: relative;
    isolation: isolate;
    overflow: visible;
    background: linear-gradient(180deg, #fff8df, #f3dfb7);
    border: 2px solid rgba(121, 79, 39, 0.22);
    color: #794f27;
    box-shadow: 0 3px 0 rgba(121, 79, 39, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.animal-option-icon .icon-fallback,
.animal-profile-icon .icon-fallback {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.animal-option-icon {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 16px 18px 15px 19px;
}

.animal-option-icon::before,
.animal-option-icon::after,
.animal-profile-icon::before,
.animal-profile-icon::after {
    content: '';
    position: absolute;
    display: block;
    box-sizing: border-box;
}

.animal-option-icon::before {
    inset: 9px;
    border-radius: 999px;
    background: #19c8b9;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.animal-option-icon::after {
    width: 9px;
    height: 9px;
    right: 8px;
    top: 7px;
    border-radius: 999px;
    background: #ffcc00;
    border: 2px solid rgba(121, 79, 39, 0.16);
}

.animal-option-icon[data-option-icon='style-anime']::before {
    inset: 10px;
    background: #f8a6b2;
    clip-path: polygon(50% 0%, 62% 33%, 98% 35%, 69% 56%, 80% 92%, 50% 70%, 20% 92%, 31% 56%, 2% 35%, 38% 33%);
}

.animal-option-icon[data-option-icon='style-anime']::after {
    width: 8px;
    height: 8px;
    left: 9px;
    top: 9px;
    background: #82d5bb;
}

.animal-option-icon[data-option-icon='style-gothic'] {
    background: linear-gradient(180deg, #ded6ff, #b7c6e5);
}

.animal-option-icon[data-option-icon='style-gothic']::before {
    width: 22px;
    height: 22px;
    inset: auto;
    left: 9px;
    top: 9px;
    border-radius: 999px;
    background: #7558b8;
    box-shadow: 6px 0 0 #ded6ff;
}

.animal-option-icon[data-option-icon='style-gothic']::after {
    width: 18px;
    height: 8px;
    left: 17px;
    top: 25px;
    border-radius: 999px 999px 2px 2px;
    background: #794f27;
    clip-path: polygon(0 0, 50% 100%, 100% 0, 82% 0, 50% 55%, 18% 0);
}

.animal-option-icon[data-option-icon='style-cyber']::before {
    inset: 10px;
    border-radius: 8px;
    background: #3dd4c6;
    border: 3px solid #794f27;
}

.animal-option-icon[data-option-icon='style-cyber']::after {
    width: 22px;
    height: 22px;
    left: 10px;
    top: 10px;
    background: linear-gradient(90deg, transparent 45%, #fff8df 45% 55%, transparent 55%), linear-gradient(0deg, transparent 45%, #fff8df 45% 55%, transparent 55%);
    border-radius: 6px;
}

.animal-option-icon[data-option-icon='style-pixel']::before {
    inset: auto;
    width: 7px;
    height: 7px;
    left: 10px;
    top: 11px;
    border-radius: 2px;
    background: #19c8b9;
    box-shadow: 10px 0 #f7cd67, 20px 0 #f8a6b2, 0 10px #889df0, 10px 10px #82d5bb, 20px 10px #e59266;
}

.animal-option-icon[data-option-icon='style-minimal']::before {
    inset: 12px;
    background: transparent;
    border: 4px solid #19c8b9;
}

.animal-option-icon[data-option-icon='style-fantasy']::before {
    inset: auto;
    left: 12px;
    top: 8px;
    width: 18px;
    height: 26px;
    border-radius: 10px 10px 5px 5px;
    background: #b77dee;
    clip-path: polygon(50% 0, 100% 32%, 82% 100%, 18% 100%, 0 32%);
}

.animal-option-icon[data-option-icon='style-retro']::before {
    inset: 11px 8px;
    border-radius: 8px;
    background: repeating-linear-gradient(180deg, #f7cd67 0 4px, #e59266 4px 8px);
}

.animal-option-icon[data-option-icon='style-3d']::before {
    inset: auto;
    left: 11px;
    top: 10px;
    width: 20px;
    height: 20px;
    background: #82d5bb;
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.animal-option-icon[data-option-icon^='setting-']::before {
    inset: auto;
    left: 9px;
    top: 16px;
    width: 24px;
    height: 14px;
    border-radius: 999px 999px 7px 7px;
    background: #82d5bb;
}

.animal-option-icon[data-option-icon='setting-space']::before {
    width: 24px;
    height: 24px;
    left: 9px;
    top: 9px;
    background: #889df0;
    clip-path: polygon(50% 0, 62% 34%, 98% 35%, 69% 56%, 80% 92%, 50% 70%, 20% 92%, 31% 56%, 2% 35%, 38% 34%);
}

.animal-option-icon[data-option-icon='setting-water']::before {
    background: #82d5bb;
    clip-path: polygon(0 55%, 18% 35%, 36% 55%, 54% 35%, 72% 55%, 90% 35%, 100% 55%, 100% 100%, 0 100%);
}

.animal-option-icon[data-option-icon^='play-']::before,
.animal-option-icon[data-option-icon^='type-']::before,
.animal-option-icon[data-option-icon='option-generic']::before,
.animal-option-icon[data-option-icon='style-generic']::before {
    inset: 11px;
    background: #82d5bb;
    clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 55%, 79% 91%, 50% 70%, 21% 91%, 32% 55%, 2% 35%, 39% 35%);
}

.animal-profile-icon {
    width: 1.55rem;
    height: 1.55rem;
    flex: 0 0 1.55rem;
    border-radius: 999px;
}

.animal-profile-icon::before {
    inset: 5px;
    border-radius: 999px;
    background: #19c8b9;
}

.animal-profile-icon[data-profile-icon='mood-happy']::before {
    background: #f7cd67;
    box-shadow: 0 0 0 2px rgba(247, 205, 103, 0.2);
}

.animal-profile-icon[data-profile-icon='mood-happy']::after {
    width: 13px;
    height: 6px;
    left: 6px;
    top: 11px;
    border-bottom: 2px solid #794f27;
    border-radius: 0 0 999px 999px;
}

.animal-profile-icon[data-profile-icon='mood-calm']::before {
    inset: auto;
    left: 6px;
    top: 6px;
    width: 14px;
    height: 13px;
    border-radius: 999px 0 999px 999px;
    background: #82d5bb;
    transform: rotate(-28deg);
}

.animal-profile-icon[data-profile-icon='mood-excited']::before {
    inset: 5px;
    background: #f7cd67;
    clip-path: polygon(50% 0, 62% 34%, 100% 38%, 70% 58%, 80% 100%, 50% 74%, 20% 100%, 30% 58%, 0 38%, 38% 34%);
}

.animal-profile-icon[data-profile-icon='mood-focused']::before {
    inset: 5px;
    background: transparent;
    border: 3px solid #19c8b9;
}

.animal-profile-icon[data-profile-icon='mood-focused']::after {
    inset: 10px;
    border-radius: 999px;
    background: #794f27;
}

.animal-profile-icon[data-profile-icon='mood-tired']::before {
    width: 15px;
    height: 15px;
    left: 5px;
    top: 5px;
    border-radius: 999px;
    background: #889df0;
    box-shadow: 5px 0 0 #fff8df;
}

.animal-profile-icon[data-profile-icon='vibe-cozy_cute']::before,
.animal-profile-icon[data-profile-icon='state-decompress']::before {
    inset: 6px;
    background: #f8a6b2;
    clip-path: polygon(50% 8%, 61% 37%, 92% 37%, 67% 56%, 77% 88%, 50% 68%, 23% 88%, 33% 56%, 8% 37%, 39% 37%);
}

/* ===== Mood-specific profile button backgrounds ===== */
.inspire-profile-chip[data-profile-key^="mood-"],
.profile-sidebar-chip[data-profile-key^="mood-"] {
    --mood-bg-1: rgba(255, 248, 223, 0.15);
    --mood-bg-2: rgba(243, 223, 183, 0.08);
    --mood-border: rgba(255, 248, 223, 0.22);
    --mood-text: #f8fafc;
    --mood-glow: rgba(255, 248, 223, 0.12);
    background:
        radial-gradient(circle at 18% 18%, var(--mood-bg-1), transparent 58%),
        linear-gradient(180deg, var(--mood-bg-2), rgba(15, 23, 42, 0.5));
    border-color: var(--mood-border);
    color: var(--mood-text);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.inspire-profile-chip[data-profile-key^="mood-"]:hover,
.profile-sidebar-chip[data-profile-key^="mood-"]:hover {
    border-color: color-mix(in srgb, var(--mood-border) 72%, white 28%);
    background:
        radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--mood-bg-1) 78%, white 22%), transparent 60%),
        linear-gradient(180deg, color-mix(in srgb, var(--mood-bg-2) 80%, white 20%), rgba(15, 23, 42, 0.52));
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2), 0 0 26px var(--mood-glow);
}

.inspire-profile-chip[data-profile-key^="mood-"].selected,
.profile-sidebar-chip[data-profile-key^="mood-"].selected {
    color: #3f2a17;
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.34), transparent 52%),
        linear-gradient(180deg, color-mix(in srgb, var(--mood-bg-1) 80%, white 20%), color-mix(in srgb, var(--mood-bg-2) 62%, white 38%));
    border-color: color-mix(in srgb, var(--mood-border) 64%, white 36%);
    box-shadow: 0 4px 0 rgba(121, 79, 39, 0.18), 0 16px 28px var(--mood-glow);
}

.inspire-profile-chip[data-profile-key="mood-happy"],
.profile-sidebar-chip[data-profile-key="mood-happy"] {
    --mood-bg-1: rgba(255, 221, 107, 0.52);
    --mood-bg-2: rgba(255, 188, 92, 0.22);
    --mood-border: rgba(255, 210, 92, 0.52);
    --mood-glow: rgba(255, 204, 0, 0.2);
}

.inspire-profile-chip[data-profile-key="mood-calm"],
.profile-sidebar-chip[data-profile-key="mood-calm"] {
    --mood-bg-1: rgba(130, 213, 187, 0.5);
    --mood-bg-2: rgba(79, 190, 164, 0.2);
    --mood-border: rgba(130, 213, 187, 0.5);
    --mood-glow: rgba(130, 213, 187, 0.2);
}

.inspire-profile-chip[data-profile-key="mood-excited"],
.profile-sidebar-chip[data-profile-key="mood-excited"] {
    --mood-bg-1: rgba(248, 166, 178, 0.5);
    --mood-bg-2: rgba(247, 205, 103, 0.18);
    --mood-border: rgba(248, 166, 178, 0.54);
    --mood-glow: rgba(248, 166, 178, 0.2);
}

.inspire-profile-chip[data-profile-key="mood-focused"],
.profile-sidebar-chip[data-profile-key="mood-focused"] {
    --mood-bg-1: rgba(61, 212, 198, 0.46);
    --mood-bg-2: rgba(136, 157, 240, 0.2);
    --mood-border: rgba(61, 212, 198, 0.52);
    --mood-glow: rgba(61, 212, 198, 0.18);
}

/* ===== Mood profile cards: final color differentiation ===== */
.inspire-profile-chip[data-profile-key^="mood-"],
.profile-sidebar-chip[data-profile-key^="mood-"] {
    --mood-card-bg-a: rgba(255, 248, 223, 0.2);
    --mood-card-bg-b: rgba(130, 213, 187, 0.12);
    --mood-card-bg-c: rgba(15, 23, 42, 0.58);
    --mood-card-border: rgba(255, 248, 223, 0.28);
    --mood-card-shadow: rgba(0, 0, 0, 0.2);
    --mood-card-text: #f8fafc;
    --mood-card-accent: #fff8df;
    isolation: isolate;
    border-color: var(--mood-card-border);
    color: var(--mood-card-text);
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.24), transparent 34%),
        radial-gradient(circle at 92% 0%, var(--mood-card-bg-a), transparent 44%),
        linear-gradient(135deg, var(--mood-card-bg-b), var(--mood-card-bg-c));
    box-shadow:
        0 12px 26px var(--mood-card-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.inspire-profile-chip[data-profile-key^="mood-"]::before,
.profile-sidebar-chip[data-profile-key^="mood-"]::before {
    content: '';
    position: absolute;
    inset: 1px;
    z-index: -1;
    border-radius: inherit;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.13), transparent 35%, rgba(255, 255, 255, 0.05) 68%, transparent),
        radial-gradient(circle at 12% 84%, var(--mood-card-accent), transparent 30%);
    opacity: 0.34;
    pointer-events: none;
}

.inspire-profile-chip[data-profile-key^="mood-"]:hover,
.profile-sidebar-chip[data-profile-key^="mood-"]:hover {
    transform: translateY(-1px);
    box-shadow:
        0 16px 30px color-mix(in srgb, var(--mood-card-shadow) 82%, black 18%),
        0 0 28px color-mix(in srgb, var(--mood-card-border) 62%, transparent 38%),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.inspire-profile-chip[data-profile-key="mood-happy"],
.profile-sidebar-chip[data-profile-key="mood-happy"] {
    --mood-card-bg-a: rgba(255, 236, 154, 0.72);
    --mood-card-bg-b: rgba(255, 198, 104, 0.32);
    --mood-card-bg-c: rgba(67, 45, 24, 0.36);
    --mood-card-border: rgba(255, 218, 102, 0.68);
    --mood-card-shadow: rgba(255, 191, 64, 0.14);
    --mood-card-accent: rgba(255, 245, 190, 0.46);
}

.inspire-profile-chip[data-profile-key="mood-calm"],
.profile-sidebar-chip[data-profile-key="mood-calm"] {
    --mood-card-bg-a: rgba(204, 250, 224, 0.58);
    --mood-card-bg-b: rgba(97, 211, 181, 0.34);
    --mood-card-bg-c: rgba(14, 64, 62, 0.34);
    --mood-card-border: rgba(130, 213, 187, 0.7);
    --mood-card-shadow: rgba(82, 211, 184, 0.14);
    --mood-card-accent: rgba(187, 245, 223, 0.42);
}

.inspire-profile-chip[data-profile-key="mood-excited"],
.profile-sidebar-chip[data-profile-key="mood-excited"] {
    --mood-card-bg-a: rgba(255, 202, 119, 0.54);
    --mood-card-bg-b: rgba(248, 134, 166, 0.38);
    --mood-card-bg-c: rgba(76, 37, 77, 0.34);
    --mood-card-border: rgba(248, 166, 178, 0.72);
    --mood-card-shadow: rgba(248, 134, 166, 0.16);
    --mood-card-accent: rgba(255, 229, 148, 0.4);
}

.inspire-profile-chip[data-profile-key="mood-focused"],
.profile-sidebar-chip[data-profile-key="mood-focused"] {
    --mood-card-bg-a: rgba(145, 233, 255, 0.48);
    --mood-card-bg-b: rgba(83, 156, 246, 0.34);
    --mood-card-bg-c: rgba(21, 37, 92, 0.42);
    --mood-card-border: rgba(94, 231, 255, 0.7);
    --mood-card-shadow: rgba(94, 231, 255, 0.14);
    --mood-card-accent: rgba(177, 245, 255, 0.4);
}

.inspire-profile-chip[data-profile-key^="mood-"].selected,
.profile-sidebar-chip[data-profile-key^="mood-"].selected {
    color: #3e2c19;
    border-color: color-mix(in srgb, var(--mood-card-border) 82%, white 18%);
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.42), transparent 36%),
        radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--mood-card-bg-a) 74%, white 26%), transparent 48%),
        linear-gradient(135deg, color-mix(in srgb, var(--mood-card-bg-b) 78%, white 22%), color-mix(in srgb, var(--mood-card-bg-a) 62%, white 38%));
    box-shadow:
        0 3px 0 rgba(121, 79, 39, 0.22),
        0 18px 34px color-mix(in srgb, var(--mood-card-shadow) 72%, rgba(0, 0, 0, 0.18) 28%),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.inspire-profile-chip[data-profile-key="mood-calm"].selected,
.profile-sidebar-chip[data-profile-key="mood-calm"].selected,
.inspire-profile-chip[data-profile-key="mood-focused"].selected,
.profile-sidebar-chip[data-profile-key="mood-focused"].selected {
    color: #103a3f;
}

/* Mood selected cards must beat generic inspire selected highlight. */
.inspire-profile-chip[data-profile-key^="mood-"].selected,
.profile-sidebar-chip[data-profile-key^="mood-"].selected {
    color: #3e2c19 !important;
    border-color: color-mix(in srgb, var(--mood-card-border) 82%, white 18%) !important;
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.42), transparent 36%),
        radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--mood-card-bg-a) 74%, white 26%), transparent 48%),
        linear-gradient(135deg, color-mix(in srgb, var(--mood-card-bg-b) 78%, white 22%), color-mix(in srgb, var(--mood-card-bg-a) 62%, white 38%)) !important;
    box-shadow:
        0 3px 0 rgba(121, 79, 39, 0.22),
        0 18px 34px color-mix(in srgb, var(--mood-card-shadow) 72%, rgba(0, 0, 0, 0.18) 28%),
        inset 0 1px 0 rgba(255, 255, 255, 0.28) !important;
}

.inspire-profile-chip[data-profile-key="mood-calm"].selected,
.profile-sidebar-chip[data-profile-key="mood-calm"].selected,
.inspire-profile-chip[data-profile-key="mood-focused"].selected,
.profile-sidebar-chip[data-profile-key="mood-focused"].selected {
    color: #103a3f !important;
}

/* ===== Full creative profile option cards ===== */
.inspire-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(242px, 42vh);
    overflow-y: auto;
    padding: 0.05rem 0.12rem 0.08rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(130, 213, 187, 0.45) rgba(255, 255, 255, 0.06);
}

.inspire-profile-control.random {
    border-color: rgba(255, 218, 102, 0.42);
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 248, 223, 0.24), transparent 46%),
        linear-gradient(135deg, rgba(130, 213, 187, 0.2), rgba(248, 166, 178, 0.18));
    color: #fff8df;
}

.inspire-profile-chip[data-profile-key],
.profile-sidebar-chip[data-profile-key] {
    --profile-card-bg-a: rgba(255, 248, 223, 0.24);
    --profile-card-bg-b: rgba(130, 213, 187, 0.14);
    --profile-card-bg-c: rgba(15, 23, 42, 0.56);
    --profile-card-border: rgba(255, 248, 223, 0.24);
    --profile-card-shadow: rgba(0, 0, 0, 0.18);
    --profile-card-accent: rgba(255, 248, 223, 0.34);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-color: var(--profile-card-border);
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.2), transparent 34%),
        radial-gradient(circle at 92% 0%, var(--profile-card-bg-a), transparent 44%),
        linear-gradient(135deg, var(--profile-card-bg-b), var(--profile-card-bg-c));
    box-shadow: 0 12px 24px var(--profile-card-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.inspire-profile-chip[data-profile-key]::before,
.profile-sidebar-chip[data-profile-key]::before {
    content: '';
    position: absolute;
    inset: 1px;
    z-index: -1;
    border-radius: inherit;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.13), transparent 35%, rgba(255, 255, 255, 0.05) 68%, transparent),
        radial-gradient(circle at 12% 84%, var(--profile-card-accent), transparent 30%);
    opacity: 0.3;
    pointer-events: none;
}

.inspire-profile-chip[data-profile-key].selected,
.profile-sidebar-chip[data-profile-key].selected {
    color: #3e2c19 !important;
    border-color: color-mix(in srgb, var(--profile-card-border) 78%, white 22%) !important;
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.42), transparent 36%),
        radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--profile-card-bg-a) 74%, white 26%), transparent 48%),
        linear-gradient(135deg, color-mix(in srgb, var(--profile-card-bg-b) 78%, white 22%), color-mix(in srgb, var(--profile-card-bg-a) 62%, white 38%)) !important;
    box-shadow: 0 3px 0 rgba(121, 79, 39, 0.22), 0 18px 34px var(--profile-card-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.28) !important;
}

.inspire-profile-chip[data-profile-key^='scene-'],
.profile-sidebar-chip[data-profile-key^='scene-'] {
    --profile-card-bg-a: rgba(145, 233, 255, 0.34);
    --profile-card-bg-b: rgba(83, 156, 246, 0.2);
    --profile-card-bg-c: rgba(19, 38, 86, 0.36);
    --profile-card-border: rgba(145, 233, 255, 0.42);
    --profile-card-shadow: rgba(94, 231, 255, 0.1);
    --profile-card-accent: rgba(145, 233, 255, 0.28);
}

.inspire-profile-chip[data-profile-key^='state-'],
.profile-sidebar-chip[data-profile-key^='state-'] {
    --profile-card-bg-a: rgba(255, 236, 154, 0.34);
    --profile-card-bg-b: rgba(130, 213, 187, 0.22);
    --profile-card-bg-c: rgba(34, 64, 45, 0.34);
    --profile-card-border: rgba(130, 213, 187, 0.44);
    --profile-card-shadow: rgba(130, 213, 187, 0.1);
    --profile-card-accent: rgba(255, 248, 223, 0.3);
}

.inspire-profile-chip[data-profile-key^='vibe-'],
.profile-sidebar-chip[data-profile-key^='vibe-'] {
    --profile-card-bg-a: rgba(248, 166, 178, 0.34);
    --profile-card-bg-b: rgba(183, 125, 238, 0.22);
    --profile-card-bg-c: rgba(63, 35, 88, 0.34);
    --profile-card-border: rgba(248, 166, 178, 0.44);
    --profile-card-shadow: rgba(248, 166, 178, 0.1);
    --profile-card-accent: rgba(255, 220, 228, 0.28);
}

.inspire-profile-chip[data-profile-key='scene-weekend'],
.profile-sidebar-chip[data-profile-key='scene-weekend'],
.inspire-profile-chip[data-profile-key='scene-cozy_evening'],
.profile-sidebar-chip[data-profile-key='scene-cozy_evening'] {
    --profile-card-bg-a: rgba(255, 236, 154, 0.44);
    --profile-card-bg-b: rgba(255, 188, 92, 0.22);
    --profile-card-border: rgba(255, 218, 102, 0.5);
}

.inspire-profile-chip[data-profile-key='scene-late_night'],
.profile-sidebar-chip[data-profile-key='scene-late_night'],
.inspire-profile-chip[data-profile-key='vibe-dark_gothic'],
.profile-sidebar-chip[data-profile-key='vibe-dark_gothic'] {
    --profile-card-bg-a: rgba(136, 157, 240, 0.34);
    --profile-card-bg-b: rgba(83, 68, 158, 0.25);
    --profile-card-bg-c: rgba(18, 22, 54, 0.54);
    --profile-card-border: rgba(136, 157, 240, 0.48);
}

.inspire-profile-chip[data-profile-key='scene-party'],
.profile-sidebar-chip[data-profile-key='scene-party'],
.inspire-profile-chip[data-profile-key='state-challenge'],
.profile-sidebar-chip[data-profile-key='state-challenge'] {
    --profile-card-bg-a: rgba(255, 202, 119, 0.48);
    --profile-card-bg-b: rgba(248, 134, 166, 0.32);
    --profile-card-border: rgba(248, 166, 178, 0.58);
}

.inspire-profile-chip[data-profile-key='vibe-animal_island'],
.profile-sidebar-chip[data-profile-key='vibe-animal_island'],
.inspire-profile-chip[data-profile-key='vibe-cozy_cute'],
.profile-sidebar-chip[data-profile-key='vibe-cozy_cute'] {
    --profile-card-bg-a: rgba(255, 248, 223, 0.5);
    --profile-card-bg-b: rgba(130, 213, 187, 0.28);
    --profile-card-bg-c: rgba(47, 78, 54, 0.32);
    --profile-card-border: rgba(130, 213, 187, 0.56);
}

.inspire-profile-chip[data-profile-key='vibe-cyber_neon'],
.profile-sidebar-chip[data-profile-key='vibe-cyber_neon'] {
    --profile-card-bg-a: rgba(94, 231, 255, 0.42);
    --profile-card-bg-b: rgba(139, 92, 246, 0.32);
    --profile-card-bg-c: rgba(26, 24, 72, 0.42);
    --profile-card-border: rgba(94, 231, 255, 0.58);
}

/* Profile icon shapes beyond Mood. */
.animal-profile-icon[data-profile-icon^='scene-']::before {
    inset: 6px;
    border-radius: 7px 9px 7px 10px;
    background: #91e9ff;
}

.animal-profile-icon[data-profile-icon='scene-short_break']::after,
.animal-profile-icon[data-profile-icon='scene-work_break']::after {
    left: 11px;
    top: 7px;
    width: 2px;
    height: 8px;
    background: #794f27;
    border-radius: 4px;
    box-shadow: 4px 5px 0 #794f27;
}

.animal-profile-icon[data-profile-icon='scene-weekend']::before,
.animal-profile-icon[data-profile-icon='scene-cozy_evening']::before {
    inset: 7px 6px 5px;
    border-radius: 4px 4px 7px 7px;
    background: #f7cd67;
    clip-path: polygon(50% 0, 100% 38%, 88% 38%, 88% 100%, 12% 100%, 12% 38%, 0 38%);
}

.animal-profile-icon[data-profile-icon='scene-late_night']::before,
.animal-profile-icon[data-profile-icon='mood-tired']::before {
    inset: 5px;
    border-radius: 999px;
    background: #889df0;
    box-shadow: 5px 0 0 #fff8df;
}

.animal-profile-icon[data-profile-icon='scene-party']::before,
.animal-profile-icon[data-profile-icon='mood-bold']::before {
    inset: 6px;
    border-radius: 5px;
    background: #f8a6b2;
    clip-path: polygon(50% 0, 64% 36%, 100% 34%, 70% 56%, 82% 100%, 50% 75%, 18% 100%, 30% 56%, 0 34%, 36% 36%);
}

.animal-profile-icon[data-profile-icon='scene-commute']::before {
    left: 5px;
    top: 8px;
    width: 16px;
    height: 10px;
    border-radius: 4px;
    background: #5e9cf6;
    box-shadow: -1px 8px 0 -4px #794f27, 11px 8px 0 -4px #794f27;
}

.animal-profile-icon[data-profile-icon='scene-rainy_day']::before,
.animal-profile-icon[data-profile-icon='vibe-watercolor']::before {
    left: 7px;
    top: 5px;
    width: 13px;
    height: 16px;
    border-radius: 999px 999px 999px 0;
    background: #91e9ff;
    transform: rotate(-35deg);
}

.animal-profile-icon[data-profile-icon^='state-']::before {
    inset: 6px;
    border-radius: 999px;
    background: #82d5bb;
}

.animal-profile-icon[data-profile-icon='state-challenge']::before,
.animal-profile-icon[data-profile-icon='state-mastery']::before {
    inset: 5px;
    background: #f7cd67;
    clip-path: polygon(50% 0, 92% 100%, 8% 100%);
}

.animal-profile-icon[data-profile-icon='state-immerse']::before {
    inset: 5px;
    border: 3px solid #889df0;
    background: transparent;
}

.animal-profile-icon[data-profile-icon='state-collect']::before {
    inset: 6px;
    background: #f7cd67;
    clip-path: polygon(50% 0, 100% 36%, 82% 100%, 18% 100%, 0 36%);
}

.animal-profile-icon[data-profile-icon='state-explore']::before {
    left: 6px;
    top: 6px;
    width: 14px;
    height: 13px;
    border-radius: 3px 8px 3px 8px;
    background: #82d5bb;
    transform: rotate(-12deg);
}

.animal-profile-icon[data-profile-icon='state-build']::before {
    inset: 5px;
    border-radius: 4px;
    background: #e59266;
    box-shadow: 7px 0 0 -1px #f7cd67, 3px 7px 0 -1px #82d5bb;
}

.animal-profile-icon[data-profile-icon='state-flow']::before {
    left: 5px;
    top: 11px;
    width: 17px;
    height: 8px;
    border-radius: 999px;
    background: #82d5bb;
    clip-path: polygon(0 60%, 22% 20%, 44% 60%, 66% 20%, 88% 60%, 100% 42%, 100% 100%, 0 100%);
}

.animal-profile-icon[data-profile-icon^='vibe-']::before {
    inset: 6px;
    border-radius: 8px;
    background: #f8a6b2;
}

.animal-profile-icon[data-profile-icon='vibe-cozy_cute']::before {
    inset: 6px;
    background: #f8a6b2;
    clip-path: polygon(50% 90%, 12% 50%, 20% 18%, 50% 30%, 80% 18%, 88% 50%);
}

.animal-profile-icon[data-profile-icon='vibe-animal_island']::before {
    left: 5px;
    top: 9px;
    width: 17px;
    height: 10px;
    border-radius: 999px 999px 7px 7px;
    background: #82d5bb;
    box-shadow: 3px -5px 0 -2px #f7cd67;
}

.animal-profile-icon[data-profile-icon='vibe-cyber_neon']::before {
    inset: 6px;
    border-radius: 999px;
    border: 3px solid #5ee7ff;
    background: transparent;
    box-shadow: 0 0 0 3px rgba(183, 125, 238, 0.35);
}

.animal-profile-icon[data-profile-icon='vibe-pixel_retro']::before {
    left: 6px;
    top: 6px;
    width: 6px;
    height: 6px;
    background: #f7cd67;
    box-shadow: 7px 0 0 #82d5bb, 0 7px 0 #f8a6b2, 7px 7px 0 #889df0;
}

.animal-profile-icon[data-profile-icon='vibe-storybook']::before {
    left: 6px;
    top: 6px;
    width: 15px;
    height: 14px;
    border-radius: 2px 7px 7px 2px;
    background: #fff8df;
    border-left: 3px solid #794f27;
}

.animal-profile-icon[data-profile-icon='vibe-dark_gothic']::before {
    inset: 5px;
    background: #889df0;
    clip-path: polygon(50% 0, 90% 28%, 75% 100%, 50% 78%, 25% 100%, 10% 28%);
}

.animal-profile-icon[data-profile-icon='vibe-clay_toy']::before {
    inset: 6px;
    border-radius: 40% 60% 45% 55%;
    background: #e59266;
}

/* ===== Transparent designer profile glyphs ===== */
.inspire-profile-chip .animal-profile-icon,
.profile-sidebar-chip .animal-profile-icon,
.inspire-profile-chip.selected .animal-profile-icon,
.profile-sidebar-chip.selected .animal-profile-icon {
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 1.75rem;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0;
    overflow: visible;
}

.inspire-profile-chip .animal-profile-icon::before,
.inspire-profile-chip .animal-profile-icon::after,
.profile-sidebar-chip .animal-profile-icon::before,
.profile-sidebar-chip .animal-profile-icon::after {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.28));
}

.animal-profile-icon::before {
    background: linear-gradient(135deg, #fff8df, #82d5bb);
}

.animal-profile-icon[data-profile-icon='mood-happy']::before {
    left: 5px;
    top: 5px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: radial-gradient(circle at 35% 32%, #fff8df 0 18%, #f7cd67 20% 66%, transparent 68%);
    box-shadow: none;
}

.animal-profile-icon[data-profile-icon='mood-happy']::after {
    left: 12px;
    top: 0;
    width: 4px;
    height: 28px;
    border-radius: 999px;
    background: #f7cd67;
    box-shadow: 0 0 0 0 transparent;
    transform: rotate(0deg);
    opacity: 0.9;
}

.animal-profile-icon[data-profile-icon='mood-calm']::before {
    left: 6px;
    top: 4px;
    width: 18px;
    height: 20px;
    border-radius: 999px 0 999px 999px;
    background: linear-gradient(135deg, #d7ffe9, #82d5bb 65%, #19c8b9);
    transform: rotate(-34deg);
}

.animal-profile-icon[data-profile-icon='mood-calm']::after {
    left: 13px;
    top: 8px;
    width: 2px;
    height: 13px;
    border-radius: 999px;
    background: rgba(38, 89, 72, 0.62);
    transform: rotate(-34deg);
}

.animal-profile-icon[data-profile-icon='mood-excited']::before,
.animal-profile-icon[data-profile-icon='scene-party']::before,
.animal-profile-icon[data-profile-icon='mood-bold']::before {
    inset: 3px;
    background: linear-gradient(135deg, #fff0a8, #f8a6b2 55%, #b77dee);
    clip-path: polygon(50% 0, 61% 34%, 98% 34%, 68% 55%, 80% 96%, 50% 72%, 20% 96%, 32% 55%, 2% 34%, 39% 34%);
}

.animal-profile-icon[data-profile-icon='mood-focused']::before,
.animal-profile-icon[data-profile-icon='vibe-cyber_neon']::before {
    inset: 4px;
    border-radius: 999px;
    border: 3px solid #5ee7ff;
    background: transparent;
    box-shadow: 0 0 0 3px rgba(183, 125, 238, 0.42), inset 0 0 0 3px rgba(94, 231, 255, 0.13);
}

.animal-profile-icon[data-profile-icon='mood-focused']::after,
.animal-profile-icon[data-profile-icon='vibe-cyber_neon']::after {
    inset: 11px;
    border-radius: 999px;
    background: #fff8df;
}

.animal-profile-icon[data-profile-icon='mood-tired']::before,
.animal-profile-icon[data-profile-icon='scene-late_night']::before {
    left: 4px;
    top: 4px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #889df0;
    box-shadow: 7px 0 0 #101828;
}

.animal-profile-icon[data-profile-icon='mood-nostalgic']::before {
    left: 5px;
    top: 8px;
    width: 19px;
    height: 14px;
    border-radius: 999px 999px 6px 6px;
    background: conic-gradient(from 210deg, #fff8df, #f7cd67, #e59266, #fff8df);
    clip-path: polygon(50% 0, 100% 45%, 90% 100%, 10% 100%, 0 45%);
}

.animal-profile-icon[data-profile-icon='mood-curious']::before {
    inset: 6px;
    border-radius: 999px;
    border: 3px solid #82d5bb;
    background: transparent;
}

.animal-profile-icon[data-profile-icon='mood-curious']::after {
    left: 18px;
    top: 18px;
    width: 8px;
    height: 3px;
    border-radius: 999px;
    background: #82d5bb;
    transform: rotate(42deg);
}

.animal-profile-icon[data-profile-icon^='scene-']::before {
    background: linear-gradient(135deg, #d7f4ff, #91e9ff 55%, #5e9cf6);
}

.animal-profile-icon[data-profile-icon='scene-short_break']::before,
.animal-profile-icon[data-profile-icon='scene-work_break']::before {
    inset: 5px;
    border-radius: 999px;
    border: 3px solid #91e9ff;
    background: transparent;
}

.animal-profile-icon[data-profile-icon='scene-short_break']::after,
.animal-profile-icon[data-profile-icon='scene-work_break']::after {
    left: 13px;
    top: 7px;
    width: 2px;
    height: 9px;
    background: #fff8df;
    border-radius: 999px;
    box-shadow: 4px 5px 0 #fff8df;
}

.animal-profile-icon[data-profile-icon='scene-weekend']::before,
.animal-profile-icon[data-profile-icon='scene-cozy_evening']::before {
    inset: 5px 4px 4px;
    border-radius: 3px 3px 8px 8px;
    background: linear-gradient(135deg, #fff8df, #f7cd67 58%, #e59266);
    clip-path: polygon(50% 0, 100% 39%, 88% 39%, 88% 100%, 12% 100%, 12% 39%, 0 39%);
}

.animal-profile-icon[data-profile-icon='scene-commute']::before {
    left: 4px;
    top: 8px;
    width: 20px;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(135deg, #91e9ff, #5e9cf6);
    box-shadow: -1px 9px 0 -4px #fff8df, 14px 9px 0 -4px #fff8df;
}

.animal-profile-icon[data-profile-icon='scene-rainy_day']::before,
.animal-profile-icon[data-profile-icon='vibe-watercolor']::before {
    left: 6px;
    top: 3px;
    width: 17px;
    height: 22px;
    border-radius: 999px 999px 999px 0;
    background: linear-gradient(135deg, #e8f7ff, #91e9ff 54%, #f8a6b2);
    transform: rotate(-35deg);
}

.animal-profile-icon[data-profile-icon^='state-']::before {
    background: linear-gradient(135deg, #e9ffef, #82d5bb 58%, #19c8b9);
}

.animal-profile-icon[data-profile-icon='state-challenge']::before,
.animal-profile-icon[data-profile-icon='state-mastery']::before {
    inset: 4px;
    background: linear-gradient(135deg, #fff8df, #f7cd67 58%, #e59266);
    clip-path: polygon(50% 0, 94% 100%, 6% 100%);
}

.animal-profile-icon[data-profile-icon='state-immerse']::before {
    inset: 4px;
    border-radius: 999px;
    border: 3px solid #889df0;
    background: transparent;
}

.animal-profile-icon[data-profile-icon='state-collect']::before {
    inset: 5px;
    background: linear-gradient(135deg, #fff8df, #f7cd67 60%, #82d5bb);
    clip-path: polygon(50% 0, 100% 36%, 82% 100%, 18% 100%, 0 36%);
}

.animal-profile-icon[data-profile-icon='state-explore']::before {
    left: 5px;
    top: 5px;
    width: 18px;
    height: 17px;
    border-radius: 3px 9px 3px 9px;
    background: linear-gradient(135deg, #fff8df, #82d5bb 70%);
    transform: rotate(-12deg);
}

.animal-profile-icon[data-profile-icon='state-build']::before {
    left: 5px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: #e59266;
    box-shadow: 10px 0 0 #f7cd67, 5px 10px 0 #82d5bb;
}

.animal-profile-icon[data-profile-icon='state-flow']::before {
    left: 4px;
    top: 10px;
    width: 21px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #d7ffe9, #82d5bb);
    clip-path: polygon(0 60%, 22% 20%, 44% 60%, 66% 20%, 88% 60%, 100% 42%, 100% 100%, 0 100%);
}

.animal-profile-icon[data-profile-icon^='vibe-']::before {
    background: linear-gradient(135deg, #fff8df, #f8a6b2 62%, #b77dee);
}

.animal-profile-icon[data-profile-icon='vibe-cozy_cute']::before {
    inset: 4px;
    background: linear-gradient(135deg, #fff8df, #f8a6b2 72%);
    clip-path: polygon(50% 91%, 12% 50%, 20% 18%, 50% 30%, 80% 18%, 88% 50%);
}

.animal-profile-icon[data-profile-icon='vibe-animal_island']::before {
    left: 4px;
    top: 10px;
    width: 20px;
    height: 12px;
    border-radius: 999px 999px 7px 7px;
    background: linear-gradient(135deg, #d7ffe9, #82d5bb 70%);
    box-shadow: 4px -6px 0 -2px #f7cd67;
}

.animal-profile-icon[data-profile-icon='vibe-pixel_retro']::before {
    left: 5px;
    top: 5px;
    width: 7px;
    height: 7px;
    background: #f7cd67;
    box-shadow: 8px 0 0 #82d5bb, 0 8px 0 #f8a6b2, 8px 8px 0 #889df0;
}

.animal-profile-icon[data-profile-icon='vibe-storybook']::before {
    left: 6px;
    top: 5px;
    width: 17px;
    height: 18px;
    border-radius: 2px 8px 8px 2px;
    background: linear-gradient(135deg, #fff8df, #f3dfb7);
    border-left: 3px solid #794f27;
}

.animal-profile-icon[data-profile-icon='vibe-dark_gothic']::before {
    inset: 4px;
    background: linear-gradient(135deg, #d8ddff, #889df0 62%, #4b4d88);
    clip-path: polygon(50% 0, 92% 28%, 75% 100%, 50% 78%, 25% 100%, 8% 28%);
}

.animal-profile-icon[data-profile-icon='vibe-clay_toy']::before {
    inset: 5px;
    border-radius: 43% 57% 47% 53%;
    background: linear-gradient(135deg, #fff8df, #e59266 68%);
}

/* ===== Profile option alignment: fixed left icon, centered label ===== */
.inspire-profile-chip[data-profile-key] {
    display: grid !important;
    grid-template-columns: 2.15rem minmax(0, 1fr) 2.15rem;
    align-items: center;
    justify-items: center;
    column-gap: 0.18rem;
    text-align: center;
}

.inspire-profile-chip[data-profile-key] .animal-profile-icon {
    grid-column: 1;
    justify-self: center;
    margin: 0;
}

.inspire-profile-chip[data-profile-key] > span:not(.animal-profile-icon) {
    grid-column: 2;
    justify-self: center;
    width: 100%;
    min-width: 0;
    text-align: center;
    line-height: 1.14;
}

.inspire-profile-chip[data-profile-key]::after {
    grid-column: 3;
}

/* ===== Profile option fixed card width and readable wrapping ===== */
.inspire-profile-grid {
    grid-template-columns: repeat(2, 13.25rem);
    justify-content: center;
    gap: 0.65rem 0.75rem;
}

.inspire-profile-chip[data-profile-key] {
    width: 13.25rem;
    min-height: 4.25rem;
    grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
    padding: 0.76rem 0.82rem;
}

.inspire-profile-chip[data-profile-key] > span:not(.animal-profile-icon) {
    max-width: 7.2rem;
    margin: 0 auto;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
    line-height: 1.16;
}

@media (max-width: 520px) {
    .inspire-profile-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
    }

    .inspire-profile-chip[data-profile-key] {
        width: 100%;
        grid-template-columns: 2.2rem minmax(0, 1fr) 2.2rem;
    }

    .inspire-profile-chip[data-profile-key] > span:not(.animal-profile-icon) {
        max-width: 6.4rem;
    }
}

/* ===== Profile card color cycle ===== */
.inspire-profile-chip[data-profile-color='0'],
.profile-sidebar-chip[data-profile-color='0'] {
    --profile-card-bg-a: rgba(255, 248, 223, 0.46);
    --profile-card-bg-b: rgba(130, 213, 187, 0.24);
    --profile-card-bg-c: rgba(47, 78, 54, 0.32);
    --profile-card-border: rgba(130, 213, 187, 0.58);
    --profile-card-shadow: rgba(130, 213, 187, 0.11);
    --profile-card-accent: rgba(255, 248, 223, 0.36);
}

.inspire-profile-chip[data-profile-color='1'],
.profile-sidebar-chip[data-profile-color='1'] {
    --profile-card-bg-a: rgba(145, 233, 255, 0.42);
    --profile-card-bg-b: rgba(83, 156, 246, 0.28);
    --profile-card-bg-c: rgba(21, 37, 92, 0.42);
    --profile-card-border: rgba(94, 231, 255, 0.58);
    --profile-card-shadow: rgba(94, 231, 255, 0.12);
    --profile-card-accent: rgba(177, 245, 255, 0.3);
}

.inspire-profile-chip[data-profile-color='2'],
.profile-sidebar-chip[data-profile-color='2'] {
    --profile-card-bg-a: rgba(248, 166, 178, 0.4);
    --profile-card-bg-b: rgba(183, 125, 238, 0.26);
    --profile-card-bg-c: rgba(63, 35, 88, 0.38);
    --profile-card-border: rgba(248, 166, 178, 0.52);
    --profile-card-shadow: rgba(248, 166, 178, 0.12);
    --profile-card-accent: rgba(255, 220, 228, 0.3);
}

.inspire-profile-chip[data-profile-color='3'],
.profile-sidebar-chip[data-profile-color='3'] {
    --profile-card-bg-a: rgba(255, 236, 154, 0.5);
    --profile-card-bg-b: rgba(255, 188, 92, 0.24);
    --profile-card-bg-c: rgba(80, 54, 28, 0.36);
    --profile-card-border: rgba(255, 218, 102, 0.56);
    --profile-card-shadow: rgba(255, 191, 64, 0.12);
    --profile-card-accent: rgba(255, 245, 190, 0.34);
}

.inspire-profile-chip[data-profile-color='4'],
.profile-sidebar-chip[data-profile-color='4'] {
    --profile-card-bg-a: rgba(136, 157, 240, 0.42);
    --profile-card-bg-b: rgba(83, 68, 158, 0.28);
    --profile-card-bg-c: rgba(18, 22, 54, 0.52);
    --profile-card-border: rgba(136, 157, 240, 0.52);
    --profile-card-shadow: rgba(136, 157, 240, 0.1);
    --profile-card-accent: rgba(210, 217, 255, 0.28);
}

.inspire-profile-chip[data-profile-color='5'],
.profile-sidebar-chip[data-profile-color='5'] {
    --profile-card-bg-a: rgba(229, 146, 102, 0.44);
    --profile-card-bg-b: rgba(248, 166, 178, 0.22);
    --profile-card-bg-c: rgba(84, 43, 42, 0.36);
    --profile-card-border: rgba(229, 146, 102, 0.56);
    --profile-card-shadow: rgba(229, 146, 102, 0.11);
    --profile-card-accent: rgba(255, 218, 190, 0.3);
}

.inspire-profile-chip[data-profile-color='6'],
.profile-sidebar-chip[data-profile-color='6'] {
    --profile-card-bg-a: rgba(209, 218, 73, 0.36);
    --profile-card-bg-b: rgba(138, 198, 138, 0.26);
    --profile-card-bg-c: rgba(40, 69, 35, 0.38);
    --profile-card-border: rgba(177, 214, 106, 0.52);
    --profile-card-shadow: rgba(177, 214, 106, 0.1);
    --profile-card-accent: rgba(236, 239, 154, 0.26);
}

.inspire-profile-chip[data-profile-color='7'],
.profile-sidebar-chip[data-profile-color='7'] {
    --profile-card-bg-a: rgba(255, 248, 223, 0.34);
    --profile-card-bg-b: rgba(159, 146, 125, 0.22);
    --profile-card-bg-c: rgba(37, 44, 62, 0.5);
    --profile-card-border: rgba(196, 184, 158, 0.48);
    --profile-card-shadow: rgba(196, 184, 158, 0.08);
    --profile-card-accent: rgba(255, 248, 223, 0.24);
}

/* ===== Profile recommendation continuation guidance ===== */
.inspire-profile-recommendation-hint {
    margin: 0.7rem 0 0.85rem;
    padding: 0.72rem 0.86rem;
    border: 1px solid rgba(116, 229, 255, 0.22);
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(94, 231, 255, 0.12), rgba(139, 92, 246, 0.14)),
        rgba(8, 13, 30, 0.72);
    color: rgba(235, 247, 255, 0.9);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.45;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.inspire-profile-recommendation-hint.is-fallback {
    border-color: rgba(245, 158, 11, 0.34);
    background:
        linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(139, 92, 246, 0.12)),
        rgba(8, 13, 30, 0.78);
    color: rgba(255, 236, 190, 0.96);
}

/* ===== Chat composer long draft containment ===== */
.chat-real-input {
    max-height: 10rem !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(116, 229, 255, 0.36) transparent;
}

.chat-real-input::-webkit-scrollbar {
    width: 6px;
}

.chat-real-input::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(116, 229, 255, 0.34);
}

.chat-real-input::-webkit-scrollbar-track {
    background: transparent;
}

/* ===== Composer input-first layout ===== */
.chat-input-bar.unified-pill {
    --composer-model-width: 104px;
}

.chat-composer-row {
    gap: 0.38rem;
}

.chat-composer-row .plus-btn {
    order: 1;
}

.chat-real-input {
    order: 2;
    flex: 1 1 auto;
    min-width: 7rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.chat-char-count {
    order: 3;
    height: 1.75rem;
    min-width: 0;
    padding: 0.08rem 0.42rem;
    margin: 0;
    border-right: 0;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.08);
    color: rgba(226, 232, 240, 0.48);
    font-size: 0.67rem;
    line-height: 1;
    opacity: 0.72;
}

.chat-char-count[data-count-state='mid'] {
    background: rgba(116, 229, 255, 0.1);
    color: rgba(226, 246, 255, 0.72);
    opacity: 0.94;
}

.chat-char-count[data-count-state='warning'] {
    background: rgba(245, 158, 11, 0.14);
    color: rgba(255, 222, 153, 0.96);
    opacity: 1;
}

.chat-char-count[data-count-state='full'] {
    background: rgba(239, 68, 68, 0.16);
    color: rgba(255, 167, 167, 1);
    opacity: 1;
}

.right-actions {
    order: 4;
    gap: 0.35rem;
    flex: 0 0 auto;
}

.input-model-selector .model-selector {
    width: var(--composer-model-width);
    min-width: var(--composer-model-width);
    max-width: var(--composer-model-width);
    height: 34px;
    gap: 0.34rem;
    padding: 0.4rem 0.5rem;
    justify-content: center;
}

.input-model-selector .model-selector svg {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
}

.input-model-selector .model-name {
    display: block;
    max-width: calc(var(--composer-model-width) - 34px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .chat-input-bar.unified-pill {
        --composer-model-width: 86px;
    }

    .chat-composer-row {
        gap: 0.28rem;
    }

    .chat-char-count {
        max-width: 3.35rem;
        padding-inline: 0.32rem;
        font-size: 0.62rem;
        overflow: hidden;
        text-overflow: clip;
    }

    .input-model-selector .model-selector {
        height: 32px;
        padding-inline: 0.42rem;
        font-size: 0.72rem;
    }

    .input-model-selector .model-name {
        max-width: calc(var(--composer-model-width) - 30px);
    }
}

@media (max-width: 420px) {
    .chat-input-bar.unified-pill {
        --composer-model-width: 54px;
    }

    .input-model-selector .model-name {
        max-width: 1.35rem;
    }

    .chat-char-count[data-count-state='normal'] {
        display: none;
    }
}

/* ===== Mobile generated workspace drawers ===== */
@media (max-width: 720px) {
    body.game-edit-workspace-active .chat-history {
        --chat-stage-width: min(100%, calc(100vw - 16px));
        padding: 0.45rem 0.5rem 0.75rem;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(100%, calc(100vw - 18px));
        padding: 0.5rem 0 0.65rem;
    }

    .chat-message.has-game-workspace {
        width: min(100%, calc(100vw - 16px));
    }

    .generated-game-page {
        display: grid !important;
        grid-template-rows: auto 1fr;
        max-height: calc(100dvh - 148px);
        min-height: 0;
        overflow: hidden !important;
        border-radius: 18px;
    }

    .generated-game-page .generated-page-header {
        gap: 0.65rem;
        padding: 0.72rem 0.78rem;
    }

    .generated-game-page .workspace-title-block {
        gap: 0.26rem;
    }

    .generated-game-page .workspace-title-block > small {
        font-size: 0.58rem;
        letter-spacing: 0.08em;
    }

    .generated-game-page .workspace-title-block > strong {
        font-size: 0.95rem;
        line-height: 1.15;
    }

    .generated-game-page .workspace-title-block > span {
        display: none;
    }

    .generated-game-page .workspace-status-strip {
        gap: 0.25rem;
        max-height: 1.8rem;
        overflow: hidden;
    }

    .generated-game-page .workspace-status-pill {
        padding: 0.2rem 0.42rem;
        font-size: 0.56rem;
    }

    .generated-game-page .workspace-header-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
        width: 100%;
    }

    .generated-game-page .workspace-header-actions .workspace-header-btn {
        min-height: 34px;
        padding: 0.42rem 0.5rem;
        font-size: 0.68rem;
    }

    .generated-game-page .workspace-save-state {
        display: none;
    }

    .generated-game-page .workspace-mode-switch {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem;
        padding: 0.18rem;
    }

    .generated-game-page .workspace-body {
        position: relative;
        display: block !important;
        height: 100%;
        min-height: 0;
        padding: 0.58rem;
        overflow: hidden !important;
    }

    .generated-game-page .game-preview-column {
        position: relative !important;
        z-index: 1;
        width: 100%;
        height: 100%;
        min-height: 0 !important;
        overflow: auto !important;
        border-radius: 16px;
    }

    .generated-game-page .playable-shell {
        display: grid;
        grid-template-rows: auto minmax(170px, 1fr);
        gap: 0.65rem;
        height: auto;
        min-height: 100%;
    }

    .generated-game-page .playable-preview-card {
        min-height: 280px;
        padding: 0.68rem;
    }

    .generated-game-page .generated-preview-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.22rem;
        margin-bottom: 0.5rem;
    }

    .generated-game-page .generated-preview-hero > strong {
        font-size: 1rem;
        line-height: 1.15;
    }

    .generated-game-page .generated-preview-hero > small,
    .generated-game-page .preview-card-hint {
        font-size: 0.68rem;
    }

    .generated-game-page .preview-hero-badges {
        display: none;
    }

    .generated-game-page .preview-card-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.35rem;
    }

    .generated-game-page .game-preview-btn {
        min-height: 32px;
        padding: 0.38rem 0.42rem;
        font-size: 0.66rem;
    }

    .generated-game-page .game-preview-viewport {
        min-height: 180px;
        max-height: 38dvh;
    }

    .generated-game-page .game-preview-chat-panel {
        min-height: 160px;
        max-height: none;
        padding: 0.72rem;
    }

    .generated-game-page .preview-chat-lead,
    .generated-game-page .preview-chat-points,
    .generated-game-page .preview-chat-assistant-note {
        font-size: 0.75rem;
        line-height: 1.42;
    }

    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar {
        position: fixed !important;
        top: 4.45rem !important;
        bottom: 6.65rem !important;
        z-index: 80;
        width: min(86vw, 340px) !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: auto !important;
        overscroll-behavior: contain;
        border-radius: 18px;
        box-shadow: 0 26px 78px rgba(0, 0, 0, 0.52);
        transition: transform 0.24s ease;
    }

    .generated-game-page .change-history-sidebar {
        left: 0;
        transform: translateX(calc(-100% + 42px)) !important;
        padding-right: 0.7rem;
    }

    .generated-game-page .game-edit-sidebar {
        right: 0;
        transform: translateX(calc(100% - 42px)) !important;
        padding-left: 0.7rem;
    }

    .generated-game-page .change-history-sidebar.open,
    .generated-game-page .game-edit-sidebar.open {
        transform: translateX(0) !important;
    }

    .generated-game-page .workspace-panel-toggle {
        display: inline-flex !important;
        position: fixed;
        top: 50%;
        z-index: 92;
        width: 42px;
        height: 78px;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(116, 229, 255, 0.28);
        background: rgba(12, 18, 40, 0.94);
        color: #dff8ff;
        font-size: 1.45rem;
        box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
        transform: translateY(-50%);
    }

    .generated-game-page .workspace-panel-toggle-left {
        left: 0;
        right: auto;
        border-radius: 0 18px 18px 0;
    }

    .generated-game-page .workspace-panel-toggle-right {
        right: 0;
        left: auto;
        border-radius: 18px 0 0 18px;
    }

    .generated-game-page .change-history-sidebar.open .workspace-panel-toggle-left {
        left: min(86vw, 340px);
        transform: translate(-42px, -50%);
    }

    .generated-game-page .game-edit-sidebar.open .workspace-panel-toggle-right {
        right: min(86vw, 340px);
        transform: translate(42px, -50%);
    }
}

/* ===== Mobile drawer handle and compact header correction ===== */
@media (max-width: 720px) {
    .generated-game-page .workspace-status-strip {
        display: none !important;
    }

    .generated-game-page .generated-page-header {
        align-items: stretch;
        padding: 0.62rem 0.68rem !important;
    }

    .generated-game-page .workspace-header-actions {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    }

    .generated-game-page .workspace-mode-switch {
        min-height: 36px;
    }

    .generated-game-page .change-history-sidebar {
        transform: translateX(-100%) !important;
    }

    .generated-game-page .game-edit-sidebar {
        transform: translateX(100%) !important;
    }

    .generated-game-page .change-history-sidebar.open,
    .generated-game-page .game-edit-sidebar.open {
        transform: translateX(0) !important;
    }

    .generated-game-page .workspace-panel-toggle {
        position: absolute !important;
        top: 50% !important;
        z-index: 3 !important;
        transform: translateY(-50%) !important;
        pointer-events: auto;
    }

    .generated-game-page .workspace-panel-toggle-left {
        left: auto !important;
        right: -42px !important;
        border-radius: 0 18px 18px 0;
    }

    .generated-game-page .workspace-panel-toggle-right {
        left: -42px !important;
        right: auto !important;
        border-radius: 18px 0 0 18px;
    }

    .generated-game-page .change-history-sidebar.open .workspace-panel-toggle-left,
    .generated-game-page .game-edit-sidebar.open .workspace-panel-toggle-right {
        left: auto;
        right: auto;
        transform: translateY(-50%) !important;
    }
}

/* ===== Body-level mobile drawer handles ===== */
.mobile-workspace-drawer-toggle {
    display: none;
}

@media (max-width: 720px) {
    body.game-edit-workspace-active .mobile-workspace-drawer-toggle {
        position: fixed;
        top: 50%;
        z-index: 140;
        display: inline-flex;
        width: 42px;
        height: 78px;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(116, 229, 255, 0.3);
        background: rgba(12, 18, 40, 0.96);
        color: #dff8ff;
        font: inherit;
        font-size: 1.5rem;
        font-weight: 900;
        cursor: pointer;
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.46);
        transform: translateY(-50%);
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle-history {
        left: 0;
        border-radius: 0 18px 18px 0;
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle-edit {
        right: 0;
        border-radius: 18px 0 0 18px;
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle.open {
        background: linear-gradient(135deg, rgba(94, 231, 255, 0.24), rgba(139, 92, 246, 0.3)), rgba(12, 18, 40, 0.98);
        border-color: rgba(116, 229, 255, 0.52);
    }

    .generated-game-page .workspace-panel-toggle {
        display: none !important;
    }
}

/* ===== Mobile drawer handle hit-layer fix ===== */
@media (max-width: 720px) {
    body.game-edit-workspace-active .mobile-workspace-drawer-toggle {
        z-index: 2147483000 !important;
        pointer-events: auto !important;
    }
}

/* ===== Mobile drawer handle labels ===== */
@media (max-width: 720px) {
    body.game-edit-workspace-active .mobile-workspace-drawer-toggle {
        width: 48px;
        height: 112px;
        flex-direction: column;
        gap: 0.22rem;
        font-size: 1.32rem;
        line-height: 1;
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle::after {
        content: attr(data-drawer-label);
        writing-mode: vertical-rl;
        text-orientation: mixed;
        color: rgba(226, 246, 255, 0.78);
        font-size: 0.56rem;
        font-weight: 900;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle-history::after {
        content: 'History';
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle-edit::after {
        content: 'Tools';
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle-history {
        border-radius: 0 20px 20px 0;
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle-edit {
        border-radius: 20px 0 0 20px;
    }
}

/* ===== Mobile generated page information priority ===== */
.workspace-sidebar-mode-panel {
    display: none;
}

.workspace-compact-mode-warning {
    display: none;
}

@media (max-width: 1023px) {
    .workspace-sidebar-mode-panel {
        display: grid;
        gap: 0.58rem;
        margin: 0 0 0.72rem;
        padding: 0.72rem;
        border: 1px solid rgba(116, 229, 255, 0.16);
        border-radius: 16px;
        background: rgba(8, 13, 30, 0.68);
    }

    .workspace-sidebar-mode-head {
        display: grid;
        gap: 0.18rem;
    }

    .workspace-sidebar-mode-head strong {
        color: rgba(248, 250, 252, 0.94);
        font-size: 0.82rem;
        font-weight: 900;
    }

    .workspace-sidebar-mode-head small {
        color: rgba(148, 163, 184, 0.78);
        font-size: 0.68rem;
        line-height: 1.35;
    }

    .workspace-sidebar-mode-panel .sidebar-mode-switch {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.36rem;
        padding: 0.18rem;
        border-radius: 14px;
        background: rgba(2, 6, 23, 0.48);
        border: 1px solid rgba(148, 163, 184, 0.12);
    }

    .workspace-sidebar-mode-panel .sidebar-mode-switch .workspace-header-btn {
        min-height: 34px;
        padding: 0.38rem 0.48rem;
        font-size: 0.68rem;
    }

    .workspace-sidebar-mode-panel [data-workspace-mode-set='advanced']::after {
        content: 'PC';
        margin-left: 0.28rem;
        padding: 0.08rem 0.25rem;
        border-radius: 999px;
        background: rgba(245, 158, 11, 0.16);
        color: rgba(255, 226, 166, 0.95);
        font-size: 0.52rem;
        font-weight: 900;
        letter-spacing: 0.04em;
    }

    .workspace-compact-mode-warning {
        display: block;
        padding: 0.62rem 0.68rem;
        border: 1px solid rgba(245, 158, 11, 0.28);
        border-radius: 14px;
        background:
            linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(139, 92, 246, 0.12)),
            rgba(17, 24, 39, 0.78);
        color: rgba(255, 244, 214, 0.94);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }

    .workspace-compact-mode-warning strong,
    .workspace-compact-mode-warning span {
        display: block;
    }

    .workspace-compact-mode-warning strong {
        margin-bottom: 0.18rem;
        font-size: 0.72rem;
        font-weight: 900;
    }

    .workspace-compact-mode-warning span {
        color: rgba(255, 236, 194, 0.76);
        font-size: 0.64rem;
        line-height: 1.38;
    }
}

@media (max-width: 720px) {
    .generation-result > .generation-status,
    .generation-result > .generation-title,
    .generation-result > .generation-meta,
    .generation-result > .ai-pipeline-summary,
    .generation-result > .production-applied-summary,
    .generation-result > .generated-workspace-topbar,
    .generation-result > .generated-workspace-files-card {
        display: none !important;
    }

    .generated-game-page .generated-page-header .workspace-mode-switch {
        display: none !important;
    }

    .generated-game-page .workspace-title-block > small,
    .generated-game-page .workspace-title-block > span,
    .generated-game-page .workspace-status-strip {
        display: none !important;
    }

    .generated-game-page .generated-page-header {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.54rem;
        padding: 0.58rem 0.64rem !important;
    }

    .generated-game-page .workspace-header-actions {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.42rem;
    }

    .generated-game-page .workspace-header-actions .workspace-header-btn:not(.is-mode) {
        min-height: 34px;
        border-radius: 12px;
    }

    .generated-game-page .workspace-save-state {
        display: none !important;
    }

    .generated-game-page .game-edit-sidebar .workspace-panel-head {
        margin-bottom: 0.58rem;
    }

    .generated-game-page .game-edit-sidebar .workspace-panel-head small {
        display: none;
    }
}

/* ===== Mobile chat / preview fixed switch ===== */
.mobile-workspace-view-switch {
    display: none;
}

@media (max-width: 720px) {
    body.game-edit-workspace-active .mobile-workspace-view-switch {
        position: fixed;
        left: 50%;
        bottom: 6.25rem;
        z-index: 2147482500;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.18rem;
        width: min(15.5rem, calc(100vw - 7.5rem));
        padding: 0.18rem;
        border: 1px solid rgba(116, 229, 255, 0.26);
        border-radius: 999px;
        background: rgba(8, 13, 30, 0.92);
        box-shadow: 0 16px 44px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
        backdrop-filter: blur(16px);
        transform: translateX(-50%);
    }

    body.game-edit-workspace-active .mobile-workspace-view-switch button {
        min-width: 0;
        min-height: 34px;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: rgba(226, 232, 240, 0.72);
        font: inherit;
        font-size: 0.72rem;
        font-weight: 900;
        letter-spacing: 0.01em;
        cursor: pointer;
    }

    body.game-edit-workspace-active .mobile-workspace-view-switch button.active {
        color: #ffffff;
        background: linear-gradient(135deg, rgba(94, 231, 255, 0.88), rgba(139, 92, 246, 0.9));
        box-shadow: 0 10px 28px rgba(94, 231, 255, 0.22);
    }

    body.game-edit-workspace-active .mobile-workspace-view-switch button[data-mobile-workspace-view='preview'].active {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.94), rgba(240, 147, 251, 0.88));
        box-shadow: 0 10px 28px rgba(139, 92, 246, 0.28);
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        padding-top: 2.75rem;
    }

    body.game-edit-workspace-active .chat-upload-limit-note {
        margin-top: 0.3rem;
    }
}

/* ===== Mobile chat view starts at latest message ===== */
@media (max-width: 720px) {
    .generated-game-page .game-preview-chat-panel {
        max-height: min(44dvh, 23rem);
        overflow-y: auto !important;
        overscroll-behavior: contain;
        scroll-behavior: smooth;
    }

    .generated-game-page .playable-shell:not(.preview-open) .game-preview-chat-panel {
        display: grid !important;
    }
}

/* ===== Code Tree Virtual File Browser ===== */
.code-workspace-panel.compact {
    min-height: 300px;
    max-height: 430px;
    grid-template-columns: minmax(150px, 0.48fr) minmax(0, 0.52fr);
}

.code-workspace-panel.compact .code-file-tree {
    max-height: none;
    border-right: 1px solid rgba(120, 140, 255, 0.12);
    border-bottom: 0;
}

.code-tree-list {
    position: relative;
    min-width: 0;
    display: grid;
    gap: 0.12rem;
}

.code-tree-empty {
    padding: 0.7rem;
    border-radius: 10px;
    color: rgba(203, 213, 225, 0.7);
    background: rgba(255, 255, 255, 0.035);
    border: 1px dashed rgba(148, 163, 184, 0.16);
    font-size: 0.66rem;
    font-weight: 800;
}

.code-tree-folder {
    position: relative;
    min-width: 0;
}

.code-tree-folder::before {
    content: "";
    position: absolute;
    left: calc(1.02rem + (var(--depth, 0) * 0.7rem));
    top: 30px;
    bottom: 3px;
    width: 1px;
    background: linear-gradient(180deg, rgba(94, 231, 255, 0.26), rgba(124, 109, 255, 0.08));
    pointer-events: none;
}

.code-tree-folder:not([open])::before {
    display: none;
}

.code-tree-folder summary.active {
    border: 1px solid rgba(94, 231, 255, 0.18);
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.1), rgba(124, 109, 255, 0.12));
    color: #fff;
}

.code-tree-file {
    position: relative;
}

.code-tree-file::before {
    content: "";
    position: absolute;
    left: calc(0.7rem + (var(--depth, 0) * 0.7rem));
    top: 50%;
    width: 0.48rem;
    height: 1px;
    background: rgba(94, 231, 255, 0.22);
}

.code-preview {
    margin: 0;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 0;
    color: rgba(230, 235, 255, 0.86);
    font-size: 0.62rem;
    line-height: 1.55;
    white-space: normal;
}

.code-preview-text {
    min-width: max-content;
    min-height: 100%;
    margin: 0;
    padding: 0.72rem;
    color: rgba(230, 235, 255, 0.86);
    font-family: "Cascadia Code", Consolas, monospace;
    white-space: pre;
}

.code-preview-empty,
.code-preview-asset {
    margin: 0.72rem;
    padding: 0.82rem;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.38);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.code-preview-empty strong {
    display: block;
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 950;
    margin-bottom: 0.28rem;
}

.code-preview-empty p {
    margin: 0;
    color: rgba(203, 213, 225, 0.7);
    font-size: 0.66rem;
    line-height: 1.55;
}

.code-preview-asset {
    display: grid;
    gap: 0.8rem;
}

.code-preview-image {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 10px;
    background:
        linear-gradient(45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.055) 75%),
        linear-gradient(45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.055) 75%),
        rgba(15, 23, 42, 0.72);
    background-position: 0 0, 8px 8px;
    background-size: 16px 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.code-preview-image-placeholder {
    min-height: 120px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: rgba(226, 232, 240, 0.72);
    background: rgba(15, 23, 42, 0.68);
    border: 1px dashed rgba(148, 163, 184, 0.18);
    font-size: 0.72rem;
    font-weight: 900;
}

.code-preview-asset dl {
    display: grid;
    gap: 0.44rem;
    margin: 0;
}

.code-preview-asset dl div {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 0.5rem;
}

.code-preview-asset dt {
    color: rgba(94, 231, 255, 0.72);
    font-size: 0.58rem;
    font-weight: 950;
    text-transform: uppercase;
}

.code-preview-asset dd {
    min-width: 0;
    margin: 0;
    color: rgba(226, 232, 240, 0.82);
    font-size: 0.64rem;
    overflow-wrap: anywhere;
}

.workspace-code-modal .code-workspace-panel {
    grid-template-columns: minmax(300px, 0.34fr) minmax(0, 1fr);
}

/* ===== Page-level Generated Game Layout v2 ===== */
body.game-edit-workspace-active .chat-history {
    --chat-stage-width: min(1760px, calc(100vw - 36px));
    padding: 0.9rem 1.1rem 1.2rem;
}

body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.generated-game-page {
    --page-left-width: 280px;
    --page-right-width: 400px;
    --page-gap: 14px;
    display: block !important;
    min-height: min(790px, calc(100vh - 168px));
    max-height: calc(100vh - 158px);
    overflow: visible !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.generated-game-page .generated-page-layout {
    height: 100%;
    min-height: 0;
    display: grid !important;
    grid-template-columns: var(--page-left-width) minmax(720px, 1fr) var(--page-right-width);
    gap: var(--page-gap);
    padding: 0;
    overflow: visible;
}

.generated-game-page .change-history-sidebar,
.generated-game-page .game-edit-sidebar,
.generated-game-page .game-preview-column {
    position: relative !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    min-height: 0;
    max-height: calc(100vh - 160px);
    transform: none !important;
    border-radius: 18px;
    overflow: hidden;
}

.generated-game-page .version-history-panel {
    padding: 0.95rem;
    border: 1px solid rgba(116, 229, 255, 0.14);
    background:
        radial-gradient(circle at 0% 12%, rgba(116, 229, 255, 0.06), transparent 34%),
        rgba(8, 13, 30, 0.74);
}

.generated-game-page .generated-main-panel {
    padding: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.8rem;
    border: 1px solid rgba(94, 231, 255, 0.28);
    background:
        radial-gradient(circle at 50% 0%, rgba(94, 231, 255, 0.08), transparent 34%),
        rgba(3, 7, 18, 0.94);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.generated-main-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 1rem;
    padding: 1rem 1.05rem 0;
}

.generated-main-header .workspace-title-block > small {
    color: rgba(94, 231, 255, 0.86);
    font-size: 0.62rem;
    font-weight: 950;
    text-transform: uppercase;
}

.generated-main-header .workspace-title-block > span {
    color: rgba(203, 213, 225, 0.72);
    font-size: 0.68rem;
    font-weight: 760;
}

.generated-view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.22rem;
    min-width: 220px;
    padding: 0.2rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.045);
}

.generated-view-switch button {
    min-height: 36px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: rgba(226, 232, 240, 0.68);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 950;
    cursor: pointer;
}

.generated-view-switch button.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.85), rgba(139, 92, 246, 0.88));
    box-shadow: 0 12px 30px rgba(94, 231, 255, 0.18);
}

.generated-game-page .generated-view-shell,
.generated-game-page .playable-shell {
    min-height: 0;
    height: 100%;
    display: block !important;
    padding: 0 1.05rem 1.05rem;
    overflow: hidden;
}

.generated-chat-view,
.generated-preview-view {
    height: 100%;
    min-height: 0;
}

.generated-game-page[data-generated-view='chat'] .generated-preview-view,
.generated-game-page[data-generated-view='preview'] .generated-chat-view {
    display: none !important;
}

.generated-game-page[data-generated-view='preview'] .generated-preview-view {
    display: grid !important;
}

.generated-game-page .generated-chat-view .game-preview-chat-panel {
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 0.95rem;
    border-radius: 16px;
    border: 1px solid rgba(94, 231, 255, 0.14);
    background: rgba(2, 6, 23, 0.72);
}

.generated-chat-file-summary {
    display: grid;
    gap: 0.34rem;
    padding: 0.68rem 0.76rem;
    border-radius: 13px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.72rem;
    line-height: 1.42;
}

.generated-chat-file-summary strong {
    color: #f8fafc;
    font-size: 0.76rem;
}

.generated-chat-file-summary ul {
    margin: 0;
    padding-left: 1rem;
}

.generated-game-page .generated-preview-view.playable-preview-card {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: 100%;
    min-height: 0;
    margin: 0;
}

.generated-game-page .generated-preview-view .preview-card-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.generated-game-page .edit-tools-panel {
    padding: 0.9rem;
    border: 1px solid rgba(167, 139, 250, 0.18);
    background:
        radial-gradient(circle at 100% 0%, rgba(167, 139, 250, 0.08), transparent 34%),
        rgba(12, 16, 36, 0.82);
}

.tools-topbar {
    order: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto auto;
    align-items: center;
    gap: 0.38rem;
    margin-bottom: 0.72rem;
}

.tools-save-indicator {
    min-width: 0;
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.68rem;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tools-icon-btn,
.tools-publish-btn,
.tools-save-btn {
    min-height: 34px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.055);
    color: rgba(248, 250, 252, 0.88);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 900;
    cursor: pointer;
}

.tools-icon-btn {
    width: 34px;
    padding: 0;
}

.tools-publish-btn,
.tools-save-btn {
    padding: 0 0.72rem;
}

.tools-save-btn {
    background: rgba(255, 255, 255, 0.78);
    color: rgba(15, 23, 42, 0.86);
}

.tools-publish-btn:hover,
.tools-icon-btn:hover,
.tools-save-btn:hover {
    border-color: rgba(94, 231, 255, 0.38);
}

.generated-game-page .game-edit-sidebar .workspace-panel-head {
    margin-bottom: 0.7rem;
}

.generated-game-page .game-edit-tabs {
    order: 1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 0.18rem;
    margin-bottom: 0.8rem;
}

.generated-game-page .game-edit-tab {
    min-height: 38px;
    border-radius: 12px;
}

.generated-game-page .workspace-sidebar-mode-panel {
    order: 20;
    margin-top: auto;
}

.generated-game-page .game-edit-module {
    order: 2;
}

.generated-game-page .workspace-panel-toggle {
    display: none;
}

body.game-edit-workspace-active .chat-input-wrapper {
    width: min(calc(100vw - var(--page-left-width, 280px) - var(--page-right-width, 400px) - 84px), 920px);
    min-width: min(100%, 560px);
    margin-left: calc(var(--page-left-width, 280px) + var(--page-gap, 14px));
    margin-right: auto;
}

@media (max-width: 1180px) {
    .generated-game-page .generated-page-layout {
        grid-template-columns: 250px minmax(560px, 1fr) 340px;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(calc(100vw - 250px - 340px - 72px), 760px);
        margin-left: 264px;
    }
}

@media (max-width: 1023px) {
    .generated-game-page {
        min-height: 0;
        max-height: calc(100dvh - 148px);
        overflow: hidden !important;
    }

    .generated-game-page .generated-page-layout {
        display: block !important;
        height: 100%;
        padding: 0.58rem;
        overflow: hidden !important;
    }

    .generated-main-header {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.64rem;
        padding: 0.78rem 0.78rem 0;
    }

    .generated-view-switch {
        width: 100%;
        min-width: 0;
    }

    .generated-game-page .generated-view-shell,
    .generated-game-page .playable-shell {
        padding: 0 0.78rem 0.78rem;
    }

    .generated-game-page .game-preview-column {
        height: 100% !important;
        overflow: auto !important;
    }

    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar {
        position: fixed !important;
        top: 4.45rem !important;
        bottom: 6.65rem !important;
        z-index: 80;
        width: min(86vw, 340px) !important;
        height: auto !important;
        overflow: auto !important;
        border-radius: 18px;
        box-shadow: 0 26px 78px rgba(0, 0, 0, 0.52);
        transition: transform 0.24s ease;
    }

    .generated-game-page .change-history-sidebar {
        left: 0;
        transform: translateX(calc(-100% + 42px)) !important;
    }

    .generated-game-page .game-edit-sidebar {
        right: 0;
        transform: translateX(calc(100% - 42px)) !important;
    }

    .generated-game-page .change-history-sidebar.open,
    .generated-game-page .game-edit-sidebar.open {
        transform: translateX(0) !important;
    }

    .generated-game-page .workspace-panel-toggle {
        display: inline-flex !important;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(100%, calc(100vw - 1rem));
        min-width: 0;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ===== Mobile drawer visible labels ===== */
.mobile-workspace-drawer-toggle .mobile-drawer-glyph,
.mobile-workspace-drawer-toggle .mobile-drawer-label {
    display: block;
    line-height: 1;
}

.mobile-workspace-drawer-toggle .mobile-drawer-label {
    margin-top: 0.22rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.52rem;
    font-weight: 950;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ===== Page-level edge layout refinement ===== */
body.game-edit-workspace-active .chat-history {
    --chat-stage-width: 100vw;
    width: 100vw;
    max-width: 100vw;
    padding-left: 0;
    padding-right: 0;
}

body.game-edit-workspace-active .chat-message.has-game-workspace {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble {
    width: 100%;
    max-width: none;
}

.generated-game-page {
    --page-left-width: 340px;
    --page-right-width: 430px;
    --page-gap: 22px;
    width: 100vw;
    max-width: 100vw;
    min-height: min(790px, calc(100vh - 164px));
    max-height: calc(100vh - 154px);
}

.generated-game-page .generated-page-layout {
    width: 100vw;
    grid-template-columns: var(--page-left-width) minmax(760px, 1fr) var(--page-right-width);
    gap: var(--page-gap);
    padding: 0 8px;
    box-sizing: border-box;
}

.generated-game-page .version-history-panel {
    border-radius: 0 18px 18px 0;
    border-left: 0;
    margin-left: 0;
}

.generated-game-page .edit-tools-panel {
    border-radius: 18px 0 0 18px;
    border-right: 0;
    margin-right: 0;
}

.generated-game-page .generated-main-panel {
    border-radius: 18px;
    max-width: none;
}

.generated-game-page .workspace-panel-head {
    flex: 0 0 auto;
}

.generated-game-page .game-edit-sidebar {
    overflow: hidden;
}

.generated-game-page .game-edit-sidebar > .tools-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: -0.9rem -0.9rem 0.72rem;
    padding: 0.82rem 0.9rem 0.74rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(13, 17, 38, 0.96);
    backdrop-filter: blur(18px);
}

.generated-game-page .game-edit-tabs {
    position: sticky;
    top: 3.95rem;
    z-index: 4;
    background: rgba(13, 17, 38, 0.92);
    backdrop-filter: blur(14px);
}

.generated-game-page .game-edit-module.active {
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.18rem;
}

.generated-game-page .tools-topbar .tools-save-indicator {
    font-size: 0.7rem;
}

.generated-game-page .tools-topbar .tools-save-btn {
    min-width: 108px;
}

body.game-edit-workspace-active .chat-input-wrapper {
    width: min(880px, calc(100vw - 560px));
    min-width: min(100%, 620px);
    margin-left: auto !important;
    margin-right: auto !important;
}

body.game-edit-workspace-active .chat-input-bar.unified-pill {
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 1440px) {
    .generated-game-page {
        --page-left-width: 300px;
        --page-right-width: 390px;
        --page-gap: 16px;
    }

    .generated-game-page .generated-page-layout {
        grid-template-columns: var(--page-left-width) minmax(640px, 1fr) var(--page-right-width);
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(780px, calc(100vw - 500px));
        min-width: min(100%, 560px);
    }
}

@media (max-width: 1180px) {
    .generated-game-page {
        --page-left-width: 260px;
        --page-right-width: 340px;
        --page-gap: 12px;
    }

    .generated-game-page .generated-page-layout {
        grid-template-columns: var(--page-left-width) minmax(560px, 1fr) var(--page-right-width);
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(700px, calc(100vw - 420px));
        min-width: min(100%, 520px);
    }
}

@media (max-width: 1023px) {
    body.game-edit-workspace-active .chat-history,
    body.game-edit-workspace-active .chat-message.has-game-workspace,
    .generated-game-page {
        width: auto;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .generated-game-page .generated-page-layout {
        width: auto;
        padding: 0.58rem;
    }

    .generated-game-page .version-history-panel,
    .generated-game-page .edit-tools-panel {
        border-radius: 18px;
        border-left: 1px solid rgba(116, 229, 255, 0.14);
        border-right: 1px solid rgba(167, 139, 250, 0.18);
    }

    .generated-game-page .game-edit-sidebar > .tools-topbar,
    .generated-game-page .game-edit-tabs {
        position: static;
        margin-left: 0;
        margin-right: 0;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(100%, calc(100vw - 1rem));
        min-width: 0;
    }
}

/* ===== Right tools action bar first ===== */
.generated-game-page .game-edit-sidebar > .workspace-panel-head {
    order: 1;
    margin-top: 0.68rem;
    margin-bottom: 0.68rem;
}

.generated-game-page .game-edit-sidebar > .tools-topbar {
    order: 0;
    margin-bottom: 0;
}

.generated-game-page .game-edit-sidebar > .game-edit-tabs {
    order: 2;
}

.generated-game-page .game-edit-sidebar > .game-edit-module {
    order: 3;
}

.generated-game-page .game-edit-sidebar > .workspace-sidebar-mode-panel {
    order: 20;
}

/* ===== Center generation header and page-scroll columns ===== */
body.game-edit-workspace-active .generation-result {
    display: grid;
    grid-template-columns: var(--page-left-width, 300px) minmax(640px, 1fr) var(--page-right-width, 390px);
    gap: var(--page-gap, 16px);
    align-items: start;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 0 8px;
    box-sizing: border-box;
}

body.game-edit-workspace-active .generation-result > .generation-status,
body.game-edit-workspace-active .generation-result > .generation-title,
body.game-edit-workspace-active .generation-result > .generation-meta,
body.game-edit-workspace-active .generation-result > .ai-pipeline-summary,
body.game-edit-workspace-active .generation-result > .production-applied-summary,
body.game-edit-workspace-active .generation-result > .generated-workspace-topbar,
body.game-edit-workspace-active .generation-result > .generated-workspace-files-card {
    grid-column: 2;
    width: 100%;
    max-width: none;
    justify-self: stretch;
}

body.game-edit-workspace-active .generation-result > .generation-status {
    margin-top: 0.15rem;
}

body.game-edit-workspace-active .generation-result > .generation-title {
    text-align: left;
}

body.game-edit-workspace-active .generation-result > .generation-meta {
    justify-content: flex-start;
}

body.game-edit-workspace-active .generation-result > .generated-game-page {
    grid-column: 1 / -1;
    width: 100%;
    margin: 0;
}

.generated-game-page {
    min-height: 0;
    max-height: none;
    overflow: visible !important;
}

.generated-game-page .generated-page-layout {
    height: auto;
    min-height: min(740px, calc(100vh - 170px));
    align-items: start;
    overflow: visible;
}

@media (min-width: 1024px) {
    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar,
    .generated-game-page .game-preview-column {
        max-height: none;
        height: auto !important;
        overflow: visible;
    }

    .generated-game-page .generated-main-panel {
        min-height: min(740px, calc(100vh - 170px));
    }

    .generated-game-page .version-history-panel,
    .generated-game-page .edit-tools-panel {
        min-height: min(740px, calc(100vh - 170px));
    }

    .generated-game-page .game-edit-module.active {
        overflow: visible;
        max-height: none;
    }

    .generated-game-page .code-workspace-panel.compact,
    .generated-game-page .workspace-media-panel,
    .generated-game-page .workspace-numeric-panel {
        max-height: none;
    }
}

body.game-edit-workspace-active .chat-input-wrapper {
    position: sticky;
    bottom: 0.7rem;
    z-index: 30;
}

@media (max-width: 1440px) {
    body.game-edit-workspace-active .generation-result {
        grid-template-columns: var(--page-left-width, 300px) minmax(640px, 1fr) var(--page-right-width, 390px);
    }
}

@media (max-width: 1180px) {
    body.game-edit-workspace-active .generation-result {
        grid-template-columns: var(--page-left-width, 260px) minmax(560px, 1fr) var(--page-right-width, 340px);
    }
}

@media (max-width: 1023px) {
    body.game-edit-workspace-active .generation-result {
        display: block;
        width: auto;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        padding: 0;
    }

    .generated-game-page .generated-page-layout {
        min-height: 0;
        overflow: hidden !important;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        position: static;
        bottom: auto;
    }
}

/* ===== Keep generated title inside center workspace, not above side columns ===== */
@media (min-width: 1024px) {
    body.game-edit-workspace-active .generation-result > .generation-status,
    body.game-edit-workspace-active .generation-result > .generation-title,
    body.game-edit-workspace-active .generation-result > .generation-meta,
    body.game-edit-workspace-active .generation-result > .ai-pipeline-summary,
    body.game-edit-workspace-active .generation-result > .production-applied-summary,
    body.game-edit-workspace-active .generation-result > .generated-workspace-topbar,
    body.game-edit-workspace-active .generation-result > .generated-workspace-files-card {
        display: none !important;
    }

    body.game-edit-workspace-active .generation-result {
        align-content: start;
    }

    body.game-edit-workspace-active .generation-result > .generated-game-page {
        margin-top: 0;
    }

    .generated-main-header {
        padding-top: 1.12rem;
        padding-bottom: 0.15rem;
    }

    .generated-main-header .workspace-title-block > strong {
        font-size: 1.02rem;
    }
}

/* ===== Desktop: center stays chat-flow, side panels fixed ===== */
@media (min-width: 1024px) {
    body.game-edit-workspace-active .chat-history {
        --chat-stage-width: min(920px, calc(100vw - 680px));
        width: var(--chat-stage-width);
        max-width: var(--chat-stage-width);
        margin-left: auto;
        margin-right: auto;
        padding-left: 0;
        padding-right: 0;
    }

    body.game-edit-workspace-active .chat-message.has-game-workspace {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    body.game-edit-workspace-active .generation-result {
        display: block;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 0;
    }

    body.game-edit-workspace-active .generation-result > .generated-game-page {
        width: 100%;
        max-width: 100%;
    }

    .generated-game-page {
        width: 100%;
        max-width: 100%;
        min-height: 0;
        max-height: none;
    }

    .generated-game-page .generated-page-layout {
        display: block !important;
        width: 100%;
        max-width: 100%;
        min-height: 0;
        padding: 0;
        overflow: visible;
    }

    .generated-game-page .generated-main-panel {
        width: 100%;
        max-width: 100%;
        min-height: 0;
        height: auto !important;
        margin: 0 auto;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }

    .generated-main-header {
        padding: 0.8rem 0 0.72rem;
        border: 0;
    }

    .generated-game-page .generated-view-shell,
    .generated-game-page .playable-shell {
        padding: 0;
        overflow: visible;
    }

    .generated-game-page .generated-chat-view .game-preview-chat-panel {
        padding: 0.95rem;
        border-radius: 16px;
        border: 1px solid rgba(94, 231, 255, 0.16);
        background: rgba(2, 6, 23, 0.54);
        box-shadow: none;
    }

    .generated-game-page .generated-preview-view.playable-preview-card {
        border-radius: 16px;
        background: rgba(2, 6, 23, 0.7);
    }

    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar {
        position: fixed !important;
        top: 4.15rem !important;
        bottom: 6.5rem !important;
        z-index: 24;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
    }

    .generated-game-page .change-history-sidebar {
        left: 0 !important;
        width: min(300px, calc((100vw - var(--chat-stage-width)) / 2 - 24px)) !important;
        min-width: 248px;
        transform: none !important;
        border-radius: 0 18px 18px 0;
    }

    .generated-game-page .game-edit-sidebar {
        right: 0 !important;
        width: min(390px, calc((100vw - var(--chat-stage-width)) / 2 - 24px)) !important;
        min-width: 300px;
        transform: none !important;
        border-radius: 18px 0 0 18px;
    }

    .generated-game-page .workspace-panel-toggle {
        display: none !important;
    }

    .generated-game-page .game-edit-module.active {
        overflow: visible;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: var(--chat-stage-width);
        max-width: var(--chat-stage-width);
        min-width: 0;
        margin-left: auto !important;
        margin-right: auto !important;
        position: sticky;
        bottom: 0.7rem;
        z-index: 32;
    }

    body.game-edit-workspace-active .chat-input-bar.unified-pill {
        width: 100%;
    }
}

@media (min-width: 1500px) {
    body.game-edit-workspace-active .chat-history {
        --chat-stage-width: min(980px, calc(100vw - 760px));
    }
}
/* ===== Correct fixed side panels relative to centered chat column ===== */
@media (min-width: 1024px) {
    .generated-game-page .change-history-sidebar {
        left: calc((100vw - var(--chat-stage-width)) / -2) !important;
    }

    .generated-game-page .game-edit-sidebar {
        right: calc((100vw - var(--chat-stage-width)) / -2) !important;
    }
}
/* ===== Final generated page layout: chat center, fixed side rails ===== */
@media (min-width: 1024px) {
    body.game-edit-workspace-active {
        --chat-stage-width: min(920px, calc(100vw - 680px));
        --history-rail-width: clamp(260px, 21vw, 320px);
        --tools-rail-width: clamp(340px, 27vw, 430px);
    }

    body.game-edit-workspace-active .chat-history {
        width: var(--chat-stage-width) !important;
        max-width: var(--chat-stage-width) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.game-edit-workspace-active .chat-message.has-game-workspace,
    body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble,
    body.game-edit-workspace-active .generation-result,
    body.game-edit-workspace-active .generation-result > .generated-game-page,
    .generated-game-page .generated-page-layout,
    .generated-game-page .generated-main-panel {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble,
    body.game-edit-workspace-active .generation-result,
    .generated-game-page,
    .generated-game-page .generated-page-layout,
    .generated-game-page .generated-main-panel {
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .generated-game-page .generated-page-layout {
        display: block !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .generated-game-page .generated-main-panel {
        position: relative !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }

    .generated-game-page .generated-main-header {
        padding: 0.85rem 0 0.8rem !important;
        border: 0 !important;
        background: transparent !important;
    }

    .generated-game-page .generated-chat-view .game-preview-chat-panel,
    .generated-game-page .generated-preview-view.playable-preview-card {
        border-radius: 18px !important;
        border: 1px solid rgba(94, 231, 255, 0.16) !important;
        background: rgba(2, 6, 23, 0.58) !important;
    }

    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar {
        position: fixed !important;
        top: 4.1rem !important;
        bottom: 6.4rem !important;
        z-index: 28 !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        transform: none !important;
    }

    .generated-game-page .change-history-sidebar {
        left: calc((100vw - var(--chat-stage-width)) / -2) !important;
        width: var(--history-rail-width) !important;
        min-width: 0 !important;
        border-radius: 0 20px 20px 0 !important;
    }

    .generated-game-page .game-edit-sidebar {
        right: calc((100vw - var(--chat-stage-width)) / -2) !important;
        width: var(--tools-rail-width) !important;
        min-width: 0 !important;
        border-radius: 20px 0 0 20px !important;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(760px, var(--chat-stage-width)) !important;
        max-width: min(760px, var(--chat-stage-width)) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        position: sticky !important;
        bottom: 0.75rem !important;
        z-index: 42 !important;
    }
}

@media (min-width: 1500px) {
    body.game-edit-workspace-active {
        --chat-stage-width: min(980px, calc(100vw - 760px));
    }
}
/* ===== Final side rails visibility fix: viewport-anchored History / Tools ===== */
@media (min-width: 1024px) {
    body.game-edit-workspace-active {
        --history-rail-width: clamp(220px, 20vw, 320px);
        --tools-rail-width: clamp(280px, 28vw, 420px);
        --center-rail-gap: clamp(28px, 4vw, 96px);
        --center-chat-width: min(920px, max(360px, calc(100vw - var(--history-rail-width) - var(--tools-rail-width) - var(--center-rail-gap))));
        --chat-stage-width: var(--center-chat-width);
    }

    body.game-edit-workspace-active .chat-history {
        width: var(--center-chat-width) !important;
        max-width: var(--center-chat-width) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow-x: visible !important;
    }

    body.game-edit-workspace-active .chat-message.has-game-workspace,
    body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble,
    body.game-edit-workspace-active .generation-result,
    body.game-edit-workspace-active .generation-result > .generated-game-page,
    .generated-game-page .generated-page-layout,
    .generated-game-page .generated-main-panel {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble,
    body.game-edit-workspace-active .generation-result,
    .generated-game-page,
    .generated-game-page .generated-page-layout,
    .generated-game-page .generated-main-panel {
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .generated-game-page .generated-page-layout {
        display: block !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .generated-game-page .generated-main-panel {
        position: relative !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }

    .generated-game-page .generated-main-header {
        padding: 0.85rem 0 0.8rem !important;
        border: 0 !important;
        background: transparent !important;
    }

    .generated-game-page .generated-chat-view .game-preview-chat-panel,
    .generated-game-page .generated-preview-view.playable-preview-card {
        border-radius: 18px !important;
        border: 1px solid rgba(94, 231, 255, 0.18) !important;
        background: rgba(2, 6, 23, 0.62) !important;
        box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22) !important;
    }

    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar {
        position: fixed !important;
        top: 4rem !important;
        bottom: 6.5rem !important;
        z-index: 34 !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        backdrop-filter: blur(18px) !important;
        -webkit-backdrop-filter: blur(18px) !important;
    }

    .generated-game-page .change-history-sidebar {
        left: 0 !important;
        right: auto !important;
        width: var(--history-rail-width) !important;
        min-width: 0 !important;
        border-radius: 0 20px 20px 0 !important;
        background: rgba(7, 12, 28, 0.94) !important;
        border: 1px solid rgba(94, 231, 255, 0.2) !important;
        border-left: 0 !important;
        box-shadow: 18px 0 54px rgba(0, 0, 0, 0.34) !important;
    }

    .generated-game-page .game-edit-sidebar {
        right: 0 !important;
        left: auto !important;
        width: var(--tools-rail-width) !important;
        min-width: 0 !important;
        border-radius: 20px 0 0 20px !important;
        background: rgba(13, 14, 35, 0.96) !important;
        border: 1px solid rgba(167, 139, 250, 0.24) !important;
        border-right: 0 !important;
        box-shadow: -18px 0 54px rgba(0, 0, 0, 0.36) !important;
    }

    .generated-game-page .workspace-panel-toggle {
        display: none !important;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(760px, var(--center-chat-width)) !important;
        max-width: min(760px, var(--center-chat-width)) !important;
        min-width: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
        position: sticky !important;
        bottom: 0.75rem !important;
        z-index: 48 !important;
    }

    body.game-edit-workspace-active .chat-input-bar.unified-pill {
        width: 100% !important;
    }
}

@media (min-width: 1500px) {
    body.game-edit-workspace-active {
        --history-rail-width: 320px;
        --tools-rail-width: 420px;
        --center-rail-gap: 96px;
        --center-chat-width: min(980px, calc(100vw - var(--history-rail-width) - var(--tools-rail-width) - var(--center-rail-gap)));
    }
}
/* ===== Side rails visible final: viewport-fixed rails + centered chat ===== */
@media (min-width: 1024px) {
    body.game-edit-workspace-active {
        --history-rail-width: clamp(220px, 20vw, 320px);
        --tools-rail-width: clamp(280px, 28vw, 420px);
        --rail-gutter: clamp(24px, 4vw, 96px);
        --center-chat-width: min(920px, max(360px, calc(100vw - var(--history-rail-width) - var(--tools-rail-width) - var(--rail-gutter))));
        --chat-stage-width: var(--center-chat-width);
    }

    body.game-edit-workspace-active .chat-history {
        width: var(--center-chat-width) !important;
        max-width: var(--center-chat-width) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.game-edit-workspace-active .chat-message.has-game-workspace,
    body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble,
    body.game-edit-workspace-active .generation-result,
    body.game-edit-workspace-active .generation-result > .generated-game-page,
    .generated-game-page .generated-page-layout,
    .generated-game-page .generated-main-panel {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble,
    body.game-edit-workspace-active .generation-result,
    .generated-game-page,
    .generated-game-page .generated-page-layout,
    .generated-game-page .generated-main-panel {
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .generated-game-page .generated-page-layout {
        display: block !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .generated-game-page .generated-main-panel {
        position: relative !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }

    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar {
        position: fixed !important;
        top: 4rem !important;
        bottom: 6.5rem !important;
        z-index: 36 !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        backdrop-filter: blur(20px);
        box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    }

    .generated-game-page .change-history-sidebar {
        left: 0 !important;
        right: auto !important;
        width: var(--history-rail-width) !important;
        min-width: 0 !important;
        border-radius: 0 20px 20px 0 !important;
        background: rgba(8, 13, 30, 0.94) !important;
        border: 1px solid rgba(94, 231, 255, 0.22) !important;
        border-left: 0 !important;
    }

    .generated-game-page .game-edit-sidebar {
        right: 0 !important;
        left: auto !important;
        width: var(--tools-rail-width) !important;
        min-width: 0 !important;
        border-radius: 20px 0 0 20px !important;
        background: rgba(12, 16, 36, 0.95) !important;
        border: 1px solid rgba(167, 139, 250, 0.24) !important;
        border-right: 0 !important;
    }

    .generated-game-page .workspace-panel-toggle {
        display: none !important;
    }

    body.game-edit-workspace-active .chat-input-wrapper {
        width: min(760px, var(--center-chat-width)) !important;
        max-width: min(760px, var(--center-chat-width)) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        position: sticky !important;
        bottom: 0.75rem !important;
        z-index: 52 !important;
    }

    body.game-edit-workspace-active .chat-input-bar.unified-pill {
        width: 100% !important;
    }
}

@media (min-width: 1500px) {
    body.game-edit-workspace-active {
        --history-rail-width: 320px;
        --tools-rail-width: 420px;
        --center-chat-width: min(980px, calc(100vw - 840px));
        --chat-stage-width: var(--center-chat-width);
    }
}

@media (max-width: 1023px) {
    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar {
        position: fixed !important;
        top: 4rem !important;
        bottom: 5.8rem !important;
    }
}
/* ===== Side rails fixed-position containment fix ===== */
@media (min-width: 1024px) {
    body.game-edit-workspace-active #inspireView,
    body.game-edit-workspace-active .chat-message.has-game-workspace {
        transform: none !important;
        animation: none !important;
        will-change: auto !important;
    }

    body.game-edit-workspace-active .chat-message.has-game-workspace {
        opacity: 1 !important;
    }
}
/* ===== Tools bottom mode switch ===== */
.generated-game-page .game-edit-sidebar {
    display: flex !important;
    flex-direction: column !important;
}

.generated-game-page .game-edit-sidebar > .workspace-sidebar-mode-panel {
    display: grid !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 18 !important;
    gap: 0.6rem !important;
    margin: auto -0.15rem -0.25rem !important;
    padding: 0.78rem 0.82rem 0.82rem !important;
    border-top: 1px solid rgba(148, 163, 184, 0.18) !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
    border-radius: 18px 18px 0 0 !important;
    background:
        linear-gradient(180deg, rgba(13, 18, 42, 0.78), rgba(5, 8, 22, 0.96)),
        rgba(5, 8, 22, 0.96) !important;
    box-shadow: 0 -18px 46px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
}

.generated-game-page .workspace-sidebar-mode-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.65rem !important;
}

.generated-game-page .workspace-sidebar-mode-head strong {
    color: rgba(248, 250, 252, 0.95) !important;
    font-size: 0.76rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.02em !important;
}

.generated-game-page .workspace-sidebar-mode-head small {
    max-width: 250px !important;
    color: rgba(148, 163, 184, 0.78) !important;
    font-size: 0.62rem !important;
    line-height: 1.3 !important;
    text-align: right !important;
}

.generated-game-page .workspace-sidebar-mode-panel .sidebar-mode-switch {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.34rem !important;
    padding: 0.22rem !important;
    border: 1px solid rgba(148, 163, 184, 0.14) !important;
    border-radius: 16px !important;
    background: rgba(2, 6, 23, 0.62) !important;
}

.generated-game-page .workspace-sidebar-mode-panel .sidebar-mode-switch .workspace-header-btn {
    min-height: 38px !important;
    justify-content: center !important;
    border-radius: 13px !important;
    font-size: 0.76rem !important;
    font-weight: 900 !important;
}

.generated-game-page .workspace-sidebar-mode-panel .sidebar-mode-switch .workspace-header-btn.active {
    color: #f8fafc !important;
    border-color: rgba(94, 231, 255, 0.42) !important;
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.34), rgba(139, 92, 246, 0.42)) !important;
    box-shadow: 0 10px 28px rgba(94, 231, 255, 0.15) !important;
}

.generated-game-page .workspace-sidebar-mode-panel .sidebar-mode-switch .workspace-header-btn.is-muted:not(.active) {
    color: rgba(203, 213, 225, 0.72) !important;
    background: rgba(15, 23, 42, 0.72) !important;
}

.generated-game-page .workspace-compact-mode-warning {
    display: none !important;
}

.generated-game-page .workspace-compact-mode-warning.show {
    display: block !important;
}

.generated-game-page .workspace-status-strip [data-workspace-mode-label] {
    display: none !important;
}

@media (max-width: 1023px) {
    .generated-game-page .game-edit-sidebar > .workspace-sidebar-mode-panel {
        margin: 0.7rem 0 0 !important;
        border: 1px solid rgba(245, 158, 11, 0.22) !important;
        border-radius: 16px !important;
    }

    .generated-game-page .workspace-sidebar-mode-head {
        display: grid !important;
        justify-content: stretch !important;
    }

    .generated-game-page .workspace-sidebar-mode-head small {
        max-width: none !important;
        text-align: left !important;
    }

    .generated-game-page .workspace-sidebar-mode-panel [data-workspace-mode-set='advanced']::after {
        content: 'PC';
        margin-left: 0.28rem;
        padding: 0.08rem 0.25rem;
        border-radius: 999px;
        background: rgba(245, 158, 11, 0.16);
        color: rgba(255, 226, 166, 0.95);
        font-size: 0.52rem;
        font-weight: 900;
        letter-spacing: 0.04em;
    }
}
/* ===== Dock Tools mode switch outside the scroll area ===== */
@media (min-width: 1024px) {
    .generated-game-page .game-edit-sidebar {
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .generated-game-page .game-edit-sidebar > .tools-topbar,
    .generated-game-page .game-edit-sidebar > .workspace-panel-head,
    .generated-game-page .game-edit-sidebar > .game-edit-tabs,
    .generated-game-page .game-edit-sidebar > .workspace-sidebar-mode-panel {
        flex: 0 0 auto !important;
    }

    .generated-game-page .game-edit-sidebar > .game-edit-module {
        display: none !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .generated-game-page .game-edit-sidebar > .game-edit-module.active {
        display: block !important;
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        padding-bottom: 0.2rem !important;
    }

    .generated-game-page .game-edit-sidebar > .workspace-sidebar-mode-panel {
        position: relative !important;
        bottom: auto !important;
        margin: 0.18rem -0.15rem -0.25rem !important;
        box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    }
}
/* ===== Dock Tools mode switch for desktop and drawer layouts ===== */
.generated-game-page .game-edit-sidebar {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.generated-game-page .game-edit-sidebar > .tools-topbar,
.generated-game-page .game-edit-sidebar > .workspace-panel-head,
.generated-game-page .game-edit-sidebar > .game-edit-tabs,
.generated-game-page .game-edit-sidebar > .workspace-sidebar-mode-panel {
    flex: 0 0 auto !important;
}

.generated-game-page .game-edit-sidebar > .game-edit-module {
    display: none !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.generated-game-page .game-edit-sidebar > .game-edit-module.active {
    display: block !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    padding-bottom: 0.2rem !important;
}

.generated-game-page .game-edit-sidebar > .workspace-sidebar-mode-panel {
    position: relative !important;
    bottom: auto !important;
    flex: 0 0 auto !important;
    margin: 0.18rem -0.15rem -0.25rem !important;
    box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
/* ===== Tools draft apply + beginner locked tabs ===== */
.generated-game-page.is-beginner-mode [data-edit-module-tab="media"],
.generated-game-page.is-beginner-mode [data-edit-module-tab="code"],
.generated-game-page.is-beginner-mode [data-edit-module-tab="tools"] {
    display: inline-flex !important;
}

.generated-game-page.is-beginner-mode .game-edit-tab.advanced-only,
.generated-game-page .game-edit-tab.is-locked {
    opacity: 0.46 !important;
    cursor: not-allowed !important;
    filter: saturate(0.45) brightness(0.82) !important;
    background: rgba(15, 23, 42, 0.42) !important;
    border-color: rgba(148, 163, 184, 0.14) !important;
    color: rgba(203, 213, 225, 0.62) !important;
}

.generated-game-page .game-edit-tab .tab-lock-label {
    display: none;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    color: rgba(253, 230, 138, 0.9);
}

.generated-game-page.is-beginner-mode .game-edit-tab.advanced-only small,
.generated-game-page .game-edit-tab.is-locked small {
    display: none !important;
}

.generated-game-page.is-beginner-mode .game-edit-tab.advanced-only .tab-lock-label,
.generated-game-page .game-edit-tab.is-locked .tab-lock-label {
    display: none !important;
}

.generated-game-page.is-advanced-mode .game-edit-tab.capability-locked .tab-lock-label,
.generated-game-page.is-advanced-mode .game-edit-tab.is-readonly .tab-lock-label {
    display: inline-flex !important;
}

.generated-game-page.is-advanced-mode .game-edit-tab.is-readonly {
    border-color: rgba(96, 165, 250, 0.22) !important;
    color: rgba(219, 234, 254, 0.86) !important;
}

.workspace-advanced-lock-hint {
    margin: 0.46rem 0 0.12rem;
    padding: 0.5rem 0.58rem;
    border: 1px solid rgba(245, 158, 11, 0.24);
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(15, 23, 42, 0.74));
    color: rgba(253, 230, 138, 0.92);
    font-size: 0.68rem;
    line-height: 1.35;
}

.workspace-advanced-lock-hint[hidden] {
    display: none !important;
}

.generated-game-page .workspace-numeric-panel {
    gap: 0.54rem !important;
}

.generated-game-page .workspace-numeric-head {
    padding-bottom: 0.42rem !important;
    margin-bottom: 0.08rem !important;
}

.generated-game-page .workspace-numeric-card {
    gap: 0.42rem !important;
    padding: 0.52rem !important;
    border-radius: 14px !important;
}

.generated-game-page .workspace-numeric-card-head {
    gap: 0.5rem !important;
}

.generated-game-page .workspace-numeric-card-head small {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.generated-game-page .workspace-numeric-row {
    gap: 0.46rem !important;
}

.generated-game-page .workspace-numeric-row input[type="number"] {
    width: 4.15rem !important;
    min-height: 30px !important;
}

.generated-game-page .workspace-numeric-presets {
    gap: 0.28rem !important;
}

.generated-game-page .workspace-numeric-presets button {
    min-height: 25px !important;
    padding: 0.26rem 0.44rem !important;
    font-size: 0.58rem !important;
}

.generated-game-page .workspace-numeric-actions {
    display: none !important;
}

.workspace-numeric-apply-bar {
    position: sticky;
    bottom: 0.08rem;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.58rem;
    align-items: center;
    margin-top: 0.32rem;
    padding: 0.62rem;
    border: 1px solid rgba(94, 231, 255, 0.2);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.96));
    box-shadow: 0 -16px 34px rgba(2, 6, 23, 0.42);
}

.workspace-numeric-apply-bar strong {
    display: block;
    color: #f8fafc;
    font-size: 0.72rem;
    line-height: 1.2;
}

.workspace-numeric-apply-bar small {
    display: block;
    margin-top: 0.14rem;
    color: rgba(203, 213, 225, 0.66);
    font-size: 0.62rem;
    line-height: 1.28;
}

.workspace-numeric-apply-actions {
    display: flex;
    gap: 0.34rem;
    align-items: center;
}

.workspace-numeric-apply-actions button {
    min-height: 30px;
    padding: 0.34rem 0.56rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.72);
    color: rgba(226, 232, 240, 0.84);
    font-size: 0.62rem;
    font-weight: 900;
    cursor: pointer;
}

.workspace-numeric-apply-actions button.primary {
    border-color: rgba(94, 231, 255, 0.34);
    color: #f8fafc;
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.28), rgba(139, 92, 246, 0.34));
    box-shadow: 0 10px 24px rgba(94, 231, 255, 0.12);
}

.workspace-numeric-apply-actions button.disabled,
.workspace-numeric-apply-actions button:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    box-shadow: none;
}

@media (max-width: 520px) {
    .workspace-numeric-apply-bar {
        grid-template-columns: 1fr;
    }

    .workspace-numeric-apply-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}
/* ===== Generated workspace: hide legacy GameSpec overlay ===== */
body.game-edit-workspace-active .chat-profile-sidebar {
    display: none !important;
    pointer-events: none !important;
}

body.game-edit-workspace-active .inspire-view.has-profile-sidebar .chat-history {
    --chat-stage-width: var(--center-chat-width, min(920px, calc(100vw - 680px)));
}
/* ===== Compact devices: hide workspace side rails by default ===== */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
    body.game-edit-workspace-active {
        --center-chat-width: min(100%, calc(100vw - 16px));
        --chat-stage-width: var(--center-chat-width);
    }

    body.game-edit-workspace-active .chat-history,
    body.game-edit-workspace-active .chat-message.has-game-workspace,
    body.game-edit-workspace-active .chat-message.has-game-workspace .chat-bubble,
    body.game-edit-workspace-active .generation-result,
    body.game-edit-workspace-active .generation-result > .generated-game-page {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    body.game-edit-workspace-active .chat-history {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .generated-game-page .generated-page-layout {
        display: block !important;
        overflow: hidden !important;
    }

    .generated-game-page .generated-main-panel {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        z-index: 1 !important;
    }

    .generated-game-page .change-history-sidebar,
    .generated-game-page .game-edit-sidebar {
        position: fixed !important;
        top: max(0.75rem, calc(env(safe-area-inset-top, 0px) + 0.75rem)) !important;
        bottom: max(5.85rem, calc(env(safe-area-inset-bottom, 0px) + 5.85rem)) !important;
        z-index: 2147482000 !important;
        width: min(86vw, 360px) !important;
        max-width: calc(100vw - 64px) !important;
        min-width: 0 !important;
        height: auto !important;
        max-height: none !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: transform 0.24s ease, opacity 0.18s ease, visibility 0.18s ease !important;
        box-shadow: 0 24px 72px rgba(0, 0, 0, 0.5) !important;
    }

    .generated-game-page .change-history-sidebar {
        left: 0 !important;
        right: auto !important;
        border-radius: 0 20px 20px 0 !important;
        transform: translate3d(calc(-100% - 12px), 0, 0) !important;
    }

    .generated-game-page .game-edit-sidebar {
        right: 0 !important;
        left: auto !important;
        border-radius: 20px 0 0 20px !important;
        transform: translate3d(calc(100% + 12px), 0, 0) !important;
    }

    .generated-game-page .change-history-sidebar.open,
    .generated-game-page .game-edit-sidebar.open {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translate3d(0, 0, 0) !important;
    }

    .generated-game-page .workspace-panel-toggle {
        display: none !important;
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle {
        display: inline-flex !important;
        position: fixed !important;
        top: 50% !important;
        z-index: 2147483000 !important;
        pointer-events: auto !important;
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle-history {
        left: 0 !important;
    }

    body.game-edit-workspace-active .mobile-workspace-drawer-toggle-edit {
        right: 0 !important;
    }
}
/* Compact playable preview: keep gameplay full-width on narrow screens. */
@media (max-width: 720px) {
  body.game-edit-workspace-active:has(.playable-shell.preview-open) {
    overflow: hidden !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .chat-history {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .chat-input-wrapper {
    display: none !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .chat-message.has-game-workspace,
  body.game-edit-workspace-active:has(.playable-shell.preview-open) .generated-game-page {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .generated-game-page {
    min-height: 100dvh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    overflow-y: auto !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .generated-game-page .workspace-body,
  body.game-edit-workspace-active:has(.playable-shell.preview-open) .generated-game-page .game-preview-column,
  body.game-edit-workspace-active:has(.playable-shell.preview-open) .generated-game-page .playable-shell {
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .playable-shell.preview-open .playable-preview-card {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) auto !important;
    gap: 0.55rem !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-height: 100dvh !important;
    padding: 0.5rem !important;
    border-radius: 0 !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .playable-shell.preview-open .game-preview-actions {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0.4rem !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .playable-shell.preview-open .game-preview-actions button {
    min-width: 0 !important;
    padding-inline: 0.45rem !important;
    font-size: 0.72rem !important;
    white-space: normal !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .game-preview-viewport {
    display: block !important;
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    min-height: min(72dvh, 740px) !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    margin: 0 auto !important;
    overflow: hidden !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .template-preview-frame {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: min(72dvh, 740px) !important;
    min-height: 520px !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .game-preview-canvas {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 9 / 16 !important;
  }
}

.game-preview-viewport {
  position: relative;
}

.iframe-visual-theme-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  border-radius: inherit;
}

.animal-island-overlay {
  box-shadow: inset 0 0 0 2px rgba(255, 246, 223, 0.86), inset 0 -120px 80px rgba(139, 212, 122, 0.22);
}

.animal-island-overlay::before {
  content: '';
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -5%;
  height: 28%;
  background: var(--animal-grass, #8bd47a);
  border-radius: 52% 48% 0 0 / 42% 40% 0 0;
  opacity: 0.78;
}

.animal-island-overlay-leaf {
  position: absolute;
  right: 8%;
  top: 10%;
  width: 52px;
  height: 76px;
  border-radius: 52% 48% 58% 42%;
  background: var(--animal-leaf, #4f9f63);
  transform: rotate(28deg);
  box-shadow: inset -8px -10px 0 rgba(0, 0, 0, 0.08);
  opacity: 0.86;
}

.animal-island-overlay-sign {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  max-width: min(58%, 260px);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--animal-cream, #fff6df);
  border: 2px solid rgba(185, 128, 79, 0.45);
  color: #31523a;
  font: 900 0.78rem Inter, system-ui, sans-serif;
  box-shadow: 0 8px 0 rgba(98, 63, 39, 0.12);
}

.animal-island-overlay-flower {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--animal-flower, #f58fb0);
  box-shadow: 18px 5px 0 #ffd95a, 8px 19px 0 #fff6df;
}

.animal-island-overlay-flower.flower-a { left: 74%; bottom: 16%; }
.animal-island-overlay-flower.flower-b { left: 16%; bottom: 24%; transform: scale(0.78); }
/* Portrait bullet-hell previews need full canvas height, not a cropped viewport. */
@media (max-width: 720px) {
  body.game-edit-workspace-active:has(.playable-shell.preview-open) .game-preview-viewport:has(.game-preview-canvas[data-orientation="portrait"]) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .game-preview-viewport:has(.game-preview-canvas[data-orientation="portrait"]) .game-preview-canvas {
    display: block !important;
    height: auto !important;
    max-height: none !important;
  }
}
/* Let portrait playable canvases define the row height on compact Preview. */
@media (max-width: 720px) {
  body.game-edit-workspace-active:has(.playable-shell.preview-open) .playable-shell.preview-open .playable-preview-card:has(.game-preview-canvas[data-orientation="portrait"]) {
    grid-template-rows: auto auto auto auto !important;
    min-height: auto !important;
    height: auto !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .generated-game-page:has(.game-preview-canvas[data-orientation="portrait"]) {
    overflow-y: auto !important;
  }
}
/* Preview-first cleanup: hide the mobile close-preview switch in playable mode. */
.generated-game-page[data-generated-view="preview"] .mobile-game-preview-toggle,
.playable-shell.preview-open > .mobile-game-preview-toggle {
  display: none !important;
}
/* Compact drawer handles: show one clean label only. */
body.game-edit-workspace-active .mobile-workspace-drawer-toggle {
  width: 44px !important;
  min-width: 44px !important;
  padding: 0 !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0 !important;
  text-transform: none !important;
}

body.game-edit-workspace-active .mobile-workspace-drawer-toggle::before,
body.game-edit-workspace-active .mobile-workspace-drawer-toggle::after,
body.game-edit-workspace-active .mobile-workspace-drawer-toggle .mobile-drawer-glyph {
  content: none !important;
  display: none !important;
}

body.game-edit-workspace-active .mobile-workspace-drawer-toggle .mobile-drawer-label {
  display: block !important;
  writing-mode: vertical-rl !important;
  text-orientation: mixed !important;
  white-space: nowrap !important;
  transform: none !important;
  font-size: 0.66rem !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  line-height: 1 !important;
}
/* Start-screen preview cleanup: avoid covering the game canvas. */
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .mobile-workspace-view-switch {
  display: none !important;
}
/* UI design cleanup: remove the duplicated bottom Chat/Preview switch. */
body.game-edit-workspace-active .mobile-workspace-view-switch {
  display: none !important;
}
/* Center workspace redesign: artifact-style stage plus conversational edit thread. */
.generated-game-page .generated-main-panel {
  gap: 0.55rem !important;
}

.generated-game-page .generated-main-header {
  align-items: center !important;
  gap: 0.75rem !important;
  padding: 0.78rem 0.85rem 0.38rem !important;
}

.generated-game-page .workspace-title-block {
  min-width: 0 !important;
  display: grid !important;
  gap: 0.16rem !important;
}

.generated-game-page .workspace-title-block > strong {
  overflow: hidden !important;
  color: #f8fbff !important;
  font-size: clamp(1rem, 1.5vw, 1.2rem) !important;
  line-height: 1.14 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.generated-game-page .workspace-artifact-status {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.38rem !important;
  min-width: 0 !important;
  color: rgba(203, 213, 225, 0.68) !important;
  font-size: 0.68rem !important;
  font-weight: 780 !important;
}

.generated-game-page .workspace-artifact-status b {
  color: rgba(126, 239, 255, 0.9) !important;
  font-style: normal !important;
}

.generated-game-page .workspace-artifact-status i {
  min-width: 0 !important;
  overflow: hidden !important;
  color: rgba(226, 232, 240, 0.64) !important;
  font-style: normal !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.generated-game-page .workspace-status-strip {
  display: none !important;
}

.generated-game-page .generated-view-switch {
  min-width: min(230px, 42vw) !important;
  border-color: rgba(148, 163, 184, 0.18) !important;
  border-radius: 999px !important;
  background: rgba(7, 11, 24, 0.78) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

.generated-game-page .generated-view-switch button {
  min-height: 34px !important;
  border-radius: 999px !important;
  font-size: 0.72rem !important;
}

.generated-game-page .generated-view-shell,
.generated-game-page .playable-shell {
  padding: 0 0.85rem 0.85rem !important;
}

.generated-game-page .generated-preview-view.playable-preview-card {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  gap: 0.58rem !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.generated-game-page .workspace-stage-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.68rem !important;
  min-width: 0 !important;
  padding: 0.5rem !important;
  border: 1px solid rgba(116, 229, 255, 0.14) !important;
  border-radius: 13px !important;
  background: rgba(7, 13, 28, 0.74) !important;
}

.generated-game-page .workspace-stage-label {
  min-width: 0 !important;
  display: grid !important;
  gap: 0.05rem !important;
}

.generated-game-page .workspace-stage-label span {
  color: rgba(126, 239, 255, 0.8) !important;
  font-size: 0.62rem !important;
  font-weight: 950 !important;
  text-transform: uppercase !important;
}

.generated-game-page .workspace-stage-label strong {
  overflow: hidden !important;
  color: rgba(248, 250, 252, 0.92) !important;
  font-size: 0.76rem !important;
  line-height: 1.2 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.generated-game-page .workspace-stage-toolbar .preview-card-actions {
  display: flex !important;
  grid-template-columns: none !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  gap: 0.36rem !important;
}

.generated-game-page .workspace-stage-toolbar .game-preview-btn {
  min-width: 0 !important;
  min-height: 32px !important;
  padding: 0.42rem 0.68rem !important;
  border-radius: 999px !important;
  border-color: rgba(148, 163, 184, 0.2) !important;
  background: rgba(255, 255, 255, 0.055) !important;
  color: rgba(241, 245, 249, 0.9) !important;
  font-size: 0.72rem !important;
  font-weight: 900 !important;
  white-space: nowrap !important;
}

.generated-game-page .workspace-stage-toolbar .game-preview-btn:hover {
  border-color: rgba(116, 229, 255, 0.42) !important;
  background: rgba(116, 229, 255, 0.12) !important;
}

.generated-game-page .workspace-stage-toolbar .game-preview-btn-primary,
.generated-game-page .workspace-stage-toolbar .game-preview-btn[data-game-action="pause"] {
  border-color: rgba(116, 229, 255, 0.36) !important;
  background: linear-gradient(135deg, rgba(94, 231, 255, 0.78), rgba(139, 92, 246, 0.72)) !important;
  color: #fff !important;
  box-shadow: 0 12px 28px rgba(94, 231, 255, 0.16) !important;
}

.generated-game-page .game-preview-viewport {
  width: 100% !important;
  min-width: 0 !important;
  border-radius: 14px !important;
  border-color: rgba(116, 229, 255, 0.2) !important;
  background: rgba(2, 6, 23, 0.88) !important;
}

.generated-game-page .preview-card-hint {
  display: none !important;
}

.generated-game-page .generated-chat-view .game-preview-chat-panel {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.68rem !important;
  padding: 0.9rem !important;
  border-radius: 14px !important;
  border-color: rgba(116, 229, 255, 0.14) !important;
  background: linear-gradient(180deg, rgba(10, 17, 34, 0.82), rgba(2, 6, 23, 0.72)), rgba(2, 6, 23, 0.72) !important;
}

.generated-game-page .preview-chat-title-row {
  justify-content: space-between !important;
  gap: 0.6rem !important;
  font-size: 0.98rem !important;
}

.generated-game-page .preview-chat-title-row span {
  flex: 0 0 auto !important;
  padding: 0.18rem 0.5rem !important;
  border: 1px solid rgba(116, 229, 255, 0.14) !important;
  border-radius: 999px !important;
  color: rgba(126, 239, 255, 0.78) !important;
  font-size: 0.66rem !important;
  font-weight: 900 !important;
}

.generated-game-page .preview-chat-assistant-note {
  margin: 0 !important;
  padding: 0.72rem 0.82rem !important;
  border: 1px solid rgba(116, 229, 255, 0.14) !important;
  border-left: 2px solid rgba(116, 229, 255, 0.46) !important;
  border-radius: 12px !important;
  background: rgba(6, 16, 33, 0.72) !important;
}

.generated-game-page .workspace-prompt-chips {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.42rem !important;
}

.generated-game-page .workspace-prompt-chip {
  min-height: 32px !important;
  padding: 0.4rem 0.66rem !important;
  border: 1px solid rgba(148, 163, 184, 0.18) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.055) !important;
  color: rgba(226, 232, 240, 0.86) !important;
  font: inherit !important;
  font-size: 0.72rem !important;
  font-weight: 850 !important;
  cursor: pointer !important;
}

.generated-game-page .workspace-prompt-chip:hover {
  border-color: rgba(116, 229, 255, 0.36) !important;
  background: rgba(116, 229, 255, 0.1) !important;
  color: #fff !important;
}

.generated-game-page .preview-chat-edit-status {
  margin-top: auto !important;
  padding: 0.68rem 0.78rem !important;
  border: 1px solid rgba(116, 229, 255, 0.14) !important;
  border-radius: 12px !important;
  background: rgba(7, 13, 28, 0.68) !important;
  color: rgba(155, 239, 255, 0.88) !important;
}

@media (max-width: 720px) {
  .generated-game-page .generated-main-header {
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 0.64rem 0.5rem 0.4rem !important;
  }

  .generated-game-page .workspace-title-block > strong,
  .generated-game-page .workspace-artifact-status i {
    white-space: normal !important;
  }

  .generated-game-page .generated-view-switch {
    width: 100% !important;
    min-width: 0 !important;
  }

  .generated-game-page .generated-view-shell,
  .generated-game-page .playable-shell {
    padding: 0 0.5rem 0.5rem !important;
  }

  .generated-game-page .workspace-stage-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0.44rem !important;
    padding: 0.42rem !important;
    border-radius: 12px !important;
  }

  .generated-game-page .workspace-stage-toolbar .preview-card-actions {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: 100% !important;
    gap: 0.32rem !important;
  }

  .generated-game-page .workspace-stage-toolbar .game-preview-btn {
    min-height: 30px !important;
    padding: 0.35rem 0.28rem !important;
    font-size: 0.68rem !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .playable-shell.preview-open .playable-preview-card {
    grid-template-rows: auto minmax(0, 1fr) !important;
    gap: 0.5rem !important;
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 0.5rem !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .playable-shell.preview-open .workspace-stage-toolbar .game-preview-actions {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0.32rem !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .playable-shell.preview-open .workspace-stage-toolbar .game-preview-actions button {
    min-width: 0 !important;
    padding-inline: 0.28rem !important;
    white-space: nowrap !important;
  }

  body.game-edit-workspace-active:has(.playable-shell.preview-open) .game-preview-viewport {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
  }

  .generated-game-page .generated-chat-view .game-preview-chat-panel {
    padding: 0.78rem !important;
  }
}
/* Center workspace view-state guard: only the active panel should render. */
.generated-game-page[data-generated-view="chat"] .generated-preview-view,
.generated-game-page[data-generated-view="preview"] .generated-chat-view {
  display: none !important;
}

.generated-game-page[data-generated-view="chat"] .generated-chat-view {
  display: block !important;
}

.generated-game-page[data-generated-view="preview"] .generated-preview-view.playable-preview-card {
  display: grid !important;
}
/* Compact/tablet preview focus: hide workspace chrome and center the full game stage. */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-main-header {
    display: none !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"],
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .workspace-body,
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .game-preview-column,
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .playable-shell {
    min-height: 0 !important;
    height: auto !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .playable-shell {
    display: grid !important;
    place-items: center !important;
    padding: 0.45rem !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-preview-view.playable-preview-card {
    width: 100% !important;
    max-width: 100vw !important;
    min-height: calc(100dvh - 4.5rem) !important;
    height: calc(100dvh - 4.5rem) !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    align-items: center !important;
    justify-items: center !important;
    gap: 0.45rem !important;
    padding: 0 !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .workspace-stage-toolbar {
    width: min(100%, 520px) !important;
    max-width: calc(100vw - 1rem) !important;
    margin: 0 auto !important;
    padding: 0.34rem !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .workspace-stage-label {
    display: none !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .workspace-stage-toolbar .preview-card-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0.32rem !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .workspace-stage-toolbar .game-preview-btn {
    min-height: 30px !important;
    padding: 0.34rem 0.28rem !important;
    font-size: 0.68rem !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .game-preview-viewport {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: calc(100vw - 1rem) !important;
    height: min(80dvh, calc(100dvh - 8rem), 820px) !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 9 / 16 !important;
    margin: 0 auto !important;
    overflow: hidden !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .game-preview-canvas {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    aspect-ratio: 9 / 16 !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .template-preview-frame {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
  }
}
/* Compact/tablet Preview should not reserve space for the chat transcript above the game. */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-history > .chat-message:not(.has-game-workspace),
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-history > #chatOptionsContainer,
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-history > .progress-container {
    display: none !important;
  }

  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-history {
    align-content: start !important;
    padding-top: 0 !important;
  }

  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-message.has-game-workspace,
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .generation-result,
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .generation-result > .generated-game-page {
    margin-top: 0 !important;
  }
}
/* Compact/tablet Preview should show only the game workspace, not generation summary chrome. */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .generation-result > :not(.generated-game-page) {
    display: none !important;
  }

  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .generation-result > .generated-game-page {
    display: block !important;
  }
}
/* Keep compact Preview controls inside the visible area while the game remains centered. */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .playable-shell {
    align-items: start !important;
    justify-items: center !important;
    place-items: start center !important;
  }
}
/* Final compact/tablet safe fit: leave a little bottom breathing room for landscape browsers. */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .game-preview-viewport {
    height: min(78dvh, calc(100dvh - 9rem), 800px) !important;
  }
}
/* Compact/tablet Preview top-right view switch: keep chat/preview accessible without stealing game height. */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-main-header {
    position: fixed !important;
    top: calc(env(safe-area-inset-top, 0px) + 0.62rem) !important;
    right: calc(env(safe-area-inset-right, 0px) + 0.62rem) !important;
    left: auto !important;
    z-index: 80 !important;
    display: flex !important;
    width: auto !important;
    max-width: min(52vw, 250px) !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    pointer-events: none !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-main-header .workspace-title-block {
    display: none !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-main-header .generated-view-switch {
    pointer-events: auto !important;
    width: min(52vw, 236px) !important;
    min-width: 0 !important;
    padding: 0.18rem !important;
    border-radius: 999px !important;
    border-color: rgba(116, 229, 255, 0.24) !important;
    background: rgba(8, 13, 30, 0.88) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(14px) !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-main-header .generated-view-switch button {
    min-height: 30px !important;
    padding: 0 0.42rem !important;
    font-size: 0.68rem !important;
    white-space: nowrap !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .workspace-stage-toolbar {
    margin-top: 2.35rem !important;
  }
}

@media (max-width: 430px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-main-header {
    max-width: 214px !important;
    right: calc(env(safe-area-inset-right, 0px) + 0.42rem) !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-main-header .generated-view-switch {
    width: 214px !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-main-header .generated-view-switch button {
    font-size: 0.64rem !important;
  }
}
/* Stable body-level compact view switch: avoids scroll/container-dependent jumps. */
.compact-workspace-view-switch {
  display: none;
}

@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active .compact-workspace-view-switch {
    position: fixed !important;
    top: calc(env(safe-area-inset-top, 0px) + 4.55rem) !important;
    right: calc(env(safe-area-inset-right, 0px) + 0.6rem) !important;
    z-index: 120 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.18rem !important;
    width: min(52vw, 236px) !important;
    min-width: 190px !important;
    padding: 0.18rem !important;
    border: 1px solid rgba(116, 229, 255, 0.24) !important;
    border-radius: 999px !important;
    background: rgba(8, 13, 30, 0.9) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(14px) !important;
  }

  body.game-edit-workspace-active .compact-workspace-view-switch button {
    min-width: 0 !important;
    min-height: 30px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: transparent !important;
    color: rgba(226, 232, 240, 0.72) !important;
    font: inherit !important;
    font-size: 0.68rem !important;
    font-weight: 950 !important;
    white-space: nowrap !important;
  }

  body.game-edit-workspace-active .compact-workspace-view-switch button.active {
    color: #fff !important;
    background: linear-gradient(135deg, rgba(94, 231, 255, 0.84), rgba(139, 92, 246, 0.88)) !important;
    box-shadow: 0 10px 24px rgba(94, 231, 255, 0.16) !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .generated-main-header {
    display: none !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .workspace-stage-toolbar {
    margin-top: 2.35rem !important;
  }
}

@media (max-width: 430px) {
  body.game-edit-workspace-active .compact-workspace-view-switch {
    right: calc(env(safe-area-inset-right, 0px) + 0.42rem) !important;
    width: 214px !important;
    min-width: 0 !important;
  }

  body.game-edit-workspace-active .compact-workspace-view-switch button {
    font-size: 0.64rem !important;
  }
}
/* Ensure the compact view switch is the actual click target above the playable stage. */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active .compact-workspace-view-switch {
    z-index: 2147483000 !important;
    pointer-events: auto !important;
  }

  body.game-edit-workspace-active .compact-workspace-view-switch button {
    pointer-events: auto !important;
    cursor: pointer !important;
  }
}
/* Compact/tablet Preview final fit: no bottom composer in preview, and reserve enough landscape height. */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-input-wrapper {
    display: none !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .game-preview-viewport {
    height: min(78dvh, calc(100dvh - 11.5rem), 800px) !important;
  }
}
/* Compact/tablet Preview final-final landscape safety margin. */
@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1366px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .game-preview-viewport {
    height: min(78dvh, calc(100dvh - 12rem), 800px) !important;
  }
}
/* All-screen preview shell cleanup: use the body-level floating Chat/Preview switch only. */
body.game-edit-workspace-active .compact-workspace-view-switch {
  position: fixed !important;
  top: calc(env(safe-area-inset-top, 0px) + 4.55rem) !important;
  right: calc(env(safe-area-inset-right, 0px) + 1rem) !important;
  z-index: 2147483000 !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 0.18rem !important;
  width: 236px !important;
  min-width: 190px !important;
  padding: 0.18rem !important;
  border: 1px solid rgba(116, 229, 255, 0.24) !important;
  border-radius: 999px !important;
  background: rgba(8, 13, 30, 0.9) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(14px) !important;
  pointer-events: auto !important;
}

body.game-edit-workspace-active .compact-workspace-view-switch button {
  min-width: 0 !important;
  min-height: 30px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: rgba(226, 232, 240, 0.72) !important;
  font: inherit !important;
  font-size: 0.68rem !important;
  font-weight: 950 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}

body.game-edit-workspace-active .compact-workspace-view-switch button.active {
  color: #fff !important;
  background: linear-gradient(135deg, rgba(94, 231, 255, 0.84), rgba(139, 92, 246, 0.88)) !important;
  box-shadow: 0 10px 24px rgba(94, 231, 255, 0.16) !important;
}

body.game-edit-workspace-active .generated-game-page .generated-main-header {
  display: none !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-history > .chat-message:not(.has-game-workspace),
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-history > #chatOptionsContainer,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-history > .progress-container,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .progress-container,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .generation-result > :not(.generated-game-page) {
  display: none !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .generation-result > .generated-game-page {
  display: block !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-history,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .generation-result,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"]) .chat-message.has-game-workspace {
  margin-top: 0 !important;
  padding-top: 0 !important;
  align-content: start !important;
}

@media (min-width: 1181px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"] .workspace-stage-toolbar {
    margin-top: 0.4rem !important;
  }
}
/* Composer v2: multiline text area above a stable tool row. */
.chat-input-bar.unified-pill {
  display: grid !important;
  grid-template-rows: auto auto !important;
  gap: 0.48rem !important;
  padding: 0.72rem 0.82rem 0.58rem !important;
  border-radius: 24px !important;
}

.chat-input-bar.unified-pill .chat-attachment-tray {
  grid-row: 1 !important;
}

.chat-input-bar.unified-pill .chat-composer-row {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto !important;
  grid-template-rows: minmax(24px, auto) 36px !important;
  column-gap: 0.48rem !important;
  row-gap: 0.42rem !important;
  align-items: center !important;
  width: 100% !important;
  overflow: visible !important;
}

.chat-input-bar.unified-pill .chat-real-input {
  grid-column: 1 / -1 !important;
  grid-row: 1 !important;
  order: 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 28px !important;
  max-height: min(32vh, 220px) !important;
  padding: 0.12rem 0.18rem 0.22rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: rgba(248, 250, 252, 0.96) !important;
  font-size: clamp(0.96rem, 1vw, 1.06rem) !important;
  font-weight: 650 !important;
  line-height: 1.48 !important;
  resize: none !important;
  overflow-y: auto !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  scrollbar-width: thin !important;
}

.chat-input-bar.unified-pill .chat-real-input::placeholder {
  color: rgba(226, 232, 240, 0.54) !important;
  font-weight: 650 !important;
}

.chat-input-bar.unified-pill .plus-btn {
  grid-column: 1 !important;
  grid-row: 2 !important;
  order: 0 !important;
  justify-self: start !important;
}

.chat-input-bar.unified-pill .chat-char-count {
  grid-column: 3 !important;
  grid-row: 2 !important;
  order: 0 !important;
  justify-self: end !important;
  align-self: center !important;
}

.chat-input-bar.unified-pill .right-actions {
  grid-column: 4 / 6 !important;
  grid-row: 2 !important;
  order: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.38rem !important;
  min-width: 0 !important;
}

.chat-input-bar.unified-pill .icon-btn,
.chat-input-bar.unified-pill .chat-send-btn,
.chat-input-bar.unified-pill .model-selector {
  flex: 0 0 auto !important;
}

.chat-input-bar.unified-pill:focus-within {
  border-radius: 28px !important;
  box-shadow: 0 18px 52px rgba(14, 165, 233, 0.16), 0 0 0 1px rgba(72, 187, 255, 0.28) !important;
}

body.game-edit-workspace-active .chat-input-bar.unified-pill {
  max-height: min(44vh, 340px) !important;
}

body.game-edit-workspace-active .chat-input-bar.unified-pill .chat-real-input {
  max-height: min(28vh, 210px) !important;
}

@media (max-width: 720px) {
  .chat-input-bar.unified-pill {
    border-radius: 22px !important;
    padding: 0.68rem 0.72rem 0.52rem !important;
  }

  .chat-input-bar.unified-pill .chat-composer-row {
    grid-template-columns: auto minmax(0, 1fr) auto auto !important;
    grid-template-rows: minmax(24px, auto) 34px !important;
    column-gap: 0.34rem !important;
  }

  .chat-input-bar.unified-pill .chat-real-input {
    max-height: min(30vh, 180px) !important;
    font-size: 0.96rem !important;
    line-height: 1.44 !important;
  }

  .chat-input-bar.unified-pill .chat-char-count {
    grid-column: 2 !important;
    justify-self: end !important;
    font-size: 0.62rem !important;
  }

  .chat-input-bar.unified-pill .right-actions {
    grid-column: 3 / 5 !important;
    gap: 0.28rem !important;
  }
}
/* Composer v3: make long-draft selection behave like a native editor. */
.chat-input-bar.unified-pill,
.chat-input-bar.unified-pill .chat-composer-row {
  user-select: auto !important;
  -webkit-user-select: auto !important;
  touch-action: auto !important;
}

.chat-input-bar.unified-pill .chat-real-input {
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text !important;
  touch-action: auto !important;
  overscroll-behavior: auto !important;
  scroll-padding-block: 0.75rem !important;
  -webkit-user-drag: none !important;
}

.chat-input-bar.unified-pill:focus-within .chat-real-input {
  max-height: min(42vh, 320px) !important;
}

body.game-edit-workspace-active .chat-input-bar.unified-pill:focus-within {
  max-height: min(64vh, 500px) !important;
}

body.game-edit-workspace-active .chat-input-bar.unified-pill:focus-within .chat-real-input {
  max-height: min(42vh, 320px) !important;
}

@media (max-width: 720px) {
  .chat-input-bar.unified-pill:focus-within .chat-real-input,
  body.game-edit-workspace-active .chat-input-bar.unified-pill:focus-within .chat-real-input {
    max-height: min(34dvh, 260px) !important;
  }

  body.game-edit-workspace-active .chat-input-bar.unified-pill:focus-within {
    max-height: min(52dvh, 390px) !important;
  }
}
/* Generated preview layout v2: landscape games should not inherit the compact 9:16 phone stage. */
.generated-game-page[data-preview-layout="landscape"] .game-preview-viewport {
  aspect-ratio: var(--preview-aspect, 16 / 9) !important;
}

.generated-game-page[data-preview-layout="landscape"] .template-preview-frame,
.generated-game-page[data-preview-layout="portrait"] .template-preview-frame {
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
}

.preview-layout-diagnostic {
  width: min(100%, 960px);
  margin: 0.45rem auto 0;
  padding: 0.48rem 0.68rem;
  border: 1px solid rgba(245, 195, 28, 0.45);
  border-radius: 8px;
  background: rgba(245, 195, 28, 0.12);
  color: #fde68a;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.35;
}

.preview-layout-diagnostic[hidden] {
  display: none !important;
}

@media (min-width: 721px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .generated-main-header {
    display: grid !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .generated-page-layout,
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .game-preview-column,
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .playable-shell {
    min-height: 0 !important;
    height: 100% !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .playable-shell {
    display: grid !important;
    place-items: stretch !important;
    padding: 0.65rem !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .generated-preview-view.playable-preview-card {
    width: 100% !important;
    max-width: none !important;
    min-height: min(78dvh, 760px) !important;
    height: auto !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    align-items: stretch !important;
    justify-items: stretch !important;
    gap: 0.6rem !important;
    padding: 0.72rem !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .workspace-stage-toolbar {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .workspace-stage-label {
    display: grid !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .game-preview-viewport {
    display: block !important;
    width: min(100%, calc((100dvh - 10.5rem) * 1.7778)) !important;
    min-width: min(70%, 720px) !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: min(78dvh, 760px) !important;
    aspect-ratio: var(--preview-aspect, 16 / 9) !important;
    margin: 0 auto !important;
    overflow: hidden !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="portrait"] .game-preview-viewport {
    aspect-ratio: var(--preview-aspect, 9 / 16) !important;
  }
}

@media (min-width: 900px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .game-preview-viewport {
    width: min(100%, calc((100dvh - 9.25rem) * 1.7778)) !important;
    min-width: min(82%, 860px) !important;
  }
}

@media (max-width: 720px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .game-preview-viewport {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    min-height: 0 !important;
    height: auto !important;
    aspect-ratio: var(--preview-aspect, 16 / 9) !important;
  }

  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="portrait"] .game-preview-viewport,
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="portrait"] .game-preview-canvas {
    aspect-ratio: var(--preview-aspect, 9 / 16) !important;
  }
}
/* Generated preview layout v2 override with valid attribute selectors. */
.generated-game-page[data-preview-layout="landscape"] {}
.generated-game-page[data-preview-layout="portrait"] {}
.generated-game-page[data-preview-layout="landscape"] .game-preview-viewport { aspect-ratio: var(--preview-aspect, 16 / 9) !important; }
.generated-game-page[data-preview-layout="landscape"] .template-preview-frame,
.generated-game-page[data-preview-layout="portrait"] .template-preview-frame { width: 100% !important; height: 100% !important; border: 0 !important; }
@media (min-width: 721px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .generated-main-header { display: grid !important; }
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .generated-page-layout,
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .game-preview-column,
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .playable-shell { min-height: 0 !important; height: 100% !important; }
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .playable-shell { display: grid !important; place-items: stretch !important; padding: 0.65rem !important; }
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .generated-preview-view.playable-preview-card { width: 100% !important; max-width: none !important; min-height: min(78dvh, 760px) !important; height: auto !important; grid-template-rows: auto minmax(0, 1fr) auto !important; align-items: stretch !important; justify-items: stretch !important; gap: 0.6rem !important; padding: 0.72rem !important; }
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .workspace-stage-toolbar { width: 100% !important; max-width: none !important; margin: 0 !important; }
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .workspace-stage-label { display: grid !important; }
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .game-preview-viewport { display: block !important; width: min(100%, calc((100dvh - 10.5rem) * 1.7778)) !important; min-width: min(70%, 720px) !important; max-width: 100% !important; height: auto !important; min-height: 0 !important; max-height: min(78dvh, 760px) !important; aspect-ratio: var(--preview-aspect, 16 / 9) !important; margin: 0 auto !important; overflow: hidden !important; }
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="portrait"] .game-preview-viewport { aspect-ratio: var(--preview-aspect, 9 / 16) !important; }
}
@media (min-width: 900px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .game-preview-viewport { width: min(100%, calc((100dvh - 9.25rem) * 1.7778)) !important; min-width: min(82%, 860px) !important; }
}
@media (max-width: 720px) {
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"] .game-preview-viewport { width: calc(100vw - 1rem) !important; max-width: calc(100vw - 1rem) !important; min-height: 0 !important; height: auto !important; aspect-ratio: var(--preview-aspect, 16 / 9) !important; }
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="portrait"] .game-preview-viewport,
  body.game-edit-workspace-active .generated-game-page[data-generated-view="preview"][data-preview-layout="portrait"] .game-preview-canvas { aspect-ratio: var(--preview-aspect, 9 / 16) !important; }
}
/* Generated preview layout v3: make landscape generated games use the full workspace width. */
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) {
  --chat-stage-width: min(1760px, calc(100vw - 36px)) !important;
  --center-chat-width: var(--chat-stage-width) !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .chat-history,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .chat-message.has-game-workspace,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .chat-message.has-game-workspace .chat-bubble,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generation-result,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generation-result > .generated-game-page {
  width: var(--chat-stage-width) !important;
  max-width: var(--chat-stage-width) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page {
  min-height: min(820px, calc(100dvh - 86px)) !important;
  max-height: calc(100dvh - 74px) !important;
  overflow: hidden !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .change-history-sidebar,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .game-edit-sidebar {
  display: none !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .generated-page-layout,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .game-preview-column,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .generated-main-panel,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .playable-shell {
  display: grid !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .generated-page-layout,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .game-preview-column,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .generated-main-panel {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .playable-shell {
  align-items: stretch !important;
  justify-items: center !important;
  padding: 0.65rem !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .generated-preview-view.playable-preview-card {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  height: 100% !important;
  grid-template-rows: auto minmax(0, auto) auto !important;
  align-content: start !important;
  justify-items: center !important;
  gap: 0.58rem !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .game-preview-viewport {
  display: block !important;
  width: min(100%, calc((100dvh - 11rem) * 1.7778), 1600px) !important;
  min-width: min(72vw, 860px) !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: var(--preview-aspect, 16 / 9) !important;
  margin: 0 auto !important;
  overflow: hidden !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .game-preview-canvas,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .template-preview-frame {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  border: 0 !important;
}

@media (min-width: 1181px) {
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .game-preview-viewport {
    width: min(100%, calc((100dvh - 10rem) * 1.7778), 1600px) !important;
    min-width: min(78vw, 980px) !important;
  }
}

@media (max-width: 720px) {
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) {
    --chat-stage-width: 100vw !important;
  }

  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page {
    min-height: calc(100dvh - 76px) !important;
    max-height: calc(100dvh - 76px) !important;
  }

  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .playable-shell {
    padding: 0.5rem !important;
  }

  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .game-preview-viewport {
    width: calc(100vw - 1rem) !important;
    min-width: 0 !important;
    aspect-ratio: var(--preview-aspect, 16 / 9) !important;
  }
}
/* Generated preview layout v4: override chat-history local stage variables for landscape preview. */
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .chat-history {
  --chat-stage-width: min(1760px, calc(100vw - 36px)) !important;
  --center-chat-width: var(--chat-stage-width) !important;
  width: min(1760px, calc(100vw - 36px)) !important;
  max-width: min(1760px, calc(100vw - 36px)) !important;
}

body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .chat-message.has-game-workspace,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .chat-message.has-game-workspace .chat-bubble,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generation-result,
body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generation-result > .generated-game-page {
  --chat-stage-width: min(1760px, calc(100vw - 36px)) !important;
  width: min(1760px, calc(100vw - 36px)) !important;
  max-width: min(1760px, calc(100vw - 36px)) !important;
}
/* Generated preview layout v5: keep landscape preview flush on phone widths. */
@media (max-width: 720px) {
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .chat-history,
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .chat-message.has-game-workspace,
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .chat-message.has-game-workspace .chat-bubble,
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generation-result,
  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generation-result > .generated-game-page {
    --chat-stage-width: 100vw !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body.game-edit-workspace-active:has(.generated-game-page[data-generated-view="preview"][data-preview-layout="landscape"]) .generated-game-page .game-preview-viewport {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
  }
}
/* ===== UX cleanup: thin progress trails + non-overlapping workspace controls ===== */
.progress-container {
    min-height: 300px !important;
    gap: 1.15rem !important;
    padding: 1.2rem 0 1.8rem !important;
}

.progress-text {
    order: 2 !important;
    font-size: clamp(2.4rem, 8vw, 4.2rem) !important;
    font-weight: 850 !important;
    letter-spacing: 0 !important;
    filter: drop-shadow(0 0 12px rgba(164, 130, 255, 0.32)) !important;
}

.progress-bar-bg {
    order: 3 !important;
    width: min(74vw, 520px) !important;
    height: 26px !important;
    margin: 0.1rem auto 0.25rem !important;
    overflow: visible !important;
    background: transparent !important;
    box-shadow: none !important;
}

.progress-bar-bg::before,
.progress-bar-bg::after {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    height: 1px !important;
    pointer-events: none !important;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), rgba(164, 130, 255, 0.24), transparent) !important;
}

.progress-bar-bg::before {
    top: 7px !important;
}

.progress-bar-bg::after {
    bottom: 6px !important;
    opacity: 0.65 !important;
}

.progress-bar-fill {
    position: absolute !important;
    left: 0 !important;
    top: 12px !important;
    height: 2px !important;
    min-width: 38px !important;
    border-radius: 999px !important;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(205, 190, 255, 0.92), #ffffff) !important;
    box-shadow:
        -36px 0 14px rgba(255, 255, 255, 0.34),
        -86px 0 18px rgba(164, 130, 255, 0.3),
        0 0 12px rgba(198, 176, 255, 0.7) !important;
}

.progress-bar-fill::before,
.progress-bar-fill::after {
    content: '' !important;
    position: absolute !important;
    right: -2px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    border-radius: 999px !important;
    pointer-events: none !important;
}

.progress-bar-fill::before {
    width: 120px !important;
    height: 1px !important;
    background: linear-gradient(90deg, rgba(164, 130, 255, 0), rgba(212, 202, 255, 0.48), rgba(255, 255, 255, 0.95)) !important;
    filter: blur(0.8px) !important;
}

.progress-bar-fill::after {
    width: 7px !important;
    height: 7px !important;
    background: radial-gradient(circle, #fff 0%, #d8c9ff 48%, rgba(164, 130, 255, 0) 72%) !important;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 0 18px rgba(164, 130, 255, 0.72) !important;
}

.generation-steps {
    order: 4 !important;
    max-width: 420px !important;
    gap: 0.62rem !important;
    margin-top: 0.15rem !important;
}

.step-icon {
    width: 18px !important;
    height: 18px !important;
    border-width: 1.5px !important;
    margin-right: 0.34rem !important;
}

.step-text {
    font-size: 0.82rem !important;
    color: rgba(226, 232, 240, 0.66) !important;
}

.progress-logo {
    order: 5 !important;
    max-width: 420px !important;
    margin-top: 0.25rem !important;
}

body.game-edit-workspace-active .compact-workspace-view-switch,
body.game-edit-workspace-active .mobile-workspace-view-switch {
    display: none !important;
}

body.game-edit-workspace-active .generated-game-page .generated-main-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    align-items: center !important;
    gap: 0.72rem !important;
    min-height: 58px !important;
    padding: 0.58rem 0.78rem 0 !important;
}

body.game-edit-workspace-active .generated-game-page .workspace-header-actions {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 0.42rem !important;
    min-width: 0 !important;
}

body.game-edit-workspace-active .generated-game-page .generated-view-switch {
    position: static !important;
    width: auto !important;
    min-width: 206px !important;
    max-width: 240px !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    flex: 0 0 auto !important;
    transform: none !important;
}

body.game-edit-workspace-active .generated-game-page .generated-view-switch button {
    min-height: 32px !important;
    padding: 0 0.62rem !important;
    font-size: 0.68rem !important;
}

body.game-edit-workspace-active .generated-game-page .playable-shell {
    padding: 0.58rem 0.78rem 0.78rem !important;
}

body.game-edit-workspace-active .generated-game-page[data-generated-view='preview'] .generated-preview-view.playable-preview-card {
    grid-template-rows: auto minmax(0, 1fr) !important;
    align-content: stretch !important;
    justify-items: stretch !important;
    gap: 0.55rem !important;
    padding: 0 !important;
}

body.game-edit-workspace-active .generated-game-page .workspace-stage-toolbar {
    position: relative !important;
    z-index: 2 !important;
    display: grid !important;
    grid-template-columns: minmax(150px, 0.52fr) minmax(320px, 1fr) !important;
    align-items: center !important;
    gap: 0.6rem !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0.4rem 0.48rem !important;
    border-radius: 12px !important;
    background: rgba(7, 13, 28, 0.62) !important;
}

body.game-edit-workspace-active .generated-game-page .workspace-stage-label {
    min-width: 0 !important;
    padding-left: 0.12rem !important;
}

body.game-edit-workspace-active .generated-game-page .workspace-stage-label span {
    font-size: 0.56rem !important;
    line-height: 1.05 !important;
}

body.game-edit-workspace-active .generated-game-page .workspace-stage-label strong {
    max-width: 100% !important;
    font-size: 0.74rem !important;
}

body.game-edit-workspace-active .generated-game-page .workspace-stage-toolbar .preview-card-actions {
    justify-self: stretch !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0.38rem !important;
}

body.game-edit-workspace-active .generated-game-page .workspace-stage-toolbar .game-preview-btn {
    width: 100% !important;
    min-height: 30px !important;
    padding: 0.34rem 0.5rem !important;
    font-size: 0.68rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

body.game-edit-workspace-active .mobile-workspace-drawer-toggle {
    display: none !important;
}

@media (max-width: 720px) {
    body.game-edit-workspace-active .mobile-workspace-drawer-toggle {
        display: inline-flex !important;
    }

    body.game-edit-workspace-active .generated-game-page .generated-main-header {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 0.5rem !important;
    }

    body.game-edit-workspace-active .generated-game-page .workspace-header-actions,
    body.game-edit-workspace-active .generated-game-page .generated-view-switch {
        width: 100% !important;
        max-width: none !important;
    }

    body.game-edit-workspace-active .generated-game-page .workspace-stage-toolbar {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.game-edit-workspace-active .generated-game-page .workspace-stage-toolbar .preview-card-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* ===== Narrow preview final pass: remove overlapping header and let trails lead ===== */
.progress-text {
    font-size: clamp(1.35rem, 3.6vw, 2.1rem) !important;
    font-weight: 820 !important;
    opacity: 0.86 !important;
}

.progress-bar-bg {
    width: min(78vw, 560px) !important;
}

@media (max-width: 1023px) {
    body.game-edit-workspace-active .generated-game-page[data-generated-view='preview'] .generated-main-header {
        display: none !important;
    }

    body.game-edit-workspace-active .generated-game-page[data-generated-view='preview'] .playable-shell {
        padding-top: 0.58rem !important;
    }
}

/* ===== Absolute last guard: narrow landscape preview must not show duplicate header ===== */
@media (max-width: 1023px) {
    body.game-edit-workspace-active .generated-game-page[data-generated-view='preview'][data-preview-layout='landscape'] .generated-main-header {
        display: none !important;
    }
}

/* ===== Chat rebuild color tokens (CHAT_REBUILD_PLAN M1/T1.4) =====
   Authoritative token block: values live ONLY here; chat-rebuild.css
   references them via rgb()/rgba(var(--rgb-*)). Appended last so it wins. */
:root {
    --rgb-cyan-soft: 125, 231, 255;
    --rgb-cyan: 94, 231, 255;
    --rgb-white: 255, 255, 255;
    --rgb-black: 0, 0, 0;
    --rgb-ink-a: 11, 18, 34;
    --rgb-ink-b: 7, 10, 20;
    --rgb-ink-c: 12, 20, 42;
    --rgb-ink-d: 7, 10, 22;
    --rgb-ink-e: 3, 7, 18;
    --rgb-periwinkle: 160, 190, 255;
    --rgb-lavender: 216, 228, 255;
    --rgb-indigo-soft: 118, 109, 255;
    --rgb-blue-glow: 80, 170, 255;
    --rgb-text-soft: 232, 244, 255;
    --rgb-text-strong: 243, 248, 255;
    --rgb-text-stronger: 246, 249, 255;
    --rgb-option-text: 237, 246, 255;
    --rgb-option-strong: 247, 251, 255;
    --rgb-action-text: 238, 246, 255;
    --rgb-muted-a: 159, 180, 204;
    --rgb-muted-b: 148, 169, 196;
    --rgb-muted-c: 154, 167, 189;
    --rgb-detail: 197, 212, 232;
    --rgb-kicker: 128, 202, 255;
    --rgb-ok: 68, 209, 138;
    --rgb-warn: 255, 209, 102;
    --rgb-fail: 255, 107, 122;
    --rgb-queued: 167, 139, 250;
    --state-ok: rgb(111, 231, 168);
    --state-ok-dim: rgba(111, 231, 168, 0.14);
}
