/* コンポーネントCSS - AI面接システム */

/* ローディングスピナー */
.loading-spinner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    padding: 20px;
    color: white;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* 送信ボタン内のスピナー */
#send-btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 0 0 8px;
    display: inline-block;
    vertical-align: middle;
}

/* 送信ボタンの無効化スタイル */
#send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 読み込み中オーバーレイ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

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

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    height: 40px;
}

.bounce-dot {
    width: 12px;
    height: 12px;
    background: #007bff;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.bounce-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.bounce-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.bounce-dot:nth-child(3) {
    animation-delay: 0s;
}

.loading-text {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    display: none;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}


/* インライン版（回答エリア内） */
.inline-loading-spinner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(74, 144, 226, 0.1);
    border-radius: 8px;
    margin: 10px 0;
    color: #4a90e2;
    font-size: 14px;
    font-weight: 500;
}

.inline-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(74, 144, 226, 0.3);
    border-top: 2px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 録画制御 */
.recording-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.recording-status.recording {
    color: var(--accent-red);
}

.recording-status.paused {
    color: var(--accent-orange);
}

.recording-status.stopped {
    color: var(--text-secondary);
}

.recording-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.recording-dot.pulsing {
    background: var(--accent-red);
    animation: pulse 1s infinite;
}

.recording-dot.paused {
    background: var(--accent-orange);
}

.recording-dot.stopped {
    background: var(--text-secondary);
}

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

