/* リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本スタイル - じょうてつバスのコーポレートカラー(オレンジ)をベースに */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1000px;
    width: 100%;
    height: 100vh;
    background: white;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ヘッダー - 温かみのあるオレンジ系 */
header {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    color: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.logo-section h1 {
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-bus-icon {
    font-size: 0.85em;
}

.subtitle {
    font-size: 0.85em;
    opacity: 0.9;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.current-location {
    font-size: 0.9em;
    margin-top: 6px;
    opacity: 0.95;
}

.header-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.auto-play-btn,
.settings-btn,
.back-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-icon {
    font-size: 1.1em;
}

.auto-play-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.auto-play-btn:not(.active) {
    background: rgba(0, 0, 0, 0.15);
    opacity: 0.8;
}

.auto-play-btn:hover:not(:disabled),
.settings-btn:hover:not(:disabled),
.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.auto-play-btn:disabled,
.settings-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    max-width: 520px;
    width: 90%;
    animation: slideIn 0.3s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: #f57c00;
    margin-bottom: 30px;
    font-size: 1.6em;
    font-weight: 600;
    border-bottom: 2px solid #fff3e0;
    padding-bottom: 12px;
}

.modal-subtitle {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 20px;
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    line-height: 20px;
    transition: color 0.3s;
}

.close:hover {
    color: #f57c00;
}

/* フォーム */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
    background: #fafafa;
    font-family: inherit;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #f57c00;
    background: white;
    box-shadow: 0 0 0 3px rgba(245, 124, 0, 0.1);
}

/* スライダー */
.form-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #f57c00;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.form-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(245, 124, 0, 0.4);
}

.form-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #f57c00;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

.form-group input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(245, 124, 0, 0.4);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: #777;
    margin-top: 8px;
}

.form-group label span {
    color: #f57c00;
    font-weight: 700;
}

/* ボタン */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: #f57c00;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(245, 124, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: #e65100;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 124, 0, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #757575;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #616161;
}

.btn-secondary:active {
    background: #424242;
}

/* チャットエリア */
.chat-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.current-stop-display {
    background: #f8f9fa;
    padding: 14px 24px;
    text-align: center;
    color: #f57c00;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    font-size: 0.95em;
}

.stop-label {
    color: #666;
    margin-right: 8px;
}

.current-stop-display strong {
    color: #f57c00;
    font-size: 1.1em;
}

/* メッセージエリア */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #fafafa;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.message {
    margin-bottom: 20px;
    animation: messageSlide 0.3s;
}

/* ユーザーメッセージ: 右寄せ */
.message.user {
    display: flex;
    justify-content: flex-end;
}

/* ボット応答: LINE風アバター + 吹き出しレイアウト */
.message.bot,
.message.ai-message {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    text-align: left;
}

/* ボット応答のアバター画像（吹き出しの下に揃える） */
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* メッセージバブルラッパー */
.message-bubble {
    flex: 1;
    min-width: 0;
    max-width: 85%;
}

/* 共通メッセージ吹き出し */
.message-content {
    display: inline-block;
    max-width: 100%;
    padding: 12px 16px;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 0.95em;
    position: relative;
}

/* ユーザーメッセージ: 吹き出し（右側） */
.message.user .message-content {
    background: #f57c00;
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 10px 16px;
    box-shadow: 0 1px 3px rgba(245, 124, 0, 0.2);
}

/* ボット応答: 吹き出し（左側・左下が尖る＝アバター側） */
.message.bot .message-content,
.message.ai-message .message-content {
    background: white;
    border: 1px solid #e0e0e0;
    color: #333;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border-radius: 18px 18px 18px 4px;
    max-width: 100%;
}

/* ウェルカムカード */
.welcome-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px 18px 18px 4px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.welcome-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.welcome-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.welcome-title {
    font-size: 1em;
    font-weight: 600;
    color: #333;
}

.welcome-sub {
    font-size: 0.85em;
    color: #888;
    margin-left: 48px;
}

/* クイックアクションボタン */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: white;
    border: 1.5px solid #f57c00;
    border-radius: 20px;
    color: #f57c00;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.quick-action-btn:hover {
    background: #fff3e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(245, 124, 0, 0.15);
}

.quick-action-btn:active {
    transform: translateY(0);
}

.quick-action-btn .material-symbols-outlined {
    font-size: 1.1em;
}

.message-footer {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.message.user .message-footer {
    justify-content: flex-end;
}

.message.user .message-time {
    color: #bbb;
}

.message-time {
    font-size: 0.75em;
    color: #999;
}

.speaker-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    color: #555;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.speaker-btn:hover {
    background: #f57c00;
    color: white;
    border-color: #f57c00;
    transform: scale(1.05);
}

