/* ============================================
   LERNHELDEN WEDEMARK - Design System
   Farben, Typografie, Komponenten
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Outfit:wght@100..900&display=swap');

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Farben */
    --color-primary: #FB5FAB;
    --color-primary-light: #FD8AC4;
    --color-primary-dark: #E0489A;
    --color-primary-bg: #FFF0F7;

    --color-success: #4CAF50;
    --color-success-light: #E8F5E9;
    --color-warning: #FF9800;
    --color-warning-light: #FFF3E0;
    --color-error: #F44336;
    --color-error-light: #FFEBEE;
    --color-info: #2196F3;
    --color-info-light: #E3F2FD;

    --color-text: #2D2D2D;
    --color-text-light: #666666;
    --color-text-muted: #999999;
    --color-white: #FFFFFF;
    --color-bg: #FFFFFF;
    --color-bg-alt: #FAFAFA;
    --color-border: #E0E0E0;

    /* Kindgerechte Akzentfarben */
    --color-kid-blue: #5DADE2;
    --color-kid-green: #58D68D;
    --color-kid-yellow: #F7DC6F;
    --color-kid-orange: #F5B041;
    --color-kid-purple: #AF7AC5;

    /* Typografie */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'DM Sans', sans-serif;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* Abstände */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Schatten */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Animationen */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;

    /* Container */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
}

/* ============================================
   Typografie
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin-bottom: var(--space-4);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
}

/* ============================================
   Layout Komponenten
   ============================================ */
.container {
    width: 100%;
    max-width: var(--container-lg);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.container--sm { max-width: var(--container-sm); }
.container--md { max-width: var(--container-md); }
.container--xl { max-width: var(--container-xl); }

/* Tool-Wrapper für einzelne Tools */
.tool-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-primary-bg) 100%);
}

.tool-header {
    background: var(--color-white);
    padding: var(--space-4) 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tool-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.tool-header__logo {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-primary);
}

.tool-header__back {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-light);
}

.tool-header__back:hover {
    color: var(--color-primary);
}

.tool-main {
    flex: 1;
    padding: var(--space-8) 0;
}

.tool-footer {
    background: var(--color-white);
    padding: var(--space-4) 0;
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
}

/* ============================================
   Karten
   ============================================ */
.card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--space-6);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card--flat {
    box-shadow: none;
    border: 1px solid var(--color-border);
}

.card--flat:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--color-primary);
}

.card--interactive {
    cursor: pointer;
}

.card__icon {
    width: 64px;
    height: 64px;
    background: var(--color-primary-bg);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
}

.card__title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.card__description {
    color: var(--color-text-light);
    font-size: var(--text-sm);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

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

.btn--primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--secondary {
    background: var(--color-white);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn--secondary:hover:not(:disabled) {
    background: var(--color-primary-bg);
}

.btn--ghost {
    background: transparent;
    color: var(--color-text);
}

.btn--ghost:hover:not(:disabled) {
    background: var(--color-bg-alt);
}

.btn--lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
}

.btn--sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

.btn--block {
    width: 100%;
}

/* ============================================
   Formulare
   ============================================ */
.form-group {
    margin-bottom: var(--space-4);
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-body);
    font-size: var(--text-base);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-bg);
}

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

/* ============================================
   Quiz/Test Komponenten
   ============================================ */
.quiz-container {
    max-width: 700px;
    margin: 0 auto;
}

.quiz-progress {
    margin-bottom: var(--space-6);
}

.quiz-progress__bar {
    height: 8px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.quiz-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.quiz-progress__text {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.quiz-question {
    text-align: center;
    margin-bottom: var(--space-8);
}

.quiz-question__number {
    display: inline-block;
    background: var(--color-primary);
    color: var(--color-white);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-4);
}

.quiz-question__text {
    font-size: var(--text-2xl);
    font-family: var(--font-heading);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quiz-option:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
}

.quiz-option--selected {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
}

.quiz-option__indicator {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.quiz-option--selected .quiz-option__indicator {
    border-color: var(--color-primary);
    background: var(--color-primary);
}

.quiz-option--selected .quiz-option__indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--color-white);
    border-radius: var(--radius-full);
}

