/* 
 * Global Stylesheet for Harsh Patel's Website
 * Contains shared styles that apply across all pages
 */

/* Theme Variables */
:root {
    --bg: #ffffff;
    --text: #000000;
    --link: #2563eb;
    --section-bg: rgba(26, 26, 46, 0.03);
    --border: rgba(26, 26, 46, 0.1);
    /* Keyboard Key Variables - Light Mode */
    --key-bg: #f7f7f7;
    --key-border: #ccc;
    --key-text: var(--text);
    
    /* Retro-Modern Number Munchers Theme Colors */
    /* page - Warm, inviting background */
    --bg: #FFF8F0;                    /* Warm cream background */
    --title: #2D1B69;                 /* Deep purple for contrast */
    --score: #2D1B69;
    --score-bg: #FFE8D6;              /* Warm peach panels */

    /* board - Retro cyan/teal */
    --frame: #00A0A0;                 /* Bright teal frame */
    --grid: #00A0A0;                  /* Matching grid lines */

    /* tiles - Warm purple/navy */
    --tile: #4A148C;                  /* Rich purple tiles */
    --num: #FFF3E0;                   /* Warm cream numbers */

    /* states */
    --tile-blocked: #6A1B9A;          /* Darker purple */
    --tile-blocked-border: #8E24AA;
    --blocked-num: #FFEBEE;

    --tile-eaten: #4CAF50;            /* Bright lime green - retro! */
    --tile-eaten-border: #66BB6A;
    --eaten-num: #E8F5E8;

    --tile-wrong: #FF6B35;            /* Warm coral - modern retro */
    --tile-wrong-border: #FF8A65;
    --wrong-num: #FFF3E0;
}

:root[data-theme="dark"] {
    --bg: #1a1a2e;                      /* Deep purple background */
    --text: #ffffff;
    --link: #00bcd4;                   /* Bright cyan links */
    --section-bg: rgba(255, 255, 255, 0.05);
    --border: rgba(0, 188, 212, 0.2);
    /* Keyboard Key Variables - Dark Mode */
    --key-bg: #333;
    --key-border: #00bcd4;
    --key-text: var(--text);

    /* Dark Retro-Modern Number Munchers Theme */
    --title: #E1BEE7;                  /* Light purple text */
    --score: #E1BEE7;
    --score-bg: #2D2D5F;               /* Dark purple panels */

    --frame: #00BCD4;                  /* Bright cyan frame */
    --grid: #00BCD4;                   /* Matching grid */

    --tile: #7C4DFF;                   /* Bright purple tiles */
    --num: #FFF8E1;                    /* Warm yellow numbers */

    --tile-blocked: #BA68C8;           /* Medium purple */
    --tile-blocked-border: #CE93D8;
    --blocked-num: #FCE4EC;

    --tile-eaten: #4CAF50;             /* Same lime green */
    --tile-eaten-border: #66BB6A;
    --eaten-num: #E8F5E8;

    --tile-wrong: #FF7043;             /* Warm orange-red */
    --tile-wrong-border: #FF8A65;
    --wrong-num: #FFF3E0;
}

/* Base Typography */
body {
    font-family: Verdana, sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.6;
    max-width: 650px;
    margin: 50px auto;
    padding: 0 20px;
    background: var(--bg);
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Headings */
h1 {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 500;
}

h2 {
    display: block;
    position: relative;
    font-size: 1.1rem;
    margin: 0.8rem 0 0;
    padding-bottom: 0.5rem;
    font-weight: 600;
}

/* Link Styling */
a {
    color: var(--link);
    text-decoration: none;
    position: relative;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0 4px;
    margin: 0 -4px;
    border-radius: 3px;
}

a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--link);
    opacity: 0.15;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
    z-index: -1;
    border-radius: 3px;
}

a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Common List Styling */
ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0.8rem;
}

li {
    padding-left: 20px;
    position: relative;
}

li::before {
    content: "→ ";
    position: absolute;
    left: 0;
}

