/* Modern Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #6b7280;
    --success: #10b981;
    --fotzig-color: #ef4444;
    --atzig-color: #f59e0b;
    --mausig-color: #3b82f6;
    --bg: #f9fafb;
    --card-bg: #ffffff;
    --text: #111827;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-light);
    font-size: 1.125rem;
}

main {
    flex: 1;
}

.quiz {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.questions {
    min-height: 300px;
}

.question {
    display: none;
    animation: fadeIn 0.3s ease;
}

.question.active {
    display: block;
}

.question h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.options {
    display: grid;
    gap: 1rem;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.option label {
    font-size: 1rem;
    cursor: pointer;
    flex: 1;
}

.option.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

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

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

.btn-success:hover {
    background: #059669;
}

.question-counter {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Results */
.results {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.results h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.results-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.triangle-visualization {
    margin: 2rem auto;
    max-width: 600px;
    width: 100%;
    min-height: 500px;
}

#ternary-plot {
    width: 100%;
    height: auto;
    max-height: 400px;
    display: block;
    margin: 0 auto;
    background: transparent;
}

#ternary-plot svg {
    display: block;
}



.corner-label {
    font-size: 0.875rem;
    font-weight: 500;
    fill: var(--text);
}

.corner-title {
    fill: var(--text);
}

.corner-value {
    fill: var(--primary);
    font-weight: 700;
    font-size: 1rem;
}

#fotzig-label {
    fill: var(--fotzig-color);
}

#atzig-label {
    fill: var(--atzig-color);
}

#mausig-label {
    fill: var(--mausig-color);
}

.result-dot {
    fill: var(--primary);
    stroke: white;
    stroke-width: 2;
    transition: cx 0.6s ease-out, cy 0.6s ease-out;
    filter: drop-shadow(0 0 6px rgba(79, 70, 229, 0.7));
    z-index: 10;
}

.scores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.score-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.score-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 3rem;
    font-weight: 800;
}

#fotzig-score .score-value {
    color: var(--fotzig-color);
}

#atzig-score .score-value {
    color: var(--atzig-color);
}

#mausig-score .score-value {
    color: var(--mausig-color);
}

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.answer-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.answer-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.answer-input input {
    flex: 1;
}

.answer-input .category-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.fotzig-badge {
    background: var(--fotzig-color);
}

.atzig-badge {
    background: var(--atzig-color);
}

.mausig-badge {
    background: var(--mausig-color);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.5rem;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    .quiz {
        padding: 1rem;
    }
    
    .navigation {
        flex-direction: column-reverse;
    }
    
    .btn {
        width: 100%;
    }
}
