:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --bg-color: #f8f9fa;
    --text-color: #1f2937;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

main {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

section {
    margin-bottom: 30px;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.language-selector label {
    font-weight: 600;
    color: var(--text-color);
}

#language {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: border-color 0.3s ease;
}

#language:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-color);
}

#textInput {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

#textInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

.example-phrases {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.example-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: white;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.btn {
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

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

.btn .icon {
    font-size: 1.2em;
}

.btn.primary {
    background: var(--primary-color);
    color: white;
}

.btn.primary:hover:not(:disabled) {
    background: #5558e3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.btn.secondary {
    background: var(--secondary-color);
    color: white;
}

.btn.secondary:hover:not(:disabled) {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.4);
}

.btn.danger {
    background: var(--danger-color);
    color: white;
}

.btn.danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.4);
}

.btn.info {
    background: var(--info-color);
    color: white;
}

.btn.info:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
}

.speed-control label {
    font-weight: 600;
}

#speedSlider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
}

#speedSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

#speedSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

#speedValue {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 50px;
    text-align: center;
}

.results {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
}

.results.hidden {
    display: none;
}

.results h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
}

.result-box {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.result-box p {
    margin-bottom: 15px;
    font-size: 1.1em;
}

.result-box strong {
    color: var(--text-color);
}

.score-container {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-top: 25px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.3);
    transition: all 0.5s ease;
}

.score-circle.excellent {
    background: linear-gradient(135deg, var(--success-color), #059669);
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.3);
}

.score-circle.good {
    background: linear-gradient(135deg, var(--info-color), #2563eb);
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.3);
}

.score-circle.fair {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    box-shadow: 0 5px 20px rgba(245, 158, 11, 0.3);
}

.score-circle.poor {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    box-shadow: 0 5px 20px rgba(239, 68, 68, 0.3);
}

.feedback {
    flex: 1;
    font-size: 1.2em;
    font-weight: 600;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.feedback.excellent {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.feedback.good {
    color: var(--info-color);
    background: rgba(59, 130, 246, 0.1);
}

.feedback.fair {
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

.feedback.poor {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.visualizer {
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
}

#waveform {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #6b7280;
}

.browser-note {
    font-size: 0.9em;
    margin-top: 10px;
    opacity: 0.8;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    main {
        padding: 20px;
    }
    
    .controls {
        grid-template-columns: 1fr 1fr;
    }
    
    .score-container {
        flex-direction: column;
        text-align: center;
    }
    
    .example-phrases {
        justify-content: center;
    }
}

/* アニメーション */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.btn:active:not(:disabled) {
    transform: scale(0.95);
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e5e7eb;
        --card-bg: #2d2d2d;
        --border-color: #404040;
    }
    
    #language,
    #textInput,
    .example-btn {
        background: #2d2d2d;
        color: #e5e7eb;
    }
    
    .result-box {
        background: #2d2d2d;
    }
    
    #waveform {
        background: rgba(45, 45, 45, 0.8);
    }
}