/* H5 公共样式 */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: #f5f7fb;
    color: #1f2937;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

.page-header {
    padding: 24px 16px 12px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}

.page-title {
    margin: 0;
    font-size: 22px;
}

.page-subtitle {
    margin: 8px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.page-main {
    flex: 1;
    padding: 16px;
}

.page-footer {
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0));
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
}

.page-footer a {
    color: #6b7280;
    text-decoration: none;
}

.page-footer a:hover {
    text-decoration: underline;
}

.footer-note {
    margin: 0 0 6px;
    line-height: 1.5;
}

.footer-beian {
    margin: 0;
    line-height: 1.6;
}

.footer-sep {
    margin: 0 6px;
    color: #d1d5db;
}

.home-desc-sub {
    margin-top: 8px;
    font-size: 13px;
    color: #6b7280;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.card-title {
    margin: 0 0 12px;
    font-size: 16px;
}

.status-text {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
}

.status-text.ok {
    color: #059669;
}

.status-text.error {
    color: #dc2626;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-default {
    background: #e5e7eb;
    color: #374151;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-small {
    padding: 6px 10px;
    font-size: 12px;
    margin-right: 6px;
}

.input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.input:focus {
    border-color: #2563eb;
}

.form-row {
    display: flex;
    gap: 8px;
}

.form-row .input {
    flex: 1;
}

.tip-text {
    margin: 10px 0 0;
    font-size: 13px;
    min-height: 18px;
}

.tip-text.ok {
    color: #059669;
}

.tip-text.error {
    color: #dc2626;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-title-inline {
    margin: 0;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid #f3f4f6;
    padding: 10px 8px;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: #6b7280;
    font-weight: 600;
    background: #f9fafb;
}

.empty-cell {
    text-align: center;
    color: #9ca3af;
}

.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-panel {
    position: relative;
    width: calc(100% - 32px);
    max-width: 420px;
    margin: 30vh auto 0;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.modal-title {
    margin: 0 0 8px;
    font-size: 16px;
}

.modal-desc {
    margin: 0 0 12px;
    font-size: 13px;
    color: #6b7280;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-item {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item-disabled {
    color: #9ca3af;
}

.hidden {
    display: none !important;
}

.view.hidden {
    display: none;
}

.btn-block {
    width: 100%;
}

.btn-text {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    cursor: pointer;
    padding: 0;
}

.home-main {
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-card {
    width: 100%;
    max-width: 520px;
}

.interview-main {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}

.phase-card {
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .page-header {
        padding: 28px 24px 16px;
    }

    .page-main {
        padding: 20px 24px;
    }

    .dialogue-list {
        max-height: 60vh;
    }

    .btn-record {
        min-width: 140px;
    }
}

@media (max-width: 360px) {
    .record-row {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-record {
        width: 100%;
    }
}

.phase-script {
    margin: 0 0 20px;
    padding: 16px;
    font-size: 16px;
    line-height: 1.8;
    color: #1f2937;
    background: #f9fafb;
    border-radius: 8px;
    text-align: center;
}

.voice-timer {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    color: #2563eb;
    text-align: center;
}

.voice-timer.hidden {
    display: none;
}

.phase-desc {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
}

.record-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-record {
    min-width: 120px;
}

.home-desc {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.7;
    color: #4b5563;
}

.interview-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.interview-header-main {
    flex: 1;
    min-width: 0;
}

.btn-text-end {
    flex-shrink: 0;
    white-space: nowrap;
    margin-top: 2px;
}

.btn-text-end:disabled {
    opacity: 0.55;
}

.page-title-sm {
    font-size: 18px;
}

#sessionIdText {
    word-break: break-all;
}

.btn-record.recording {
    background: #dc2626;
}

.record-status {
    font-size: 13px;
    color: #6b7280;
}

.live-correct-hint {
    margin: 0 0 12px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.6;
    color: #4b5563;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #2563eb;
}

.live-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.live-status {
    font-size: 13px;
    color: #059669;
}

.live-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d1d5db;
}

.live-indicator.active {
    background: #ef4444;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.35; }
    100% { opacity: 1; }
}

.dialogue-list {
    max-height: 52vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dialogue-empty {
    margin: 0;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.dialogue-empty.error {
    color: #dc2626;
}

.dialogue-item {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.dialogue-item.candidate {
    align-self: flex-start;
}

.dialogue-item.interviewer {
    align-self: flex-end;
    align-items: flex-end;
}

.dialogue-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.dialogue-role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.dialogue-role-badge.candidate {
    background: #dbeafe;
    color: #1d4ed8;
}

.dialogue-role-badge.interviewer {
    background: #d1fae5;
    color: #047857;
}

.dialogue-correct-btn {
    border: none;
    background: transparent;
    color: #2563eb;
    font-size: 11px;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.dialogue-correct-btn:disabled {
    color: #9ca3af;
    cursor: default;
    text-decoration: none;
}

.dialogue-corrected-tag {
    font-size: 11px;
    color: #9ca3af;
}

.dialogue-bubble {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.dialogue-item.candidate .dialogue-bubble {
    background: #eff6ff;
    color: #1e3a8a;
}

.dialogue-item.interviewer .dialogue-bubble {
    background: #ecfdf5;
    color: #065f46;
}

.calibration-card {
    margin-bottom: 14px;
    padding: 16px 14px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
    border: 1px solid #fcd34d;
    text-align: center;
}

.calibration-title {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.6;
    color: #92400e;
    font-weight: 600;
}

.calibration-score {
    margin: 0 0 8px;
    font-size: 12px;
    color: #b45309;
}

.calibration-text {
    margin: 0 0 16px;
    padding: 14px 12px;
    font-size: 16px;
    line-height: 1.7;
    color: #1f2937;
    background: #ffffff;
    border-radius: 10px;
    border: 1px dashed #f59e0b;
    word-break: break-word;
}

.calibration-actions {
    display: flex;
    gap: 12px;
}

.btn-calibration {
    flex: 1;
    padding: 12px 10px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    color: #fff;
}

.btn-calibration-left {
    background: #2563eb;
}

.btn-calibration-right {
    background: #059669;
}