.speaker-btn:active {
    transform: scale(1);
}

.speaker-btn.speaking {
    background: #d32f2f;
    color: white;
    border-color: #d32f2f;
    animation: speakerPulse 1.2s ease-in-out infinite;
}

.speaker-btn.speaking:hover {
    background: #b71c1c;
    border-color: #b71c1c;
}

.speaker-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #e0e0e0;
    color: #999;
    border-color: #ccc;
    transform: none;
}

/* 入力エリア */
.input-area {
    border-top: 1px solid #e0e0e0;
    padding: 20px 24px;
    background: white;
    flex-shrink: 0;
}

/* 検索バー風入力コンテナ */
.input-container {
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    background: #fafafa;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.input-container:focus-within {
    border-color: #f57c00;
    background: white;
    box-shadow: 0 0 0 3px rgba(245, 124, 0, 0.1);
}

#messageInput {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 1rem;
    resize: none;
    font-family: inherit;
    min-height: 48px;
    max-height: 150px;
    line-height: 1.5;
    overflow-y: hidden; /* JavaScriptで高さ管理するため非表示 */
    overflow-x: hidden;
    box-sizing: border-box;
    outline: none;
}

#messageInput:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* フッター（区切り線とボタンエリア） */
.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid #e0e0e0;
    min-height: 40px;
}

.input-footer-left {
    flex: 1;
}

.input-footer-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.voice-btn {
    padding: 6px;
    background: transparent;
    color: #555;
    border: none;
    border-radius: 6px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.voice-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.voice-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.voice-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.voice-btn.recording {
    background: #d32f2f;
    color: white;
    animation: pulse 1.5s infinite;
}

.send-btn {
    padding: 6px;
    background: #f57c00;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.send-btn:hover:not(:disabled) {
    background: #e65100;
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-status {
    margin-top: 12px;
    padding: 10px 16px;
    background: #fff3e0;
    border-radius: 6px;
    color: #f57c00;
    font-weight: 500;
    display: none;
    text-align: center;
    font-size: 0.9em;
}

.voice-status.active {
    display: block;
}

/* ローディング（プログレスバー） */
.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    text-align: center;
    min-width: 280px;
}

.loading.active {
    display: block;
}

.loading-avatar-wrapper {
    margin-bottom: 16px;
}

.loading-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    animation: avatarBounce 1.2s ease-in-out infinite;
}

.progress-container {
    margin-bottom: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f57c00, #ff9800);
    border-radius: 4px;
    transition: width 0.15s ease-out;
}

.progress-text {
    color: #555;
    font-weight: 500;
    font-size: 0.9em;
}

@keyframes avatarBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

.btn-cancel {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* 音声入力モーダル */
.voice-input-modal {
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-modal-content {
    text-align: center;
    padding: 40px 30px;
    max-width: 500px;
    margin: 0 auto;
}

.voice-animation {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 30px;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 4px solid #f57c00;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulseRing 1.5s ease-out infinite;
}

.microphone-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4em;
    animation: bounce 1s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.microphone-icon .material-symbols-outlined {
    font-size: 1em;
}

.realtime-transcript {
    min-height: 60px;
    max-height: 150px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
    font-size: 1.05em;
    line-height: 1.6;
    color: #333;
    text-align: left;
    border: 2px solid #e0e0e0;
}

.realtime-transcript:empty {
    display: none;
}

.realtime-transcript .interim {
    color: #999;
    font-style: italic;
}

.realtime-transcript .final {
    color: #333;
    font-weight: 500;
}

.voice-instruction {
    color: #666;
    font-size: 1em;
    margin-bottom: 30px;
}

/* アニメーション */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes messageSlide {
    from {
        transform: translateY(15px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes speakerPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.4);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 0 6px rgba(211, 47, 47, 0);
    }
}

@keyframes pulseRing {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.5;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* スクロールバー */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #f57c00;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #e65100;
}

/* =========================================
   レスポンシブデザイン
   ========================================= */

/* タブレット (横向き・縦向き) */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        border-radius: 0;
    }

    header {
        padding: 18px 24px;
    }

    .logo-section h1 {
        font-size: 1.6em;
    }
}