/* Common Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes wiggle {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
    100% { transform: rotate(0deg); }
}

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

/* Badge Styling */
.new-badge {
    color: white;
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 0.7rem;
    margin-left: 4px;
    vertical-align: text-top;
    letter-spacing: 0;
}

/* Animation Utility Class */
.animate-in {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

/* Theme Toggle Styles */
.theme-toggle {
    position: relative;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--section-bg);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    opacity: 0.7;
    width: 32px;
    height: 32px;
    margin-left: auto;
}

.theme-toggle:hover {
    opacity: 1;
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    fill: var(--text);
}

/* Top Menu Styles */
.top-menu {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    opacity: 0.7;
    align-items: center;
    justify-content: flex-start;
    letter-spacing: -0.02em;
    line-height: 24px;
}

.menu-item {
    color: var(--text);
    text-decoration: none;
    transition: opacity 0.2s ease;
    position: relative;
    padding: 0 4px;
    margin: 0;
    font-size: 16px;
    letter-spacing: -0.02em;
    line-height: 24px;
    display: inline-block;
}

/* Disable general 'a::after' background effect for menu items */
.menu-item::after {
    transform: none !important; /* Prevent scaling */
    background-color: var(--text) !important; /* Ensure underline color */
    height: 1px !important; /* Ensure underline height */
    bottom: -2px !important; /* Position underline correctly */
    opacity: 0; /* Start hidden */
    transition: opacity 0.2s ease !important; /* Use opacity transition */
}

/* Original menu-item underline styles (adjusted) */
/* .menu-item::after { */
/*     content: ''; */
/*     position: absolute; */
/*     left: 0; */
/*     width: 100%; */
    /* height: 1px; */ /* Controlled above */
    /* background-color: var(--text); */ /* Controlled above */
    /* opacity: 0; */ /* Controlled above */
    /* transition: opacity 0.2s ease; */ /* Controlled above */
    /* bottom: -2px; */ /* Controlled above */
/* } */

.menu-item:hover::after {
    opacity: 0.5 !important; /* Fade in underline on hover */
}

.menu-item.active {
    color: var(--link);
}

.menu-item.active::after {
    opacity: 0.8;
    background-color: var(--link);
}

.menu-item:hover {
    opacity: 1;
}

