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

:root {
    --primary-color: #3b82f6;
    --secondary-color: #6366f1;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f9fafb;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

header {
    background: white;
    box-shadow: var(--shadow);
    padding: 20px 0;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    text-align: center;
}

.subtitle {
    text-align: center;
    color: #6b7280;
    margin-top: 5px;
}

main {
    min-height: calc(100vh - 200px);
}

/* 録音コントロール */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.record-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.record-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.record-btn.recording {
    background: var(--error-color);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.record-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b7280;
}

.status.active .status-dot {
    background: var(--success-color);
    animation: blink 1s infinite;
}

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

/* 波形表示 */
.waveform-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#waveform {
    width: 100%;
    height: 80px;
}

/* 文字起こしエリア */
.transcription-area {
    display: grid;
    gap: 25px;
}

.layer-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.layer-section h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.layer-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
}

.layer-badge.whisper {
    background: var(--primary-color);
}

.layer-badge.refine {
    background: var(--secondary-color);
}

.layer-badge.summary {
    background: var(--success-color);
}

.output-box {
    background: #f3f4f6;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    min-height: 120px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.8;
}

.output-box.summary-box {
    max-height: 400px;
}

.output-box .placeholder {
    color: #9ca3af;
    font-style: italic;
}

.output-box p {
    margin-bottom: 10px;
}

.output-box p:last-child {
    margin-bottom: 0;
}

/* 処理中インジケーター */
.processing-indicator {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
}

.processing-indicator.hidden {
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* エラーメッセージ */
.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--error-color);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}

.error-message.hidden {
    display: none;
}

.error-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* フッター */
footer {
    text-align: center;
    padding: 30px 0;
    color: #6b7280;
    font-size: 0.9rem;
}

/* タイムスタンプ */
.timestamp {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-right: 10px;
}

/* サマリーアイテム */
.summary-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid var(--success-color);
}

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

.summary-time {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 5px;
}

.summary-content {
    color: var(--text-color);
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    animation: slideIn 0.3s ease;
}

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

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.api-key-form {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.api-key-input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: monospace;
}

.api-key-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.save-btn {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.save-btn:hover {
    background: #2563eb;
}

.api-key-note {
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.5;
}

.api-key-note a {
    color: var(--primary-color);
    text-decoration: none;
}

.api-key-note a:hover {
    text-decoration: underline;
}

/* 設定ボタン */
.settings-btn {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6b7280;
}

.settings-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 無効化状態 */
.record-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.record-btn:disabled:hover {
    background: var(--primary-color);
    transform: none;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .layer-section {
        padding: 20px;
    }
    
    .layer-section h2 {
        font-size: 1rem;
    }
    
    .output-box {
        font-size: 0.9rem;
        padding: 15px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .api-key-form {
        flex-direction: column;
    }
}

/* サマリーコントロール */
.summary-controls {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f3f4f6;
    border-radius: 0.5rem;
}

.summary-control-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.summary-controls label {
    font-weight: 500;
    color: #374151;
}

.summary-type-select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: white;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.2s;
}

.summary-type-select:hover {
    border-color: #9ca3af;
}

.summary-type-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* サマリー生成ボタン */
.generate-summary-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.generate-summary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

.generate-summary-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

.generate-summary-btn .btn-icon {
    font-size: 1rem;
}

.generate-summary-btn.loading .btn-icon {
    animation: spin 1s linear infinite;
}

.generate-summary-btn.loading .btn-text {
    content: '生成中...';
}

/* サマリーコンテンツのMarkdownスタイル */
.summary-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: #1f2937;
}

.summary-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem 0;
    color: #374151;
}

.summary-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.5rem 0 0.25rem 0;
    color: #4b5563;
}

.summary-content ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
    list-style-type: disc;
}

.summary-content li {
    margin: 0.25rem 0;
    line-height: 1.6;
}

.summary-content li.task-item {
    list-style-type: none;
    margin-left: -1rem;
}

.summary-content li.task-item.done {
    color: #6b7280;
    text-decoration: line-through;
}