/* タブレット (縦向き) & スマートフォン (横向き) */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    header {
        padding: 16px 20px;
    }

    .header-content {
        flex-direction: row;
        gap: 12px;
        align-items: center;
    }

    .logo-section h1 {
        font-size: 1.4em;
    }

    .subtitle {
        font-size: 0.8em;
    }

    .current-location {
        font-size: 0.85em;
    }

    .header-buttons {
        gap: 8px;
    }

    /* ボタンテキストを非表示にしてアイコンのみ */
    .auto-play-btn .btn-text,
    .settings-btn .btn-text,
    .back-btn .btn-text {
        display: none;
    }

    .auto-play-btn,
    .settings-btn,
    .back-btn {
        padding: 10px 12px;
        min-width: 44px;
    }

    .chat-messages {
        padding: 16px;
    }

    .message-content {
        max-width: 100%;
        font-size: 0.9em;
        padding: 12px 16px;
    }

    .quick-action-btn {
        font-size: 0.8em;
        padding: 8px 14px;
    }

    .current-stop-display {
        padding: 12px 20px;
        font-size: 0.9em;
    }

    .input-area {
        padding: 16px 20px;
    }

    .modal-content {
        padding: 30px 24px;
        max-width: 95%;
        margin: 20px;
    }

    .modal-content h2 {
        font-size: 1.4em;
    }
}

/* スマートフォン (縦向き) */
@media (max-width: 480px) {
    header {
        padding: 12px 16px;
    }

    .header-content {
        gap: 8px;
    }

    .logo-section h1 {
        font-size: 1.2em;
        margin-bottom: 2px;
    }

    .subtitle {
        font-size: 0.75em;
    }

    .current-location {
        font-size: 0.8em;
        margin-top: 4px;
    }

    .header-buttons {
        gap: 6px;
    }

    .auto-play-btn,
    .settings-btn,
    .back-btn {
        padding: 8px 10px;
        min-width: 40px;
    }

    .btn-icon {
        font-size: 1em;
    }

    .chat-messages {
        padding: 12px;
    }

    .message {
        margin-bottom: 16px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .message.bot,
    .message.ai-message {
        gap: 6px;
    }

    .message-bubble {
        max-width: 90%;
    }

    .message-content {
        max-width: 100%;
        font-size: 0.85em;
        padding: 10px 14px;
    }

    .quick-action-btn {
        font-size: 0.78em;
        padding: 8px 12px;
    }

    .welcome-card {
        padding: 16px;
    }

    .welcome-avatar {
        width: 30px;
        height: 30px;
    }

    .welcome-title {
        font-size: 0.9em;
    }

    .welcome-sub {
        font-size: 0.8em;
        margin-left: 42px;
    }

    .current-stop-display {
        padding: 10px 16px;
        font-size: 0.85em;
    }

    .input-area {
        padding: 12px 16px;
    }

    .input-controls {
        gap: 8px;
    }

    .voice-btn {
        min-width: 44px;
        padding: 10px 12px;
        font-size: 1.2em;
    }

    .send-btn {
        padding: 10px 20px;
        font-size: 0.9em;
        min-width: 70px;
    }

    #messageInput {
        font-size: 16px; /* iOS zoomを防ぐ */
        padding: 10px 14px;
    }

    .modal-content {
        padding: 24px 20px;
        margin: 16px;
    }

    .modal-content h2 {
        font-size: 1.3em;
        margin-bottom: 24px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-group input[type="text"],
    .form-group input[type="password"],
    .form-group select {
        font-size: 16px; /* iOS zoomを防ぐ */
        padding: 10px 14px;
    }

    .btn-primary {
        padding: 12px;
        font-size: 0.95em;
    }

    .speaker-btn {
        padding: 5px 10px;
        font-size: 0.85em;
    }

    .voice-animation {
        width: 120px;
        height: 120px;
        margin: 0 auto 24px;
    }

    .microphone-icon {
        font-size: 3em;
    }

    .voice-modal-content {
        padding: 30px 20px;
    }

    .voice-instruction {
        font-size: 0.9em;
        margin-bottom: 24px;
    }

    .loading {
        padding: 24px 30px;
        min-width: 240px;
    }

    .loading-avatar {
        width: 40px;
        height: 40px;
    }
}

/* 極小スマートフォン (iPhone SE など) */
@media (max-width: 375px) {
    .logo-section h1 {
        font-size: 1.1em;
    }

    .subtitle {
        font-size: 0.7em;
    }

    .current-location {
        font-size: 0.75em;
    }

    .message-content {
        font-size: 0.8em;
    }

    .send-btn {
        padding: 10px 16px;
        min-width: 60px;
    }

    .modal-content h2 {
        font-size: 1.2em;
    }
}

/* 横向き (ランドスケープ) 対応 */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        height: auto;
        min-height: 100vh;
    }

    header {
        padding: 10px 16px;
    }

    .logo-section h1 {
        font-size: 1.2em;
    }

    .current-location {
        display: none;
    }

    .chat-messages {
        padding: 12px;
    }

    .input-area {
        padding: 10px 16px;
    }

    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
    }

    .voice-animation {
        width: 100px;
        height: 100px;
    }

    .microphone-icon {
        font-size: 2.5em;
    }
}

