/* 基礎樣式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-y: auto !important; /* 確保總是有捲軸 */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 頁面切換 */
.page {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

.page.hidden {
    display: none;
}

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

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

/* 頁面統一佈局 */
.page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 100px;
    flex: 1;
}

.logo-section {
    margin-bottom: 3vh;
    flex-shrink: 0;
}

/* 登入頁面樣式 */
#login-page {
    justify-content: center;
    text-align: center;
    padding-top: 60px;
}

.logo {
    margin-bottom: 30px;
    text-align: center;
}

.logo-image {
    max-width: 200px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* 備用文字 logo 樣式（如果圖片載入失敗） */
.logo h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 2px;
    color: white;
    margin: 0;
}

.ai-text {
    font-size: 1.5rem;
    color: #FFD700;
}

.hourglass-icon {
    font-size: 48px;
    margin-bottom: 10px;
    color: #FFD700;
}

.form-section {
    background: white;
    padding: 3vh 2vw;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 500px;
}

.form-section h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #333;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
}

.serial-input {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.serial-input-field {
    width: 200px;
    height: 50px;
    padding: 0 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.serial-input-field:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.serial-input-field::placeholder {
    font-size: 0.9rem;
    font-weight: normal;
    color: #999;
}

.checkbox-section {
    text-align: left;
    margin-bottom: 30px;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    cursor: pointer;
    line-height: 1.5;
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
    margin-top: 2px;
    flex-shrink: 0;
    transition: all 0.3s;
}

.checkbox-item input[type="checkbox"]:checked+.checkmark {
    background-color: #4A90E2;
    border-color: #4A90E2;
}

.checkbox-item input[type="checkbox"]:checked+.checkmark::after {
    content: '✓';
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.link {
    color: #4A90E2;
    text-decoration: underline;
}

.link:hover {
    color: #357ABD;
}

.submit-btn {
    width: 100%;
    height: 50px;
    background: #4A90E2;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.submit-btn:hover:not(:disabled) {
    background: #357ABD;
    transform: translateY(-2px);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 錯誤訊息樣式 */
.error-message {
    color: #e74c3c;
    background-color: #fadbd8;
    border: 1px solid #e74c3c;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    text-align: center;
    animation: shakeError 0.5s ease-in-out;
}

@keyframes shakeError {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Alert 訊息樣式 */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: slideInDown 0.4s ease-out;
}

.alert svg {
    flex-shrink: 0;
}

.alert-error {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.alert-error svg {
    stroke: #c33;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-success svg {
    stroke: #155724;
}

.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert-warning svg {
    stroke: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.alert-info svg {
    stroke: #0c5460;
}

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

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

/* 主要內容區域統一樣式 */
.main-content {
    width: 100%;
    max-width: 1200px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2vh 0;
}


/* 職位確認頁面 */
.position-card {
    background: white;
    padding: 3vh 2vw;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 100%;
}

.position-card h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
    color: #333;
}

.position-info {
    margin-bottom: 30px;
}

.info-row {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
}

.info-row .label {
    font-weight: bold;
    min-width: 150px;
    color: #555;
}

.info-row .value {
    flex: 1;
    color: #333;
}

.job-content p {
    margin-bottom: 12px;
    line-height: 1.6;
}

.job-content ul,
.job-content ol {
    margin-bottom: 15px;
    padding-left: 25px;
}

.job-content ul {
    list-style-type: disc;
}

.job-content ol {
    list-style-type: decimal;
}

.job-content li {
    margin-bottom: 5px;
    line-height: 1.6;
}

.job-content strong,
.job-content b {
    font-weight: bold;
    color: #333;
}

.job-content h1,
.job-content h2,
.job-content h3 {
    margin-top: 20px;
    margin-bottom: 15px;
    color: #4A90E2;
}

.job-content h1 {
    font-size: 1.4rem;
}

.job-content h2 {
    font-size: 1.25rem;
}

.job-content h3 {
    font-size: 1.15rem;
}

.job-content blockquote {
    border-left: 4px solid #4A90E2;
    padding-left: 15px;
    margin: 15px 0;
    color: #666;
    font-style: italic;
}

.next-btn {
    width: 100%;
    height: 50px;
    background: #4A90E2;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.next-btn:hover {
    background: #357ABD;
    transform: translateY(-2px);
}

/* 測評選項首頁 */
.page-title {
    text-align: center;
    color: white;
    font-size: 2rem;
    margin-bottom: 30px;
    width: 100%;
}

.assessment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 1200px;
}

.assessment-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.assessment-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.assessment-card.completed {
    opacity: 0.7;
}

.assessment-image {
    height: 200px;
    overflow: hidden;
}

.assessment-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.assessment-content {
    padding: 20px;
}

.assessment-content h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
}

.assessment-description {
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.assessment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.duration {
    font-weight: bold;
    color: #666;
}

.start-btn,
.completed-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.start-btn {
    background: #4A90E2;
    color: white;
}

.start-btn:hover {
    background: #357ABD;
}

.completed-btn {
    background: #888;
    color: white;
    cursor: not-allowed;
    transition: background-color 0.3s;
}

.completed-btn:hover {
    background: #888;
}

.expired-btn {
    background: #d9534f;
    color: white;
    cursor: not-allowed;
    transition: background-color 0.3s;
}

.expired-btn:hover {
    background: #d9534f;
}

/* 測評詳細說明頁面 */
.detail-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.detail-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.detail-section h3 {
    margin-bottom: 20px;
    color: #4A90E2;
    font-size: 1.3rem;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 10px;
}

.steps p {
    margin-bottom: 12px;
    line-height: 1.6;
    padding-left: 20px;
    position: relative;
}

.steps p::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #4A90E2;
    font-size: 0.8rem;
}

.video-container {
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.video-player {
    background: #000;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    aspect-ratio: 16/9;
    position: relative;
}

.video-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.video-controls-bar {
    background: #1a1a1a;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 0 0 10px 10px;
}

.control-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    padding: 6px 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

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

.control-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.control-btn.play-btn {
    background: #4A90E2;
    color: white;
    font-size: 1.4rem;
    min-width: 44px;
    min-height: 44px;
}

.control-btn.play-btn:hover {
    background: #357ABD;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.progress {
    height: 100%;
    background: #FF6B35;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s;
}

.time {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
    flex-shrink: 0;
}

.video-player {
    position: relative;
    cursor: pointer;
}

.video-player video {
    background: #000;
}

.video-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 視訊音訊測試樣式 */
.video-test-container {
    margin-top: 20px;
}

.test-controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.test-status {
    display: flex;
    gap: 30px;
    justify-content: center;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-icon {
    font-size: 1.2rem;
}

.status-text {
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
}

.test-btn {
    padding: 12px 30px;
    background: #4A90E2;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    align-self: center;
    min-width: 150px;
}

.test-btn:hover:not(:disabled) {
    background: #357ABD;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.test-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.test-btn.testing {
    background: #f44336;
}

.test-btn.testing:hover {
    background: #d32f2f;
}

.test-status-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.7;
}

.test-placeholder-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    text-align: center;
    padding: 0 20px;
}

.detail-footer {
    border-top: 1px solid #eee;
    padding-top: 30px;
    text-align: center;
}

.start-test-btn {
    width: 200px;
    height: 50px;
    background: #4A90E2;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
}

.start-test-btn:hover:not(:disabled) {
    background: #357ABD;
    transform: translateY(-2px);
}

.start-test-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.start-test-btn.ready {
    background: #28a745;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.start-test-btn.loading {
    background: #6c757d;
    position: relative;
}

.start-test-btn.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* 模擬面談頁面 */
.interview-header {
    background: linear-gradient(180deg, rgba(238, 241, 244, 0.95), rgba(217, 222, 227, 0.95));
    color: #1b1f23;
    /* darker text for better contrast on light header */
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-radius: 10px 10px 0 0;
    border-bottom: 1px solid rgba(16, 22, 28, 0.06);
}

.interview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: linear-gradient(180deg, #222831, #2b2f36);
    /* match participant pill tone */
    color: #fff;
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 1100px;
    z-index: 1200;
}

.hint-btn,
.complete-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.hint-btn {
    background: #FF6B35;
    color: white;
}

.complete-btn {
    background: #4A90E2;
    color: white;
}

.interview-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    background: transparent;
    /* use panel background for consistency */
    height: 100%;
    /* Fill parent container */
    transition: grid-template-columns 0.3s ease;
    overflow: hidden;
}

/* Header: match participant-name pill color for cohesion */
.interview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.64), rgba(0, 0, 0, 0.48));
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 6px 18px rgba(6, 8, 10, 0.18);
}