/* Theme Text Toggle */
.theme-text {
    font-size: 13px;
    opacity: 0.8;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.theme-text::after {
    display: none;
}

/* Theme Options */
.theme-option {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.theme-separator {
    opacity: 0.5;
}

/* When light theme is active */
[data-mode="light"] .theme-option.light {
    opacity: 1;
}

/* When dark theme is active */
[data-mode="dark"] .theme-option.dark {
    opacity: 1;
}

/* New Badge in Menu */
.new-badge {
    font-size: 0.55rem;
    color: #ff0000;
    background: transparent;
    border: none;
    margin-left: 2px;
    letter-spacing: 0;
    font-weight: normal;
    position: absolute;
    top: -0.5rem;
    right: -1.5rem;
}

/* Number Munchers page styling */
.game-body {
    background-color: var(--bg) !important;
    margin: 0;
    padding: 0;
    height: 100vh;
    font-family: 'Courier New', 'Monaco', 'Lucida Console', monospace;
    overflow: hidden;
}

/* Main game layout - left/right split */
/* Game Over Modal */
.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.game-over-modal.hidden {
    display: none;
}

.game-over-content {
    background: linear-gradient(135deg, var(--bg) 0%, rgba(255,255,255,0.1) 100%);
    border: 3px solid var(--frame);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Game Layout - Now 2 columns */
.game-layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    gap: 30px;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transform: scale(0.95) translateY(20px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-layout.game-loaded {
    opacity: 1;
    transform: scale(1) translateY(0);
}



/* Loading state - game is visible immediately */
.game-loading {
    opacity: 1 !important;
    transform: none !important;
}

/* Staggered animation states */
.game-left-panel-ready {
    opacity: 1 !important;
}

.game-board-ready {
    opacity: 1 !important;
}

/* Left Panel - Levels & Progress */
.left-panel {
    width: 380px;
    background-color: var(--game-score-bg);
    border: 3px solid var(--game-board-frame);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.left-panel h2 {
    color: var(--game-text);
    font-size: 1.4rem;
    margin: 0;
    text-align: center;
    font-weight: bold;
}

.left-panel h3 {
    color: var(--game-text);
    font-size: 1.1rem;
    margin: 0 0 1rem 0;
    font-weight: 600;
}

/* Progress Section */
.progress-section {
    border-top: 2px solid var(--game-board-frame);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Game Types Section */
.game-types-section {
    margin-bottom: 1rem;
}

.game-types-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-type-btn {
    padding: 12px 16px;
    border: 2px solid #22c55e;
    border-radius: 6px;
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.game-type-btn:hover:not(.locked) {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
    border-color: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.game-type-btn.active {
    background: linear-gradient(135deg, #4ade80 0%, #22d55f 100%);
    border-color: #22d55f;
    color: white;
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.5);
}

.game-type-btn.locked {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #a7f3d0;
    color: #059669;
    cursor: not-allowed;
    opacity: 0.8;
    box-shadow: 0 1px 4px rgba(167, 243, 208, 0.3);
}

/* Center - Game Area */
.game-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

/* Game Board Container */
.game-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

/* Stars progression display - In left panel */
.stars-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 16px 12px;
    background: linear-gradient(135deg, var(--game-score-bg) 0%, rgba(255,255,255,0.8) 100%);
    border: 3px solid var(--game-board-frame);
    border-radius: 16px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
}

.stars-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="sparkles" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="5" cy="5" r="1" fill="rgba(255,255,255,0.3)" opacity="0.6"><animate attributeName="opacity" values="0.3;1;0.3" dur="2s" repeatCount="indefinite"/></circle><circle cx="15" cy="15" r="0.5" fill="rgba(255,255,255,0.4)" opacity="0.8"><animate attributeName="opacity" values="0.8;0.3;0.8" dur="1.5s" repeatCount="indefinite"/></circle></pattern></defs><rect width="100" height="100" fill="url(%23sparkles)"/></svg>');
    pointer-events: none;
    z-index: 1;
}

.star {
    font-size: 2.6rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: grayscale(100%) opacity(0.4);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    line-height: 1;
    z-index: 2;
    animation: starTwinkle 3s ease-in-out infinite;
}

@keyframes starTwinkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.05) rotate(5deg); }
}

/* Stars Message */
.stars-message {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--title);
    text-align: center;
    padding: 0.5rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, var(--bg) 100%);
    border-radius: 8px;
    border: 2px solid var(--frame);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    animation: messageGlow 2s ease-in-out infinite alternate;
}

@keyframes messageGlow {
    0% { box-shadow: 0 2px 8px rgba(0,160,160,0.2); }
    100% { box-shadow: 0 2px 8px rgba(0,160,160,0.4); }
}

.star.earned {
    filter: none;
    transform: scale(1.1);
    text-shadow: 0 0 15px rgba(255,215,0,0.8), 0 3px 6px rgba(0,0,0,0.3);
    animation: sparkle 2s ease-in-out infinite alternate;
}

/* Reset Progress Link */
.reset-progress-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.reset-progress-link {
    color: #888;
    font-size: 12px;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.reset-progress-link:hover {
    opacity: 1;
    color: #666;
    text-decoration: underline;
}

/* Modal Buttons */
.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}

.play-again-btn.secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border: 3px solid #495057;
}

.play-again-btn.secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #3d4246 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(73, 80, 87, 0.4);
}

/* Star Attention Animation - First Play Only */
.star-attention {
    color: #FFD700 !important; /* Bright gold */
    filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1)) !important;
    text-shadow: 0 0 35px rgba(255, 215, 0, 1) !important;
    animation: starAttentionBounce 0.8s ease-in-out 3 alternate !important;
    z-index: 10 !important;
}

