:root {
    --cyber-black: #050505;
    --cyber-green: #00FF99;
    --cyber-green-glow: rgba(0, 255, 153, 0.4);
    --glass: rgba(255, 255, 255, 0.05);
}

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

body {
    background-image: url('./assets/片头碗底青字幕_mini.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #eee;
    font-size: 18px;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); /* 降低遮罩浓度，露出背景字 */
    z-index: -1;
}

.avatar-container {
    width: 100%;
    height: 20vh; /* 缩小头像高度，为聊天窗口留出空间 */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    filter: blur(2px) opacity(0.2) saturate(0.3) drop-shadow(0 0 20px #00FF99);
    transition: filter 1.5s ease;
}

.matrix-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(0, 255, 153, 0.05) 0%, transparent 100%);
    pointer-events: none;
    z-index: 10;
}

/* Header */
.aui-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    padding: 15px 40px; /* 略微收缩内边距 */
    align-items: center;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, transparent 100%);
    box-sizing: border-box;
}

.brand-identity { display: flex; align-items: center; gap: 15px; }

.logo-wrapper {
    width: 42px; /* 核心修正：缩小圆圈 */
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--cyber-green); /* 减薄边框 */
    background: rgba(0, 0, 0, 0.5);
    padding: 0; 
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--cyber-green-glow);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logo-wrapper:hover {
    box-shadow: 0 0 25px var(--cyber-green);
    transform: scale(1.05);
}

.logo-wrapper a {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.top-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
    filter: drop-shadow(0 0 5px var(--cyber-green));
    transform: scale(1.4); /* 放大 Logo 使其填满圆形边框 */
    transform-origin: center;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 15px;
    font-family: 'Orbitron', sans-serif;
}

.main-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--cyber-green);
    text-shadow: 0 0 10px var(--cyber-green);
    margin: 0;
    line-height: 1.2;
}

.sub-title {
    font-size: 12px;
    color: #a0f0c0;
    opacity: 0.8;
    letter-spacing: 2px;
    line-height: 1;
    white-space: nowrap;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.cyber-input, .cyber-select {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--cyber-green);
    color: var(--cyber-green);
    padding: 8px 15px; /* 回调至常规间距 */
    border-radius: 6px;
    font-size: 14px; /* 1080p 标准字号 */
    outline: none;
    width: 300px; /* 收紧宽度 */
    transition: all 0.3s ease;
}

.cyber-input:focus {
    box-shadow: 0 0 10px var(--cyber-green);
    background: rgba(0, 255, 153, 0.05);
}

/* Central Content & Column Layout */
.aui-dock {
    flex: 1;
    width: 60vw; /* 核心收紧宽度 */
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding-bottom: 20px;
    z-index: 10;
}

.chat-terminal {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--cyber-green);
    border-radius: 12px;
    padding: 20px;
    overflow: hidden; /* 限制内部滚动 */
    box-shadow: 0 0 30px rgba(0, 255, 153, 0.1);
}

.central-avatar {
    position: fixed; /* 核心修正：锁定在背景层 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px !important; /* 强制固定像素尺寸 */
    height: 800px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1; /* 位于背景之上，UI之下 */
    pointer-events: none; /* 防止遮挡下方交互 */
    
    /* 边缘虚化保持 */
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent),
                        linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent),
                linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}

.char-frame {
    width: 100%;
    aspect-ratio: 4/5;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#main-avatar {
    max-height: 100%;
    opacity: 0.3; /* 核心修正：大幅提高透明度 */
    filter: blur(8px) drop-shadow(0 0 20px var(--cyber-green-glow)); /* 加强模糊，营造虚幻感 */
}

.aui-status {
    margin-top: 15px;
    font-family: 'Orbitron', sans-serif;
    color: var(--cyber-green);
    font-size: 13px;
    letter-spacing: 3px;
    opacity: 0.8;
}

.bottom-interaction-zone {
    flex-shrink: 0; /* 绝对禁止被挤压 */
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 15px;
    padding-bottom: 20px; /* 增加底部防挤压边距 */
    border-top: 1px solid rgba(0, 255, 153, 0.1);
    margin-top: auto; /* 锚定至底部 */
}

.command-tip {
    font-size: 14px; /* 1080p 标准字号 */
    color: var(--cyber-green);
    background: rgba(0, 255, 153, 0.05);
    padding: 8px 15px;
    border-radius: 4px;
    border-left: 4px solid var(--cyber-green);
    margin-bottom: 5px;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
}

.chat-history {
    flex: 1; /* 占据剩余全部空间 */
    height: auto !important; /* 解除高度封锁 */
    min-height: 0; /* 彻底修复：允许在超短窗口下极度压缩 */
    overflow-y: auto;
    padding: 15px;
    font-size: 15px !important; 
    line-height: 1.5; 
    scrollbar-width: thin;
    scrollbar-color: var(--cyber-green) transparent;
}

.message {
    margin-bottom: 15px;
    color: #eee;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    font-size: inherit; /* 继承容器的大字号，解决微缩问题 */
}

.message.system { color: var(--cyber-green); }

.input-layer {
    display: flex;
    gap: 20px;
    align-items: center; /* 确保所有元素垂直居中对齐 */
    margin-bottom: 20px;
}