/* 音声切り替えボタン */
.voice-toggle-btn {
    background: transparent;
    border: 2px solid var(--text-secondary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    margin-right: 12px;
    transition: all 0.2s ease;
    font-size: 16px;
    min-width: 44px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-toggle-btn.enabled {
    border-color: var(--primary-green);
    color: var(--primary-green);
    background: rgba(76, 175, 80, 0.1);
}

.voice-toggle-btn.disabled {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(244, 67, 54, 0.1);
}

.voice-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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


/* メインコンテナ */
.main-container {
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary, #18191c);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ウェルカム画面表示時はコンテンツエリアを非表示（入力エリアは除く） */
.welcome-screen:not([style*="display: none"]) ~ .content-area .sidebar-chat {
    display: none;
}

.content-area {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px - 220px); /* ヘッダーと入力エリアを除いた高さ（余裕を追加） */
    padding-top: 60px;
}

/* メインビデオエリア */
.main-video-container {
    flex: 0 0 60%;
    position: relative;
    background: #000;
    overflow: hidden;
}

.main-video-panel {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* メイン面接者ビデオ */
.candidate-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    transform: scaleX(-1); /* カメラ映像を反転（鏡像） */
}

.camera-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
    font-size: 18px;
}

.camera-placeholder i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* PIP面接官ビデオ */
.pip-video-panel {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    width: 180px;
    height: 135px;
    background: transparent;
    border: none !important;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    z-index: 5; /* モバイルでの前面表示を防ぐため低めに設定 */
    transform: none !important;
    left: auto !important;
    bottom: auto !important;
    pointer-events: none; /* タップイベントを通す */
}

/* 面接官ビデオ（PIP内） */
.interviewer-video {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    width: calc(100% - 20px) !important;
    height: calc(100% - 20px) !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    z-index: 1 !important;
    pointer-events: none !important;
    /* モバイルでの自動最前面表示を防ぐ */
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    /* 強制的にインライン表示を保持 */
    max-width: 160px !important;
    max-height: 120px !important;
}

/* ビデオコントロールを完全に隠す */
.interviewer-video::-webkit-media-controls {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-overlay {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-enclosure {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-panel {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-timeline {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-current-time-display {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-time-remaining-display {
    display: none !important;
}

/* すべてのビデオ要素の時間表示を隠す */
video {
    outline: none;
    /* モバイルでの全画面表示を防ぐ */
    -webkit-video-presentation: none;
    video-presentation: none;
    -webkit-playsinline: true;
    playsinline: true;
}

/* すべてのビデオ要素のコントロールを隠す */
video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-overlay {
    display: none !important;
}

video::-webkit-media-controls-timeline {
    display: none !important;
}

video::-webkit-media-controls-current-time-display {
    display: none !important;
}

.interviewer-image {
    position: absolute;
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    object-fit: cover;
    border-radius: 50%;
    aspect-ratio: 1/1;
    z-index: 2; /* ビデオより上に表示 */
    pointer-events: none;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* ビデオコントロールオーバーレイ */
.video-controls-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 300px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.7);
    border-radius: 8px;
    padding: 12px 16px;
    z-index: 10;
}

.participant-info {
    color: white;
    font-weight: 600;
}

.control-buttons {
    display: flex;
    gap: 12px;
}

.control-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    border: none;
    outline: none;
}

.control-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

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

/* カメラボタンの状態 */
.control-btn.camera-on {
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.control-btn.camera-off {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

.control-btn.camera-off i::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: currentColor;
    transform: rotate(-45deg);
}

/* マイクボタンの状態 */
.control-btn.mic-on {
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.control-btn.mic-off {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

.control-btn.mic-off i::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: currentColor;
    transform: rotate(-45deg);
}

/* 旧control-iconクラスとの互換性保持 */
.control-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 16px;
}

.control-icon.active {
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.control-icon.muted {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

.control-icon:hover {
    background: rgba(255,255,255,0.3);
}

/* 右側チャットサイドバー */
.sidebar-chat {
    flex: 1;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 9997;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.chat-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.sidebar-chat .chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    padding-bottom: 40px; /* 下部に余裕を追加 */
    background: var(--bg-secondary);
    border-radius: 0;
    margin-bottom: 0;
    position: relative;
    z-index: 9998;
    scroll-behavior: smooth;
    height: 100%;
}

.sidebar-chat .interview-status {
    padding: 16px;
    text-align: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
}

.sidebar-chat .error-message {
    margin: 12px 16px;
}

.sidebar-chat .loading {
    padding: 20px;
    text-align: center;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

/* フッター入力エリア */
.input-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001; /* ウェルカム画面より上に表示 */
    gap: 16px;
    height: auto;
    min-height: 180px;
    max-height: 220px;
}


.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 16px;
}

.camera-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.video-info {
    background: rgba(0, 0, 0, 0.7);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.participant-name {
    font-weight: 700;
    color: var(--text-primary, #fff);
    font-size: 1.25rem;
    letter-spacing: 0.04em;
}

.participant-controls {
    display: flex;
    gap: 16px;
}

.participant-controls .participant-control {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    border: none;
}

.participant-controls .participant-control:hover {
    background: rgba(255,255,255,0.3);
}

.participant-controls .participant-control.active {
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.participant-controls .participant-control.muted {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

/* チャットメッセージ共通スタイル */
.chat-messages {
    font-size: 14px;
    line-height: 1.6;
}

.input-area, #responseArea {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: var(--background-tertiary);
    border-radius: 8px;
    margin-top: 10px;
}

.input-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

/* Voice button styles */
.voice-btn {
    background: var(--accent-green);
    color: white;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
}

.voice-btn:hover {
    background: var(--accent-green-hover, #43a047);
    transform: scale(1.05);
}

.voice-btn.listening {
    background: var(--accent-red);
    animation: pulse-mic 1s infinite;
}

.voice-btn.listening:hover {
    background: var(--accent-red-hover, #e53e3e);
}

.voice-btn .mic-label {
    font-size: 14px;
    display: none;
}

@media (min-width: 768px) {
    .voice-btn .mic-label {
        display: inline;
    }
}

/* 録音インジケーター */
.recording-indicator {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(244, 67, 54, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 10;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite;
}

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

/* 一時停止ボタン */
.pause-btn {
    background: var(--accent-orange);
    color: white;
}

.pause-btn:hover {
    background: #d68910;
}

/* 送信ボタンのラベル */
.send-label {
    font-size: 14px;
    margin-left: 4px;
    display: none;
}

@media (min-width: 768px) {
    .send-label {
        display: inline;
    }
}

@keyframes pulse-mic {
    0%, 100% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
    }
    50% { 
        opacity: 0.8; 
        box-shadow: 0 0 0 10px rgba(255, 71, 87, 0);
    }
}

.interview-status {
    text-align: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.message.ai {
    background: #2d3748 !important;
    color: #ffffff !important;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border-left: 4px solid #4fd1c7;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 99999;
    position: relative;
    font-weight: 500;
    line-height: 1.6;
    min-height: 40px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.message.user {
    background: var(--accent-blue);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.system {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin: 8px auto;
    text-align: center;
    font-size: 13px;
    font-style: italic;
    border: 1px solid var(--border-color);
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.name-input-area {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.name-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.name-input-wrapper label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

#candidateName {
    width: 300px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease;
}

#candidateName:focus {
    border-color: var(--accent-blue);
}

#user-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s ease;
    margin-bottom: 10px;
}

#user-input:focus {
    border-color: var(--accent-blue);
}

.btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn.text-btn {
    border-radius: 8px;
    padding: 12px 24px;
    width: auto;
    height: auto;
    font-size: 14px;
    font-weight: 500;
    gap: 8px;
}

.btn:hover {
    background: #4752c4;
    transform: translateY(-1px);
}

.btn:disabled {
    background: var(--hover-bg);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--hover-bg);
}

.btn-secondary:hover {
    background: #6d717a;
}

.loading {
    display: none;
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
}

.loading.active {
    display: block;
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.error-message {
    background: rgba(237, 66, 69, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    display: none;
}

/* 面接結果表示 */
.interview-results {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 24px;
    margin: 16px 0;
    border-left: 4px solid var(--accent-blue);
}

.interview-results h3 {
    color: var(--text-primary);
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
}

.result-summary {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.result-summary p {
    margin: 8px 0;
    color: var(--text-primary);
    font-size: 14px;
}

.result-summary strong {
    color: var(--accent-blue);
}

.result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.strengths, .concerns {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
}

.strengths h4 {
    color: var(--accent-green);
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.concerns h4 {
    color: var(--accent-red);
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.strengths ul, .concerns ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-primary);
    font-size: 14px;
}

.strengths li, .concerns li {
    margin: 4px 0;
}

@media (max-width: 768px) {
    .result-details {
        grid-template-columns: 1fr;
    }
}

/* リアルタイム評価表示 */
.realtime-evaluation {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    border-left: 3px solid var(--accent-blue);
    transition: opacity 0.5s ease;
    font-size: 13px;
}

.evaluation-header {
    margin-bottom: 8px;
}

.evaluation-score {
    font-size: 14px;
}

.evaluation-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.evaluation-details .keywords {
    color: var(--accent-blue);
    font-weight: 500;
}

.evaluation-details .strengths {
    color: var(--accent-green);
}

.evaluation-details .concerns {
    color: var(--accent-orange);
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .content-area {
        flex-direction: column;
    }
    
    .sidebar-chat {
        width: 100%;
        height: 250px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .pip-video-panel {
        width: 150px;
        height: 112px;
        top: 15px;
        right: 15px;
    }
    
    .video-controls-overlay {
        right: 170px;
        width: 250px;
    }
}

@media (max-width: 768px) {
    /* メインコンテナ */
    .main-container {
        height: 100dvh; /* 動的ビューポート高さ */
    }
    
    /* モバイルでのPIPビデオ制御 */
    .pip-video-panel {
        z-index: 3 !important; /* さらに低いz-index */
        pointer-events: none !important;
    }
    
    .interviewer-video {
        z-index: 1 !important;
        pointer-events: none !important;
        /* モバイルでの全画面表示を完全に防ぐ */
        -webkit-video-presentation: none !important;
        video-presentation: none !important;
        /* 追加の制御 */
        position: absolute !important;
        max-width: 100px !important;
        max-height: 75px !important;
        overflow: hidden !important;
        /* フルスクリーン化を防ぐ追加属性 */
        -webkit-transform: translate3d(0,0,0) !important;
        transform: translate3d(0,0,0) !important;
    }
    
    .interviewer-image {
        z-index: 2 !important;
        pointer-events: none !important;
    }
    
    /* ヘッダー */
    .header-toolbar {
        padding: 8px 12px;
        height: 50px;
        flex-wrap: nowrap;
        gap: 8px;
    }
    
    .header-left {
        flex: 1;
        min-width: 0;
    }
    
    .app-title {
        font-size: 16px;
    }
    
    .recording-status {
        font-size: 12px;
    }
    
    .timer, .progress-info {
        font-size: 12px;
    }
    
    /* ウェルカム画面の調整 */
    .welcome-content {
        padding: 20px 16px;
        max-width: 100%;
        margin: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: calc(100vh - 220px); /* 入力エリア分を確保 */
    }
    
    .welcome-content h1 {
        font-size: 24px;
        margin-bottom: 16px;
    }
    
    .welcome-content p {
        font-size: 16px;
        margin-bottom: 24px;
        line-height: 1.5;
    }
    
    .welcome-instructions {
        gap: 16px;
        margin-bottom: 20px;
    }
    
    .instruction-item {
        font-size: 15px;
        gap: 12px;
    }
    
    .instruction-item i {
        font-size: 20px;
        width: 24px;
    }
    
    /* コンテンツエリア */
    .content-area {
        height: calc(100dvh - 50px - 200px); /* ヘッダー(50px) + 入力エリア(200px) */
        padding-top: 50px;
        margin-bottom: 0;
        flex-direction: column;
    }
    
    .main-video-container {
        flex: 1;
        height: 50%;
        min-height: 200px;
    }
    
    .sidebar-chat {
        flex: 1;
        height: 50%;
        min-height: 200px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    /* モバイル版では面接進行中表示を非表示 */
    .sidebar-chat .interview-status {
        display: none;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-header h3 {
        font-size: 16px;
    }
    
    .chat-messages {
        padding: 12px;
        font-size: 13px;
    }
    
    .sidebar-chat .chat-messages {
        padding: 12px;
        overflow-y: auto;
    }
    
    /* 入力エリアの調整 */
    .input-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        padding: 12px;
        min-height: 180px;
        max-height: 220px;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    }
    
    .input-area {
        padding: 12px 0;
        gap: 8px;
    }
    
    #responseArea {
        padding: 12px 0;
        gap: 8px;
    }
    
    .name-input-area {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 0;
    }
    
    /* テキストエリアの高さ調整 */
    #user-input {
        min-height: 70px;
        max-height: 100px;
        font-size: 16px; /* iOSでのズーム防止 */
        padding: 12px;
        border-radius: 8px;
        resize: vertical;
    }
    
    #candidateName {
        width: 100%;
        min-height: 48px;
        padding: 12px;
        font-size: 16px; /* iOSズーム防止 */
        border-radius: 8px;
    }
    
    /* ボタンの調整 */
    .btn {
        min-height: 48px; /* タップしやすいサイズ */
        font-size: 16px;
        border-radius: 50%;
        width: 48px;
        height: 48px;
    }
    
    .btn.text-btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 50px;
        width: auto;
        height: auto;
        border-radius: 8px;
    }
    
    .input-controls {
        justify-content: center;
        gap: 12px;
        flex-wrap: nowrap;
    }
    
    .voice-btn, .pause-btn, #send-btn {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }
    
    /* PIPビデオ */
    .pip-video-panel {
        width: 100px;
        height: 75px;
        top: 8px;
        right: 8px;
    }
    
    /* ビデオコントロール */
    .video-controls-overlay {
        width: 200px;
        right: 8px;
        bottom: 8px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    /* メッセージ */
    .message {
        max-width: 90%;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* エラーメッセージ */
    .error-message {
        margin: 8px 0;
        padding: 10px;
        font-size: 13px;
    }
    
    /* ローディング */
    .loading {
        padding: 16px;
        font-size: 13px;
    }
}

/* リアルタイム音声認識スタイル */
#user-input.realtime-input {
    border: 2px solid var(--accent-blue);
    background: rgba(52, 152, 219, 0.05);
    animation: glow 2s ease-in-out infinite alternate;
}

/* 手入力モード時のスタイル */
#user-input.manual-input {
    border: 2px solid var(--accent-green);
    background: rgba(87, 242, 135, 0.05);
    animation: manual-glow 1s ease-in-out;
}

@keyframes glow {
    from { box-shadow: 0 0 5px rgba(52, 152, 219, 0.3); }
    to { box-shadow: 0 0 15px rgba(52, 152, 219, 0.6); }
}

@keyframes manual-glow {
    from { box-shadow: 0 0 10px rgba(87, 242, 135, 0.6); }
    to { box-shadow: 0 0 5px rgba(87, 242, 135, 0.3); }
}

/* 面接終了モーダル */
.completion-modal-content {
    /* modal-contentの基本スタイルを継承 */
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalEnter 0.4s ease-out;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--accent-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon i {
    font-size: 40px;
    color: white;
}

.modal-content h2 {
    font-size: 28px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.completion-message {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.completion-details {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 16px;
}

.detail-item i {
    color: var(--accent-blue);
    width: 20px;
}

.btn-close-modal {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-close-modal:hover {
    background: #4752c4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.3);
}

/* リアルタイム音声認識状態表示 */
.realtime-status {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(52, 152, 219, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    display: none;
}

.realtime-status.active {
    display: block;
    animation: fadeInOut 0.3s ease-in-out;
}

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

@media (max-width: 480px) {
    /* 極小画面対応 */
    .header-toolbar {
        padding: 6px 8px;
        height: 48px;
    }
    
    /* 極小画面でのビデオ制御強化 */
    .pip-video-panel {
        z-index: 2 !important;
        pointer-events: none !important;
        /* より小さく表示 */
        width: 80px !important;
        height: 60px !important;
    }
    
    .interviewer-video {
        z-index: 1 !important;
        pointer-events: none !important;
        -webkit-video-presentation: none !important;
        video-presentation: none !important;
        /* iOS Safari対策 */
        -webkit-playsinline: true;
        playsinline: true;
    }
    
    .interviewer-image {
        z-index: 2 !important;
        pointer-events: none !important;
    }
    
    .app-title {
        font-size: 14px;
    }
    
    /* ウェルカム画面の調整 */
    .welcome-content {
        padding: 16px 12px;
        min-height: calc(100vh - 200px);
    }
    
    .welcome-content h1 {
        font-size: 22px;
        margin-bottom: 12px;
    }
    
    .welcome-content p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .welcome-logo {
        width: 120px;
        margin-bottom: 20px;
    }
    
    .instruction-item {
        font-size: 14px;
        gap: 10px;
    }
    
    .instruction-item i {
        font-size: 18px;
        width: 20px;
    }
    
    /* コンテンツエリア */
    .content-area {
        height: calc(100vh - 48px - 180px); /* ヘッダー(48px) + 入力エリア(180px) */
        padding-top: 48px;
    }
    
    .main-video-container {
        height: 45%;
        min-height: 180px;
    }
    
    .sidebar-chat {
        height: 55%;
        min-height: 200px;
    }
    
    /* 入力エリア */
    .input-footer {
        padding: 10px;
        min-height: 160px;
        max-height: 200px;
    }
    
    #user-input {
        min-height: 60px;
        max-height: 80px;
        font-size: 16px;
        padding: 10px;
    }
    
    #candidateName {
        min-height: 44px;
        padding: 10px;
        font-size: 16px;
    }
    
    .btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    .btn.text-btn {
        padding: 10px 16px;
        font-size: 15px;
        min-height: 46px;
    }
    
    .input-controls {
        gap: 10px;
    }
    
    /* PIPビデオ */
    .pip-video-panel {
        width: 80px;
        height: 60px;
        top: 6px;
        right: 6px;
    }
    
    /* ビデオコントロール */
    .video-controls-overlay {
        width: 160px;
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .control-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .chat-messages {
        padding: 8px;
        font-size: 12px;
    }
    
    /* モーダルのレスポンシブ対応 */
    .modal-content {
        padding: 20px;
        width: 95%;
    }
}

/* 極小画面（320px以下）対応 */
@media (max-width: 320px) {
    .content-area {
        height: calc(100vh - 48px - 140px); /* ヘッダー(48px) + 入力エリア(140px) */
        padding-top: 48px;
    }
    
    .sidebar-chat {
        height: 50%;
        min-height: 250px;
    }
    
    .video-section {
        height: 50%;
        min-height: 200px;
    }
    
    /* 入力エリアの調整 */
    .input-footer {
        padding: 10px;
        min-height: 140px;
    }
    
    .input-area, #responseArea {
        padding: 10px;
        gap: 6px;
    }
    
    /* テキストエリアの高さ調整 */
    #user-input, #candidateName {
        min-height: 70px;
        font-size: 16px;
        padding: 10px;
    }
    
    /* ボタンの調整 */
    .btn {
        padding: 10px 16px;
        font-size: 15px;
        min-height: 44px;
    }
    
    .text-btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 46px;
    }
    
    /* チャットメッセージの調整 */
    .chat-messages {
        padding: 6px;
        font-size: 13px;
    }
    
    .message {
        padding: 8px 12px;
        margin-bottom: 6px;
        font-size: 13px;
    }
    
    /* モーダルの調整 */
    .modal-content {
        padding: 20px;
        width: 98%;
    }
    
    .answer-validation-modal {
        padding: 20px;
        width: 98%;
    }
    
    .voice-input-modal {
        padding: 20px;
        width: 98%;
    }
    
    .modal-content h2 {
        font-size: 22px;
    }
    
    .completion-message {
        font-size: 14px;
    }
    
    .detail-item {
        font-size: 14px;
    }
    
    .btn-close-modal {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .message {
        padding: 8px 10px;
        font-size: 12px;
    }
}


#micBtn {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}
#micBtn.active {
    background: var(--accent-red);
}
#micBtn:focus {
    outline: 2px solid var(--accent-blue);
}

/* 音声入力確認モーダル */
.voice-input-modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalEnter 0.4s ease-out;
    position: relative;
    z-index: 10001;
}

.voice-input-modal .modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-input-modal .modal-icon i {
    font-size: 36px;
    color: white;
}

.voice-input-modal h3 {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

.voice-input-modal p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-benefits {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.benefit-item i {
    color: var(--accent-green);
    width: 16px;
    flex-shrink: 0;
}

.modal-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-buttons .btn {
    border-radius: 8px;
    padding: 12px 20px;
    width: auto;
    height: auto;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
}

.modal-buttons .btn-primary {
    background: var(--accent-blue);
    color: white;
}

.modal-buttons .btn-primary:hover {
    background: #4752c4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.3);
}

.modal-buttons .btn-secondary {
    background: var(--hover-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-buttons .btn-secondary:hover {
    background: #6d717a;
    transform: translateY(-1px);
}

/* モバイル対応 */
@media (max-width: 480px) {
    .voice-input-modal {
        padding: 24px;
        width: 95%;
    }
    
    .voice-input-modal h3 {
        font-size: 20px;
    }
    
    .voice-input-modal p {
        font-size: 14px;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-buttons .btn {
        width: 100%;
        min-width: unset;
    }
}

/* 回答内容確認モーダル */
.answer-validation-modal {
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

.answer-validation-modal .modal-header {
    margin-bottom: 24px;
}

.answer-validation-modal h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.validation-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    color: #ffc107;
    font-size: 14px;
}

.validation-status.valid {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.validation-status.invalid {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

.validation-messages {
    margin-bottom: 20px;
}

.validation-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: rgba(244, 67, 54, 0.05);
    border: 1px solid rgba(244, 67, 54, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    color: #f44336;
    font-size: 14px;
}

.validation-message i {
    flex-shrink: 0;
    margin-top: 2px;
}

.answer-edit-section {
    margin-bottom: 20px;
}

.answer-edit-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.answer-edit-textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

.answer-edit-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.character-count {
    text-align: right;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.character-count.warning {
    color: #ffc107;
}

.character-count.error {
    color: #f44336;
}

.validation-suggestions {
    display: none;
}

.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 13px;
}

.suggestion-item i {
    flex-shrink: 0;
    margin-top: 2px;
}

.answer-validation-modal .modal-footer {
    display: flex;
    gap: 20px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.answer-validation-modal .btn {
    min-width: 200px;
    height: 48px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none;
    white-space: nowrap;
}

.answer-validation-modal .btn:focus {
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.3);
}

.answer-validation-modal .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.answer-validation-modal .btn:active {
    transform: translateY(0);
}

/* 編集を続けるボタン（セカンダリ） */
.answer-validation-modal #editAnswerBtn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.answer-validation-modal #editAnswerBtn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* 次の質問へボタン（プライマリ） */
.answer-validation-modal #proceedWithAnswerBtn {
    background: linear-gradient(135deg, var(--accent-blue), #667eea);
    color: white;
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.3);
    min-width: 220px;
    font-size: 13px;
}

.answer-validation-modal #proceedWithAnswerBtn:hover {
    background: linear-gradient(135deg, #667eea, var(--accent-blue));
    box-shadow: 0 4px 16px rgba(88, 101, 242, 0.4);
}

.answer-validation-modal #proceedWithAnswerBtn:active {
    background: linear-gradient(135deg, #5a67d8, #4c51bf);
}

/* アイコンのスタイル */
.answer-validation-modal .btn i {
    font-size: 16px;
    transition: transform 0.2s ease;
}

/* ホバー時のアニメーション */
.answer-validation-modal .btn:hover i {
    transform: scale(1.1);
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    .answer-validation-modal {
        padding: 24px;
        width: 95%;
    }
    
    .answer-validation-modal h3 {
        font-size: 20px;
    }
    
    .answer-validation-modal .modal-footer {
        flex-direction: column-reverse;
        gap: 12px;
    }
    
    .answer-validation-modal .btn {
        width: 100%;
        min-width: unset;
        height: 52px;
        font-size: 16px;
        padding: 14px 16px;
    }
} 