@keyframes starAttentionBounce {
    0% {
        transform: scale(1.0) rotate(0deg);
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.4));
    }
    25% {
        transform: scale(1.4) rotate(-5deg);
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.7));
    }
    50% {
        transform: scale(1.6) rotate(5deg);
        filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.9));
    }
    75% {
        transform: scale(1.8) rotate(-3deg);
        filter: drop-shadow(0 0 30px rgba(255, 215, 0, 1));
    }
    100% {
        transform: scale(1.2) rotate(0deg);
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
    }
}

@keyframes sparkle {
    0% { filter: brightness(1) drop-shadow(0 0 5px rgba(255,215,0,0.5)); }
    100% { filter: brightness(1.2) drop-shadow(0 0 12px rgba(255,215,0,1)); }
}

.star:hover {
    transform: scale(1.3);
    filter: none;
    text-shadow: 0 0 20px rgba(255,215,0,0.9), 0 4px 8px rgba(0,0,0,0.4);
}

.star.locked:hover {
    filter: grayscale(100%) opacity(0.5);
    transform: scale(1.1);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Celebration screen */
.celebration-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--game-text);
    margin-bottom: 1rem;
    margin-top: 2rem;
    text-align: center;
    z-index: 1050;
    position: relative;
}

.celebration-message {
    font-size: 1.3rem;
    color: var(--game-text);
    margin-bottom: 2rem;
    margin-top: 1rem;
    text-align: center;
    z-index: 1050;
    position: relative;
    line-height: 1.4;
    padding: 0 1rem;
}

.celebration-content {
    margin-top: 8rem; /* Space for star animation above */
    position: relative;
    z-index: 1050;
}

/* Confetti animation */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--tile-eaten);
    animation: confetti-fall 3s linear infinite;
}

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

/* Star Earning Animation */
.star-earning-animation {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100;
    pointer-events: none;
    opacity: 0;
    animation: starEarningShow 0.5s ease forwards;
}

.star-burst {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
}

.star-center {
    font-size: 3rem;
    z-index: 2;
    position: relative;
    animation: starGlow 2s ease-in-out infinite alternate;
}

.star-rays {
    position: absolute;
    width: 100%;
    height: 100%;
    animation: rayRotate 3s linear infinite;
}

.ray {
    position: absolute;
    width: 4px;
    height: 60px;
    background: linear-gradient(to top, var(--tile-eaten), transparent);
    border-radius: 2px;
    transform-origin: bottom center;
}

.ray-1 { transform: rotate(0deg); }
.ray-2 { transform: rotate(60deg); }
.ray-3 { transform: rotate(120deg); }
.ray-4 { transform: rotate(180deg); }
.ray-5 { transform: rotate(240deg); }
.ray-6 { transform: rotate(300deg); }

.star-earned-text {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--title);
    margin-top: 0.5rem;
    animation: textPulse 1.5s ease-in-out infinite alternate;
}