.quiz-option__text {
    font-size: var(--text-base);
    flex: 1;
}

.quiz-actions {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-8);
    gap: var(--space-4);
}

/* ============================================
   Ergebnis-Komponenten
   ============================================ */
.result-container {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.result-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto var(--space-6);
    background: var(--color-primary-bg);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.result-title {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
}

.result-subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-light);
    margin-bottom: var(--space-6);
}

.result-details {
    background: var(--color-bg-alt);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    text-align: left;
    margin-bottom: var(--space-6);
}

.result-details h4 {
    margin-bottom: var(--space-3);
}

.result-details ul {
    list-style: none;
    padding: 0;
}

.result-details li {
    padding: var(--space-2) 0;
    padding-left: var(--space-6);
    position: relative;
}

.result-details li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: bold;
}

.result-cta {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-top: var(--space-6);
}

.result-cta h4 {
    color: var(--color-white);
    margin-bottom: var(--space-2);
}

.result-cta p {
    opacity: 0.9;
    margin-bottom: var(--space-4);
}

/* ============================================
   Spiel-Komponenten (für Kinder)
   ============================================ */
.game-container {
    max-width: 800px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.game-score {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.game-score__icon {
    font-size: var(--text-2xl);
}

.game-score__value {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-primary);
}

.game-level {
    background: var(--color-primary-bg);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-weight: 500;
    color: var(--color-primary-dark);
}

.game-lives {
    display: flex;
    gap: var(--space-1);
    font-size: var(--text-xl);
}

.game-lives span {
    transition: transform var(--transition-fast);
}

.game-lives span.lost {
    filter: grayscale(1);
    opacity: 0.3;
}

.game-area {
    background: var(--color-white);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-prompt {
    font-family: var(--font-heading);
    font-size: var(--text-4xl);
    margin-bottom: var(--space-8);
    text-align: center;
}

.game-choices {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    justify-content: center;
}

.game-choice {
    min-width: 120px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: var(--text-4xl);
    background: var(--color-bg-alt);
    border: 3px solid var(--color-border);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.game-choice:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
    transform: scale(1.05);
}

.game-choice--correct {
    border-color: var(--color-success);
    background: var(--color-success-light);
    animation: pulse-success 0.5s ease;
}

.game-choice--wrong {
    border-color: var(--color-error);
    background: var(--color-error-light);
    animation: shake 0.5s ease;
}

@keyframes pulse-success {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ============================================
   Memory-Spiel
   ============================================ */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    max-width: 500px;
    margin: 0 auto;
}

.memory-card {
    aspect-ratio: 1;
    perspective: 1000px;
    cursor: pointer;
}

.memory-card__inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.memory-card.flipped .memory-card__inner {
    transform: rotateY(180deg);
}

.memory-card__front,
.memory-card__back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
}

.memory-card__front {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-white);
}

.memory-card__back {
    background: var(--color-white);
    border: 2px solid var(--color-border);
    transform: rotateY(180deg);
    font-size: var(--text-3xl);
}

.memory-card.matched .memory-card__back {
    background: var(--color-success-light);
    border-color: var(--color-success);
}

/* ============================================
   Feedback/Toast
   ============================================ */
.feedback {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-xl);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    transition: transform var(--transition-base);
}

.feedback.show {
    transform: translateX(-50%) translateY(0);
}

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

.feedback--error {
    background: var(--color-error);
    color: var(--color-white);
}

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

.feedback__icon {
    font-size: var(--text-xl);
}

/* ============================================
   Konfetti-Animation
   ============================================ */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-muted { color: var(--color-text-muted); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    :root {
        --text-4xl: 1.875rem;
        --text-3xl: 1.5rem;
        --text-2xl: 1.25rem;
    }

    .container {
        padding: 0 var(--space-3);
    }

    .card {
        padding: var(--space-4);
    }

    .game-area {
        padding: var(--space-4);
    }

    .game-choice {
        min-width: 80px;
        min-height: 80px;
        font-size: var(--text-3xl);
    }

    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .quiz-actions {
        flex-direction: column;
    }

    .quiz-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .memory-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .game-header {
        flex-wrap: wrap;
        gap: var(--space-3);
    }
}
