/* 基本スタイル */
* {
    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;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ログインページ */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-form h1 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.login-form p {
    color: #666;
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

button {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

button:hover {
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #ff6b6b;
    color: white;
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* チャットページ */
.chat-page {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    padding: 0;
    margin: 0;
}

.chat-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 状態バー */
.status-bar {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.status-indicator {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    background: #ff6b6b;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #51cf66;
}

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

/* キャラクターエリア */
.character-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.character-animation {
    width: 300px;
    height: 300px;
    position: relative;
    margin-bottom: 2rem;
}

/* アバターアニメーション */
.character-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-circle {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: breathe 3s ease-in-out infinite;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

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

.avatar-face {
    position: relative;
}

.eyes {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.eye {
    width: 12px;
    height: 12px;
    background: #333;
    border-radius: 50%;
    animation: blink 4s infinite;
}

@keyframes blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

.mouth {
    width: 20px;
    height: 10px;
    background: #333;
    border-radius: 0 0 20px 20px;
    margin: 0 auto;
}

/* 音声入力アニメーション */
.voice-input-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.microphone-icon {
    position: relative;
    z-index: 2;
}

.mic-body {
    width: 40px;
    height: 60px;
    background: #ff6b6b;
    border-radius: 20px 20px 0 0;
    position: relative;
}

.mic-stand {
    width: 4px;
    height: 20px;
    background: #333;
    margin: 0 auto;
}

.sound-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.wave {
    position: absolute;
    border: 2px solid rgba(255, 107, 107, 0.6);
    border-radius: 50%;
    animation: wave-pulse 1.5s ease-out infinite;
}

.wave1 {
    width: 100px;
    height: 100px;
    margin: -50px 0 0 -50px;
    animation-delay: 0s;
}

.wave2 {
    width: 150px;
    height: 150px;
    margin: -75px 0 0 -75px;
    animation-delay: 0.3s;
}

.wave3 {
    width: 200px;
    height: 200px;
    margin: -100px 0 0 -100px;
    animation-delay: 0.6s;
}

@keyframes wave-pulse {
    0% {
        opacity: 1;
        transform: scale(0.5);
    }
    100% {
        opacity: 0;
        transform: scale(1);
    }
}

/* AI応答アニメーション */
.ai-speaking-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.speaker-icon {
    position: relative;
}

.speaker-cone {
    width: 60px;
    height: 60px;
    background: #51cf66;
    clip-path: polygon(0 20%, 60% 0, 100% 50%, 60% 100%, 0 80%);
}

.sound-lines {
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
}

.line {
    width: 20px;
    height: 2px;
    background: #51cf66;
    margin: 5px 0;
    border-radius: 2px;
    animation: sound-line 0.8s ease-in-out infinite;
}

.line1 { animation-delay: 0s; }
.line2 { animation-delay: 0.2s; }
.line3 { animation-delay: 0.4s; }

@keyframes sound-line {
    0%, 100% { transform: scaleX(1); opacity: 0.5; }
    50% { transform: scaleX(1.5); opacity: 1; }
}

/* 状態メッセージ */
.state-message {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

/* コントロール */
.controls {
    padding: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.mic-button {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    padding: 1rem 2rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    min-width: 150px;
    justify-content: center;
}

.mic-button:disabled {
    background: #ccc;
}

.logout-button {
    background: rgba(255, 255, 255, 0.2);
    padding: 1rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    backdrop-filter: blur(10px);
}

/* アニメーション状態 */
.character-animation.idle .character-avatar {
    display: flex;
}

.character-animation.idle .voice-input-animation,
.character-animation.idle .ai-speaking-animation {
    display: none;
}

.character-animation.listening .character-avatar,
.character-animation.listening .ai-speaking-animation {
    display: none;
}

.character-animation.listening .voice-input-animation {
    display: flex;
}

.character-animation.speaking .character-avatar,
.character-animation.speaking .voice-input-animation {
    display: none;
}

.character-animation.speaking .ai-speaking-animation {
    display: flex;
}

/* デバッグ情報 */
.debug-info {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem;
    border-radius: 10px;
    font-size: 0.8rem;
    max-width: 300px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .character-animation {
        width: 250px;
        height: 250px;
    }
    
    .avatar-circle {
        width: 150px;
        height: 150px;
    }
    
    .controls {
        padding: 1rem;
    }
    
    .mic-button {
        min-width: 120px;
        padding: 0.8rem 1.5rem;
    }
}
