:root {
    --bg-dark: #09090b;
    --surface: #18181b;
    --surface-glass: rgba(24, 24, 27, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(139, 92, 246, 0.5);
    
    --primary: #8B5CF6; /* Violet */
    --primary-hover: #7C3AED;
    --secondary: #EC4899; /* Pink */
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --radius-lg: 16px;
    --radius-md: 8px;
    --transition: 200ms ease;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    
    /* Background gradient mesh */
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

.app-container {
    width: 100%;
    max-width: 900px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1rem;
}

.logo-box {
    width: 64px;
    height: 64px;
    background: var(--surface-glass);
    border: 1px solid var(--border);
    border-radius: clamp(16px, 20%, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Layout */
.main-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Panels */
.panel {
    background: var(--surface-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.char-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Text Area */
textarea {
    width: 100%;
    flex: 1;
    min-height: 200px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--border-highlight);
    background: rgba(0,0,0,0.4);
}

/* Controls */
.playback-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: center;
}

.spacer {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

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

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-primary:not(:disabled):hover {
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.5);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
    border-color: var(--border);
}

.btn-secondary:not(:disabled):hover {
    background: rgba(255,255,255,0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:not(:disabled):hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-outline:not(:disabled):hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

/* Tooltip hack for export button */
.tooltip-trigger {
    position: relative;
}

.tooltip-trigger::after {
    content: attr(aria-label);
    position: absolute;
    bottom: 120%;
    right: 0;
    width: max-content;
    max-width: 250px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 10;
    pointer-events: none;
    line-height: 1.4;
    white-space: normal;
    text-align: right;
}

.tooltip-trigger:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.value-display {
    font-size: 0.875rem;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* Selects */
select {
    width: 100%;
    appearance: none;
    background: rgba(0,0,0,0.2) url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2394a3b8%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E") no-repeat right 0.75rem center;
    background-size: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--border-highlight);
}

select option {
    background: var(--surface);
    color: var(--text-main);
}

.small-select {
    padding: 0.25rem 1.5rem 0.25rem 0.5rem;
    font-size: 0.75rem;
    width: auto;
    border-color: transparent;
    background-color: transparent;
}
.small-select:hover {
    background-color: rgba(255,255,255,0.05);
}

/* Range Inputs */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    border-radius: 999px;
}

input[type=range]::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--text-main);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}

input[type=range]:active::-webkit-slider-thumb {
    transform: scale(1.2);
    background: var(--primary);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.footer strong {
    color: var(--text-main);
}
