/* CharaTomo UI リデザイン - 3要素レイアウト */
/* 明るく楽しい配色と多世代ユーザー対応 */

/* 基本設定 */
:root {
    --primary-pink: #FFB6C1;
    --primary-blue: #87CEEB;
    --accent-yellow: #FFD700;
    --accent-green: #98FB98;
    --text-dark: #333;
    --text-light: #666;
    --background-white: #FFFFFF;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --border-radius-large: 20px;
    --transition: all 0.3s ease;
}

/* 大型マイクボタン */
.large-mic-btn {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    font-size: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue)) !important;
    border: 3px solid var(--primary-pink) !important;
    box-shadow: 0 4px 15px var(--shadow-medium) !important;
    transition: var(--transition) !important;
    cursor: pointer !important;
}

.large-mic-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px var(--shadow-medium) !important;
}

.large-mic-btn:active {
    transform: scale(0.95) !important;
}

/* 文字数制限表示 */
.character-counter {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-light);
    gap: 4px;
}

.char-count {
    font-weight: 600;
    color: var(--text-dark);
}

.char-separator {
    color: var(--text-light);
}

.char-limit {
    color: var(--text-light);
}

/* 文字数制限警告 */
.character-counter.warning .char-count {
    color: #FF6B6B;
}

.character-counter.warning .char-limit {
    color: #FF6B6B;
}

/* 文字数制限エラー */
.character-counter.error .char-count {
    color: #FF4444;
    font-weight: 700;
}

.character-counter.error .char-limit {
    color: #FF4444;
    font-weight: 700;
}

/* ロゴスタイル */
.logo-image,
.character-logo-image {
    height: 50px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    animation: logoSway 3s ease-in-out infinite;
}

.mobile-logo-image {
    height: 35px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    animation: logoSway 3s ease-in-out infinite;
}

/* ロゴのズーム・縮小アニメーション */
@keyframes logoSway {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* iOS音声入力ボタンのスタイル */
input[type="text"][x-webkit-speech],
input[type="text"][speech] {
    position: relative;
}

input[type="text"][x-webkit-speech]::-webkit-input-speech-button,
input[type="text"][speech]::-webkit-input-speech-button {
    background: var(--primary-pink);
    border: 2px solid var(--primary-blue);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    cursor: pointer;
    transition: var(--transition);
}

input[type="text"][x-webkit-speech]::-webkit-input-speech-button:hover,
input[type="text"][speech]::-webkit-input-speech-button:hover {
    background: var(--primary-blue);
    border-color: var(--primary-pink);
    transform: scale(1.1);
}

/* ロゴアニメーション */
.logo-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.logo-splash.hidden {
    opacity: 0;
    pointer-events: none;
}

.logo-splash-image {
    width: 80vw;
    max-width: 600px;
    height: auto;
    object-fit: contain;
    animation: logoZoomIn 2s ease-out forwards, logoSway 3s ease-in-out infinite 2s;
}

@keyframes logoZoomIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ロゴの最終位置へのアニメーション */
.logo-image.animate-to-position {
    animation: logoToPosition 1s ease-in-out forwards;
}

@keyframes logoToPosition {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.1);
        opacity: 0;
    }
}

/* メインコンテナ - 上下分割レイアウト（上半分: キャラクター、下半分: メッセージ） */
.main-container {
    display: grid;
    grid-template-areas:
        "character"
        "output"
        "input";
    grid-template-columns: 1fr;
    grid-template-rows: 40vh 1fr auto;
    /* キャラクターエリアを小さく、メッセージエリアを大きく */
    height: calc(100vh - 80px);
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ヘッダー内のチャット使用量表示 */
.header-usage-display {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    background: rgba(135, 206, 235, 0.1);
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-dark);
    margin-left: 10px;
}

.header-usage-text {
    font-weight: 500;
    color: var(--text-dark);
}

#headerUsageCurrent {
    font-weight: 600;
    color: var(--primary-blue);
}

#headerUsageLimit {
    color: var(--text-light);
}

/* 上半分: キャラクターエリア（大きく表示） */
.character-area {
    grid-area: character;
    display: flex;
    flex-direction: row;
    /* 横並びに変更 */
    align-items: center;
    /* 縦方向中央揃え（変更前の高さ位置に戻す） */
    justify-content: flex-start;
    /* 左寄せ */
    background: transparent;
    /* 背景を透明に */
    border-radius: 0;
    /* 枠を削除 */
    box-shadow: none;
    /* 影を削除 */
    padding: 20px 20px 20px 20px;
    position: relative;
    overflow: visible;
    /* キャラクター画像全体が見えるように */
    min-height: 0;
    gap: 20px;
    /* アバターと選択肢の間隔 */
}

