/* X-Mas Rätsel - Buntes, modernes Design */

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

:root {
    --primary-red: #e74c3c;
    --primary-green: #27ae60;
    --primary-gold: #f39c12;
    --primary-blue: #3498db;
    --primary-purple: #9b59b6;
    --primary-pink: #e91e63;
    --dark-bg: #1a1a2e;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #ecf0f1;
    --shadow: rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-dark);
}

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

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow);
    text-align: center;
    max-width: 400px;
    width: 100%;
    animation: slideIn 0.5s ease-out;
}

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

.login-card h1 {
    color: var(--primary-red);
    margin-bottom: 10px;
    font-size: 2.5em;
}

.login-subtitle {
    color: var(--text-dark);
    margin-bottom: 30px;
    font-size: 1.1em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.code-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1em;
    transition: border-color 0.3s;
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.error-message {
    background: #fee;
    color: var(--primary-red);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-red);
}

/* Header */
.header {
    text-align: center;
    color: var(--white);
    margin-bottom: 40px;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px var(--shadow);
}

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

/* Success Banner */
.success-banner {
    background: linear-gradient(135deg, var(--primary-green) 0%, #2ecc71 100%);
    color: var(--white);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px var(--shadow);
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-banner h2 {
    margin-bottom: 10px;
    font-size: 2em;
}

/* Puzzles Grid */
.puzzles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.puzzle-card {
    background: var(--white);
    border-radius: 15px;
    padding: 22.5px;  /* 25px * 0.9 = 22.5px (10% kleiner) */
    box-shadow: 0 5px 15px var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.puzzle-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-red), var(--primary-green), var(--primary-gold), var(--primary-blue), var(--primary-purple));
}

.puzzle-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow);
}

.puzzle-card.completed {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid var(--primary-green);
}

.puzzle-icon {
    font-size: 3.6em;  /* 4em * 0.9 = 3.6em (10% kleiner) */
    margin-bottom: 13.5px;  /* 15px * 0.9 = 13.5px */
}

.puzzle-card h3 {
    color: var(--text-dark);
    margin-bottom: 9px;  /* 10px * 0.9 = 9px */
    font-size: 1.35em;  /* 1.5em * 0.9 = 1.35em (10% kleiner) */
}

.puzzle-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95em;
}

.puzzle-status {
    margin-bottom: 15px;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.status-solved {
    background: var(--primary-green);
    color: var(--white);
}

.status-unsolved {
    background: #ddd;
    color: #666;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: #2980b9;
    transform: scale(1.05);
}

.btn-secondary {
    background: #95a5a6;
    color: var(--white);
}

.btn-secondary:hover {
    background: #7f8c8d;
}

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

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

.btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
    margin-top: 15px;
}

.btn-puzzle {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-pink) 100%);
    color: var(--white);
}

.btn-puzzle:hover {
    background: linear-gradient(135deg, #c0392b 0%, #c2185b 100%);
}

/* Progress Bar */
.progress-bar-container {
    background: var(--white);
    padding: 18px;  /* 20px * 0.9 = 18px (10% kleiner) */
    border-radius: 15px;
    box-shadow: 0 5px 15px var(--shadow);
    margin-top: 27px;  /* 30px * 0.9 = 27px */
}

.progress-label {
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-dark);
}

.progress-bar {
    width: 100%;
    height: 27px;  /* 30px * 0.9 = 27px (10% kleiner) */
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green) 0%, var(--primary-blue) 100%);
    transition: width 0.5s ease-out;
    border-radius: 15px;
}

/* Puzzle Pages */
.puzzle-header {
    background: var(--white);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px var(--shadow);
}

.back-link {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 10px;
    display: inline-block;
}

.back-link:hover {
    text-decoration: underline;
}

.puzzle-header h1 {
    color: var(--text-dark);
    margin-bottom: 5px;
}

.puzzle-container {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px var(--shadow);
}

.puzzle-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    display: none;
}

.message.success {
    background: #d4edda;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    display: block;
}

.message.error {
    background: #f8d7da;
    color: var(--primary-red);
    border: 2px solid var(--primary-red);
    display: block;
}

/* Sudoku Grid */
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    width: 451px;  /* 392px * 1.15 = 451px */
    margin: 0 auto;
    background: #333;
    padding: 2px;
    border-radius: 8px;
    border: 2px solid #333;
}

