:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --logical-color: #3b82f6;
    --emotional-color: #ef4444;
    --creative-color: #10b981;
    --critical-color: #f59e0b;
}

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.input-section {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.8s ease-out 0.2s both;
}

#textInput {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
}

#textInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.analyze-btn {
    margin-top: 1rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.analyze-btn:active {
    transform: translateY(0);
}

.results-section {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-out;
}

.hidden {
    display: none;
}

.chart-container {
    width: 100%;
    max-width: 400px;
    height: 400px;
    margin: 2rem auto;
    position: relative;
}

#patternChart {
    width: 100%;
    height: 100%;
}

.pattern-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.pattern-item {
    padding: 1.5rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.pattern-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pattern-item h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.logical h3 { color: var(--logical-color); }
.emotional h3 { color: var(--emotional-color); }
.creative h3 { color: var(--creative-color); }
.critical h3 { color: var(--critical-color); }

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 1s ease-out;
}

.logical .progress-fill { background: var(--logical-color); }
.emotional .progress-fill { background: var(--emotional-color); }
.creative .progress-fill { background: var(--creative-color); }
.critical .progress-fill { background: var(--critical-color); }

.pattern-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.feedback-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 0.5rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.feedback-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.feedback-text {
    line-height: 1.8;
}

.history-section {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.history-section h2 {
    margin-bottom: 1.5rem;
}

.history-list {
    display: grid;
    gap: 1rem;
}

.history-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.history-preview {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-scores {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.history-scores span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.score-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.clear-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .pattern-details {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 300px;
    }
}