/* キャラクターエリア内のロゴ（非表示） */
.character-logo {
    display: none;
    /* ロゴを非表示にしてキャラクターを大きく表示 */
}

/* キャラクターエリアのボーダーラインを削除 */

.character-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: auto;
    /* 幅を自動に */
    flex: 0 0 auto;
    /* 固定サイズ */
    justify-content: center;
    /* 縦方向中央揃え（変更前の状態に戻す） */
    margin-bottom: 0;
}

.character-avatar {
    position: relative;
    width: 675px;
    /* キャラクターサイズ（元のサイズに戻す） */
    height: 675px;
    /* キャラクターサイズ（元のサイズに戻す） */
    border-radius: 0;
    /* 円を無くしてキャラクター画像全体を表示 */
    overflow: visible;
    /* 画像全体が見えるように */
    box-shadow: none;
    /* 影を削除 */
    border: none;
    /* ボーダーを削除 */
    background: transparent;
    /* 背景を透明に */
}

.character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* 画像全体が見えるようにcontainに変更 */
    transition: var(--transition);
}

.character-avatar:hover img {
    transform: scale(1.05);
}

/* VRMビューアーのスタイル */
.character-vrm-viewer {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 0;
    /* 円を無くしてVRM全体を表示 */
    overflow: visible;
    /* VRM全体が見えるように */
    /* キャンバスの実際の解像度と表示サイズを一致させる */
    object-fit: contain;
}

/* VRMビューアーが表示されている場合、画像を非表示 */
.character-avatar.has-vrm img {
    display: none;
}

.character-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-light);
}

/* キャラクターグリッド内のローディング/エラーメッセージ */
.character-grid .character-loading,
.character-grid .character-empty,
.character-grid .character-error {
    position: static;
    transform: none;
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-medium);
    font-size: 1.1rem;
}

.character-grid .character-loading {
    color: var(--primary-blue);
}

.character-grid .character-error {
    color: var(--error-color, #e74c3c);
}

/* 口パクアニメーション（画像差し替え方式） */
/* CSSアニメーションは削除 - JavaScriptで画像切り替えのみ使用 */

.character-name {
    font-size: 2rem;
    /* キャラクター名のサイズ */
    font-weight: bold;
    color: var(--text-dark);
    text-align: left;
    /* 左上に配置するため左寄せ */
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: absolute;
    /* 絶対配置で左上に配置 */
    top: 20px;
    left: 20px;
    z-index: 10;
    margin: 0;
    /* マージンをリセット */
}

.character-settings {
    margin-top: 10px;
}

/* キャラクター変更ボタン（キャラクターエリア右下） */
.character-change-btn {
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--shadow-light);
    position: absolute;
    /* character-areaを基準に絶対配置 */
    bottom: 20px;
    right: 20px;
    z-index: 10;
}

.character-change-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.character-change-btn:active {
    transform: translateY(0);
}

/* ヘッダーのキャラクター変更ボタン（非表示） */
.header-character-select-btn {
    display: none;
    /* キャラクターエリアに移動したので非表示 */
}

/* キャラクターエリア内のキャラクター変更ボタン（非表示） */
.character-select-btn {
    display: none;
    /* 新しいボタンに置き換えたので非表示 */
}

/* チャット使用量ゲージ（キャラクターエリア下部に配置） */
.usage-gauge-container {
    width: 100%;
    margin-top: auto;
    margin-bottom: 0;
    padding: 15px;
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.1), rgba(135, 206, 235, 0.1));
    border-radius: var(--border-radius);
    border: 2px solid var(--primary-pink);
    box-shadow: 0 4px 15px var(--shadow-light);
    animation: gaugeSlideIn 0.5s ease-out;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

@keyframes gaugeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.usage-gauge-header {
    text-align: center;
    margin-bottom: 12px;
}

.usage-gauge-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.usage-gauge {
    position: relative;
    margin-bottom: 8px;
}

.usage-gauge-track {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(135, 206, 235, 0.3);
}

.usage-gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-yellow), var(--primary-pink));
    border-radius: 6px;
    transition: width 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.usage-gauge-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: gaugeShine 2s ease-in-out infinite;
}