.sudoku-cell {
    aspect-ratio: 1;
    background: var(--white);
    border: 1px solid #ddd;
    text-align: center;
    font-size: 0.75em;
    font-weight: 600;
    padding: 0;
    width: 100%;
    height: 100%;
    position: relative;
}

/* Dickere Linien für 3x3 Boxen - optische Abtrennung */
.sudoku-cell.box-right {
    border-right: 2px solid #333 !important;
}

.sudoku-cell.box-bottom {
    border-bottom: 2px solid #333 !important;
}

.sudoku-cell.box-left {
    border-left: 2px solid #333 !important;
}

.sudoku-cell.box-top {
    border-top: 2px solid #333 !important;
}

.sudoku-cell:focus {
    outline: 2px solid var(--primary-blue);
    background: #e3f2fd;
    border: 2px solid var(--primary-blue);
}

.sudoku-cell.prefilled {
    background: #ffffff;  /* Weißer Hintergrund für bessere Lesbarkeit */
    font-weight: 700;
    color: #000000;  /* Schwarze Schrift für besseren Kontrast */
}

.sudoku-cell.user-input {
    background: #e8f4f8;  /* Hellblauer Hintergrund für Nutzer-Eingaben */
    color: #0066cc;  /* Blaue Schrift für Nutzer-Eingaben */
    font-weight: 600;
}

/* Wordle Layout */
.wordle-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.wordle-keyboard-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 20px;
}

/* Wordle Grid */
.wordle-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7.2px;  /* 8px * 0.9 = 7.2px */
    max-width: 360px;  /* 400px * 0.9 = 360px */
    width: 100%;
    margin: 0 auto 25px;
}

.wordle-row {
    display: contents;
}

.wordle-cell {
    aspect-ratio: 1;
    background: #ddd;
    border: 2px solid #bbb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35em;  /* 1.5em * 0.9 = 1.35em (10% kleiner) */
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
    min-height: 54px;  /* 60px * 0.9 = 54px */
}

.wordle-cell.correct {
    background: var(--primary-green);
    color: var(--white);
}

.wordle-cell.present {
    background: var(--primary-gold);
    color: var(--white);
}

.wordle-cell.absent {
    background: #787c7e;
    color: var(--white);
}

.wordle-keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 767px) {
    .wordle-keyboard {
        max-width: 100%;
        gap: 6px;
    }
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 0;
}

.keyboard-key {
    padding: 12px 8px;
    background: #ddd;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    min-width: 40px;
    min-height: 44px;  /* Größere Tasten für Touch-Geräte */
}

@media (min-width: 768px) {
    .keyboard-key {
        padding: 15px 10px;
        font-size: 1.1em;
    }
}

.keyboard-key:hover {
    background: #bbb;
}

/* Wordsearch */
.wordsearch-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.wordsearch-info-compact {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.words-section {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.95em;
}

.words-to-find ul, .found-words ul {
    list-style: none;
    padding: 0;
}

.words-to-find li, .found-words li {
    padding: 5px;
    margin: 5px 0;
}

.words-to-find li {
    color: #666;
}

.found-words li {
    color: var(--primary-green);
    font-weight: 600;
    text-decoration: line-through;
}

.wordsearch-grid {
    display: grid;
    gap: 1px;
    background: #333;
    padding: 1px;
    border-radius: 8px;
    max-width: 100%;
    overflow-x: auto;
}

.wordsearch-cell {
    aspect-ratio: 1;
    background: var(--white);
    border: none;
    text-align: center;
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
}

.wordsearch-cell:hover {
    background: #e3f2fd;
}

.wordsearch-cell.selected {
    background: var(--primary-blue);
    color: var(--white);
}

.wordsearch-cell.found {
    background: var(--primary-green);
    color: var(--white);
}

/* Magic Square */
.magicsquare-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);  /* 4x4 Grid */
    gap: 1px;
    width: 230px;  /* 200px * 1.15 = 230px */
    margin: 0 auto;
    background: #333;
    padding: 1px;
    border-radius: 8px;
}

.magicsquare-cell {
    aspect-ratio: 1;
    background: var(--white);
    border: 1px solid #ddd;
    text-align: center;
    font-size: 0.8em;
    font-weight: 600;
    padding: 0;
    width: 100%;
    height: 100%;
}