.interview-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: inherit;
}

.interview-header .timer {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

/* Interview panel wrapper visual styling */
.interview-panel {
    width: 100%;
    /* 更有質感的灰色基調：淡暖灰到中灰 */
    background: linear-gradient(180deg, #eef1f4 0%, #d9dee3 100%);
    border: 1px solid rgba(16, 22, 28, 0.08);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 18px 40px rgba(10, 16, 22, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
    height: 85vh;
}

/* move the whole panel below the fixed header to avoid being covered */
.interview-panel {
    margin-top: 50px;
    /* adjust if header height changes */
}

/* Fullscreen-mode styles: make video container occupy viewport */
.video-call-container.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    /* ensure dark background while fullscreen */
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* remove internal padding to allow main-video to use full height */
    box-sizing: border-box;
}

/* When body has this class, prevent scrolling */
.video-fullscreen-active {
    overflow: hidden;
}

/* Scale main-video to fill the fullscreen container while preserving aspect */
/* fallback: fill the fullscreen container fully */
.video-call-container.fullscreen-mode .main-video {
    /* nearly full-width but not full-height; keep black bars visible */
    width: 96vw;
    max-width: 1400px;
    height: auto;
    max-height: calc(100vh - 120px);
    /* leave space for header + pill */
    margin: 0 auto;
    /* center horizontally */
    background: #000;
    /* show black where image/video doesn't fill */
    min-height: 0;
}

.video-call-container.fullscreen-mode .main-video img {
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #000;
}

/* When body indicates fullscreen-mode, pin the interview-panel to viewport origin */
.video-fullscreen-active .interview-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    z-index: 1250;
}

/* Keep header visible above the fullscreen panel */
.video-fullscreen-active .interview-header {
    z-index: 1400;
    /* above the panel */
}

/* When fullscreen, keep participant label under header and centered */
.video-fullscreen-active .participant-label {
    position: fixed;
    top: 72px;
    /* below the fixed header; adjust if header height changes */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1420;
    pointer-events: auto;
}

/* hide any duplicate pill inside main-video (we keep the pill in participant-label) */
.main-video .participant-name {
    display: none;
}

/* place elapsed-time under the participant label when fullscreen and center it */
.video-fullscreen-active .elapsed-time {
    position: fixed;
    top: calc(72px + 44px);
    /* below participant label */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1410;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
}

/* enlarge main-video when inside fullscreen-mode */
.video-call-container.fullscreen-mode .main-video.large {
    width: 90vw;
    height: calc(100vh - 160px);
    /* alternate size if needed */
    max-width: none;
}

/* In fullscreen, make the sidebar a right-side floating overlay */
.video-fullscreen-active .interview-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 360px;
    max-width: 80vw;
    background: #fff;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
    z-index: 1500;
    /* above panel and header */
    transform: translateX(100%);
    /* hidden by default (to the right) */
    transition: transform 260ms cubic-bezier(.2, .9, .2, 1);
    overflow-y: auto;
}