@keyframes gaugeShine {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.usage-gauge-text {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: bold;
}

.usage-gauge-current {
    color: var(--primary-pink);
    font-size: 1.1rem;
}

.usage-gauge-separator {
    color: var(--text-light);
    font-size: 0.9rem;
}

.usage-gauge-limit {
    color: var(--primary-blue);
    font-size: 1.1rem;
}

.usage-gauge-info {
    text-align: center;
    margin-top: 6px;
}

.usage-gauge-remaining {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ゲージの状態別スタイル */
.usage-gauge-fill.low {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-yellow));
}

.usage-gauge-fill.medium {
    background: linear-gradient(90deg, var(--accent-yellow), #FFA500);
}

.usage-gauge-fill.high {
    background: linear-gradient(90deg, #FFA500, var(--primary-pink));
}

.usage-gauge-fill.critical {
    background: linear-gradient(90deg, var(--primary-pink), #FF4500);
    animation: gaugePulse 1s ease-in-out infinite alternate;
}

@keyframes gaugePulse {
    from {
        box-shadow: 0 0 0 0 rgba(255, 69, 0, 0.4);
    }

    to {
        box-shadow: 0 0 0 8px rgba(255, 69, 0, 0);
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .usage-gauge-container {
        margin-top: 15px;
        padding: 12px;
        position: static;
    }

    .usage-gauge-title {
        font-size: 0.8rem;
    }

    .usage-gauge-track {
        height: 10px;
    }

    .usage-gauge-text {
        font-size: 0.8rem;
    }

    .usage-gauge-current,
    .usage-gauge-limit {
        font-size: 1rem;
    }

    .usage-gauge-remaining {
        font-size: 0.75rem;
    }

    .character-area {
        justify-content: flex-start;
        flex-direction: row;
        /* 横並びを維持 */
    }

    .character-container {
        margin-bottom: 15px;
    }

    /* モバイル時はcharacter-area内の選択肢を非表示 */
    .character-area .choice-buttons-container {
        display: none !important;
    }
}

/* 右上: 出力エリア */
.output-area {
    grid-area: output;
    display: flex;
    flex-direction: column;
    background: transparent;
    /* 背景を透明に */
    border-radius: var(--border-radius-large);
    /* 入力エリアと同じ角丸 */
    box-shadow: none;
    /* 影を削除 */
    overflow: hidden;
    /* 角丸を適用するためにoverflowをhiddenに */
    position: relative;
}

/* 出力エリアのボーダーラインを削除 */

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

.output-header {
    padding: 20px 30px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-green));
    color: white;
    text-align: center;
}

.output-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.output-subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* デスクトップサイズでは出力エリア内のキャラクター表示エリアを非表示 */
.output-character-area {
    display: none;
}

.output-messages {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    background: linear-gradient(135deg, #f8f9ff, #f0f8ff);
    position: relative;
    border-radius: var(--border-radius-large);
    /* 入力エリアと同じ角丸 */
}

/* ウェルカムメッセージ */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    background: var(--background-white);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px var(--shadow-light);
    margin-bottom: 20px;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.welcome-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.welcome-text {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* 下部: 入力エリア */
.input-area {
    grid-area: input;
    background: var(--background-white);
    border-radius: var(--border-radius-large);
    box-shadow: 0 4px 20px var(--shadow-light);
    padding: 30px 15px;
    /* 左右の余白を小さく: 30px → 15px */
    position: relative;
}

/* 入力エリアとメッセージ表示エリアの間のボーダーラインを削除 */
.input-area::before {
    display: none;
    /* ボーダーラインを非表示 */
}

.input-container {
    width: 100%;
    /* 親パネルのサイズに応じて可変 */
    margin: 0 auto;
}

.input-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.input-field {
    width: 100%;
    min-height: 90px;
    /* 60px → 90px (1.5倍) */
    max-height: 180px;
    /* 120px → 180px (1.5倍) */
    padding: 22px 50px 22px 30px;
    /* 15px → 22px, 20px → 30px (1.5倍) */
    border: 2px solid var(--primary-pink);
    border-radius: var(--border-radius);
    font-size: 1.65rem;
    /* 1.1rem → 1.65rem (1.5倍) */
    font-family: inherit;
    resize: none;
    outline: none;
    transition: var(--transition);
    background: linear-gradient(135deg, #fff, #f8f9ff);
}

.input-field:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(135, 206, 235, 0.2);
    animation: inputGlow 2s ease-in-out infinite alternate;
}

/* 入力フィールドの明滅ハイライト効果 */
@keyframes inputGlow {
    0% {
        box-shadow: 0 0 0 3px rgba(135, 206, 235, 0.2);
        border-color: var(--primary-blue);
    }

    100% {
        box-shadow: 0 0 0 6px rgba(135, 206, 235, 0.4);
        border-color: #4A90E2;
    }
}

.input-actions {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 8px;
}

.voice-input-btn {
    background: var(--primary-pink);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    /* 40px → 60px (1.5倍) */
    height: 60px;
    /* 40px → 60px (1.5倍) */
    font-size: 1.65rem;
    /* 1.1rem → 1.65rem (1.5倍) */
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-input-btn:hover {
    background: var(--primary-blue);
    transform: scale(1.1);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0 45px;
    /* 高さを入力フィールドに合わせるため上下パディングを0に */
    font-size: 1.65rem;
    /* 1.1rem → 1.65rem (1.5倍) */
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    min-width: 150px;
    /* 100px → 150px (1.5倍) */
    height: 90px;
    /* 入力フィールドの最小高さに合わせる */
    box-shadow: 0 4px 15px var(--shadow-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.send-btn:active {
    transform: translateY(0);
}

/* キャラクター選択モーダル */
.character-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.character-selection {
    padding: 20px 0;
}

.preset-characters h3,
.custom-character h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.character-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: var(--background-white);
    border: 2px solid var(--primary-pink);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}


.character-option:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-light);
}

.character-option.selected {
    border-color: var(--primary-blue);
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    color: white;
}

.character-option-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 10px;
    object-fit: cover;
    border: 2px solid var(--primary-pink);
}

.character-option-name {
    font-size: 0.9rem;
    font-weight: bold;
}

.custom-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.custom-character-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--primary-pink);
    border-radius: var(--border-radius);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.custom-character-input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(135, 206, 235, 0.2);
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .main-container {
        grid-template-areas:
            "output"
            "input";
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        padding: 10px;
        gap: 10px;
        margin-top: 50px;
        /* モバイルヘッダーの高さ分だけ下にずらす */
    }

    .character-area {
        display: none;
    }

    .output-area {
        grid-area: output;
        border-radius: var(--border-radius-large);
        /* 入力エリアと同じ角丸 */
        overflow: hidden;
        /* 角丸を適用するためにoverflowをhiddenに */
    }

    .input-area {
        grid-area: input;
    }

    .output-header {
        padding: 15px 20px;
    }

    .output-title {
        display: none;
        /* モバイルでは「キャラと話そう！」を非表示 */
    }

    /* モバイル用キャラクター表示エリア（ヘッダーとメッセージエリアの間） */
    .output-character-area {
        display: flex;
        flex-direction: row;
        /* 横並びに変更 */
        align-items: center;
        /* 縦方向中央揃え */
        justify-content: flex-start;
        /* 左寄せ */
        padding: 20px 20px 20px 20px;
        background: transparent;
        /* 背景を透明に */
        border-radius: 0;
        /* 枠を削除 */
        box-shadow: none;
        /* 影を削除 */
        min-height: 200px;
        position: relative;
        /* 絶対配置の基準にする */
        gap: 15px;
        /* アバターと選択肢の間隔 */
    }

    .output-character-avatar {
        position: relative;
        width: 200px;
        /* モバイルでは少し小さく */
        height: 200px;
        /* モバイルでは少し小さく */
        border-radius: 0;
        /* 円を無くしてキャラクター画像全体を表示 */
        overflow: visible;
        /* 画像全体が見えるように */
        box-shadow: none;
        /* 影を削除 */
        border: none;
        /* ボーダーを削除 */
        background: transparent;
        /* 背景を透明に */
        margin-bottom: 0;
        flex: 0 0 auto;
        /* 固定サイズ */
    }

    .output-character-avatar img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        /* 画像全体が見えるようにcontainに変更 */
    }

    .output-character-vrm-viewer {
        width: 100%;
        height: 100%;
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        border-radius: 0;
        /* 円を無くしてVRM全体を表示 */
        overflow: visible;
        /* VRM全体が見えるように */
    }

    .output-character-avatar.has-vrm .output-character-vrm-viewer {
        display: block;
    }

    .output-character-avatar.has-vrm img {
        display: none !important;
    }

    .output-character-loading {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: var(--text-dark);
    }

    .output-character-name {
        font-size: 1.5rem;
        /* キャラクター名のサイズ */
        font-weight: bold;
        color: var(--text-dark);
        text-align: left;
        /* 左上に配置するため左寄せ */
        padding: 8px 12px;
        background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        position: absolute;
        /* 絶対配置で左上に配置 */
        top: 15px;
        left: 15px;
        z-index: 10;
        margin: 0;
        /* マージンをリセット */
    }

    /* モバイル用キャラクター変更ボタン（キャラクターエリア右下） */
    .output-character-change-btn {
        background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
        color: white;
        border: none;
        border-radius: var(--border-radius);
        padding: 10px 20px;
        font-size: 1rem;
        font-weight: bold;
        cursor: pointer;
        transition: var(--transition);
        box-shadow: 0 4px 15px var(--shadow-light);
        position: absolute;
        /* output-character-areaを基準に絶対配置 */
        bottom: 15px;
        right: 15px;
        z-index: 10;
    }

    .output-character-change-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px var(--shadow-medium);
    }

    .output-character-change-btn:active {
        transform: translateY(0);
    }

    .output-messages {
        padding: 15px 20px;
        border-radius: var(--border-radius-large);
        /* 入力エリアと同じ角丸 */
    }

    /* モバイル表示時のみメッセージのフォントサイズを小さく */
    .message.user .message-bubble {
        font-size: 1.2rem;
    }

    .message.assistant .message-bubble {
        font-size: 1.5rem;
    }

    .thinking-text {
        font-size: 1.5rem;
    }

    .input-area {
        padding: 10px 0;
        /* 左右の余白をなくす */
    }

    .input-form {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 0 10px;
    }

    .input-wrapper {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 8px;
        position: relative;
        min-width: 0;
    }

    .input-field {
        flex: 1;
        min-height: 50px;
        max-height: 120px;
        padding: 12px 45px 12px 12px;
        font-size: 1rem;
        margin: 0;
        min-width: 0;
    }

    .input-actions {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
    }

    .voice-input-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .character-counter {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 0.85rem;
        white-space: nowrap;
        margin: 0;
        flex-shrink: 0;
    }

    .send-btn {
        min-width: 80px;
        height: 50px;
        padding: 0 20px;
        font-size: 1rem;
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .main-container {
        grid-template-areas:
            "output"
            "input";
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        padding: 10px;
        gap: 10px;
        margin-top: 50px;
        /* モバイルヘッダーの高さ分だけ下にずらす */
    }

    .character-area {
        display: none;
    }

    .output-area {
        grid-area: output;
        border-radius: var(--border-radius-large);
        /* 入力エリアと同じ角丸 */
        overflow: hidden;
        /* 角丸を適用するためにoverflowをhiddenに */
    }

    .input-area {
        grid-area: input;
    }

    .output-header {
        padding: 15px 20px;
    }

    .output-title {
        display: none;
        /* モバイルでは「キャラと話そう！」を非表示 */
    }

    /* モバイル用キャラクター表示エリア（ヘッダーとメッセージエリアの間） */
    .output-character-area {
        display: flex;
        flex-direction: row;
        /* 横並びに変更 */
        align-items: center;
        /* 縦方向中央揃え */
        justify-content: flex-start;
        /* 左寄せ */
        padding: 20px 20px 20px 20px;
        background: transparent;
        /* 背景を透明に */
        border-radius: 0;
        /* 枠を削除 */
        box-shadow: none;
        /* 影を削除 */
        min-height: 200px;
        position: relative;
        /* 絶対配置の基準にする */
        gap: 15px;
        /* アバターと選択肢の間隔 */
    }

    .output-character-avatar {
        position: relative;
        width: 200px;
        /* モバイルでは少し小さく */
        height: 200px;
        /* モバイルでは少し小さく */
        border-radius: 0;
        /* 円を無くしてキャラクター画像全体を表示 */
        overflow: visible;
        /* 画像全体が見えるように */
        box-shadow: none;
        /* 影を削除 */
        border: none;
        /* ボーダーを削除 */
        background: transparent;
        /* 背景を透明に */
        margin-bottom: 0;
        flex: 0 0 auto;
        /* 固定サイズ */
    }

    .output-character-avatar img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        /* 画像全体が見えるようにcontainに変更 */
    }

    .output-character-vrm-viewer {
        width: 100%;
        height: 100%;
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        border-radius: 0;
        /* 円を無くしてVRM全体を表示 */
        overflow: visible;
        /* VRM全体が見えるように */
    }

    .output-character-avatar.has-vrm .output-character-vrm-viewer {
        display: block;
    }

    .output-character-avatar.has-vrm img {
        display: none !important;
    }

    .output-character-loading {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: var(--text-dark);
    }

    .output-character-name {
        font-size: 1.5rem;
        /* キャラクター名のサイズ */
        font-weight: bold;
        color: var(--text-dark);
        text-align: left;
        /* 左上に配置するため左寄せ */
        padding: 8px 12px;
        background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        position: absolute;
        /* 絶対配置で左上に配置 */
        top: 15px;
        left: 15px;
        z-index: 10;
        margin: 0;
        /* マージンをリセット */
    }

    /* モバイル用キャラクター変更ボタン（キャラクターエリア右下） */
    .output-character-change-btn {
        background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
        color: white;
        border: none;
        border-radius: var(--border-radius);
        padding: 10px 20px;
        font-size: 1rem;
        font-weight: bold;
        cursor: pointer;
        transition: var(--transition);
        box-shadow: 0 4px 15px var(--shadow-light);
        position: absolute;
        /* output-character-areaを基準に絶対配置 */
        bottom: 15px;
        right: 15px;
        z-index: 10;
    }

    .output-character-change-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px var(--shadow-medium);
    }

    .output-character-change-btn:active {
        transform: translateY(0);
    }

    .output-messages {
        padding: 15px 20px;
        border-radius: var(--border-radius-large);
        /* 入力エリアと同じ角丸 */
    }

    /* モバイル表示時のみメッセージのフォントサイズを小さく */
    .message.user .message-bubble {
        font-size: 1.2rem;
    }

    .message.assistant .message-bubble {
        font-size: 1.5rem;
    }

    .thinking-text {
        font-size: 1.5rem;
    }

    .input-area {
        padding: 10px 0;
        /* 左右の余白をなくす */
    }

    .input-form {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 0 10px;
    }

    .input-wrapper {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 8px;
        position: relative;
        min-width: 0;
    }

    .input-field {
        flex: 1;
        min-height: 50px;
        max-height: 120px;
        padding: 12px 45px 12px 12px;
        font-size: 1rem;
        margin: 0;
        min-width: 0;
    }

    .input-actions {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
    }

    .voice-input-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .character-counter {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 0.85rem;
        white-space: nowrap;
        margin: 0;
        flex-shrink: 0;
    }

    .send-btn {
        min-width: 80px;
        height: 50px;
        padding: 0 20px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .character-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }

    .character-option-avatar {
        width: 50px;
        height: 50px;
    }
}

