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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 1400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 30px;
    align-items: start;
}

.left-panel {
    display: flex;
    flex-direction: column;
}

.right-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2em;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.section {
    margin-bottom: 25px;
}

label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.95em;
}

input[type="file"],
textarea,
input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

input[type="file"]:focus,
textarea:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

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

.params-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.status-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #1565c0;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    min-height: 50px;
}

.status-box.success {
    background: #e8f5e9;
    border-left-color: #4caf50;
    color: #2e7d32;
}

.status-box.error {
    background: #ffebee;
    border-left-color: #f44336;
    color: #c62828;
}

.status-text-wrapper {
    flex: 1;
    min-width: 200px;
}

.backend-badge {
    display: inline-block;
    visibility: hidden;
    padding: 6px 12px;
    background: #ff9800;
    color: white;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 10px;
    white-space: nowrap;
}

.backend-badge.visible {
    visibility: visible;
}

.ref-audio-info {
    color: #4caf50;
    font-weight: 700;
    font-size: 0.95em;
}

.ref-audio-label {
    margin-bottom: 8px;
}

.ref-audio-label label {
    display: inline;
    margin-bottom: 0;
}


.results {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.result-item {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.result-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.result-item h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.result-text-container {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-bottom: 1px solid #e8ecf5;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.result-text-label {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #667eea;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-text {
    color: #333;
    line-height: 1.7;
    font-size: 0.95em;
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-y: auto;
    padding-right: 8px;
    flex: 1;
}

.result-text::-webkit-scrollbar {
    width: 6px;
}

.result-text::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.result-text::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

.result-text::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

.result-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: #fafbff;
}

.info-item {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #666;
    border-bottom: 1px solid #e8ecf5;
}

.info-item:nth-child(1) {
    border-right: 1px solid #e8ecf5;
}

.info-item strong {
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
    margin-left: auto;
}

.result-player {
    padding: 20px;
    background: white;
}

.result-item audio {
    width: 100%;
    height: 48px;
    outline: none;
}

.result-item audio:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 4px;
}

.result-actions {
    padding: 16px 20px 20px;
    background: white;
}

.result-item button {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 0.95em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.result-item button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.result-item button:active {
    transform: translateY(0);
}

@media (max-width: 640px) {
    .result-info {
        grid-template-columns: 1fr;
    }
    
    .info-item:nth-child(1) {
        border-right: none;
    }
}

audio {
    width: 100%;
    margin-top: 10px;
}

.error {
    background: #fee;
    color: #c00;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    display: none;
}

.error.active {
    display: block;
}

.warning-box {
    background: #fff3cd;
    color: #856404;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 10px;
    border-left: 4px solid #ffc107;
    font-size: 0.9em;
    display: none;
    line-height: 1.5;
}

.warning-box.active {
    display: block;
}

.warning-box::before {
    content: "⚠️ ";
    margin-right: 5px;
}

.results-placeholder {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 60px 40px;
    text-align: center;
    color: #999;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 400px;
}

.results-placeholder:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.results-placeholder-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.6;
    animation: float 3s ease-in-out infinite;
}

.results-placeholder.generating .results-placeholder-icon {
    animation: spin 2s linear infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.results-placeholder p {
    font-size: 1.05em;
    color: #888;
    font-weight: 500;
    margin: 0;
}

.hidden {
    display: none;
}