/* タッチデバイス用の調整 */
@media (hover: none) and (pointer: coarse) {
    /* タッチ操作に最適化 */
    .auto-play-btn,
    .settings-btn,
    .back-btn,
    .voice-btn,
    .send-btn,
    .speaker-btn,
    .btn-primary,
    .btn-secondary {
        min-height: 44px; /* iOS推奨タップターゲットサイズ */
    }

    /* ホバーエフェクトを無効化 */
    .auto-play-btn:hover,
    .settings-btn:hover,
    .back-btn:hover,
    .voice-btn:hover,
    .send-btn:hover,
    .speaker-btn:hover {
        transform: none;
    }

    /* アクティブ状態のフィードバック */
    .auto-play-btn:active,
    .settings-btn:active,
    .back-btn:active,
    .voice-btn:active,
    .send-btn:active,
    .speaker-btn:active {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

/* ハイコントラストモード対応 */
@media (prefers-contrast: high) {
    .message.user .message-content {
        border: 2px solid #bf360c;
    }

    .message.bot .message-content,
    .message.ai-message .message-content {
        border: 2px solid #555;
    }
}

/* Material Symbols アイコン設定 */
.material-symbols-outlined {
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
    vertical-align: middle;
    user-select: none;
}

.voice-btn .material-symbols-outlined,
.send-btn .material-symbols-outlined {
    font-size: 1em;
}

/* ストリーミングカーソル */
.streaming-cursor {
    display: inline-block;
    animation: blink 0.8s infinite;
    color: #f57c00;
    font-weight: bold;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* =========================================
   言語確認バナー
   ========================================= */
.language-banner {
    background: #fff3e0;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.9em;
    border-bottom: 1px solid #ffe0b2;
    flex-shrink: 0;
    color: #333;
}

.banner-buttons {
    display: flex;
    gap: 8px;
}

.banner-btn {
    padding: 6px 16px;
    border-radius: 16px;
    border: none;
    font-size: 0.85em;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.banner-yes {
    background: #f57c00;
    color: white;
}

.banner-yes:hover {
    background: #e65100;
}

.banner-change {
    background: white;
    border: 1px solid #f57c00;
    color: #f57c00;
}

.banner-change:hover {
    background: #fff3e0;
}

/* =========================================
   言語トグル・ドロップダウン
   ========================================= */
.lang-toggle-wrapper {
    position: relative;
}

.lang-toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}

.lang-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lang-btn-text {
    font-size: 0.85em;
    font-weight: 500;
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 500;
    padding: 8px 0;
}

.lang-group-label {
    padding: 8px 16px 4px;
    font-size: 0.7em;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.lang-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9em;
    color: #333;
    font-family: inherit;
    transition: background 0.15s;
}

.lang-option:hover {
    background: #fff3e0;
}

.lang-option.active {
    background: #fff3e0;
    color: #f57c00;
    font-weight: 600;
}

/* =========================================
   アラビア語 RTL 対応
   ========================================= */
[dir="rtl"] .header-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .header-buttons {
    flex-direction: row-reverse;
}

[dir="rtl"] .message.user {
    justify-content: flex-start;
}

[dir="rtl"] .message.bot,
[dir="rtl"] .message.ai-message {
    flex-direction: row-reverse;
}

[dir="rtl"] .message.user .message-content {
    border-radius: 18px 18px 18px 4px;
}

[dir="rtl"] .message.bot .message-content,
[dir="rtl"] .message.ai-message .message-content {
    border-radius: 18px 18px 4px 18px;
}

[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .lang-option {
    text-align: right;
}

[dir="rtl"] .stop-label {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .welcome-sub {
    margin-left: 0;
    margin-right: 48px;
}

[dir="rtl"] .quick-action-btn {
    flex-direction: row-reverse;
}

[dir="rtl"] .input-footer {
    flex-direction: row-reverse;
}

[dir="rtl"] .input-footer-right {
    flex-direction: row-reverse;
}

/* =========================================
   言語関連レスポンシブ
   ========================================= */
@media (max-width: 768px) {
    .lang-btn-text {
        display: none;
    }

    .lang-toggle-btn {
        padding: 10px 12px;
        min-width: 44px;
    }
}

@media (max-width: 480px) {
    .language-banner {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 16px;
        font-size: 0.85em;
    }

    .lang-dropdown {
        min-width: 160px;
        max-height: 300px;
        right: -10px;
    }

    .lang-toggle-btn {
        padding: 8px 10px;
        min-width: 40px;
    }
}

/* ダークモード対応 (将来的な拡張) */
@media (prefers-color-scheme: dark) {
    /* 現在はライトモードのみだが、将来的にダークモード追加可能 */
}