.magicsquare-cell:focus {
    outline: 2px solid var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.magicsquare-cell.prefilled {
    background: #ffffff;  /* Weißer Hintergrund für bessere Lesbarkeit */
    font-weight: 700;
    border: 1px solid #bbb;
    color: #000000;  /* Schwarze Schrift für besseren Kontrast */
}

.magicsquare-cell.user-input {
    background: #e8f4f8;  /* Hellblauer Hintergrund für Nutzer-Eingaben */
    color: #0066cc;  /* Blaue Schrift für Nutzer-Eingaben */
    font-weight: 600;
    border: 1px solid #99ccff;
}

.magicsquare-info {
    text-align: center;
    margin: 20px 0;
    font-size: 1.2em;
}

/* Differences */
.differences-info {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: 600;
}

.differences-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.image-container {
    position: relative;
    border: 3px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    display: inline-block;
}

.image-container img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
}

.image-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    pointer-events: auto;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    10%, 90% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Memory */
.memory-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    justify-content: center;
    font-size: 1.1em;
}

.stat-item {
    background: #f8f9fa;
    padding: 15px 25px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.stat-item strong {
    color: #2c3e50;
    margin-right: 10px;
}

.stat-item span {
    color: #e74c3c;
    font-weight: bold;
    font-size: 1.2em;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

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

.memory-card-front,
.memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 3em;
    transition: transform 0.6s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.memory-card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: rotateY(180deg);
}

.memory-card-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-weight: bold;
    font-size: 2.5em;
}

.memory-card.flipped .memory-card-front {
    transform: rotateY(0deg);
}

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

.memory-card.found {
    opacity: 0.6;
    cursor: default;
}

.memory-card.found .memory-card-front {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.memory-card:hover:not(.found):not(.flipped) .memory-card-back {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Crossword */
.crossword-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    max-height: 85vh;
    overflow: hidden;
}

.crossword-grid-container {
    max-height: 85vh;
    overflow: auto;
}

.crossword-grid {
    display: grid;
    gap: 0;
    background: #000000;
    padding: 0;
    border: 2px solid #000000;
    width: 100%;
    max-width: 569px;
    margin: 0 auto;
    max-height: 600px;
    overflow: hidden;
}

/* Basis-Styles für alle Quadrate (basierend auf Open-Crossword) */
.crossword-square {
    box-shadow: 0 0 0 1px #000000;
    display: inline-block;
    aspect-ratio: 1;
    min-height: 18px;
    min-width: 18px;
    color: #000000;
    background-color: #ffffff;
    user-select: none;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Schwarze Felder */
.crossword-block {
    background-color: #000000 !important;
}

/* Unsichtbare Felder (außerhalb des Rätsels) */
.crossword-invisible {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    display: none !important; /* Verstecke unsichtbare Felder komplett */
}

/* Aktive Zellen (editierbar) */
.crossword-cell {
    background-color: #ffffff !important;
    cursor: text;
}

.crossword-cell:hover,
.crossword-cell.highlighted {
    background-color: #d4d4d4 !important;
}

.crossword-cell.selected {
    background-color: #a0c2e9 !important;
}

/* Nummern */
.crossword-square-clue {
    position: absolute;
    left: 2px;
    top: 2px;
    font-size: 0.6em;
    font-weight: 900;
    color: #000000;
    background: #ffffff;
    padding: 1px 3px;
    border: 1px solid #000000;
    z-index: 15;
    pointer-events: none;
    line-height: 1.1;
}

/* Input-Felder */
.crossword-square-text {
    font-size: 0.9em !important;
    font-weight: bold !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    text-transform: uppercase !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    appearance: none !important;
    font-family: inherit !important;
    color: #000000 !important;
    text-align: center !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

.crossword-square-text:focus {
    background-color: transparent !important;
    outline: 2px solid #3498db !important;
    outline-offset: -2px !important;
}

.crossword-clues {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    max-height: 85vh;
    overflow-y: auto;
    font-size: 0.9em;
}

.clues-section h3 {
    margin-bottom: 10px;
    color: var(--text-dark);
}

.clues-section ul {
    list-style: none;
    padding: 0;
}

.clues-section li {
    padding: 8px;
    margin: 5px 0;
    background: var(--white);
    border-radius: 5px;
    cursor: pointer;
}

.clues-section li:hover {
    background: #e3f2fd;
}

.clues-section li.solved {
    background: #d4edda;
    text-decoration: line-through;
}

/* Responsive */
@media (max-width: 768px) {
    .puzzles-grid {
        grid-template-columns: 1fr;
    }
    
    .wordsearch-info {
        grid-template-columns: 1fr;
    }
    
    .differences-images {
        grid-template-columns: 1fr;
    }
    
    .crossword-layout {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 2em;
    }
}

