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

:root {
    --primary: #000;
    --primary-hover: #333;
    --accent: #0066ff;
    --success: #22c55e;
    --error: #ef4444;
    --bg: #fafafa;
    --card-bg: #fff;
    --text: #111;
    --text-secondary: #666;
    --text-muted: #999;
    --border: #eee;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

header {
    margin-bottom: 3rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

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

.card h2 {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Model Grid */
.model-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.model-card {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--card-bg);
}

.model-card:hover {
    border-color: var(--text-muted);
}

.model-card.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.model-card.selected h3,
.model-card.selected .description,
.model-card.selected .vram,
.model-card.selected .status-badge {
    color: #fff;
}

.model-card h3 {
    font-size: 0.875rem;
    font-weight: 500;
}

.model-card .description,
.model-card .vram,
.status-badge {
    display: none;
}

/* Input Options */
.input-options {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: center;
}

.upload-area,
.record-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.15s ease;
    cursor: pointer;
    min-height: 140px;
}

.upload-area:hover,
.upload-area.dragover,
.record-area:hover {
    border-color: var(--text-muted);
    background: #fafafa;
}

.upload-icon,
.record-icon {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.upload-area p,
.record-area p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.upload-area .small {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: inherit;
}

.link-btn:hover {
    text-decoration: underline;
}

.file-name {
    color: var(--success);
    font-weight: 500;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.divider {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.record-area {
    border-style: dashed;
}

.record-area:hover {
    border-color: var(--error);
}

.record-area.recording {
    border-color: var(--error);
    background: #fef2f2;
}

.record-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.record-btn {
    display: none;
}

/* Audio Player */
.audio-player {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.audio-player audio {
    width: 100%;
    height: 36px;
}

/* Actions */
.actions {
    margin-bottom: 1rem;
}

.primary-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.primary-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.primary-btn.loading {
    position: relative;
    color: transparent;
}

.primary-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Results */
.result-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--card-bg);
}

.result-card:last-child {
    margin-bottom: 0;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-card.collapsible .result-header {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

.result-card.collapsible .result-header:hover {
    opacity: 0.8;
}

.result-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-toggle {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.result-model {
    font-weight: 500;
    font-size: 0.875rem;
}

.result-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-content {
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease, opacity 0.2s ease;
    max-height: 2000px;
    margin-top: 0.75rem;
    opacity: 1;
}

.result-card.collapsed .result-content {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
}

.result-text {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-line;
}

.result-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.result-error {
    color: var(--error);
    font-size: 0.875rem;
}

/* Spinner for loading state */
.result-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--text-muted);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Footer */
footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.health-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--success);
}

.status-dot.offline {
    background: var(--error);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 2rem 1rem;
    }

    .input-options {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .divider {
        text-align: center;
    }

    .upload-area,
    .record-area {
        min-height: 100px;
    }
}