/* when not collapsed (visible), slide in from right */
.video-fullscreen-active .interview-sidebar:not(.collapsed) {
    transform: translateX(0);
}

/* Keep participant label (pill) visible and fixed under the header */
.video-fullscreen-active .participant-label {
    position: fixed;
    top: 72px;
    /* below the fixed header; adjust if header height changes */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1400;
    pointer-events: auto;
}

.elapsed-time {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.fullscreen-btn {
    background: transparent;
    border: none;
    color: inherit;
    padding: 6px;
    margin-left: 6px;
    cursor: pointer;
}

.fullscreen-btn svg {
    display: block;
}

/* 如果要全白外觀，給該元素額外類別 .white */
.interview-panel.white {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.interview-panel .participant-label {
    margin-bottom: 8px;
}

.interview-content.sidebar-collapsed {
    grid-template-columns: 1fr 0px;
}

.video-call-container {
    position: relative;
    /* use lighter gray gradient to match panel and avoid black appearance */
    background: linear-gradient(180deg, #eef1f4 0%, #d9dee3 100%);
    border-radius: 10px;
    border: 1px solid rgba(22, 28, 34, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 8px 20px rgba(6, 10, 14, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-video {
    flex: 1;
    position: relative;
    height: 100%;
}

.elapsed-time {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 10;
}

/* small red status dot to the left of elapsed text */
#elapsed-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#elapsed-text::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #e74c3c;
    /* red */
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px rgba(231, 76, 60, 0.6);
}

.main-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.participant-label {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    padding: 12px 0;
}

.participant-label .participant-name,
.participant-label .participant-name-header,
.main-video .participant-name {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.64), rgba(0, 0, 0, 0.48));
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 18px;
    font-weight: 600;
    font-size: 0.98rem;
    box-shadow: 0 6px 18px rgba(6, 8, 10, 0.22);
    backdrop-filter: blur(4px);
}

.main-video .participant-name {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 15;
}

/* Prevent global .participant-name rules from positioning this element outside the interview layout */
.interview-content>.participant-name {
    position: static;
    /* ensure it flows between header and content */
}

/* Allow participant-name inside .video-conference .participant to use absolute positioning */
.video-conference .participant .participant-name {
    position: absolute !important;
}

/* Video conference participant avatar styling (minimal — do not change participant layout) */
/* Keep existing participant block layout; only adjust image appearance */
.video-conference .participant img {
    border-radius: 50%;
    /* circular avatar if image aspect is square */
    object-fit: cover;
    display: block;
    border: 6px solid #bdbdbd;
    /* default gray thick border */
    box-shadow: 0 6px 18px rgba(11, 13, 15, 0.12);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
    max-width: 350px;
    width: auto;
    height: auto;
    /* avoid forcing participant block size */
}

/* Override for discussion page - use rectangular images */
.discussion-call .video-conference .participant img {
    border-radius: 10px !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    border: none !important;
}

/* when speaking: green border and subtle glow; supports :has() and .speaking fallback */
.video-conference .participant:has(.speaking-indicator.active) img,
.video-conference .participant.speaking img {
    border-color: #28a745;
    box-shadow: 0 6px 24px rgba(40, 167, 69, 0.28);
    transform: translateY(-2px);
}

/* Make participant width percentage-based so toggleSidebar only alters width, not height */
.video-conference .participant {
    display: inline-flex;
    /* keep inline flow but enable centering */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* vertical + horizontal centering of children */
    width: 100%;
    /* four participants per row by default */
    box-sizing: border-box;
    vertical-align: top;
    padding: 6px;
    max-height: 360px;
    /* limit height to avoid overly tall blocks */
}

/* Discussion page specific styles */
.discussion-call .video-conference .participant {
    height: 30vh !important;
    max-height: calc(30vh - 30px) !important;
    position: relative !important;
    border-radius: 10px !important;
    overflow: visible !important;
    background: #000 !important;
    padding: 0 !important;
}

/* When sidebar is toggled (collapsed/expanded), center avatars visually */
.interview-content.sidebar-collapsed .video-conference,
.interview-content .video-conference {
    text-align: center;
}

.interview-content.sidebar-collapsed .video-conference .participant {
    display: inline-flex;
    /* keep width percent behavior but center contents */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    vertical-align: top;
}

.interview-content.sidebar-collapsed .video-conference .participant img {
    margin: 0 auto;
    /* center image within participant block */
    display: block;
}

.speaking-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #bdbdbd;
    box-shadow: none;
    transition: background 160ms ease, box-shadow 160ms ease;
}

.speaking-indicator.active {
    background: #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.35);
}

.self-video {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 200px;
    height: 150px;
    border: 3px solid white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.self-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-controls {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    background: linear-gradient(180deg, rgba(8, 12, 16, 0.78), rgba(6, 8, 10, 0.6));
    padding: 10px 18px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px) saturate(120%);
    z-index: 100;
    bottom: 2vh;
}

/* Subtitles container */
.subtitles-container {
    position: absolute;
    top: calc(60vh - 80px);
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 800px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.75));
    padding: 16px 24px;
    border-radius: 12px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.subtitle-text {
    margin: 0;
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.5;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* During fullscreen, adjust subtitles position */
body.video-fullscreen-active .subtitles-container {
    position: fixed;
    top: calc(100vh - 180px);
    z-index: 99999 !important;
}

/* For discussion page with video-conference grid layout */
.discussion-call .subtitles-container {
    position: relative;
    top: auto;
    transform: none;
    margin: 20px auto;
    left: 0;
}

/* Strong override placed after main layout rules to ensure fullscreen sizing takes precedence */
body.video-fullscreen-active .video-call-container.fullscreen-mode .main-video,
.video-call-container.fullscreen-mode .main-video {
    width: 100vw !important;
    height: calc(100vh - 120px) !important;
    /* reserve space for header + pill */
    max-height: none !important;
    min-height: 0 !important;
    display: block;
}

/* Ensure videos inside scale correctly */
body.video-fullscreen-active .video-call-container.fullscreen-mode .main-video img,
.video-call-container.fullscreen-mode .main-video img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* During fullscreen, pin controls to viewport so they're always visible */
body.video-fullscreen-active .video-controls {
    position: fixed;
    top: calc(100vh - 100px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000 !important;
}

.video-control {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(.2, .9, .3, 1), background 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(6, 8, 10, 0.18);
}

.video-control:hover {
    transform: translateY(-4px) scale(1.04);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
}

.video-control.hang-up {
    background: linear-gradient(180deg, #e0524b, #c93a34);
    box-shadow: 0 8px 22px rgba(200, 40, 50, 0.28);
}

.video-control.hang-up:hover {
    transform: translateY(-3px) scale(1.03);
}

/* SVG line icon styles */
.video-control svg {
    width: 24px;
    height: 24px;
    display: block;
    color: white;
    /* stroke uses currentColor */
}

.video-control svg path,
.video-control svg rect,
.video-control svg circle {
    stroke: currentColor;
    fill: none;
}

/* hang-up: white icon on red background */
.video-control.hang-up svg {
    color: #fff;
}

/* hover: slightly invert for visibility */
.video-control:hover svg {
    opacity: 0.95;
}

/* === Fullscreen pill & self-preview adjustments === */
/* Ensure participant pill stays visible above all fullscreen elements */
body.video-fullscreen-active .participant-label {
    position: fixed !important;
    top: 72px !important;
    /* keep under header */
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 100010 !important;
    /* higher than controls */
    pointer-events: none;
    /* avoid capturing clicks */
    background: rgba(0, 0, 0, 0.55) !important;
    color: #fff !important;
    padding: 6px 12px !important;
    border-radius: 18px !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45) !important;
}

/* Hide any duplicate name inside .main-video to avoid overlapping pills */
body.video-fullscreen-active .main-video .participant-name {
    display: none !important;
}

/* Move the local self-preview down when fullscreen so it doesn't overlap the pill */
body.video-fullscreen-active .video-call-container.fullscreen-mode .self-video {
    top: calc(72px + 48px) !important;
    /* header + pill height */
    right: 20px !important;
    transform: translateY(0) !important;
    transition: top 200ms ease-in-out, transform 200ms ease-in-out;
    z-index: 100005 !important;
    /* below pill but above main-video */
}

/* Slight extra padding so main-video content doesn't start under the pill */
body.video-fullscreen-active .video-call-container.fullscreen-mode {
    padding-top: 28px !important;
}

/* Merge header + pill into a single semi-transparent bar in fullscreen */
body.video-fullscreen-active .interview-header {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(6px) !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    top: 12px !important;
    /* keep some spacing from viewport top */
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 32px) !important;
    max-width: 1400px !important;
    z-index: 100020 !important;
}

/* Remove separate pill background since header now provides the bar */
body.video-fullscreen-active .participant-label {
    background: transparent !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

/* Ensure sidebar slides over the merged header and fullscreen panel */
body.video-fullscreen-active .interview-sidebar {
    z-index: 100030 !important;
    transform: translateX(100%);
    /* keep hidden by default */
}

body.video-fullscreen-active .interview-sidebar:not(.collapsed) {
    transform: translateX(0) !important;
}

.interview-sidebar {
    background: white;
    border-left: 1px solid #ddd;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 73vh;
}

.interview-sidebar.collapsed {
    width: 0;
    opacity: 0;
}

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

.sidebar-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.close-sidebar {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

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

.sidebar-content {
    padding: 20px;
    overflow-y: auto;
    height: calc(70vh - 30px);
}

.sidebar-info {
    line-height: 1.6;
    font-size: 0.9rem;
}

.sidebar-info p {
    margin-bottom: 15px;
}

.sidebar-info ul,
.sidebar-info ol {
    margin: 10px 0 15px 20px;
    padding-left: 0;
}

.sidebar-info li {
    margin-bottom: 8px;
}

.hint-panel {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    line-height: 1.6;
}

.hint-panel.hidden {
    display: none;
}

/* Modal 開啟時禁用 body 滾動 */
body.modal-open {
    overflow: hidden;
}

/* 彈窗樣式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    min-height: 60px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
    line-height: 1.4;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    flex-shrink: 0;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    line-height: 1.6;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body h4 {
    color: #4A90E2;
    margin: 20px 0 10px 0;
    font-size: 1.1rem;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 5px;
}

.modal-body h4:first-child {
    margin-top: 0;
}

.modal-body ul {
    margin: 10px 0 15px 20px;
    padding-left: 0;
}

.modal-body li {
    margin-bottom: 5px;
}

.modal-body p {
    margin-bottom: 12px;
}

.modal-body strong {
    color: #333;
    font-weight: 600;
}

.modal-footer {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
    background: #f9f9f9;
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    justify-content: center;
    min-height: 70px;
    align-items: center;
}

.modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.modal-btn.primary {
    background: #4A90E2;
    color: white;
}

.modal-btn.primary:hover {
    background: #357ABD;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.modal-btn.secondary {
    background: white;
    color: #666;
    border: 1px solid #ddd;
}

.modal-btn.secondary:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* 背景資料 modal 樣式 */
.background-section {
    line-height: 1.6;
}

.background-section h4 {
    color: #4A90E2;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 8px;
}

.background-section p {
    margin-bottom: 15px;
}

.background-section ul,
.background-section ol {
    margin: 10px 0 15px 20px;
    padding-left: 0;
}

.background-section li {
    margin-bottom: 8px;
}

.participant-list {
    margin-top: 15px;
}

.participant {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #4A90E2;
}

.participant strong {
    color: #4A90E2;
    display: block;
    margin-bottom: 8px;
}

.participant ul {
    margin-top: 8px;
}

/* 查看模式樣式 */
.view-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.view-btn:hover {
    background: #218838;
}

.completion-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    color: #155724;
}

.status-icon {
    font-size: 18px;
}

.status-text {
    font-weight: 500;
}

.view-result-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 12px;
    transition: background-color 0.3s;
}

.view-result-btn:hover {
    background: #0056b3;
}

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.back-btn:hover {
    background: #545b62;
}

/* 詳細結果彈窗樣式 */
.detailed-results {
    text-align: left;
}

.detailed-results h4 {
    color: #28a745;
    margin-bottom: 20px;
    text-align: center;
}

.score-breakdown {
    margin-bottom: 20px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.score-label {
    font-weight: 500;
    color: #333;
}

.score-value {
    font-weight: bold;
    color: #007bff;
}

.feedback-section h5 {
    color: #495057;
    margin: 16px 0 8px 0;
}

.feedback-section ul {
    margin: 0;
    padding-left: 20px;
}

.feedback-section li {
    margin-bottom: 4px;
    color: #666;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .form-section {
        padding: 2vh 4vw;
    }

    .logo-image {
        max-width: 150px;
        max-height: 90px;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .assessment-grid {
        grid-template-columns: 1fr;
    }

    .detail-sections {
        grid-template-columns: 1fr;
    }

    /* Small-screen adjustments: make interview single-column on narrow viewports */
    @media (max-width: 900px) {
        .interview-content {
            grid-template-columns: 1fr;
            min-height: calc(100vh - 60px);
        }

        .page {
            padding: 1vh 10px;
        }

        .interview-content.sidebar-collapsed {
            grid-template-columns: 1fr;
        }
    }

    .interview-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .interview-sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .self-video {
        width: 120px;
        height: 90px;
        top: 10px;
        right: 10px;
    }

    .participant-name {
        bottom: 60px;
        left: 10px;
        font-size: 0.9rem;
        padding: 6px 12px;
    }

    .video-controls {
        bottom: 2vh;
        gap: 8px;
        padding: 8px 16px;
    }

    .video-control {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .interview-sidebar {
        order: -1;
        max-height: 200px;
    }

    .serial-input {
        width: 100%;
        padding: 0 20px;
    }

    .serial-input-field {
        width: 100%;
        max-width: 300px;
    }

    .interview-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .interview-header h2 {
        flex: none;
    }
}

@media (max-width: 480px) {
    .logo-image {
        max-width: 120px;
        max-height: 72px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .form-section h2 {
        font-size: 1.5rem;
    }

    .assessment-content {
        padding: 15px;
    }

    .detail-section {
        padding: 20px;
    }

    .modal-content {
        width: 95%;
    }

    .video-controls {
        gap: 10px;
    }

    .video-control {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .self-video {
        width: 120px;
        height: 80px;
    }
}

/* 動畫效果 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

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

.start-btn:hover {
    animation: pulse 0.6s ease-in-out;
}

/* Footer 樣式 */
.footer {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 40px 20px 20px;
    margin-top: auto;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-section h4 {
    color: #FFD700;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.footer-section p,
.footer-section li {
    line-height: 1.6;
    color: #ccc;
    margin-bottom: 8px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: #FFD700;
}

.footer-bottom {
    border-top: 1px solid #444;
    margin-top: 30px;
    padding-top: 20px;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.footer-logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-link {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.social-link:hover {
    background: #FFD700;
    color: #000;
}

/* 可訪問性 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高對比度模式 */
@media (prefers-contrast: high) {

    .submit-btn,
    .start-btn,
    .next-btn {
        border: 2px solid #000;
    }

    .checkbox-item input[type="checkbox"]:checked+.checkmark {
        border: 2px solid #000;
    }
}

/* 針對小螢幕高度優化 Modal */
@media (max-height: 768px) {
    .modal-content {
        max-height: 95vh;
    }

    .modal-header {
        padding: 12px 20px;
        min-height: 52px;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 15px 20px;
    }

    .modal-body h4 {
        margin: 15px 0 8px 0;
        font-size: 1rem;
    }

    .modal-body p {
        margin-bottom: 10px;
        font-size: 0.95rem;
    }

    .modal-body ul,
    .modal-body ol {
        margin: 8px 0 12px 20px;
    }

    .modal-body li {
        margin-bottom: 4px;
        font-size: 0.95rem;
    }

    .modal-footer {
        padding: 10px 20px;
        min-height: 60px;
    }

    .modal-btn {
        padding: 8px 20px;
        font-size: 0.85rem;
    }
}

/* 針對極小螢幕高度 */
@media (max-height: 600px) {
    .modal-content {
        max-height: 98vh;
        border-radius: 10px;
    }

    .modal-header {
        padding: 10px 15px;
        min-height: 48px;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .close-btn {
        width: 25px;
        height: 25px;
        font-size: 1.3rem;
    }

    .modal-body {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .modal-body h4 {
        margin: 12px 0 6px 0;
        font-size: 0.95rem;
    }

    .modal-body p {
        margin-bottom: 8px;
        font-size: 0.9rem;
    }

    .modal-body ul,
    .modal-body ol {
        margin: 6px 0 10px 18px;
    }

    .modal-body li {
        margin-bottom: 3px;
        font-size: 0.9rem;
    }

    .modal-footer {
        padding: 8px 15px;
        min-height: 52px;
        gap: 8px;
    }

    .modal-btn {
        padding: 7px 16px;
        font-size: 0.8rem;
    }
}