/* アクセシビリティ対応 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    :root {
        --primary-pink: #FF69B4;
        --primary-blue: #4169E1;
        --text-dark: #000000;
        --text-light: #333333;
    }
}

/* フォーカス表示の改善 */
.character-select-btn:focus,
.voice-input-btn:focus,
.send-btn:focus,
.character-option:focus,
.custom-character-input:focus {
    outline: 3px solid var(--primary-blue);
    outline-offset: 2px;
}

/* ローディングアニメーション */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-pink);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* ファイル添付エリア */
.file-attach-area {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9ff, #f0f8ff);
    border-radius: var(--border-radius);
    border: 2px dashed var(--primary-pink);
}

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

.file-attach-title {
    font-weight: bold;
    color: var(--text-dark);
}

.file-attach-close {
    background: var(--primary-pink);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.file-attach-close:hover {
    background: var(--primary-blue);
}

/* ドラッグ&ドロップエリア */
.drag-drop-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 182, 193, 0.9);
    border: 3px dashed var(--primary-blue);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.drag-drop-content {
    text-align: center;
    color: var(--text-dark);
}

.drag-drop-content svg {
    margin-bottom: 15px;
    color: var(--primary-blue);
}

.drag-drop-hint {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 5px;
}

/* レスポンスメッセージ */
.response-message {
    margin-bottom: 20px;
    animation: slideInUp 0.3s ease;
}

