/* ========================================
   MANGO BANGO - Fruchtiges Logikspiel
   ======================================== */

:root {
    /* Frucht-Farbpalette */
    --mango-primary: #FFB347;
    --mango-secondary: #FF9800;
    --mango-light: #FFE0B2;
    --avocado-primary: #7CB342;
    --avocado-secondary: #558B2F;
    --avocado-light: #C5E1A5;

    /* Hintergrund & Neutral */
    --bg-cream: #FFF8E7;
    --bg-white: #FFFFFF;
    --bg-light: #FFF5E6;

    /* Akzente */
    --coral: #FF6B6B;
    --mint: #4ECDC4;
    --error-red: #E53935;
    --success-green: #43A047;

    /* Text */
    --text-dark: #4A4A4A;
    --text-medium: #757575;
    --text-light: #9E9E9E;

    /* Schatten */
    --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.12);
    --shadow-strong: 0 8px 30px rgba(0, 0, 0, 0.15);

    /* Abstände */
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 20px;
    --radius-round: 50%;
}

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-cream) 0%, var(--bg-light) 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.5;
}

/* Container */
.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--mango-secondary) 0%, var(--avocado-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-medium);
    font-weight: 600;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    padding: 15px 30px;
    background: var(--bg-white);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-soft);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* Grid Container */
.grid-container {
    background: var(--bg-white);
    padding: 15px;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-medium);
    margin-bottom: 25px;
}

/* Game Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(6, 55px);
    grid-template-rows: repeat(6, 55px);
    gap: 4px;
    position: relative;
    width: fit-content;
}

/* Zellen */
.cell {
    width: 55px;
    height: 55px;
    flex-shrink: 0;
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: var(--radius-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-soft);
}

.cell:active {
    transform: scale(0.95);
}

/* Zell-Zustände */
.cell.mango {
    background: var(--mango-light);
    border-color: var(--mango-primary);
}

.cell.avocado {
    background: var(--avocado-light);
    border-color: var(--avocado-primary);
}

.cell.fixed {
    cursor: not-allowed;
    border-width: 3px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.cell.fixed.mango {
    background: linear-gradient(135deg, var(--mango-light) 0%, var(--mango-primary) 100%);
    border-color: var(--mango-secondary);
}

.cell.fixed.avocado {
    background: linear-gradient(135deg, var(--avocado-light) 0%, var(--avocado-primary) 100%);
    border-color: var(--avocado-secondary);
}

.cell.fixed::after {
    content: '🔒';
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6rem;
    opacity: 0.7;
}

.cell.error {
    animation: shake 0.4s ease;
    border-color: var(--error-red) !important;
    background: rgba(229, 57, 53, 0.1) !important;
}

.cell.valid {
    border-color: var(--success-green) !important;
}

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

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

.cell.placed {
    animation: bounce 0.3s ease;
}

/* Constraint Markers (= und ×) */
.constraint {
    position: absolute;
    background: var(--bg-white);
    border-radius: var(--radius-round);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-medium);
    box-shadow: var(--shadow-soft);
    z-index: 10;
    pointer-events: none;
}

.constraint.horizontal {
    /* Positionierung zwischen horizontalen Zellen */
}

.constraint.vertical {
    /* Positionierung zwischen vertikalen Zellen */
}

.constraint.equals {
    color: var(--mango-secondary);
}

.constraint.different {
    color: var(--avocado-secondary);
}

/* Zeilen/Spalten-Fehler */
.row-error .cell,
.col-error .cell {
    border-color: var(--error-red);
}

/* Buttons */
.buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-medium);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn span {
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--mango-primary) 0%, var(--mango-secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-dark);
    box-shadow: var(--shadow-soft);
}

.btn-secondary:hover {
    background: var(--bg-light);
    transform: translateY(-2px);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Legende */
.legend {
    display: flex;
    gap: 25px;
    color: var(--text-medium);
    font-size: 0.875rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-symbol {
    width: 24px;
    height: 24px;
    background: var(--bg-white);
    border-radius: var(--radius-small);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: var(--shadow-soft);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-large);
    padding: 30px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

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

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

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

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

/* Spielregeln */
.rule {
    display: flex;
    gap: 15px;
    margin-bottom: 18px;
    align-items: flex-start;
}

.rule-number {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--mango-light) 0%, var(--avocado-light) 100%);
    border-radius: var(--radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.rule p {
    color: var(--text-dark);
    font-size: 0.95rem;
}

.tip {
    background: var(--bg-light);
    padding: 15px;
    border-radius: var(--radius-medium);
    margin-top: 20px;
    margin-bottom: 25px;
    font-size: 0.9rem;
}

/* Win Modal */
.modal-win {
    text-align: center;
}

.win-header {
    margin-bottom: 25px;
}

.win-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
    animation: bounce 0.6s ease infinite;
}

.win-header h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--mango-secondary) 0%, var(--avocado-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.win-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
}

.win-stat {
    display: flex;
    flex-direction: column;
}

.win-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark);
}

.win-stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
}

.win-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

/* Share Preview */
.share-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--bg-light);
}

.share-preview textarea {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 1px solid var(--bg-light);
    border-radius: var(--radius-medium);
    font-family: monospace;
    font-size: 0.8rem;
    resize: none;
    margin-bottom: 10px;
    background: var(--bg-light);
}

/* Responsive */
@media (max-width: 420px) {
    .container {
        padding: 15px;
    }

    .title {
        font-size: 2rem;
    }

    .cell {
        width: 48px;
        height: 48px;
        font-size: 1.7rem;
    }

    .stats-bar {
        gap: 20px;
        padding: 12px 20px;
    }

    .buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .legend {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
}

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

.container {
    animation: fadeIn 0.5s ease;
}

/* Frucht-Partikel Animation (optional) */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}
