* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f6f9fc;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    color: #1a1f36;
}

.container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
    max-width: 800px;
    width: 100%;
    padding: 48px;
}

h1 {
    color: #1a1f36;
    margin-bottom: 8px;
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #6b7c93;
    text-align: center;
    margin-bottom: 40px;
    font-size: 15px;
    font-weight: 400;
}

.section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1f36;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #3c4257;
    font-size: 14px;
    font-weight: 500;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #c7cdd8;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.15s ease;
    font-family: inherit;
    background: #ffffff;
    color: #1a1f36;
}

.name-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.name-input-wrapper input {
    flex: 1;
}

.btn-random {
    padding: 11px 16px;
    background: #f6f9fc;
    color: #3c4257;
    border: 1px solid #c7cdd8;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-random:hover {
    background: #e3e8ee;
    border-color: #635bff;
    color: #1a1f36;
}

input[type="text"]:hover,
textarea:hover,
select:hover {
    border-color: #a3acb9;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #635bff;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.hint {
    font-size: 13px;
    color: #6b7c93;
    margin-top: 6px;
    line-height: 1.4;
}

.hint a {
    color: #635bff;
    text-decoration: none;
    transition: color 0.15s ease;
}

.hint a:hover {
    color: #0a2540;
}

.voice-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.voice-type-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #c7cdd8;
    background: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    font-weight: 500;
    color: #3c4257;
}

.voice-type-btn:hover {
    border-color: #635bff;
    background: #f6f9fc;
}

.voice-type-btn.active {
    background: #635bff;
    color: #ffffff;
    border-color: #635bff;
}

.voice-options {
    display: none;
}

.voice-options.active {
    display: block;
}

.file-upload {
    border: 1.5px dashed #c7cdd8;
    border-radius: 6px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #f6f9fc;
}

.file-upload:hover {
    border-color: #635bff;
    background: #ffffff;
}

.file-upload.drag-over {
    border-color: #635bff;
    background: #f0edff;
    transform: scale(1.01);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload > div:first-of-type {
    color: #3c4257;
    font-size: 14px;
    font-weight: 500;
}

.file-info {
    margin-top: 12px;
    color: #635bff;
    font-size: 13px;
    font-weight: 500;
}

.audio-preview {
    margin-top: 16px;
    display: none;
}

.audio-preview.active {
    display: block;
}

.audio-preview audio {
    width: 100%;
    height: 40px;
}

.slider-container {
    margin-bottom: 20px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    align-items: center;
}

.slider-label label {
    margin-bottom: 0;
}

.slider-label span {
    font-size: 14px;
    font-weight: 600;
    color: #1a1f36;
    min-width: 40px;
    text-align: right;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #e3e8ee;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #635bff;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(99, 91, 255, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #635bff;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(99, 91, 255, 0.3);
}

.btn {
    width: 100%;
    padding: 13px 24px;
    background: #635bff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: -0.01em;
}

.btn:hover:not(:disabled) {
    background: #0a2540;
    transform: translateY(-1px);
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f6f9fc;
    color: #3c4257;
    border: 1px solid #c7cdd8;
    margin-top: 12px;
}

.btn-secondary:hover:not(:disabled) {
    background: #e3e8ee;
    color: #1a1f36;
}

.audio-player {
    margin-top: 32px;
    padding: 24px;
    background: #f6f9fc;
    border-radius: 8px;
    border: 1px solid #e3e8ee;
    display: none;
}

.audio-player.active {
    display: block;
}

audio {
    width: 100%;
    margin-top: 12px;
}

.loading {
    display: none;
    text-align: center;
    margin-top: 24px;
    color: #6b7c93;
}

.loading.active {
    display: block;
}

.spinner {
    border: 3px solid #e3e8ee;
    border-top: 3px solid #635bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fff5f5;
    color: #c41e3a;
    padding: 12px 16px;
    border-radius: 6px;
    margin-top: 20px;
    display: none;
    font-size: 14px;
    border: 1px solid #ffc9c9;
}

.error.active {
    display: block;
}

.info-box {
    background: #f6f9fc;
    border-left: 3px solid #635bff;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #3c4257;
    line-height: 1.5;
}

.voice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.voice-card {
    padding: 16px 12px;
    border: 1px solid #c7cdd8;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    background: #ffffff;
}

.voice-card:hover {
    border-color: #635bff;
    background: #f6f9fc;
    transform: translateY(-1px);
}

.voice-card.selected {
    border-color: #635bff;
    background: #635bff;
    color: #ffffff;
}

.voice-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.voice-desc {
    font-size: 12px;
    color: #6b7c93;
}

.voice-card.selected .voice-desc {
    color: rgba(255, 255, 255, 0.85);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 31, 54, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e3e8ee;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1f36;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0 0 16px;
    color: #3c4257;
    font-size: 15px;
    line-height: 1.5;
}

.uri-display {
    background: #f6f9fc;
    border: 1px solid #e3e8ee;
    border-radius: 6px;
    padding: 12px;
}

.uri-display label {
    display: block;
    margin-bottom: 8px;
    color: #6b7c93;
    font-size: 13px;
    font-weight: 500;
}

.uri-text {
    background: #ffffff;
    border: 1px solid #c7cdd8;
    border-radius: 4px;
    padding: 10px 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #1a1f36;
    word-break: break-all;
    line-height: 1.5;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer .btn,
.modal-footer .btn-secondary {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

@media (max-width: 640px) {
    .container {
        padding: 32px 24px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .voice-type-selector {
        flex-direction: column;
    }
    
    .voice-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .name-input-wrapper {
        flex-direction: column;
    }
    
    .btn-random {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn,
    .modal-footer .btn-secondary {
        width: 100%;
    }
}
