:root {
    --bg: #0f0f1e;
    --panel: #1a1a2e;
    --panel-2: #252540;
    --text: #e8e8f0;
    --text-dim: #9090a8;
    --accent: #6c5ce7;
    --accent-hot: #ff6b9d;
    --success: #4ade80;
    --danger: #ef4444;
    --border: #2a2a44;
    --radius: 10px;
}

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

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 640px; margin: 0 auto; padding: 24px 16px 80px; }

header { text-align: center; margin-bottom: 24px; }
header h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

.hidden { display: none !important; }

/* Mode toggle */
.mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}
.mode-btn {
    background: var(--panel);
    border: 2px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 14px 12px;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.15s;
}
.mode-btn.active {
    border-color: var(--accent);
    background: var(--panel-2);
}
.mode-title { font-weight: 600; font-size: 15px; }
.mode-hint { font-size: 12px; color: var(--text-dim); }

/* Recording */
.record-section {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 24px 16px;
    margin-bottom: 16px;
    text-align: center;
}
.btn-record {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.35);
}
.btn-record:hover { transform: scale(1.04); }
.btn-record.recording {
    background: var(--accent-hot);
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 157, 0.5); }
    50% { box-shadow: 0 0 0 16px rgba(255, 107, 157, 0); }
}
.record-status { margin-top: 12px; color: var(--text-dim); font-size: 14px; }
.record-timer { margin-top: 4px; font-family: monospace; font-size: 18px; color: var(--accent-hot); }

#audio-preview { width: 100%; margin-top: 16px; }

/* Transcript / text panels */
.transcript-panel, .text-panel { margin-top: 16px; text-align: left; }
.form-label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
    font-weight: 500;
}
.transcript-textarea, textarea, select, input[type=text] {
    width: 100%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

/* Options */
.options-toggle {
    width: 100%;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 12px;
}
.options-panel {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-select { width: 100%; }

/* Episode type grid */
.types-section { margin-top: 8px; }
.section-title {
    font-size: 14px;
    color: var(--text-dim);
    font-weight: 500;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.type-btn {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.type-btn:hover { background: var(--panel-2); border-color: var(--accent); }
.type-btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.type-btn.primary:hover { background: #8370f0; }
.type-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Status */
.status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
}
.status.info { background: var(--panel-2); color: var(--text); }
.status.success { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.status.error { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

footer { text-align: center; margin-top: 32px; color: var(--text-dim); font-size: 12px; }

/* Auth gate */
.auth-gate {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    max-width: 360px;
    width: 100%;
}
.auth-card h1 { font-size: 22px; margin-bottom: 8px; }
.auth-card p { color: var(--text-dim); margin-bottom: 20px; }
.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}
.btn-primary:hover { background: #8370f0; }
