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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

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

main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

section {
    margin-bottom: 40px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* 錄音區域 */
.recording-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #fff5f5 100%);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.recording-area {
    text-align: center;
    padding: 40px 20px;
}

.recording-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

.recording-icon.recording {
    animation: recording-pulse 1s ease-in-out infinite;
    color: #e74c3c;
}

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

@keyframes recording-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.recording-text {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 10px;
    font-weight: 500;
}

.recording-timer {
    font-size: 2rem;
    color: #e74c3c;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    margin: 20px 0;
}

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

.btn-record {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    min-width: 180px;
}

.btn-record:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

.btn-stop {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    min-width: 180px;
}

.btn-stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(149, 165, 166, 0.4);
}

.btn-icon {
    font-size: 1.2rem;
    margin-right: 8px;
}

/* 音訊預覽 */
.audio-preview {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-top: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.audio-preview audio {
    width: 100%;
    margin: 15px 0;
}

.preview-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.preview-actions .btn {
    flex: 1;
}

/* 上傳區域 */
.upload-section {
    opacity: 0.8;
}

.upload-area {
    border: 2px dashed #ccc;
    border-radius: 15px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #999;
    background: #f5f5f5;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #f0f2ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 0.9rem;
    color: #666;
}

/* 檔案資訊 */
.file-info {
    background: #f0f2ff;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.file-info p {
    margin: 5px 0;
    color: #333;
}

/* 按鈕 */
.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

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

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

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

.btn-secondary {
    background: #f0f2ff;
    color: #667eea;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #e8ebff;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

/* 結果區域 */
.result-hint {
    background: #fff9e6;
    border-left: 4px solid #f39c12;
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    color: #856404;
    font-size: 0.95rem;
}

.result-card {
    background: #f8f9ff;
    border-radius: 15px;
    padding: 25px;
}

.result-card.editable .result-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.result-label {
    font-weight: bold;
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 8px;
    display: block;
}

.result-input,
.result-textarea {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    color: #333;
    transition: all 0.3s ease;
    font-family: inherit;
}

.result-input:focus,
.result-textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.result-textarea {
    resize: vertical;
    min-height: 60px;
}

.result-value {
    color: #333;
    font-size: 1rem;
    text-align: right;
    max-width: 60%;
}

/* 結果操作按鈕 */
.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.result-actions .btn {
    flex: 1;
    min-width: 150px;
}

.btn-continue {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-continue:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.4);
}

.btn-confirm {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    font-weight: bold;
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(39, 174, 96, 0.4);
}

/* 分析歷史 */
.analysis-history {
    background: #f0f0f0;
    padding: 20px;
    border-radius: 10px;
    margin-top: 25px;
}

.history-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-time {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
}

.history-content {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.6;
}

/* JSON 輸出 */
.json-output {
    margin-top: 20px;
}

.json-output h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.json-output pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 錯誤訊息 */
.error-message {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-left: 5px solid #ff6b6b;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    display: block;
    color: #856404;
    font-size: 0.95rem;
    line-height: 1.8;
    white-space: pre-line;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.15);
}

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

.error-text {
    color: #c33;
    flex: 1;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    margin-top: 30px;
    opacity: 0.8;
}

/* 響應式設計 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 20px;
    }
    
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .result-value {
        max-width: 100%;
        text-align: left;
    }
}