.sensor-mini {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mini-btn {
    width: 36px; /* 回调至标准图标尺寸 */
    height: 36px;
    background: rgba(0, 255, 153, 0.05);
    border: 1px solid var(--cyber-green);
    border-radius: 50%;
    color: var(--cyber-green);
    font-size: 16px; /* 1080p 图标尺寸 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    box-shadow: 0 0 10px rgba(0, 255, 153, 0.2);
}

#user-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 12px;
    height: 60px; /* 收缩高度 */
    resize: none;
    border-radius: 6px;
    font-size: 14px; /* 字号回调 */
}

#send-btn {
    background: var(--cyber-green);
    color: #000;
    border: none;
    padding: 0 30px;
    height: 60px;
    border-radius: 6px;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 14px; /* 字号回调 */
    cursor: pointer;
    transition: 0.3s;
}

.command-buttons {
    display: flex !important; /* 强制显示 */
    visibility: visible !important;
    opacity: 1 !important;
    gap: 10px;
    flex-shrink: 0;
    margin-top: 10px !important;
}

.aui-btn {
    flex: 1;
    background: transparent;
    border: 2px solid var(--cyber-green);
    color: var(--cyber-green);
    padding: 5px;
    height: 36px; /* 1080p 标准高度 */
    min-height: 36px;
    border-radius: 4px;
    font-size: 14px !important;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aui-btn:hover { 
    background: var(--cyber-green); 
    color: #000;
    box-shadow: 0 0 20px var(--cyber-green);
}

.mini-btn:hover { 
    background: var(--cyber-green); 
    color: #000;
    box-shadow: 0 0 20px var(--cyber-green);
    transform: scale(1.1);
}

.mini-btn.active { color: #fff; background: var(--cyber-green); box-shadow: 0 0 25px var(--cyber-green); animation: pulse 2s infinite; }

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.legal-footer { 
    flex-shrink: 0;
    text-align: center;
    padding: 15px 0; /* 统一步长 */
    font-size: 12px; 
    color: rgba(0, 255, 153, 0.6); /* 调优透明度 */
    letter-spacing: 1px;
    width: 100%;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(20px);
    z-index: 2000;
}

.modal-window {
    position: absolute;
    top: 50%; left: 50%; width: 85%; max-width: 800px;
    transform: translate(-50%, -50%);
    background: var(--cyber-black);
    border: 1px solid var(--cyber-green);
    box-shadow: 0 0 40px var(--cyber-green-glow);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.modal-window.wide { max-width: 800px; }
.modal-window.video-win { max-width: 1100px; }

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass);
    display: flex;
    justify-content: space-between;
    font-family: 'Orbitron', sans-serif;
    color: var(--cyber-green);
}

.modal-controls { display: flex; align-items: center; gap: 20px; }

.switch-btn {
    background: var(--cyber-green);
    color: #000;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.close-btn { font-size: 24px; cursor: pointer; }

.modal-body { padding: 30px; }
.modal-body.scrollable { max-height: 70vh; overflow-y: auto; }
.modal-body.no-padding { padding: 0; }

#modal-text { white-space: pre-wrap; color: #eee; line-height: 1.8; }

.cast-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; }
.cast-card { text-align: center; }
.cast-card img { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--cyber-green); object-fit: cover; }
.cast-card h3 { font-size: 14px; margin-top: 10px; color: var(--cyber-green); }
.cast-card p { font-size: 11px; color: #888; }

.player-container { width: 100%; aspect-ratio: 16/9; background: #000; }
.player-container iframe { width: 100%; height: 100%; }


/* -----------------------------------------------------------
   FINAL RELEASE: MOBILE RESPONSIVE RECONSTRUCTION (768px)
   ----------------------------------------------------------- */
@media (max-width: 768px) {
    .aui-header {
        flex-direction: column !important;
        padding: 15px 20px !important;
        gap: 12px !important;
        height: auto !important;
        align-items: center !important;
    }

    .brand-identity {
        flex-direction: column !important;
        gap: 8px !important;
        align-items: center !important;
    }

    .header-right {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 8px !important;
        align-items: center !important;
    }

    .cyber-input, .cyber-select {
        width: 90% !important;
        max-width: 100% !important;
        font-size: 13px !important;
    }

    .aui-dock {
        width: 96vw !important;
        padding: 5px !important;
    }

    .chat-terminal {
        padding: 10px !important;
    }

    .command-buttons {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        gap: 8px !important;
        margin-top: 10px !important;
    }

    .aui-btn {
        flex: none !important;
        width: 48% !important;
        height: 38px !important;
        font-size: 13px !important;
        padding: 5px !important;
    }

    .central-avatar {
        width: 55vw !important;
        height: 55vw !important;
    }

    #user-input {
        height: 45px !important;
        font-size: 13px !important;
    }

    #send-btn {
        height: 45px !important;
        padding: 0 15px !important;
        font-size: 13px !important;
    }

    .mini-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }

    .legal-footer {
        font-size: 10px !important;
        padding: 10px 5px !important;
        line-height: 1.4 !important;
        opacity: 0.7 !important;
    }
    
    .command-tip {
        display: none !important; /* Mobile space saving */
    }
}
