/* ベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: transparent; /* 透明背景に変更 */
    color: #333;
    height: 100vh;
    overflow: hidden;
}

/* ハンバーガーメニュー */
.hamburger-menu {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.hamburger-menu:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.hamburger-menu i {
    font-size: 20px;
    color: #667eea;
}

/* チャット履歴メニュー */
.chat-history-menu {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.chat-history-menu:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.chat-history-menu i {
    font-size: 20px;
    color: #4CAF50;
}

/* サイドバー */
.sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    color: #667eea;
    font-size: 1.5rem;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-sidebar:hover {
    background: #f0f0f0;
    color: #333;
}

.sidebar-content {
    padding: 20px;
}

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

.setting-group h4 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

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

.setting-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.setting-item select,
.setting-item input[type="range"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.setting-item input[type="range"] {
    height: 6px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.setting-item input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
}

.reset-button {
    width: 100%;
    padding: 12px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-button:hover {
    background: #ff5252;
    transform: translateY(-2px);
}

/* 認証関連ボタン */
.auth-group {
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

.user-info i {
    font-size: 20px;
    color: #667eea;
}

.btn-login,
.btn-logout {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-login {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-logout {
    background: #e0e0e0;
    color: #666;
}

.btn-logout:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

/* チャット履歴サイドバー */
.chat-history-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.chat-history-sidebar.open {
    right: 0;
}

.chat-history-content {
    padding: 20px;
}

.history-search {
    position: relative;
    margin-bottom: 20px;
}

.history-search input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.history-search input:focus {
    border-color: #4CAF50;
}

.history-search i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.history-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.history-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: #f0f8ff;
    border-color: #4CAF50;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.character-name {
    font-weight: bold;
    color: #4CAF50;
    font-size: 1.1rem;
}

.chat-date {
    font-size: 0.8rem;
    color: #666;
}

.chat-preview {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.message-count {
    background: #4CAF50;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 10px;
}

.history-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.clear-history-button {
    width: 100%;
    padding: 12px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-history-button:hover {
    background: #ff5252;
    transform: translateY(-2px);
}

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

.no-history i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #ddd;
}

.no-history p {
    font-size: 1rem;
    color: #999;
}

/* 会話詳細モーダル */
.conversation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
}

.modal-overlay {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px 25px 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.modal-header h3 {
    margin: 0;
    color: #4CAF50;
    font-size: 1.3rem;
}

.modal-date {
    font-size: 0.9rem;
    color: #666;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.conversation-messages {
    padding: 20px 25px;
}

.conversation-message {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
}

.conversation-message.user-message {
    flex-direction: row-reverse;
}

.conversation-message .message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
    font-size: 14px;
}

.user-message .message-avatar {
    background: #667eea;
    color: white;
}

.assistant-message .message-avatar {
    background: #4CAF50;
    color: white;
}

.conversation-message .message-content {
    flex: 1;
    max-width: 70%;
}

.conversation-message .message-text {
    background: #f5f5f5;
    padding: 10px 15px;
    border-radius: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.user-message .message-text {
    background: #667eea;
    color: white;
}

.conversation-message .message-timestamp {
    font-size: 0.7rem;
    color: #999;
    margin-top: 5px;
    text-align: left;
}

.user-message .message-timestamp {
    text-align: right;
}

.no-messages {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.modal-footer {
    padding: 15px 25px 20px;
    border-top: 1px solid #e0e0e0;
    text-align: right;
}

.modal-button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.modal-button:hover {
    background: #45a049;
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 90vh;
    }
    
    .conversation-message .message-content {
        max-width: 85%;
    }
}

/* メインコンテンツ */
.main-content {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* キャラクター表示領域 */
.character-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.character-container canvas {
    display: block !important;
}

/* ステータスバー */
.status-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 20px;
    z-index: 100;
}

.connection-status,
.character-mood {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.text-green { color: #4caf50; }
.text-red { color: #f44336; }
.text-gray { color: #666; }

/* ローディングオーバーレイ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* エラートースト */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease;
}

.error-toast {
    background: #f44336;
    color: white;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    margin-left: 10px;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        right: -100%;
    }
    
    .chat-history-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .chat-history-menu {
        top: 70px;
        right: 10px;
        width: 45px;
        height: 45px;
    }
    
    .status-bar {
        top: 10px;
        left: 10px;
        flex-direction: column;
        gap: 10px;
    }
    
    .hamburger-menu {
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
    }
}

/* アニメーション用クラス */
.emotion-happy {
    filter: brightness(1.2) saturate(1.3);
}

.emotion-sad {
    filter: brightness(0.8) saturate(0.7);
}

.emotion-surprised {
    filter: contrast(1.2) saturate(1.2);
}

.emotion-neutral {
    filter: none;
}

/* ハイコントラストモード対応 */
@media (prefers-contrast: high) {
    .sidebar {
        background: white;
        border: 2px solid #000;
    }
    
    .chat-container {
        background: white;
        border: 2px solid #000;
    }
    
    .message-text {
        border: 1px solid #000;
    }
}

/* アニメーション削減設定 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =====================================
   3D UI System - Glassmorphism Panel
   ===================================== */

.glass-panel {
    width: 240px;
    height: 150px;
    background: 
        linear-gradient(135deg, 
            rgba(15, 30, 50, 0.95),
            rgba(20, 40, 65, 0.92),
            rgba(25, 50, 80, 0.90)
        ),
        linear-gradient(45deg, transparent 25%, rgba(0, 255, 255, 0.04) 25%, rgba(0, 255, 255, 0.04) 50%, transparent 50%, transparent 75%, rgba(0, 255, 255, 0.04) 75%);
    background-size: 100% 100%, 6px 6px;
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 2px solid rgba(0, 220, 255, 0.7);
    border-radius: 10px;
    box-shadow: 
        0 10px 40px rgba(0, 220, 255, 0.3),
        inset 0 1px 0 rgba(0, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 0 25px rgba(0, 220, 255, 0.25);
    padding: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Courier New', monospace;
    user-select: none;
    position: relative;
    overflow: hidden;
    animation: hologram-pulse 4s infinite ease-in-out;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(0, 255, 255, 0.2), 
        transparent
    );
    transition: left 0.5s ease;
}

.glass-panel:hover {
    background: 
        linear-gradient(135deg, 
            rgba(20, 40, 65, 0.98),
            rgba(25, 50, 80, 0.95),
            rgba(30, 60, 95, 0.92)
        ),
        linear-gradient(45deg, transparent 25%, rgba(0, 255, 255, 0.06) 25%, rgba(0, 255, 255, 0.06) 50%, transparent 50%, transparent 75%, rgba(0, 255, 255, 0.06) 75%);
    background-size: 100% 100%, 6px 6px;
    border-color: rgba(0, 255, 255, 0.9);
    box-shadow: 
        0 14px 50px rgba(0, 220, 255, 0.4),
        inset 0 1px 0 rgba(0, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 0 35px rgba(0, 220, 255, 0.35);
}

.glass-panel:hover::before {
    left: 100%;
}

.glass-panel:active {
    box-shadow: 
        0 6px 20px rgba(0, 220, 255, 0.5),
        inset 0 1px 0 rgba(0, 255, 255, 0.4),
        0 0 20px rgba(0, 220, 255, 0.3);
}

.glass-panel-icon {
    font-size: 0.8rem;
    color: #00ffff;
    margin-bottom: 2px;
    text-shadow: 
        0 0 5px rgba(0, 255, 255, 0.9),
        0 0 10px rgba(0, 255, 255, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.5);
}

.glass-panel-text {
    color: #00ffff;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    text-shadow: 
        0 0 4px rgba(0, 255, 255, 0.9),
        0 0 8px rgba(0, 255, 255, 0.5),
        0 1px 4px rgba(0, 0, 0, 0.7);
    line-height: 1.3;
}

.glass-panel-subtext {
    color: rgba(0, 255, 255, 0.85);
    font-size: 1rem;
    margin-top: 2px;
    text-shadow: 
        0 0 3px rgba(0, 255, 255, 0.6),
        0 0 6px rgba(0, 255, 255, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.8);
}

/* =====================================
   Message Input Panel
   ===================================== */

.message-input-panel {
    width: 350px;
    background: 
        linear-gradient(135deg, 
            rgba(15, 30, 50, 0.95),
            rgba(20, 40, 65, 0.92),
            rgba(25, 50, 80, 0.90)
        ),
        linear-gradient(45deg, transparent 25%, rgba(0, 255, 255, 0.04) 25%, rgba(0, 255, 255, 0.04) 50%, transparent 50%, transparent 75%, rgba(0, 255, 255, 0.04) 75%);
    background-size: 100% 100%, 6px 6px;
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 2px solid rgba(0, 220, 255, 0.7);
    border-radius: 14px;
    box-shadow: 
        0 10px 40px rgba(0, 220, 255, 0.3),
        inset 0 1px 0 rgba(0, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 0 25px rgba(0, 220, 255, 0.25);
    padding: 20px;
    display: none;
    flex-direction: column;
    gap: 15px;
    font-family: 'Courier New', monospace;
    user-select: none;
    position: relative;
    overflow: hidden;
    animation: panel-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(20px);
}

.message-input-panel.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

@keyframes panel-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-input-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.message-input-panel-title {
    color: rgba(0, 255, 255, 0.9);
    font-size: 1.2rem;
    font-weight: 600;
    text-shadow: 
        0 0 3px rgba(0, 255, 255, 0.6),
        0 0 6px rgba(0, 255, 255, 0.3);
}

.message-input-panel-close {
    background: transparent;
    border: none;
    color: rgba(0, 255, 255, 0.7);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.message-input-panel-close:hover {
    background: rgba(0, 255, 255, 0.1);
    color: rgba(0, 255, 255, 1);
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.8);
}

.message-input-textarea {
    width: 100%;
    min-height: 100px;
    background: rgba(5, 15, 30, 0.85);
    border: 2px solid rgba(0, 220, 255, 0.5);
    border-radius: 8px;
    color: #00ffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
    padding: 12px;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
}

.message-input-textarea::placeholder {
    color: rgba(0, 255, 255, 0.4);
}

.message-input-textarea:focus {
    border-color: rgba(0, 255, 255, 0.9);
    box-shadow: 0 0 20px rgba(0, 220, 255, 0.4), inset 0 0 10px rgba(0, 220, 255, 0.1);
    background: rgba(5, 15, 30, 0.95);
}

.message-input-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.message-input-btn {
    padding: 10px 20px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(0, 255, 255, 0.05);
    color: rgba(0, 255, 255, 0.9);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 0 3px rgba(0, 255, 255, 0.5);
}

.message-input-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.message-input-btn.primary {
    background: rgba(0, 255, 255, 0.15);
    border-color: rgba(0, 255, 255, 0.5);
}

.message-input-btn.primary:hover {
    background: rgba(0, 255, 255, 0.25);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.message-input-btn:active {
    transform: scale(0.95);
}

/* 音声入力ボタン */
.voice-button {
    padding: 10px 15px !important;
    min-width: auto !important;
}

.voice-button.recording {
    background: rgba(255, 0, 0, 0.2) !important;
    border-color: rgba(255, 0, 0, 0.5) !important;
    animation: pulse-recording 1.5s ease-in-out infinite;
}

.voice-button.recording i {
    color: #ff0000 !important;
}

@keyframes pulse-recording {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
    }
}

/* 録音中インジケーター */
.voice-recording-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ff0000;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
    animation: blink-recording 1s ease-in-out infinite;
}

.voice-recording-indicator i {
    font-size: 0.7rem;
    animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes blink-recording {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

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

/* =====================================
   AR Speech Bubble System
   ===================================== */

.ar-speech-bubble {
    position: fixed;
    background: 
        linear-gradient(135deg, 
            rgba(10, 25, 47, 0.95),
            rgba(15, 35, 60, 0.92),
            rgba(20, 45, 75, 0.90)
        ),
        linear-gradient(45deg, transparent 25%, rgba(0, 255, 255, 0.03) 25%, rgba(0, 255, 255, 0.03) 50%, transparent 50%, transparent 75%, rgba(0, 255, 255, 0.03) 75%);
    background-size: 100% 100%, 8px 8px;
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 2px solid rgba(0, 220, 255, 0.8);
    border-radius: 12px;
    padding: 18px 20px;
    max-width: 600px;
    min-width: 400px;
    color: #00ffff;
    font-family: 'Courier New', monospace;
    font-size: 1.0rem;
    line-height: 1.4;
    font-weight: 500;
    text-shadow: 
        0 0 5px rgba(0, 255, 255, 0.9),
        0 0 10px rgba(0, 255, 255, 0.5),
        0 1px 3px rgba(0, 0, 0, 0.8);
    box-shadow: 
        0 8px 32px rgba(0, 220, 255, 0.4),
        inset 0 1px 0 rgba(0, 255, 255, 0.4),
        0 0 0 1px rgba(0, 220, 255, 0.3),
        0 0 30px rgba(0, 220, 255, 0.2);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8) translateY(10px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: hologram-flicker 3s infinite ease-in-out;
}

.ar-speech-bubble.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.ar-speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 220, 255, 0.9);
    filter: drop-shadow(0 0 5px rgba(0, 220, 255, 0.7));
}

.ar-speech-bubble::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
.ar-speech-bubble::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, 
        rgba(0, 255, 255, 0.2),
        transparent 30%,
        rgba(0, 255, 255, 0.1) 70%,
        rgba(0, 255, 255, 0.05)
    );
    border-radius: 8px;
    z-index: -1;
    animation: scan-line 2s infinite linear;
}

.ar-speech-bubble-text {
    position: relative;
    z-index: 1;
}

.typing-indicator {
    display: inline-block;
    width: 2px;
    height: 8px;
    background: rgba(0, 255, 255, 0.9);
    margin-left: 1px;
    animation: blink 1s infinite;
    box-shadow: 0 0 3px rgba(0, 255, 255, 0.6);
}

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

/* 近未来的なアニメーション */
@keyframes hologram-flicker {
    0%, 100% { 
        opacity: 1;
        filter: brightness(1);
    }
    2%, 4% { 
        opacity: 0.9;
        filter: brightness(1.1);
    }
    6%, 8% { 
        opacity: 1;
        filter: brightness(0.9);
    }
    96%, 98% { 
        opacity: 0.95;
        filter: brightness(1.05);
    }
}

@keyframes scan-line {
    0% { 
        transform: translateY(-100%) scaleY(0);
        opacity: 0;
    }
    10% { 
        transform: translateY(-50%) scaleY(1);
        opacity: 1;
    }
    90% { 
        transform: translateY(150%) scaleY(1);
        opacity: 1;
    }
    100% { 
        transform: translateY(200%) scaleY(0);
        opacity: 0;
    }
}

@keyframes hologram-pulse {
    0%, 100% { 
        opacity: 1;
        box-shadow: 
            0 6px 24px rgba(0, 255, 255, 0.2),
            inset 0 1px 0 rgba(0, 255, 255, 0.3),
            inset 0 -1px 0 rgba(0, 0, 0, 0.1),
            0 0 20px rgba(0, 255, 255, 0.1);
    }
    50% { 
        opacity: 0.8;
        box-shadow: 
            0 6px 24px rgba(0, 255, 255, 0.3),
            inset 0 1px 0 rgba(0, 255, 255, 0.4),
            inset 0 -1px 0 rgba(0, 0, 0, 0.1),
            0 0 30px rgba(0, 255, 255, 0.15);
    }
}

/* =====================================
   CSS3D Renderer Container
   ===================================== */

.css3d-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    background: transparent; /* 明示的に透明背景を設定 */
}

.css3d-container canvas {
    pointer-events: auto;
}

/* =====================================
   3D UI Mode Styles
   ===================================== */

.character-container {
    cursor: crosshair;
}

/* =====================================
   Responsive Design for 3D UI
   ===================================== */

@media (max-width: 768px) {
    .glass-panel {
        width: 60px;
        height: 40px;
        padding: 4px;
    }
    
    .glass-panel-icon {
        font-size: 0.6rem;
    }
    
    .glass-panel-text {
        font-size: 0.3rem;
    }
    
    .ar-speech-bubble {
        max-width: 80px;
        font-size: 1rem;
        padding: 3px 4px;
    }
}

@media (max-width: 480px) {
    .glass-panel {
        width: 50px;
        height: 35px;
        padding: 3px;
    }
    
    .ar-speech-bubble {
        max-width: 60px;
        font-size: 0.8rem;
        padding: 2px 3px;
    }
}

/* =====================================
   Upload Button Styles
   ===================================== */

.upload-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.upload-button:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.upload-button:active {
    transform: translateY(0);
}

.upload-status {
    display: block;
    font-size: 0.7rem;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

.upload-status.success {
    color: #28a745;
}

.upload-status.error {
    color: #dc3545;
}

/* ===================================
   Save Button Styles
   ===================================== */

.save-button {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    margin-left: 8px;
}

.save-button:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.save-button:active {
    transform: translateY(0);
}

/* Textarea for character prompt */
#characterPrompt {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.85rem;
    resize: vertical;
    margin-top: 4px;
}

#characterPrompt:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Success toast */
.success-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    z-index: 10000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
