* {
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #2c3e50, #4a235a);
    color: #f0f0f0;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 1300px;
    background: rgba(40, 40, 60, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    padding: 20px;
    display: flex;
    gap: 20px;
}

.settings-panel {
    flex: 0 0 250px;
    background: rgba(35, 35, 55, 0.7);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}


.settings-panel h2 {
    font-size: 1.3rem;
    color: #f0f0f0;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #ccc;
}

.setting-group input[type="number"],
.setting-group input[type="text"] {
    width: 100%;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(140, 110, 180, 0.5);
    background: rgba(60, 60, 80, 0.8);
    color: white;
    font-size: 0.9rem;
    transition: border-color 0.3s, background 0.3s;
}

.setting-group input[type="number"]:focus,
.setting-group input[type="text"]:focus {
    outline: none;
    border-color: #8e2de2;
    background: rgba(80, 80, 100, 0.8);
}

.header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

h1 {
    font-weight: 300;
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, #ff9a9e, #fad0c4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status {
    background: #5c1f71;
    padding: 8px 15px;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #bbb;
}

.status.active .status-dot {
    background: #00ff9d;
    box-shadow: 0 0 10px #00ff9d;
}

.duration-display {
    background: #5c1f71;
    padding: 8px 15px;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
    border: 1px solid rgba(140, 110, 180, 0.3);
    backdrop-filter: blur(5px);
}

.duration-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #bbb;
    position: relative;
}

.duration-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.duration-text {
    font-size: 0.9rem;
    color: #f0f0f0;
    font-weight: 500;
}

.duration-display.active {
    border-color: rgba(0, 255, 157, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.2);
}

.duration-display.active .duration-icon {
    background: #00ff9d;
    box-shadow: 0 0 10px #00ff9d;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 157, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 255, 157, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 157, 0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.chat-container {
    background: rgba(35, 35, 55, 0.7);
    border-radius: 12px;
    height: 550px;
    overflow-y: auto;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-message {
    background: rgba(170, 60, 140, 0.5);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message .time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 4px;
}

.typing-indicator {
    align-self: flex-start;
    background: rgba(170, 60, 140, 0.5);
    padding: 12px 16px;
    border-radius: 18px;
    display: none;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #f0f0f0;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0);
    }
}

.input-area {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

textarea {
    flex: 1;
    background: rgba(60, 60, 80, 0.8);
    border: none;
    border-radius: 24px;
    padding: 15px 20px;
    color: white;
    font-size: 1rem;
    resize: none;
    height: 55px;
    transition: background 0.3s;
}

textarea:focus {
    background: rgba(80, 80, 100, 0.8);
    outline: none;
    box-shadow: 0 0 0 2px rgba(140, 110, 180, 0.5);
}

button {
    background: linear-gradient(135deg, #8e2de2, #4a00e0);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

button:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.controls button {
    padding: 12px 30px;
    border-radius: 30px;
}

.start-btn {
    background: linear-gradient(135deg, #11998e, #38ef7d);
}

.stop-btn {
    background: linear-gradient(135deg, #f85032, #e73827);
}

.clear-btn {
    background: linear-gradient(135deg, #5a5a5a, #3a3a3a);
}

.export-btn {
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
}

.api-key-input {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.api-key-input input {
    flex: 1;
    background: rgba(60, 60, 80, 0.8);
    border: none;
    border-radius: 24px;
    padding: 12px 20px;
    color: white;
    font-size: 0.9rem;
}

.api-key-input input::placeholder {
    color: #aaa;
}