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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --success: #4ecca3;
    --border: #2a2a4a;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: url('background.jpg') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 0;
}

.header-logo {
    width: 150px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.generator-panel,
.results-panel,
.history-panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

select,
textarea,
input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

select:focus,
textarea:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: var(--bg-tertiary);
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.btn-primary {
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.4);
}

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

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.hidden {
    display: none !important;
}

.results-panel h2,
.history-panel h2 {
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.history-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: normal;
}

#results-container {
    display: grid;
    gap: 15px;
}

.sound-card {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.sound-card .sound-info {
    flex: 1;
    min-width: 150px;
}

.sound-card .sound-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.sound-card .sound-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sound-card audio {
    flex: 2;
    min-width: 200px;
    height: 40px;
}

.sound-card .download-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sound-card .btn-download {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    text-decoration: none;
    font-size: 0.85rem;
}

.sound-card .btn-download:hover:not(:disabled) {
    opacity: 0.85;
    transform: translateY(-1px);
}

.sound-card .btn-download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sound-card .btn-mp3 {
    background: var(--success);
}

.sound-card .btn-ogg {
    background: #3498db;
}

.sound-card .btn-fsb {
    background: #9b59b6;
}

.history-item {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.history-item .history-prompt {
    flex: 1;
    font-size: 0.95rem;
}

.history-item .history-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-item .history-actions {
    display: flex;
    gap: 10px;
}

.history-item .btn-small {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.history-item .btn-small:hover {
    background: var(--bg-primary);
}

.empty-history {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}

footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.error-message {
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: var(--accent-hover);
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }

    .container {
        padding: 10px;
    }

    .generator-panel,
    .results-panel,
    .history-panel {
        padding: 20px;
    }

    .sound-card {
        flex-direction: column;
        align-items: stretch;
    }

    .sound-card audio {
        width: 100%;
    }
}
