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

body {
    font-family: 'Varela Round', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: #fff;
}

h1 {
    font-family: 'Bungee', 'Arial Black', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(180deg, #FFD200 0%, #FF6D00 40%, #E4002B 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.instructions {
    text-align: center;
    margin-bottom: 20px;
    opacity: 0.8;
    max-width: 500px;
}

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

.controls label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.controls select, .controls button {
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.controls select {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.controls select option {
    background: #1a1a2e;
    color: #fff;
}

.controls button {
    background: linear-gradient(135deg, #00b4db, #0083b0);
    color: #fff;
    font-weight: bold;
}

.controls button:hover {
    box-shadow: 0 5px 20px rgba(0, 180, 219, 0.4);
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#grid {
    display: grid;
    gap: 4px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    box-sizing: border-box;
}

.cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    min-width: 0;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

.cell:hover:not(.visited):not(.current):not(.hidden) {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
}

.cell.start {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    border-color: #38ef7d;
    box-shadow: 0 0 15px rgba(56, 239, 125, 0.5);
}

.cell.exit:not(.hidden) {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    border-color: #ff4b2b;
    box-shadow: 0 0 15px rgba(255, 75, 43, 0.5);
}

.cell.exit.hidden {
    box-shadow: 0 0 12px rgba(255, 65, 108, 0.5);
    border-color: rgba(255, 65, 108, 0.3);
}

.cell.current {
    background: linear-gradient(135deg, #f7971e, #ffd200);
    border-color: #ffd200;
    box-shadow: 0 0 20px rgba(255, 210, 0, 0.6);
    animation: pulse 1s infinite;
}

.cell.visited {
    background: rgba(100, 100, 100, 0.4);
    border-color: rgba(150, 150, 150, 0.3);
    color: rgba(255, 255, 255, 0.5);
}

.cell.reachable {
    border-color: rgba(0, 255, 245, 0.7);
    box-shadow: 0 0 10px rgba(0, 255, 245, 0.3);
}

.cell.hidden {
    background: rgba(0, 0, 0, 0.4);
    color: transparent;
    border-color: rgba(255, 255, 255, 0.1);
    cursor: default;
}

.cell.hidden:hover {
    transform: none;
}

.cell.path-hint {
    border-color: rgba(255, 100, 255, 0.8) !important;
    box-shadow: 0 0 15px rgba(255, 100, 255, 0.5) !important;
}

.cell.path-hint.hidden {
    color: rgba(255, 100, 255, 0.8);
}

.cell.bonus {
    background: linear-gradient(135deg, rgba(255, 100, 150, 0.3), rgba(255, 50, 100, 0.2));
}

.cell.bonus.reachable {
    box-shadow: 0 0 15px rgba(255, 100, 150, 0.6);
}

.cell.bonus-collected {
    background: linear-gradient(135deg, rgba(100, 255, 150, 0.25), rgba(50, 200, 100, 0.15));
}

.cell.fruit-pop {
    animation: fruitPopWithBorder 0.9s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes fruitPopWithBorder {
    0% { 
        transform: scale(1); 
        filter: grayscale(100%) brightness(1.5); 
        opacity: 0.4;
        background: transparent;
        border-color: transparent;
        box-shadow: none;
    }
    20% { transform: scale(1.8) rotate(-10deg); }
    35% { 
        transform: scale(2.2) rotate(10deg); 
        filter: grayscale(0%) brightness(1); 
        opacity: 1;
        background: transparent;
        border-color: transparent;
        box-shadow: none;
    }
    50% { transform: scale(1.6) rotate(-5deg); }
    65% { 
        transform: scale(1) rotate(0deg); 
        filter: grayscale(0%) brightness(1); 
        opacity: 1;
        background: transparent;
        border-color: transparent;
        box-shadow: none;
    }
    100% { 
        transform: scale(1) rotate(0deg);
        background: linear-gradient(135deg, #f7971e, #ffd200);
        border-color: #ffd200;
        box-shadow: 0 0 20px rgba(255, 210, 0, 0.6);
    }
}

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

.status {
    margin-top: 20px;
    font-size: 1.2rem;
    text-align: center;
}

.status .timer {
    color: #00fff5;
}

.win-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #11998e, #38ef7d);
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    z-index: 100;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: bounceIn 0.5s ease;
    display: none;
}

.win-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: color 0.2s;
}

.win-close-btn:hover {
    color: #fff;
}

.win-message h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #fff;
}

.win-message p {
    margin-bottom: 20px;
    color: #fff;
}

#instructions-dialog {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px 50px;
    text-align: left;
}

#instructions-dialog h2 {
    text-align: center;
    margin-bottom: 25px;
}

.instructions-content h3 {
    color: #ffe066;
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

.instructions-content h3:first-child {
    margin-top: 0;
}

.instructions-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.instructions-content ul {
    margin: 10px 0 15px 20px;
    line-height: 1.8;
}

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

.instructions-content strong {
    color: #ffe066;
}

.instructions-btn {
    display: block;
    margin: 25px auto 0;
    padding: 12px 40px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #00b4db, #0083b0);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-family: inherit;
}

.instructions-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 180, 219, 0.4);
}

.cherry-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    min-height: 40px;
}

