/* ==========================================================================
   Zahlen-Spaß - CSS Styles
   Ein fröhliches, buntes und kinderfreundliches Design
   ========================================================================== */

/* CSS-Variablen für Farben und Sizing */
:root {
    --color-primary: #FFD700;        /* Goldgelb */
    --color-secondary: #20B2AA;      /* Türkis */
    --color-accent: #FF1493;         /* Fuchsia */
    --color-success: #32CD32;        /* Limegreen */
    --color-warning: #FF6347;        /* Tomato */
    --color-bg-light: #F8F9FA;       /* Sehr helles Grau */
    --color-bg-white: #FFFFFF;       /* Weiß */
    --color-text-dark: #2C3E50;      /* Dunkles Blaugrau */
    --color-text-medium: #5A6C7D;    /* Mittleres Grau */
    --color-border: #E1E8ED;         /* Helles Grau für Borders */
    
    --font-family-title: 'Fredoka One', cursive;
    --font-family-body: 'Baloo 2', cursive;
    
    --border-radius: 15px;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   Reset und Basis-Styles
   ========================================================================== */

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

body {
    font-family: var(--font-family-body);
    font-weight: 500;
    line-height: 1.6;
    color: var(--color-text-dark);
    background: linear-gradient(135deg, var(--color-bg-light) 0%, #E8F4FD 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Barrierefreiheit - Versteckte Elemente für Screenreader */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ==========================================================================
   Container und Layout
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */

.header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(45deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.1) 10px,
        rgba(255, 255, 255, 0.1) 20px
    );
    animation: shimmer 8s linear infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.game-title {
    font-family: var(--font-family-title);
    font-size: clamp(2.5rem, 8vw, 4rem);
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.title-primary {
    color: var(--color-bg-white);
    text-shadow: 3px 3px 0px var(--color-text-dark);
}

.title-accent {
    color: var(--color-accent);
    text-shadow: 3px 3px 0px var(--color-bg-white);
}

.title-emoji {
    display: inline-block;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.game-subtitle {
    font-size: clamp(1rem, 3vw, 1.3rem);
    color: var(--color-text-dark);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Hauptspielbereich
   ========================================================================== */

.game-area {
    display: grid;
    gap: 25px;
}

/* Zielwert Anzeige */
.target-section {
    text-align: center;
}

.target-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: var(--color-bg-white);
    padding: 20px 30px;
    border-radius: var(--border-radius);
    border: 3px solid var(--color-accent);
    box-shadow: var(--shadow-medium);
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 700;
}

.target-label {
    color: var(--color-text-medium);
}

.target-number {
    color: var(--color-accent);
    font-size: clamp(2rem, 6vw, 3rem);
    font-family: var(--font-family-title);
    min-width: 60px;
    display: inline-block;
    text-align: center;
}

/* Spielfeld Layout */
.game-field {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    align-items: start;
}

.section-title {
    font-family: var(--font-family-title);
    font-size: clamp(1.3rem, 4vw, 1.6rem);
    color: var(--color-secondary);
    margin-bottom: 15px;
    text-align: center;
}

/* ==========================================================================
   Würfel Styles
   ========================================================================== */

.dice-section {
    background: var(--color-bg-white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    text-align: center;
}

.dice-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.dice {
    width: 80px;
    height: 80px;
    background: var(--color-primary);
    border: 3px solid var(--color-text-dark);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    position: relative;
}

.dice:hover {
    transform: scale(1.05);
}

.dice-face {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dice-dots {
    display: grid;
    width: 60px;
    height: 60px;
    padding: 8px;
    gap: 4px;
}

.dice-dot {
    width: 12px;
    height: 12px;
    background: var(--color-text-dark);
    border-radius: 50%;
}

/* Würfel-Animationen */
.dice.rolling {
    animation: rollAnimation 1s ease-in-out;
}

@keyframes rollAnimation {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1.2); }
    75% { transform: rotate(270deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Roll Button */
.roll-button {
    background: linear-gradient(45deg, var(--color-secondary), var(--color-primary));
    color: var(--color-bg-white);
    border: none;
    padding: 15px 30px;
    border-radius: var(--border-radius);
    font-family: var(--font-family-body);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.roll-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.roll-button:active:not(:disabled) {
    transform: translateY(-1px);
}

.roll-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.help-text {
    font-size: 0.9rem;
    color: var(--color-text-medium);
    margin-top: 5px;
    font-weight: 400;
}

/* ==========================================================================
   Zahlenauswahl Buttons
   ========================================================================== */

.selection-section {
    background: var(--color-bg-white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.number-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 300px;
    margin: 0 auto;
}

.number-btn {
    width: 60px;
    height: 60px;
    background: var(--color-accent);
    color: var(--color-bg-white);
    border: 3px solid transparent;
    border-radius: var(--border-radius);
    font-family: var(--font-family-title);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    justify-self: center;
}

.number-btn:hover:not(:disabled) {
    background: var(--color-secondary);
    transform: scale(1.1);
    box-shadow: var(--shadow-medium);
}

.number-btn:active:not(:disabled) {
    transform: scale(1.05);
}

.number-btn:disabled {
    background: var(--color-border);
    color: var(--color-text-medium);
    cursor: not-allowed;
    transform: none;
}

.number-btn.selected {
    background: var(--color-success);
    border-color: var(--color-text-dark);
}

/* ==========================================================================
   Ergebnis und Status
   ========================================================================== */

.result-section {
    grid-column: 1 / -1;
    background: var(--color-bg-white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    text-align: center;
}

.calculation {
    margin-bottom: 20px;
}

.calc-display {
    font-family: var(--font-family-title);
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    color: var(--color-text-dark);
    background: var(--color-bg-light);
    padding: 15px 25px;
    border-radius: var(--border-radius);
    display: inline-block;
    min-width: 200px;
    border: 2px solid var(--color-border);
}

.status-message {
    margin-bottom: 20px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-message p {
    font-size: clamp(1rem, 3vw, 1.4rem);
    font-weight: 600;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.status-message.success p {
    background: var(--color-success);
    color: var(--color-bg-white);
    animation: celebrate 0.6s ease-in-out;
}

.status-message.error p {
    background: var(--color-warning);
    color: var(--color-bg-white);
    animation: shake 0.5s ease-in-out;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

.new-game-btn {
    background: linear-gradient(45deg, var(--color-success), var(--color-secondary));
    color: var(--color-bg-white);
    border: none;
    padding: 15px 30px;
    border-radius: var(--border-radius);
    font-family: var(--font-family-body);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.new-game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Punktestand
   ========================================================================== */

.score-section {
    background: var(--color-bg-white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.score-display {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.score-item {
    text-align: center;
}

.score-label {
    display: block;
    font-size: 0.9rem;
    color: var(--color-text-medium);
    margin-bottom: 5px;
}

.score-value {
    display: block;
    font-family: var(--font-family-title);
    font-size: 1.8rem;
    color: var(--color-secondary);
    font-weight: 700;
}

/* ==========================================================================
   Regeln und Anleitung
   ========================================================================== */

.rules-section {
    background: var(--color-bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

.rules-details {
    width: 100%;
}

.rules-summary {
    background: linear-gradient(45deg, var(--color-secondary), var(--color-primary));
    color: var(--color-bg-white);
    padding: 20px;
    font-family: var(--font-family-title);
    font-size: 1.3rem;
    cursor: pointer;
    list-style: none;
    outline: none;
    transition: var(--transition);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.rules-summary:hover {
    background: linear-gradient(45deg, var(--color-primary), var(--color-secondary));
}

.rules-summary::-webkit-details-marker {
    display: none;
}

.rules-content {
    padding: 25px;
    line-height: 1.7;
}

.rules-content h3 {
    color: var(--color-secondary);
    font-family: var(--font-family-title);
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.rules-content h4 {
    color: var(--color-accent);
    font-family: var(--font-family-title);
    font-size: 1.2rem;
    margin: 20px 0 10px 0;
}

.rules-content ol,
.rules-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.rules-content li {
    margin-bottom: 8px;
}

.rules-content strong {
    color: var(--color-text-dark);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
    text-align: center;
    padding: 20px;
    color: var(--color-text-medium);
    font-size: 0.9rem;
}

.footer-credits {
    font-weight: 600;
    margin-bottom: 5px;
}

.footer-tech {
    opacity: 0.8;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .container {
        padding: 15px;
        gap: 20px;
    }
    
    .game-field {
        grid-template-columns: 1fr;
    }
    
    .number-buttons {
        grid-template-columns: repeat(2, 1fr);
        max-width: 200px;
    }
    
    .score-display {
        flex-direction: column;
        gap: 15px;
    }
    
    .target-display {
        flex-direction: column;
        gap: 10px;
        padding: 15px 20px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 15px;
    }
    
    .dice-section,
    .selection-section,
    .result-section {
        padding: 20px 15px;
    }
    
    .number-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .number-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .dice {
        width: 70px;
        height: 70px;
    }
}

/* ==========================================================================
   Tastatur-Navigation und Fokus-Styles
   ========================================================================== */

button:focus,
summary:focus {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .header {
        background: var(--color-bg-white) !important;
        color: var(--color-text-dark) !important;
        box-shadow: none !important;
    }
    
    .game-area,
    .rules-section {
        box-shadow: none !important;
        border: 1px solid var(--color-border) !important;
    }
} 