.response-content {
    background: var(--background-white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 2px 10px var(--shadow-light);
    border-left: 4px solid var(--primary-blue);
}

.response-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.response-time {
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: right;
}

/* エラーメッセージ */
.error-message {
    margin-bottom: 20px;
    animation: slideInUp 0.3s ease;
}

.error-content {
    background: #ffe6e6;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 2px 10px var(--shadow-light);
    border-left: 4px solid #ff4757;
    display: flex;
    align-items: center;
    gap: 15px;
}

.error-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.error-text {
    flex: 1;
    font-size: 1rem;
    color: var(--text-dark);
}

.error-time {
    font-size: 0.9rem;
    color: var(--text-light);
    flex-shrink: 0;
}

/* アニメーション */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* モーダルスタイルの改善 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--background-white);
    border-radius: var(--border-radius-large);
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px var(--shadow-medium);
    animation: modalSlideIn 0.3s ease;
}

.character-modal-content {
    max-width: 600px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 20px;
    text-align: center;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    min-width: 100px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    color: white;
    box-shadow: 0 4px 15px var(--shadow-light);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.btn-secondary {
    background: var(--background-white);
    color: var(--text-dark);
    border: 2px solid var(--primary-pink);
}

.btn-secondary:hover {
    background: var(--primary-pink);
    color: white;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

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

/* 飛ぶテキストアニメーション */
.flying-text {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    color: white;
    padding: 15px 25px;
    border-radius: 30px;
    font-size: 1.65rem;
    /* 入力フィールドと同じフォントサイズ */
    font-weight: bold;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    max-width: 400px;
    word-wrap: break-word;
    animation: flyToMessage 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    /* アニメーション時間を延長 */
}

@keyframes flyToMessage {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    30% {
        opacity: 0.9;
        transform: scale(1.15) translateY(-30px);
    }

    70% {
        opacity: 0.7;
        transform: scale(1.05) translateY(-80px);
    }

    100% {
        opacity: 0;
        transform: scale(0.9) translateY(-200px);
        /* 飛行距離を大幅に延長 */
    }
}

/* メッセージ表示エリアのアニメーション */
.message-display-area {
    position: relative;
    overflow: hidden;
}

/* ユーザーメッセージのスタイル */
.message.user .message-bubble {
    font-size: 1.4rem;
    /* 入力フィールド(1.65rem)より少し小さく */
    line-height: 1.4;
    padding: 15px 20px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    color: white;
    max-width: 95%;
    /* 80% → 95% に拡大して右端を寄せる */
    word-wrap: break-word;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* アシスタントメッセージコンテナのスタイル */
.message.assistant {
    margin-right: 0;
    /* 右マージンを削除して余白を削減 */
}

.message.assistant .message-content {
    margin-right: 0;
    /* メッセージコンテンツの右マージンも削除 */
    padding-right: 0;
    /* 右パディングも削除して右余白を削減 */
    max-width: 100%;
    /* 最大幅を100%に設定してより多くの文字が表示されるように */
}

/* アシスタントメッセージのスタイル */
.message.assistant .message-bubble {
    font-size: 2.475rem;
    /* 入力フィールド(1.65rem)の1.5倍 */
    line-height: 1.4;
    padding: 20px 10px 20px 25px;
    /* 右パディングを15px → 10px にさらに縮小 */
    margin-right: 0;
    /* 右マージンを削除して右余白を削減 */
    border-radius: 20px;
    background: #f0f8ff;
    color: #333;
    max-width: 100%;
    /* 100% で右端を完全に寄せる */
    word-wrap: break-word;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.message-appear {
    animation: messageAppear 0.5s ease-out forwards;
}

/* 考え中テキストのスタイル */
.thinking-text {
    font-size: 2.475rem;
    /* アシスタントメッセージと同じフォントサイズ */
    color: #333;
    font-weight: normal;
}

/* アニメーションする3点ダッシュのスタイル */
.thinking-dots {
    display: inline-block;
    animation: thinkingDots 1.5s ease-in-out infinite;
}

@keyframes thinkingDots {

    0%,
    20% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    80%,
    100% {
        opacity: 0;
    }
}

@keyframes messageAppear {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* モバイル用キャラクター設定 */
.mobile-character-section {
    padding: 10px 0;
}

.mobile-character-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px var(--shadow-light);
}

.mobile-character-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.mobile-character-btn span:last-child {
    font-size: 1.2rem;
}

/* Markdown要素のスタイル */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3 {
    margin: 0.5em 0;
    font-weight: bold;
    color: var(--text-dark);
}

.message-bubble h1 {
    font-size: 1.5em;
    border-bottom: 2px solid var(--primary-pink);
    padding-bottom: 0.2em;
}

.message-bubble h2 {
    font-size: 1.3em;
    border-bottom: 1px solid var(--primary-blue);
    padding-bottom: 0.1em;
}

.message-bubble h3 {
    font-size: 1.1em;
    color: var(--primary-blue);
}

.message-bubble strong {
    font-weight: bold;
    color: var(--text-dark);
}

.message-bubble em {
    font-style: italic;
    color: var(--text-light);
}

.message-bubble code {
    background-color: #f4f4f4;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #d63384;
}

.message-bubble pre {
    background-color: #f8f9fa;
    padding: 1em;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-blue);
    margin: 0.5em 0;
    overflow-x: auto;
}

.message-bubble pre code {
    background-color: transparent;
    padding: 0;
    color: var(--text-dark);
    font-size: 0.9em;
}

.message-bubble ul,
.message-bubble ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message-bubble li {
    margin: 0.2em 0;
    line-height: 1.4;
}

.message-bubble ul li {
    list-style-type: disc;
}

.message-bubble ol li {
    list-style-type: decimal;
}

/* リスト内のネストした要素 */
.message-bubble ul ul,
.message-bubble ol ol,
.message-bubble ul ol,
.message-bubble ol ul {
    margin: 0.2em 0;
    padding-left: 1.2em;
}

.message-bubble ul ul li {
    list-style-type: circle;
}

.message-bubble ul ul ul li {
    list-style-type: square;
}

/* 変身中メッセージのスタイル */
.transformation-text {
    font-size: 2.475rem;
    /* アシスタントメッセージと同じフォントサイズ */
    color: #333;
    font-weight: normal;
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* 変身中メッセージのバブルスタイル */
.message-bubble.transformation {
    line-height: 1;
    padding: 15px 10px 15px 25px;
    margin: 0;
}

/* アニメーションする3点ダッシュのスタイル（変身中） */
.transformation-dots {
    display: inline-block;
    animation: transformationDots 1.5s ease-in-out infinite;
}

@keyframes transformationDots {

    0%,
    20% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    80%,
    100% {
        opacity: 0;
    }
}

/* スプラッシュ画面 */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.splash-content {
    text-align: center;
}

.splash-title-image {
    width: 80vw;
    max-width: 600px;
    height: auto;
    object-fit: contain;
    animation: logoZoomIn 2s ease-out forwards, logoSway 3s ease-in-out infinite 2s;
}

.splash-start-button {
    background: #007bff;
    border: none;
    border-radius: 12px;
    padding: 20px 40px;
    color: white;
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin: 0 auto;
    display: block;
    min-width: 200px;
}

.splash-start-button:hover {
    background: #0056b3;
}

.splash-start-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.splash-loading {
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.splash-loading.show {
    opacity: 1;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

.splash-loading p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

@keyframes logoZoomIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes logoSway {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(1deg);
    }

    75% {
        transform: rotate(-1deg);
    }
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* メインコンテンツの初期状態 */
.main-content {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.main-content.show {
    opacity: 1;
}

/* 音声再生ブロック検出オーバーレイ */
.audio-blocked-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.audio-blocked-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.audio-blocked-content {
    background: #FFFFFF;
    border-radius: var(--border-radius-large);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: audioBlockedSlideIn 0.3s ease;
}

.audio-blocked-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: audioBlockedPulse 2s ease-in-out infinite;
}

.audio-blocked-message {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.audio-blocked-description {
    font-size: 1rem;
    color: var(--text-light);
    line-height: 1.6;
}

@keyframes audioBlockedSlideIn {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }

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

@keyframes audioBlockedPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* モバイル対応 */
@media (max-width: 768px) {
    .audio-blocked-content {
        padding: 30px 20px;
        max-width: 90%;
    }

    .audio-blocked-icon {
        font-size: 48px;
        margin-bottom: 16px;
    }

    .audio-blocked-message {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .audio-blocked-description {
        font-size: 0.9rem;
    }
}

/* 音声再生オンオフ制御アイコン（メッセージエリア右下） */
.voice-playback-toggle {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-pink), var(--primary-blue));
    border: 3px solid var(--primary-pink);
    color: white;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--shadow-medium);
    z-index: 1000;
    font-size: 1.65rem;
    opacity: 1;
    visibility: visible;
    padding: 0;
    margin: 0;
}

.voice-playback-toggle #voicePlaybackIcon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    width: 100%;
    height: 100%;
    color: white;
    text-align: center;
}

.voice-playback-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.voice-playback-toggle:active {
    transform: scale(0.95);
}

/* オフ状態（ミュート）のスタイル */
.voice-playback-toggle.muted {
    background: linear-gradient(135deg, #6c757d, #495057);
}

.voice-playback-toggle.muted:hover {
    background: linear-gradient(135deg, #5a6268, #3d4146);
}

.voice-playback-toggle.muted #voicePlaybackIcon {
    opacity: 0.6;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .voice-playback-toggle {
        bottom: 15px;
        right: 15px;
    }
}

/* クイズ画像オーバーレイ */
.quiz-image-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-image-overlay.show {
    opacity: 1;
}

.quiz-image-overlay.hide {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.quiz-image-overlay-img {
    width: 80%;
    max-width: 500px;
    min-width: 200px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

/* モバイル対応 */
.output-character-area .quiz-image-overlay {
    width: 80%;
    max-width: 300px;
}

.output-character-area .quiz-image-overlay-img {
    width: 100%;
    max-width: 300px;
}

/* キャラクターエリア内での配置 */
.character-area {
    position: relative;
}

.output-character-area {
    position: relative;
}