:root {
    --bg: #0a0f1a;
    --bg-elevated: #111827;
    --panel: #151d2e;
    --border: rgba(255, 255, 255, 0.08);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --accent: #7dd3fc;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 35%),
        radial-gradient(circle at bottom right, rgba(125, 211, 252, 0.1), transparent 30%),
        var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--accent);
}

code {
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 6px;
}

.muted {
    color: var(--muted);
}

.hidden {
    display: none !important;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card,
.panel {
    background: rgba(21, 29, 46, 0.95);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(100%, 440px);
    padding: 32px;
}

.brand {
    text-align: center;
    margin-bottom: 28px;
}

.brand-icon {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(125, 211, 252, 0.2));
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.brand h1,
.hero h1,
.panel-header h2 {
    margin: 0 0 8px;
}

.login-form label,
.text-field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

input,
textarea,
select,
button {
    font: inherit;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elevated);
    color: var(--text);
    padding: 12px 14px;
}

textarea {
    resize: vertical;
    min-height: 220px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0284c7);
    color: #04111d;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-hover), #0369a1);
}

.btn-ghost {
    background: transparent;
    border-color: var(--border);
}

.btn-block {
    width: 100%;
}

.topbar {
    border-bottom: 1px solid var(--border);
    background: rgba(10, 15, 26, 0.85);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-brand .subtitle {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-pill {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.9rem;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 48px;
    display: grid;
    gap: 20px;
}

.panel {
    padding: 24px;
}

.panel-header {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.demo-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
}

.demo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.demo-row:last-child {
    border-bottom: 0;
}

.demo-row-info {
    display: grid;
    gap: 4px;
    min-width: 180px;
    flex: 1 1 220px;
}

.demo-row audio {
    width: min(100%, 360px);
    flex: 1 1 280px;
}

.voice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.voice-card {
    text-align: left;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    cursor: pointer;
    display: grid;
    gap: 4px;
}

.voice-card[aria-pressed="true"] {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 6px;
}

.badge-high {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.badge-warn {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.voice-meta {
    font-size: 0.78rem;
    color: var(--muted);
}

.char-count {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: right;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.alert {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.alert-error {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.08);
    color: #fecaca;
}

.alert-success {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.08);
    color: #bbf7d0;
}

.alert-info {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.08);
    color: #bae6fd;
}

.player-wrap {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.player-wrap audio {
    width: min(100%, 420px);
}

@media (max-width: 640px) {
    .topbar-inner,
    .action-row,
    .panel-header {
        flex-direction: column;
        align-items: stretch;
    }
}
