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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

.subtitle {
    text-align: center;
    color: #666;
    font-size: 1.05em;
    margin-top: 10px;
    margin-bottom: 10px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.game-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
}

.game-card.companion {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    grid-column: 1 / -1;
    padding: 35px;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.game-card h3 {
    font-size: 1.4em;
    margin-bottom: 10px;
}

.game-card p {
    font-size: 0.95em;
    opacity: 0.9;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chat-container {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    padding: 15px;
    border-radius: 10px;
    max-width: 80%;
    animation: fadeIn 0.3s;
}

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

.message.user {
    background: #667eea;
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.message.assistant {
    background: white;
    color: #333;
    align-self: flex-start;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.message-role {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.85em;
    opacity: 0.8;
}

.message-content {
    line-height: 1.5;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.welcome-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-20deg); }
}

.welcome-message h3 {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 15px;
}

.welcome-message p {
    font-size: 1.1em;
    margin-bottom: 10px;
    line-height: 1.6;
}

.welcome-message .hint {
    font-size: 0.95em;
    color: #999;
    font-style: italic;
}

.controls-container {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-top: 20px;
}

.controls {
    text-align: center;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-primary:active {
    background: #764ba2;
    transform: scale(0.95);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-talk {
    padding: 20px 50px;
    font-size: 1.3em;
    display: inline-flex;
    align-items: center;
    gap: 15px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.btn-talk:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.mic-icon {
    font-size: 2em;
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

.btn-text {
    font-weight: 700;
    letter-spacing: 0.5px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.recording {
    background: #e74c3c !important;
    animation: pulse 1.5s infinite;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.6) !important;
}

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

.status {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1em;
    color: #666;
    font-weight: 500;
}

.status-dot {
    width: 12px;
    height: 12px;
    background: #95a5a6;
    border-radius: 50%;
    transition: background 0.3s;
}

.status-dot.active {
    background: #2ecc71;
    animation: blink 1.5s infinite;
}

.status-dot.processing {
    background: #f39c12;
    animation: blink 1s infinite;
}

.status-dot.speaking {
    background: #3498db;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.status-text {
    font-size: 1.05em;
}

.volume-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.volume-label {
    font-weight: 600;
    color: #666;
    font-size: 0.95em;
    white-space: nowrap;
}

.volume-bar-container {
    flex: 1;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.volume-bar {
    height: 100%;
    background: #2196F3;
    transition: width 0.1s ease, background-color 0.3s ease;
    border-radius: 10px;
    min-width: 2px;
}

.volume-value {
    font-weight: 700;
    color: #333;
    font-size: 1em;
    min-width: 50px;
    text-align: right;
    font-family: 'Courier New', monospace;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1em;
}

.error {
    background: #e74c3c;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
}

.audio-player {
    margin-top: 20px;
}

.audio-player audio {
    width: 100%;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2em;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .game-header {
        flex-direction: column;
        gap: 15px;
    }
}