@keyframes starEarningShow {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes starGlow {
    0% {
        filter: drop-shadow(0 0 10px var(--tile-eaten));
        transform: scale(1);
    }
    100% {
        filter: drop-shadow(0 0 30px var(--tile-eaten));
        transform: scale(1.1);
    }
}

@keyframes rayRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes textPulse {
    0% {
        transform: scale(1);
        color: var(--title);
    }
    100% {
        transform: scale(1.1);
        color: var(--tile-eaten);
    }
}

/* Game Title */
.game-title {
    text-align: center;
    font-family: 'Courier New', 'Monaco', 'Lucida Console', monospace;
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--title);
    margin: 1rem auto;
    padding: 0.5rem;
    text-rendering: optimizeSpeed;
    text-rendering: pixelated;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: unset;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Black Square Window - for Number Munchers page */
.black-square-window {
    width: 100%;
    max-width: 610px; /* 650px max-width minus 40px total padding */
    aspect-ratio: 1 / 1; /* Maintains square shape */
    border: 4px solid var(--frame);
    background-color: var(--frame);
    margin: 2rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 8px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Game board container */
.game-board {
    width: 500px;
    height: 500px;
    border: 4px solid var(--frame);
    background-color: var(--grid);
    border-radius: 8px;
    padding: 8px;
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 3px;
    width: 100%;
    height: 100%;
    background-color: var(--grid);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.grid-cell {
    background-color: var(--tile);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', 'Monaco', 'Lucida Console', monospace;
    font-size: 2rem;
    font-weight: bold;
    color: var(--num);
    text-rendering: optimizeSpeed;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    position: relative;
}

/* Enhanced tile styling */
.tile {
    border: 3px solid var(--grid);
    box-shadow: 2px 2px 0 0 rgba(0,0,0,.08); /* pixel offset */
    border-radius: 2px; /* chunky corners */
}

.tile.blocked {
    background: var(--tile-blocked);
    border-color: var(--tile-blocked-border);
    color: var(--blocked-num);
}

.tile.eaten {
    background: var(--tile-eaten);
    border-color: var(--tile-eaten-border);
    color: var(--eaten-num);
}

.tile.wrong {
    background: var(--tile-wrong);
    border-color: var(--tile-wrong-border);
    color: var(--wrong-num);
}

/* Player cell styling */
.player-cell {
    background-color: var(--tile) !important;
}

/* Number Muncher Character */
.number-muncher {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    z-index: 1;
    pointer-events: none;
}

.muncher-sprite {
    width: 80%;
    height: 80%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}












/* Game Header */
.game-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.2rem 2rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    border: 2px solid var(--frame);
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    gap: 0.8rem;
}

.game-title {
    text-align: center;
    font-family: 'Courier New', 'Monaco', 'Lucida Console', monospace;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--title);
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* Lives Display - Below the title */
.lives-display {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mistakes-munchers {
    display: flex;
    gap: 0.5rem;
}

.mistake-muncher {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--tile);
    border: 2px solid var(--grid);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.mistake-muncher.lost {
    background-color: var(--tile-wrong);
    border-color: var(--tile-wrong-border);
    transform: scale(0.8);
    opacity: 0.3;
    animation: muncherFade 0.5s ease-out;
}

@keyframes muncherFade {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0.3;
    }
}

.mistake-sprite {
    width: 28px;
    height: 28px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    transition: all 0.2s ease;
}

.mistake-muncher:not(.lost) .mistake-sprite {
    animation: muncherBounce 2s ease-in-out infinite;
}

@keyframes muncherBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}



.game-over-message {
    font-size: 1.1rem;
    color: var(--title);
    margin-bottom: 1rem;
    font-weight: bold;
    padding: 1rem;
    background-color: var(--score-bg);
    border-radius: 8px;
    border: 2px solid var(--frame);
}

/* Instructions Section */
.instructions {
    background-color: var(--bg);
    border: 3px solid var(--frame);
    border-radius: 12px;
    padding: 1.5rem;
}

.instructions h3 {
    margin: 0 0 1rem 0;
    color: var(--title);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.key {
    background-color: var(--tile);
    color: var(--num);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
    border: 2px solid var(--frame);
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

.description {
    color: var(--title);
    font-weight: bold;
}

.goal {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--score-bg);
    border-radius: 8px;
    color: var(--title);
    font-weight: bold;
    text-align: center;
    border: 2px solid var(--frame);
}

.completion-rating {
    font-size: 1.1rem;
    color: var(--frame);
    margin-bottom: 1rem;
    font-weight: bold;
}



/* Game Over Screen in Right Panel */


.hidden {
    display: none;
}

.play-again-btn {
    background-color: var(--tile-wrong);
    color: var(--wrong-num);
    border: 2px solid var(--tile-wrong-border);
    padding: 0.75rem 1.5rem;
    font-family: 'Courier New', 'Monaco', 'Lucida Console', monospace;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    text-rendering: optimizeSpeed;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

.play-again-btn:hover {
    background-color: var(--tile-wrong-border);
    transform: translateY(-2px);
}

/* Let's Play Button */
.lets-play-btn {
    background-color: var(--tile);
    color: var(--num);
    border: 2px solid var(--num);
    padding: 1rem 2rem;
    font-family: 'Courier New', 'Monaco', 'Lucida Console', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 1rem;
    text-rendering: optimizeSpeed;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.lets-play-btn:hover {
    background-color: var(--num);
    color: var(--frame);
    transform: translateY(-2px);
}

.lets-play-btn:active {
    transform: translateY(0);
}

/* Eaten tile styling */
.grid-cell.eaten {
    background-color: var(--tile-eaten) !important;
    border: 1px solid var(--tile-eaten-border) !important;
    color: var(--eaten-num) !important;
}

/* Wrong answer feedback */
.grid-cell.wrong {
    background-color: var(--tile-wrong) !important;
    border: 1px solid var(--tile-wrong-border) !important;
    color: var(--wrong-num) !important;
    animation: wrongFlash 0.5s ease;
}



@keyframes wrongFlash {
    0%, 100% { background-color: var(--tile-wrong); }
    50% { background-color: color-mix(in srgb, var(--tile-wrong) 80%, white); }
}

/* Celebration/Loading Screen Styles */
.loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: color-mix(in srgb, var(--bg) 95%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    font-family: 'Courier New', 'Monaco', 'Lucida Console', monospace;
}

.loading-screen.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: var(--num);
    padding: 2rem;
    background-color: var(--frame);
    border: 2px solid var(--tile);
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 480px) {
    body {
        padding: 0 15px;
        margin: 30px auto;
    }
    
    .top-menu {
        gap: 0.8rem;
        margin-bottom: 1.5rem;
    }
    
    .menu-item {
        font-size: 16px;
    }
    
    .theme-toggle {
        width: 28px;
        height: 28px;
        padding: 5px;
    }
    
    .theme-toggle svg {
        width: 14px;
        height: 14px;
    }
    
    .black-square-window {
        width: 100%;
        max-width: calc(100vw - 30px); /* Account for mobile padding */
        margin: 1.5rem auto;
    }
    
    .loading-content {
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    .loading-bar-container {
        width: 250px;
    }
    
    .loading-text {
        font-size: 1rem;
    }

    /* Mobile responsive layout for Number Munchers */
    .game-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 10px;
        gap: 20px;
    }
    
    .left-panel {
        width: 100%;
        padding: 1rem;
        order: 2; /* Move to middle on mobile */
    }

    .star {
        font-size: 2.2rem; /* Smaller on mobile for better fit */
    }

    .stars-message {
        font-size: 0.75rem;
        padding: 0.4rem;
    }

    .star-attention {
        font-size: 2.4rem !important; /* Slightly smaller bounce on mobile */
        animation: starAttentionBounceMobile 0.6s ease-in-out infinite alternate !important;
    }

    @keyframes starAttentionBounceMobile {
        0% {
            transform: scale(1.0) rotate(0deg);
            filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
        }
        25% {
            transform: scale(1.3) rotate(-4deg);
            filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.7));
        }
        50% {
            transform: scale(1.4) rotate(4deg);
            filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.9));
        }
        75% {
            transform: scale(1.5) rotate(-2deg);
            filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1));
        }
        100% {
            transform: scale(1.1) rotate(0deg);
            filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
        }
    }

    .game-section {
        order: 1; /* Keep game at top on mobile */
    }

    .game-header {
        padding: 0.8rem 1.5rem;
        gap: 0.6rem;
    }

    .game-title {
        font-size: 1.5rem;
    }



    .mistake-muncher {
        width: 35px;
        height: 35px;
    }

    .mistake-sprite {
        width: 25px;
        height: 25px;
    }
    
    .left-panel h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .left-panel h3 {
        font-size: 1rem;
        margin: 1rem 0 0.5rem 0;
    }
    
    .game-types-list {
        gap: 6px;
    }
    
    .game-type-btn {
        padding: 10px 12px;
        font-size: 0.85rem;
        gap: 6px;
    }
    
    .game-section {
        padding: 1rem;
        order: 1; /* Keep game at top */
    }
    
    .game-board {
        width: 90vw;
        height: 90vw;
        max-width: 400px;
        max-height: 400px;
    }
    

    
    .instructions {
        padding: 1rem;
    }
    
    .key {
        min-width: 50px;
        padding: 0.4rem 0.6rem;
    }
    

} 