/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
header {
    text-align: center;
    padding: 2rem 0;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tagline {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Editor */
.editor-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#pitch-text {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

#pitch-text:focus {
    outline: none;
    border-color: var(--primary);
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Recording */
.recording-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#record-btn.recording {
    background: var(--danger);
    animation: pulse 1s infinite;
}

#record-btn.recording .record-icon::before {
    content: '⏹️';
}

.record-icon {
    font-size: 1.25rem;
}

.timer {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--danger);
}

.timer.warning {
    color: var(--danger);
    animation: pulse 0.5s infinite;
}

/* Playback */
#playback-section {
    margin-top: 1.5rem;
}

#audio-playback {
    width: 100%;
    margin-bottom: 1rem;
}

.transcript-box {
    background: var(--bg);
    padding: 1rem;
    border-radius: 8px;
}

.transcript-box h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

#transcript-text {
    font-size: 1rem;
    color: var(--text);
    min-height: 2rem;
}

#transcript-text.listening {
    color: var(--primary);
    font-style: italic;
}

/* Feedback */
#feedback-btn {
    width: 100%;
}

.feedback-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--text-muted);
}

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

#feedback-content {
    margin-top: 1rem;
}

.feedback-score {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
}

.score-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.score-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.feedback-section {
    margin-bottom: 1rem;
}

.feedback-section h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.feedback-section ul {
    list-style: none;
}

.feedback-section li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.feedback-section li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
}

.structure-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.structure-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.875rem;
}

.structure-item.has-it {
    color: var(--success);
}

.structure-item.missing {
    color: var(--danger);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }
    
    header {
        padding: 1.5rem 0;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    #pitch-text {
        min-height: 150px;
    }
    
    .btn-large {
        padding: 0.875rem 1.5rem;
    }
    
    .timer {
        font-size: 1.5rem;
    }
}

/* PWA Install Banner */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
}

.install-banner p {
    font-size: 0.875rem;
}

.install-banner .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}