.cherry-icon {
    font-size: 2rem;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.cherry-icon.hollow {
    filter: grayscale(100%) brightness(1.5);
    opacity: 0.4;
}

.cherry-icon.missed {
    opacity: 0.5;
}

.cherry-icon.filled {
    animation: cherryPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes cherryPop {
    0% { transform: scale(1); filter: grayscale(100%) brightness(1.5); opacity: 0.4; }
    30% { transform: scale(1.8) rotate(-10deg); }
    50% { transform: scale(2.2) rotate(10deg); filter: grayscale(0%) brightness(1); opacity: 1; }
    70% { transform: scale(1.6) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); filter: grayscale(0%) brightness(1); opacity: 1; }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 200;
    pointer-events: none;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.win-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.daily-status {
    margin: 15px 0;
    padding: 10px;
    background: rgba(0,0,0,0.35);
    border-radius: 8px;
}

.daily-status-title {
    font-size: 0.9rem;
    margin-bottom: 8px;
    opacity: 0.9;
}

.daily-status-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
}

.daily-size {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
}

.daily-size-label {
    font-size: 0.85rem;
    min-width: 45px;
}

.daily-size-fruits {
    font-size: 1rem;
    flex: 1;
}

.daily-size-time {
    font-size: 0.8rem;
    opacity: 0.7;
}

.daily-size.solved {
    background: rgba(74, 222, 128, 0.15);
}

.daily-size.unsolved {
    opacity: 0.5;
}

.daily-size-play {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: linear-gradient(135deg, #00b4db, #0083b0);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.daily-size-play:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(0, 180, 219, 0.4);
}

.win-message button {
    padding: 12px 30px;
    font-size: 1.1rem;
    background: #fff;
    color: #11998e;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    font-family: inherit;
}

.win-message button:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

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

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
    display: none;
}

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

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-color.start { background: linear-gradient(135deg, #11998e, #38ef7d); }
.legend-color.exit { background: linear-gradient(135deg, #ff416c, #ff4b2b); }
.legend-color.current { background: linear-gradient(135deg, #f7971e, #ffd200); }
.legend-color.visited { background: rgba(100, 100, 100, 0.6); }

.footer {
    margin-top: 30px;
    padding: 20px;
    opacity: 0.6;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.how-to-play-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: normal;
}

.how-to-play-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

.reset-btn {
    margin-top: 15px;
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    font-weight: bold;
    font-family: inherit;
}

.reset-btn:hover {
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

.report-link {
    color: #aaa;
    text-decoration: none;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

.report-link:hover {
    opacity: 1;
    color: #fff;
}

.seed-display {
    font-family: 'Varela Round', sans-serif;
    font-size: 0.9rem;
    opacity: 0.6;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.seed-share-btn {
    font-size: 0.75rem;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.seed-share-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.daily-indicator {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-left: 10px;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.8); }
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 255, 245, 0.9);
    color: #1a1a2e;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 1000;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

.loading { opacity: 0.5; pointer-events: none; }

/* Mobile responsiveness */
@media (max-width: 600px) {
    .desktop-only {
        display: none;
    }
    
    body {
        padding: 10px;
        overflow-x: hidden;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .instructions {
        font-size: 0.9rem;
        padding: 0 10px;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .controls select, .controls button {
        width: 100%;
        max-width: 200px;
    }
    
    #game-container {
        width: 100%;
        max-width: calc(100vw - 20px);
        box-sizing: border-box;
    }
    
    #grid {
        padding: 6px;
        gap: 2px;
        width: calc(100vw - 32px);
        max-width: calc(100vw - 32px) !important;
        box-sizing: border-box;
    }
    
    .cell {
        font-size: clamp(0.65rem, 2vw, 1.4rem);
        border-radius: 4px;
        border-width: 1px;
    }
    
    .reset-btn {
        padding: 10px 24px;
        font-size: 0.9rem;
    }
    
    .win-message {
        width: 95%;
        padding: 20px;
    }
    
    .win-message h2 {
        font-size: 1.5rem;
    }
    
    .win-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .win-buttons button {
        width: 100%;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    body {
        padding: 5px;
    }
    
    .cell {
        font-size: clamp(0.6rem, 1.8vw, 1rem);
    }
    
    #grid {
        padding: 4px;
        gap: 1px;
        width: calc(100vw - 10px);
        max-width: calc(100vw - 10px);
    }
}
