* {
    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;
    padding: 20px;
    color: #333;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

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

.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.card h2 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.5em;
}

.recording-section {
    margin-bottom: 20px;
}

.timer-display {
    text-align: center;
    margin-bottom: 20px;
}

#timer {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
    width: 100%;
    justify-content: center;
    padding: 15px;
    font-size: 1.1em;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.icon {
    font-size: 1.2em;
}

.audio-preview {
    margin-top: 20px;
    text-align: center;
}

.audio-preview audio {
    width: 100%;
    max-width: 500px;
}

.progress-bar-container {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.1s linear;
}

.analyze-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.url-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.url-input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.url-input:focus {
    outline: none;
    border-color: #667eea;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#results {
    margin-top: 20px;
}

.emotion-item {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s, box-shadow 0.2s;
}

.emotion-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.emotion-item.top-emotion {
    background: linear-gradient(to right, rgba(102, 126, 234, 0.1), #f8f9fa);
    border-left-width: 6px;
}

.emotion-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.emotion-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.emotion-score {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-bar {
    flex: 1;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.5s ease;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.score-percentage {
    font-weight: bold;
    color: #667eea;
    min-width: 60px;
    text-align: right;
}

.summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.summary h3, .summary h4 {
    margin-bottom: 8px;
    margin-top: 0;
    font-size: 1.3em;
}

.file-header {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.file-header h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.file-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: #666;
    font-size: 0.9em;
}

.file-meta span {
    padding: 5px 10px;
    background: white;
    border-radius: 5px;
}

.utterance-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.utterance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.utterance-header h4 {
    margin: 0;
    color: #667eea;
}

.time-range {
    color: #666;
    font-size: 0.9em;
    background: white;
    padding: 5px 10px;
    border-radius: 5px;
}

.utterance-text {
    font-style: italic;
    color: #555;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #667eea;
    font-size: 1.05em;
    line-height: 1.6;
}

.utterance-confidence {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.utterance-section h5 {
    margin: 20px 0 15px 0;
    color: #333;
    font-size: 1.1em;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #dc3545;
    margin-top: 20px;
}

footer {
    text-align: center;
    color: white;
    margin-top: 30px;
    opacity: 0.9;
}

footer a {
    color: white;
    text-decoration: underline;
}

footer a:hover {
    opacity: 0.8;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9em;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.legend-name {
    color: #333;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2em;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    #timer {
        font-size: 2em;
    }
}
