* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', 'Arial', sans-serif;
}

html {
    min-height: 100%;
    background: #07111f;
    color-scheme: dark;
}

body {
    background: #07111f;
    color: #fff;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    isolation: isolate;
    margin: 0;
    padding: 0;
    font-family: 'Microsoft YaHei', 'Arial', sans-serif;
}

/* 固定背景层：避免手机浏览器在长页面滚动时露出白色画布 */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-color: #07111f;
    background-image:
        linear-gradient(rgba(3, 10, 22, 0.56), rgba(3, 10, 22, 0.78)),
        url('bg.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    transform: translateZ(0);
    pointer-events: none;
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.4;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: float 20s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

.container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    position: relative;
    overflow: hidden;
}

header {
    text-align: center;
    padding: 20px 0;
    position: relative;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.city-title {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 0;
    background: linear-gradient(90deg, #d4af37, #ffffff, #00bfff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.3);
    position: relative;
    display: inline-block;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.3rem;
    color: #90caf9;
    margin-bottom: 5px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin-bottom: 10px;
}

.time-periods {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 0;
}

.time-period {
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.time-period::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.time-period:hover::before {
    left: 100%;
}

.period-past {
    background: linear-gradient(135deg, #6d4c41, #d4af37);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.period-present {
    background: linear-gradient(135deg, #1565c0, #42a5f5);
    box-shadow: 0 4px 15px rgba(66, 165, 245, 0.4);
}

.period-future {
    background: linear-gradient(135deg, #00695c, #00bfa5);
    box-shadow: 0 4px 15px rgba(0, 191, 165, 0.4);
}

.time-period.active {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.4);
    filter: brightness(1.2);
}

.main-content {
    display: grid;
    grid-template-columns: 1.3fr 1.7fr;
    gap: 30px;
    flex: 1;
    padding: 30px;
    overflow: visible;
    position: relative;
    min-height: 0;
}

.avatar-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.section-title {
    font-size: 2.2rem;
    margin-bottom: 25px;
    color: #ffffff;
    text-align: center;
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #00bfff, transparent);
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.5);
}

.avatar-content {
    display: flex;
    gap: 20px;
    height: 100%;
    flex: 1;
}

.sdk-container {
    width: 65%;
    height: 100%;
    background-color: #07101d;
    background-image:
        linear-gradient(rgba(3, 9, 18, 0.08), rgba(3, 9, 18, 0.24)),
        url('avatar-bg.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    isolation: isolate;
}

#sdk {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: transparent;
    z-index: 1;
}

.audio-unlock-button {
    position: absolute;
    inset: 0;
    z-index: 2147483647;
    width: 100%;
    height: 100%;
    padding: 24px;
    border: 0;
    border-radius: 15px;
    background: rgba(3, 10, 20, 0.58);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font: inherit;
    font-size: clamp(1.05rem, 4vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    pointer-events: auto;
    transform: translateZ(0);
}

.audio-unlock-button[hidden] {
    display: none !important;
}

.audio-unlock-button small {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0;
}

.audio-unlock-icon {
    display: grid;
    width: 64px;
    height: 64px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    background: rgba(0, 191, 255, 0.2);
    box-shadow: 0 0 26px rgba(0, 191, 255, 0.45);
    font-size: 1.9rem;
    animation: pulse 1.8s infinite;
}

.placeholder {
    text-align: center;
    color: #90caf9;
    transition: opacity 0.3s ease;
}

.placeholder.hidden {
    display: none;
}

.placeholder-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.avatar-active {
    width: 100%;
    height: 100%;
    display: none;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.avatar-active.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-active > *,
.avatar-active canvas,
.avatar-active video,
.avatar-active iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    object-fit: contain;
}

.subtitle-display {
    width: 35%;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.subtitle-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 191, 255, 0.1), transparent);
    animation: subtitleGlow 3s infinite;
}

@keyframes subtitleGlow {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

.subtitle-text {
    font-size: 1.1rem;
    text-align: center;
    line-height: 1.6;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(0, 191, 255, 0.5);
    z-index: 1;
    position: relative;
}

.content-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    padding-bottom: 20px;
    min-height: 0;
}

.content-section::-webkit-scrollbar {
    width: 6px;
}

.content-section::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.content-section::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.content-section::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.content-section .time-periods {
    justify-content: center;
    margin-bottom: 5px;
}

.content-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
}

.content-card h3 {
    font-size: 2rem;
    margin-bottom: 18px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.question-input-panel {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.question-input-panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
}

.question-input-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.question-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.question-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.question-input:focus {
    border-color: #00bfff;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.3);
}

.submit-question-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
}

.submit-question-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.submit-question-btn:active {
    transform: translateY(0);
}

.content-icon {
    font-size: 2.2rem;
}

.content-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.content-highlights {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 25px;
}

.highlight-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: default;
}

.highlight-item.clickable-item {
    cursor: pointer;
    position: relative;
}

.highlight-item.clickable-item::after {
    content: '🔊';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.highlight-item.clickable-item:hover::after {
    opacity: 1;
}

.highlight-item:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.highlight-icon {
    font-size: 1.8rem;
    color: #00bfff;
    filter: drop-shadow(0 2px 4px rgba(0, 191, 255, 0.4));
    transition: all 0.3s ease;
}

.highlight-item:hover .highlight-icon {
    color: #4dd0e1;
    filter: drop-shadow(0 3px 6px rgba(77, 208, 225, 0.5));
    transform: scale(1.1);
}

.btn-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.status-label {
    color: #90caf9;
    font-size: 1.1rem;
}

.status-value {
    color: #00bfff;
    font-weight: bold;
    font-size: 1.1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 15px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #d4af37, #00bfff, #00bfa5);
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    text-align: center;
    color: #00bfff;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 10px;
    text-shadow: 0 0 10px rgba(0, 191, 255, 0.5);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 400px;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top: 4px solid #00bfff;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.btn-click {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.fade-in {
    animation: fadeIn 1s ease-in-out;
}

.slide-up {
    animation: slideUp 0.8s ease-out;
}

.slide-left {
    animation: slideLeft 0.8s ease-out;
}

.slide-right {
    animation: slideRight 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideLeft {
    from { 
        opacity: 0;
        transform: translateX(30px);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideRight {
    from { 
        opacity: 0;
        transform: translateX(-30px);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes breathing {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

.breathing {
    animation: breathing 3s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse-effect {
    animation: pulse 2s infinite ease-in-out;
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(0, 191, 255, 0.5); }
    50% { box-shadow: 0 0 20px rgba(0, 191, 255, 0.8), 0 0 30px rgba(0, 191, 255, 0.4); }
    100% { box-shadow: 0 0 5px rgba(0, 191, 255, 0.5); }
}

.glow-effect {
    animation: glow 3s infinite ease-in-out;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.float-effect {
    animation: float 4s infinite ease-in-out;
}

.test-controls {
    margin-top: 15px;
    text-align: center;
}

.test-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    margin: 0 5px;
}

.test-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.test-button:active {
    transform: translateY(0);
}

@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .control-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-highlights {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .city-title {
        font-size: 2.5rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .time-periods {
        flex-direction: column;
        gap: 15px;
    }
    
    .control-buttons {
        grid-template-columns: 1fr;
    }
}

/* 结束讲解按钮 */
.stop-speaking-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    z-index: 10;
    display: none;
    align-items: center;
    gap: 6px;
}

.stop-speaking-button.visible {
    display: flex;
}

.stop-speaking-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
    background: linear-gradient(135deg, #ff5252, #e04848);
}

.stop-speaking-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

.stop-speaking-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 配置按钮 */
.config-button {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.config-button:active {
    transform: translateY(-1px);
}

/* 配置弹窗遮罩 */
.config-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.config-modal-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

/* 配置弹窗 */
.config-modal {
    background: linear-gradient(135deg, rgba(30, 30, 60, 0.95), rgba(20, 20, 40, 0.95));
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.config-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.config-modal-header h2 {
    font-size: 1.8rem;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.config-close-btn {
    background: none;
    border: none;
    color: #90caf9;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.config-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.config-modal-body {
    padding: 30px;
}

.config-section {
    margin-bottom: 30px;
}

.config-section:last-child {
    margin-bottom: 0;
}

.config-section h3 {
    font-size: 1.4rem;
    color: #00bfff;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-item {
    margin-bottom: 20px;
}

.config-item.invite-promo {
    background: rgba(0, 191, 255, 0.1);
    border: 1px solid rgba(0, 191, 255, 0.3);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.config-item:last-child {
    margin-bottom: 0;
}

.config-item label {
    display: block;
    color: #90caf9;
    margin-bottom: 8px;
    font-size: 1rem;
}

.config-item input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #ffffff;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.config-item input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.config-item input:focus {
    border-color: #00bfff;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.2);
}

.config-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.config-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.config-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #90caf9;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.config-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.config-btn-save {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.config-btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.config-modal::-webkit-scrollbar {
    width: 6px;
}

.config-modal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.config-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.config-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 900px) {
    html {
        min-height: 100%;
        -webkit-text-size-adjust: 100%;
    }

    body {
        min-height: 100dvh;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        background: #07111f;
    }

    body::before {
        background-position: 58% center;
    }

    .particles {
        opacity: 0.25;
        pointer-events: none;
    }

    .container {
        width: 100%;
        min-height: 100dvh;
        height: auto;
        overflow: visible;
    }

    header {
        padding: max(14px, env(safe-area-inset-top)) 14px 12px;
        background: rgba(3, 10, 22, 0.82);
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 8px;
    }

    .city-title {
        width: 100%;
        padding: 0 4px;
        font-size: clamp(1rem, 6.4vw, 2.25rem);
        letter-spacing: 0;
        line-height: 1.15;
        white-space: nowrap;
    }

    .subtitle {
        max-width: 28em;
        margin: 0 auto;
        font-size: clamp(0.9rem, 4vw, 1.05rem);
        line-height: 1.5;
    }

    .time-periods {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin: 0;
    }

    .time-period {
        min-height: 44px;
        padding: 10px 8px;
        border-radius: 8px;
        font-size: clamp(0.92rem, 4vw, 1.05rem);
        line-height: 1.2;
        text-align: center;
    }

    .time-period.active {
        transform: none;
    }

    .main-content {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 14px;
        overflow: visible;
    }

    /*
     * 手机端展开右侧内容容器，让其子元素参与 main-content 排序。
     * 顺序：数字人 -> 互动问答 -> 内容卡片。
     */
    .content-section {
        display: contents;
    }

    .avatar-section {
        order: 1;
    }

    .question-input-panel {
        order: 2;
        width: 100%;
    }

    .content-card {
        order: 3;
        width: 100%;
    }

    .avatar-section,
    .content-card,
    .question-input-panel {
        border-radius: 8px;
        background: rgba(6, 16, 32, 0.86);
        border-color: rgba(255, 255, 255, 0.16);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }

    .content-description,
    .highlight-item,
    .subtitle-text {
        color: #ffffff;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
    }

    .avatar-section {
        height: auto;
        min-height: 0;
        padding: 16px;
        gap: 14px;
        overflow: visible;
    }

    .section-title {
        margin-bottom: 12px;
        font-size: clamp(1.25rem, 6vw, 1.7rem);
        line-height: 1.25;
    }

    .section-title::after {
        bottom: -7px;
        width: 76px;
    }

    .avatar-content {
        flex-direction: column;
        height: auto;
        min-height: 0;
        gap: 12px;
    }

    .sdk-container {
        width: 100%;
        height: auto;
        min-height: 320px;
        max-height: 58dvh;
        aspect-ratio: 3 / 4;
        border-radius: 8px;
    }

    .placeholder {
        padding: 20px;
    }

    .placeholder-icon {
        font-size: clamp(3rem, 18vw, 4.5rem);
        margin-bottom: 12px;
    }

    .placeholder p {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .subtitle-display {
        width: 100%;
        min-height: 112px;
        padding: 14px;
        border-radius: 8px;
        align-items: stretch;
        justify-content: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .subtitle-text {
        font-size: 0.98rem;
        line-height: 1.65;
        text-align: left;
    }

    .stop-speaking-button {
        position: static;
        align-self: flex-end;
        min-height: 40px;
        padding: 9px 14px;
        border-radius: 8px;
    }

    .content-section {
        height: auto;
        min-height: 0;
        overflow: visible;
        gap: 14px;
        padding: 0 0 calc(16px + env(safe-area-inset-bottom));
    }

    .content-card,
    .question-input-panel {
        padding: 16px;
    }

    .content-card h3 {
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 12px;
        font-size: clamp(1.25rem, 5.5vw, 1.55rem);
        line-height: 1.35;
    }

    .content-icon,
    .highlight-icon,
    .btn-icon {
        font-size: 1.45rem;
        flex: 0 0 auto;
    }

    .content-description {
        margin-bottom: 14px;
        font-size: 0.98rem;
        line-height: 1.75;
    }

    .content-highlights {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 14px;
    }

    .highlight-item {
        min-height: 48px;
        padding: 12px 36px 12px 12px;
        border-radius: 8px;
        align-items: flex-start;
    }

    .highlight-item span:last-child {
        min-width: 0;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .question-input-panel .section-title {
        margin-bottom: 16px;
    }

    .question-input-container {
        flex-direction: column;
        gap: 10px;
        margin-top: 0;
    }

    .question-input,
    .submit-question-btn {
        width: 100%;
        min-height: 46px;
        border-radius: 8px;
        font-size: 1rem;
    }

    .submit-question-btn {
        justify-content: center;
        padding: 12px 16px;
    }

    .loading-overlay {
        padding: 18px;
    }

    .loading-content {
        width: min(100%, 360px);
        min-width: 0;
        padding: 24px 18px;
        border-radius: 8px;
    }

    .spinner {
        width: 48px;
        height: 48px;
    }

    .config-button {
        top: max(12px, env(safe-area-inset-top));
        left: 12px;
        min-height: 42px;
        padding: 9px 14px;
        border-radius: 8px;
        font-size: 0.95rem;
    }

    .config-modal-overlay {
        align-items: flex-end;
        padding: 12px;
    }

    .config-modal {
        width: 100%;
        max-height: min(88dvh, 720px);
        border-radius: 8px;
    }

    .config-modal-header,
    .config-modal-body,
    .config-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .config-modal-header h2 {
        font-size: 1.35rem;
    }

    .config-modal-footer {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .config-btn {
        width: 100%;
        min-height: 44px;
        border-radius: 8px;
    }
}

@media (max-width: 420px) {
    .main-content {
        padding: 10px;
    }

    .avatar-section,
    .content-card,
    .question-input-panel {
        padding: 14px;
    }

    .sdk-container {
        min-height: 280px;
    }

    .time-period {
        font-size: 0.92rem;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .sdk-container {
        min-height: 240px;
        max-height: none;
        aspect-ratio: 16 / 9;
    }
}

@media (hover: none) and (pointer: coarse) {
    .content-card:hover,
    .question-input-panel:hover,
    .highlight-item:hover,
    .submit-question-btn:hover,
    .stop-speaking-button:hover,
    .config-button:hover,
    .config-btn-save:hover {
        transform: none;
    }
}
