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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: #86868b;
    font-size: 1.1rem;
}

main {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    flex: 1;
}

.api-key-section,
.voice-section,
.model-section,
.text-section,
.usage-info {
    margin-bottom: 25px;
}

.usage-info {
    background-color: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d1d1f;
}

input[type="password"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
    background-color: #f5f5f7;
}

input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
}

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

.api-key-section {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.api-key-section input {
    flex: 1;
}

.voice-section {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.voice-section select {
    flex: 1;
}

#saveApiKey,
#refreshVoices {
    padding: 12px 20px;
    background-color: #f5f5f7;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

#saveApiKey:hover,
#refreshVoices:hover {
    background-color: #e8e8ed;
}

#refreshVoices {
    padding: 12px;
    font-size: 18px;
}

.char-count {
    text-align: right;
    color: #86868b;
    font-size: 0.9rem;
    margin-top: 5px;
}

.controls {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.primary-btn,
.secondary-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.secondary-btn {
    background-color: #f5f5f7;
    color: #1d1d1f;
    border: 1px solid #d2d2d7;
}

.secondary-btn:hover {
    background-color: #e8e8ed;
}

.loading {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

.audio-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #d2d2d7;
}

.audio-section h3 {
    margin-bottom: 15px;
    color: #1d1d1f;
}

audio {
    width: 100%;
    margin-bottom: 15px;
}

.error-message {
    background-color: #fee;
    color: #c33;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 0.9rem;
}

footer {
    text-align: center;
    padding: 30px 0;
    color: #86868b;
    font-size: 0.9rem;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

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

    main {
        padding: 20px;
    }

    .api-key-section,
    .voice-section {
        flex-direction: column;
        align-items: stretch;
    }

    .api-key-section input,
    .voice-section select {
        width: 100%;
    }
}