* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 500px;
    width: 100%;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 10px;
    font-size: 28px;
}

.subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 20px;
    font-size: 14px;
}

.upload-options {
    margin-bottom: 25px;
}

.mbti-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
}

.mbti-section .form-group {
    margin-bottom: 0;
}

.tab-buttons {
    display: flex;
    gap: 10px;
    background: #f5f5f5;
    padding: 5px;
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.file-drop-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-drop-area:hover,
.file-drop-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: #667eea;
    margin-bottom: 15px;
}

.drop-text {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.file-types {
    color: #999;
    font-size: 12px;
}

.selected-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid #667eea;
}

.file-name {
    color: #333;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.remove-file {
    background: #ff4757;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-file:hover {
    background: #ff3838;
    transform: scale(1.1);
}

.mbti-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.mbti-select:focus {
    outline: none;
    border-color: #667eea;
}

.mbti-select:hover {
    border-color: #999;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    align-self: center;
    width: 100%;
    padding: 12px 28px;
    font-size: 15px;
    margin-top: 20px;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-loader {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: rotate 2s linear infinite;
}

.spinner-path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

.result-message {
    margin-top: 20px;
    padding: 16px;
    border-radius: 8px;
    font-size: 14px;
}

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

.result-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.result-message h3 {
    margin-bottom: 8px;
    font-weight: 600;
}

.result-message p {
    margin: 4px 0;
    color: inherit;
}

.result-message .data-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.result-message .data-item:last-child {
    border-bottom: none;
}

.result-message .data-label {
    font-weight: 500;
}

/* 移动端适配 */
@media (max-width: 600px) {
    body {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .container {
        padding: 20px 15px;
        border-radius: 16px;
    }
    
    h1 {
        font-size: 22px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .predict-container {
        padding: 20px 15px;
    }
    
    .tab-btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .file-drop-area {
        padding: 25px 15px;
        min-height: 140px;
    }
    
    .upload-icon {
        width: 40px;
        height: 40px;
    }
    
    .drop-text {
        font-size: 14px;
    }
    
    .file-name {
        max-width: 180px;
        font-size: 13px;
    }
    
    .record-area {
        padding: 20px 15px;
        gap: 15px;
    }
    
    .record-controls {
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .record-btn,
    .stop-btn,
    .cancel-btn {
        flex: 1;
        min-width: 90px;
        max-width: 140px;
        justify-content: center;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .record-btn .btn-text,
    .stop-btn .btn-text,
    .cancel-btn .btn-text {
        display: inline;
    }
    
    .timer-display {
        font-size: 28px;
    }
    
    .preview-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .re-record-btn,
    .upload-recorded-btn {
        max-width: 100%;
        width: 100%;
    }
    
    .submit-btn {
        width: 100%;
        padding: 14px 20px;
    }
    
    .file-drop-text .file-types {
        font-size: 11px;
    }
}

.record-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    padding: 30px 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.record-controls {
    display: flex;
    gap: 15px;
}

.record-btn,
.stop-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.record-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.record-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.record-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.stop-btn {
    background: #ff4757;
    color: white;
}

.stop-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 71, 87, 0.3);
}

.stop-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.cancel-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #6c757d;
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(108, 117, 125, 0.3);
}

.cancel-btn .cancel-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mic-icon,
.stop-icon,
.cancel-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.recording-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.timer-display {
    font-size: 36px;
    font-weight: 700;
    color: #333;
    font-family: 'Courier New', monospace;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background: #ff4757;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.recording-text {
    color: #ff4757;
    font-weight: 600;
    font-size: 14px;
}

.recorded-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.recording-filename-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.recording-filename-input:focus {
    outline: none;
    border-color: #667eea;
}

.recording-filename-input::placeholder {
    color: #999;
}

#audioPreview {
    width: 100%;
    border-radius: 8px;
}

.preview-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.re-record-btn,
.upload-recorded-btn {
    flex: 1;
    max-width: 200px;
    padding: 12px 24px;
    border: 2px solid #667eea;
    background: transparent;
    color: #667eea;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.re-record-btn:hover,
.upload-recorded-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.upload-recorded-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.upload-recorded-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.upload-recorded-btn:disabled {
    background: #ccc;
    border: none;
    cursor: not-allowed;
    opacity: 0.7;
}

.re-record-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upload-icon-small {
    width: 18px;
    height: 18px;
}

.spinner-small {
    width: 18px;
    height: 18px;
    animation: rotate 2s linear infinite;
}

/* 预测加载遮罩 */
.predict-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 12px;
    z-index: 100;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.predict-overlay.active {
    display: flex;
}

.predict-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.predict-overlay-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e8e8e8;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

.predict-overlay-text {
    color: #555;
    font-size: 15px;
    font-weight: 500;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.predict-container {
    position: relative;
}
