/* ===== Colors and Theme Variables ===== */
:root {
    /* Primary colors */
    --primary-color: #3b82f6; /* Blue */
    --primary-dark: #2563eb;
    --accent-color: #10b981; /* Emerald */
    --accent-dark: #059669;
    
    /* Background and text colors */
    --bg-color: #111827; /* Dark gray/blue */
    --card-bg: #1f2937;
    --text-color: #f3f4f6;
    --light-text: #d1d5db;
    --border-color: #374151;
    --hover-color: #374151;
    
    /* Effects */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
}

/* ===== Base Styles ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

/* ===== Header Styles ===== */
h1 {
    font-family: 'Space Mono', monospace;
    font-size: 4.5rem;
    margin-bottom: 5px;
    letter-spacing: -2px;
    font-weight: 900;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

.subtitle {
    margin-bottom: 30px;
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.9;
}

/* ===== Layout ===== */
.game-container {
    max-width: 600px;
    width: 100%;
}

/* ===== Card Components ===== */
.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--box-shadow-hover);
}

/* Game Guide Section */
.game-guide {
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    background-color: rgba(59, 130, 246, 0.1);
}

.game-guide h2 {
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.6rem;
    font-family: 'Space Mono', monospace;
}

.guide-steps {
    list-style-type: none;
}

.guide-steps li {
    margin-bottom: 15px;
    position: relative;
    padding-left: 30px;
}

.guide-steps li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 18px;
    height: 18px;
    background-color: var(--primary-color);
    border-radius: 50%;
    opacity: 0.7;
}

/* ===== KaTeX and Equation Styles ===== */
/* Common KaTeX Display Styles */
.equation .katex-display > .katex,
.equation-box .katex-display > .katex {
    display: flex !important;
    justify-content: center;
    width: 100%;
}

/* Equation Example */
.equation-example {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

/* Equation and Letter Boxes */
.equation-box, .letter-box {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 15px;
    margin: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    min-height: 80px;
    font-size: 1.4rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.letter-box {
    font-weight: 700;
    background-color: var(--primary-color);
    color: white;
    text-transform: uppercase;
}

/* ===== Game Board ===== */
.game-board {
    border-radius: var(--border-radius);
    padding: 25px;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
}

/* Timer */
.timer {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 20px;
    font-weight: 500;
    color: var(--light-text);
    font-family: 'Space Mono', monospace;
}

/* Equations Container */
.equations {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

/* Individual Equation */
.equation {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin: 5px;
    width: calc(20% - 10px);
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.3rem;
    background-color: rgba(255, 255, 255, 0.03);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.equation .katex-display {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
}

.equation .katex {
    font-size: 1.8rem; 
    display: flex;
    align-items: center;
    justify-content: center;
}

.equation:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    background-color: rgba(255, 255, 255, 0.05);
}

/* ===== Answer Grid ===== */
.answers {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 30px;
}

.guess-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.answer-box {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin: 5px;
    width: calc(20% - 10px);
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: 'Space Mono', monospace;
}

/* Answer box states */
.answer-box:hover {
    border-color: var(--primary-color);
    background-color: var(--hover-color);
}

.answer-box.completed:hover {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
}

.answer-box.correct {
    background-color: var(--accent-color) !important;
    color: white !important;
    border-color: var(--accent-color) !important;
    transition: all 0.5s ease;
}

.answer-box.present {
    background-color: #d97706 !important; /* Amber-600 */
    color: white !important;
    border-color: #d97706 !important;
    transition: all 0.5s ease;
}

.answer-box.absent {
    background-color: #4b5563 !important; /* Gray-600 */
    color: white !important;
    border-color: #4b5563 !important;
    transition: all 0.5s ease;
}

/* Disable hover effect for status boxes */
.answer-box.correct:hover,
.answer-box.present:hover,
.answer-box.absent:hover {
    transform: none;
}

/* Active box highlighting */
.active {
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* ===== Virtual Keyboard ===== */
.keyboard {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
    width: 100%;
}

.key {
    background-color: var(--hover-color);
    border-radius: 8px;
    padding: 12px;
    margin: 3px;
    min-width: 40px;
    height: 50px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Mono', monospace;
}

/* Key states */
.key:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

.key:active {
    transform: translateY(1px);
}

/* ===== Button Styles ===== */
.start-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 15px 50px;
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    margin: 30px auto;
    display: block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
    font-family: 'Outfit', sans-serif;
}

.start-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.4);
}

.start-button:active {
    transform: translateY(1px);
}

/* ===== Date and Puzzle Number Display ===== */
.date-display {
    text-align: center;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--light-text);
}

.puzzle-number {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-family: 'Space Mono', monospace;
}

/* ===== Footer ===== */
footer {
    margin-top: 50px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--light-text);
    padding: 20px;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--accent-color);
}

/* ===== Responsive Design ===== */
@media (max-width: 600px) {
    /* Adjust size for medium screens */
    .equation, .answer-box {
        width: calc(33.33% - 10px);
    }
    
    h1 {
        font-size: 3.2rem;
    }

    .game-guide, .game-board {
        padding: 20px 15px;
    }
}

@media (max-width: 400px) {
    /* Further adjustments for small screens */
    .equation, .answer-box {
        width: calc(50% - 10px);
    }
    
    .key {
        min-width: 32px;
        height: 45px;
        padding: 8px;
        font-size: 0.9rem;
    }

    .equation {
        height: 90px;
    }
}

/* ===== State Styles & Animations ===== */
/* Success/completed state */
.completed {
    background-color: var(--accent-color) !important;
    color: white !important;
    border-color: var(--accent-color) !important;
    transition: all 0.5s ease;
}

/* Animation keyframes */
@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.success-animation {
    animation: success-pulse 0.8s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}
/* GitHub Link */
.github-link {
    margin-top: 10px;
}

.github-link img {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.github-link img:hover {
    opacity: 1;
}

/* Pop animation */
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.answer-box.pop {
    animation: pop 0.3s ease;
}


@media (max-width: 500px) {
    .answer-box {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
}

@media (max-width: 350px) {
    .answer-box {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Arrow styling for equation example */
.arrow-container {
    display: flex;
    align-items: center;
    margin: 0 10px;
    color: var(--primary-color);
}

.arrow-icon {
    width: 28px;
    height: 28px;
    stroke: var(--primary-color);
    opacity: 0.9;
    transition: all 0.2s ease;
}

.equation-example:hover .arrow-icon {
    transform: translateX(3px);
    opacity: 1;
}


/* Minimal mobile fixes */
@media (max-width: 600px) {
    /* Make answer boxes smaller on mobile */
    .answer-box {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
        margin: 3px;
    }
    
    /* Adjust equations for mobile */
    .equation {
        height: 75px;
        padding: 10px;
    }
    
    /* Ensure keyboard fits on small screens */
    .key {
        min-width: 28px;
        height: 40px;
        padding: 5px;
        margin: 2px;
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    /* Even smaller for very small screens */
    .answer-box {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    /* Make keyboard more compact */
    .key {
        min-width: 24px;
        padding: 2px;
    }
    
    /* Adjust special keys */
    .key[data-key="ENTER"], 
    .key[data-key="BACKSPACE"] {
        width: 50px;
        font-size: 0.8rem;
    }
}


/* Portrait mode fixes (vertical phone orientation) */
@media (max-width: 480px) and (orientation: portrait) {
    /* Make equations display in a single column or stack better */
    .equations {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }

    .equation {
        width: 100%;
        height: 60px;
        margin: 3px 0;
    }

    /* Make answer boxes fit better */
    .guess-row {
        justify-content: center;
        gap: 3px;
    }

    /* Adjust keyboard for better vertical fit */
    .keyboard {
        margin-top: 10px;
    }

    /* Reduce spacing to fit everything on screen */
    .timer {
        margin-bottom: 10px;
    }
}

/* Fix for portrait mode equations layout */
@media (max-width: 480px) and (orientation: portrait) {
    /* Keep equations in horizontal layout but make them smaller */
    .equations {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .equation {
        width: 30%;  /* Show 3 per row */
        height: 60px;
        margin: 3px;
        padding: 5px;
    }

    /* Make the text in equations smaller to fit better */
    .equation .katex {
        font-size: 1.1rem !important;
    }
}

/* Even smaller screens (iPhone SE size) */
@media (max-width: 375px) and (orientation: portrait) {
    .equation {
        width: 45%;  /* Show 2 per row */
        margin: 2px;
    }
}

/* Better fix for portrait mode layout */
@media (max-width: 480px) and (orientation: portrait) {
    /* Force equations to stay in a single row */
    .equations {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        overflow-x: auto; /* Allow horizontal scrolling if needed */
        width: 100%;
        padding-bottom: 10px; /* Space for scrollbar */
    }

    .equation {
        min-width: 65px;
        width: 18%;
        height: 65px;
        margin: 0 2px;
        padding: 5px;
        flex-shrink: 0;
    }

    /* Make keyboard bigger */
    .keyboard {
        margin-top: 15px;
    }

    .key {
        min-width: 32px;
        height: 45px;
        font-size: 1.1rem;
        margin: 3px;
    }

    /* Special keys */
    .key[data-key="ENTER"], 
    .key[data-key="BACKSPACE"] {
        min-width: 60px;
        font-size: 0.9rem;
    }

    /* Make answer boxes a bit smaller to fit better */
    .guess-row {
        gap: 4px;
    }

    .answer-box {
        width: 45px;
        height: 45px;
        margin: 3px;
    }
}

/* Improved fix for portrait mode layout */
@media (max-width: 480px) and (orientation: portrait) {
    /* Better equation sizing and alignment */
    .equations {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        width: 100%;
        margin-bottom: 15px;
    }

    .equation {
        width: 19%;
        min-width: 60px;
        height: 60px;
        margin: 0 1px;
        padding: 5px;
        flex-shrink: 0;
    }

    /* Scale down equation text */
    .equation .katex {
        font-size: 1rem !important;
        transform: scale(0.85);
        transform-origin: center center;
    }

    /* Make answer boxes larger */
    .answer-box {
        width: 60px !important;
        height: 60px !important;
        margin: 2px !important;
        font-size: 1.8rem !important;
    }

    /* Fix keyboard alignment */
    .keyboard {
        width: 100%;
        margin: 10px auto 0;
        padding: 0;
    }

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

    .key {
        min-width: 28px;
        height: 42px;
        margin: 2px;
        padding: 0;
        font-size: 1rem;
    }

    /* Game board spacing */
    .game-board {
        padding: 15px 10px;
    }

    /* Keep answer rows centered */
    .guess-row {
        justify-content: center;
    }
}

/* Even smaller screens */
@media (max-width: 360px) and (orientation: portrait) {
    .key {
        min-width: 24px;
        height: 38px;
        margin: 1px;
        font-size: 0.9rem;
    }

    .key[data-key="ENTER"], 
    .key[data-key="BACKSPACE"] {
        width: 50px !important;
        font-size: 0.8rem;
    }
}

/* Mobile inputs styling */
.mobile-input {
    border: none;
    background: transparent;
    outline: none;
    caret-color: transparent;
}

/* Hide virtual keyboard on mobile */
@media (max-width: 767px) {
    .keyboard {
        display: none;
    }
}

/* Make answer boxes clickable on mobile */
.answer-box {
    position: relative;
}


.explanation-section {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-top: 30px;
    margin-bottom: 40px;
    box-shadow: var(--shadow);
    border: 2px solid var(--primary-color);
    opacity: 0;
    animation: fade-in 0.8s forwards;
    animation-delay: 0.5s;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.explanation-title {
    color: var(--primary-color);
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 5px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
}

.explanation-subtitle {
    text-align: center;
    color: var(--light-text);
    margin-bottom: 25px;
    font-weight: 300;
}

.explanation-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.explanation-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.explanation-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.explanation-letter {
    background-color: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    margin-right: 15px;
    font-family: 'Space Mono', monospace;
    flex-shrink: 0;
}

.explanation-equation {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    flex-grow: 1;
}

.explanation-equation .latex {
    color: var(--text-color);
    font-size: 1.3rem;
    margin-right: 20px;
    min-width: 100px;
}

.explanation-text {
    color: var(--light-text);
    font-weight: 300;
    flex-grow: 1;
    margin-left: auto;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .explanation-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
    }
    
    .explanation-letter {
        margin-bottom: 10px;
    }
    
    .explanation-equation {
        width: 100%;
        margin-left: 0;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .explanation-equation .latex {
        margin-bottom: 8px;
        margin-right: 0;
    }
    
    .explanation-text {
        margin-top: 8px;
        margin-left: 0;
    }
}

@media (max-width: 400px) {
    .explanation-section {
        padding: 15px;
    }
    
    .explanation-title {
        font-size: 1.3rem;
    }
}


.equation {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.equation:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.equation::after {
    content: "🔍";
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.equation:hover::after {
    opacity: 0.7;
}

/* Modal styling */
.equation-modal-overlay {
    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: 1100;
    animation: fadeIn 0.3s ease;
}

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

.equation-modal-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    position: relative;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); }
    to { transform: scale(1); }
}

.equation-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    background: none;
    border: none;
    color: var(--light-text);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.equation-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.expanded-equation {
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.expanded-equation .katex {
    font-size: 2rem !important;
    margin-bottom: 20px;
}

.expanded-equation-explanation {
    color: var(--light-text);
    font-size: 1.1rem;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    text-align: center;
}

/* Mobile optimization */
@media (max-width: 480px) {
    .equation-modal-content {
        padding: 20px 15px;
    }
    
    .expanded-equation .katex {
        font-size: 1.5rem !important;
    }
    
    .expanded-equation-explanation {
        font-size: 1rem;
    }
}

/* Make explanation equations clickable too */
.explanation-equation {
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 8px;
    padding: 5px;
}

.explanation-equation:hover {
    background-color: rgba(255, 255, 255, 0.08);
}


.mobile-pulse {
    animation: pulse-animation 2s infinite;
    position: relative;
}


.mobile-pulse::after {
    content: "";
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--primary-color);
    background-color: var(--card-bg);
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0.9;
    pointer-events: none;
}

@keyframes pulse-animation {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}


/* Make sure these match the tile colors you’re using */
.key.correct {
    background-color: var(--accent-color) !important; /* Green */
    color: white;
    border-color: var(--accent-color) !important;
  }
  
  .key.present {
    background-color: #d97706 !important; /* Amber/Yellow */
    color: white;
    border-color: #d97706 !important;
  }
  
  .key.absent,
  .answer-box.absent {
      background-color: #787c7e !important; /* a lighter gray */
      color: white;
      border-color: #787c7e !important;
  }


  /* Explanation letters colored like tiles */
.explanation-letter.correct {
    background-color: var(--accent-color) !important; /* green */
    color: white;
    border-color: var(--accent-color) !important;
  }
  
  .explanation-letter.present {
    background-color: #d97706 !important; /* amber/yellow */
    color: white;
    border-color: #d97706 !important;
  }
  
  .explanation-letter.absent {
    background-color: #787c7e !important; /* lighter gray */
    color: white;
    border-color: #787c7e !important;
  }
  
  .streak-display {
    text-align: center;
    margin-top: 5px;
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1rem;
    font-family: 'Space Mono', monospace;
}


@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
  }
  .shake {
    animation: shake 0.5s;
  }
  .invalid-word-message {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(239, 68, 68, 0.9);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 1500;
    font-family: 'Space Mono', monospace;
    opacity: 1;
    transition: opacity 0.3s ease;
  }

  /* Unlimited Mode Button Styles */
#unlimited-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 15px 50px;
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    margin: 10px auto 30px;
    display: block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
    font-family: 'Outfit', sans-serif;
}
  
#unlimited-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.4);
}
  
#unlimited-button:active {
    transform: translateY(1px);
}
  
/* Buttons in unlimited-mode end-of-game dialogs */
.unlimited-message-btn {
    margin-top: 15px;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
  
.unlimited-play-again {
    background-color: var(--accent-color);
    color: white;
}
  
.unlimited-show-solutions {
    background-color: var(--primary-color);
    color: white;
}
  
.unlimited-message-btn:hover {
    transform: translateY(-2px);
}
  
.unlimited-message-btn:active {
    transform: translateY(1px);
}
  
/* Styling for the unlimited mode button in the explanation section */
#explanation-unlimited-button {
    background-color: var(--primary-color);
    margin-top: 20px;
    transition: all 0.3s ease;
}
  
#explanation-unlimited-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.4);
}
  
  /* Special styling for the explanation section unlimited mode container */
  .unlimited-mode-container {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
    border-top: 1px solid var(--border-color);
  }
  
  .unlimited-mode-message {
    margin-bottom: 15px;
    color: var(--light-text);
    font-size: 1.1rem;
  }
  
  /* Style for the unlimited mode indicator */
  .unlimited-mode-badge {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 10px;
    vertical-align: middle;
    font-family: 'Space Mono', monospace;
    animation: pulse 2s infinite;
  }
  
  @keyframes pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
  }
  
  /* Make puzzle number appear differently in unlimited mode */
  .puzzle-number.unlimited-active {
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: 1px;
  }
  
  /* Animation for revealing the unlimited button after completing daily puzzle */
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .fade-in-up {
    animation: fadeInUp 0.8s forwards;
  }
  
  /* Custom styling for the unlimited section in the explanation */
  .unlimited-cta-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px dashed var(--border-color);
    text-align: center;
    animation: fadeInUp 0.8s forwards;
    animation-delay: 0.3s;
    opacity: 0;
  }
  
  .unlimited-cta-title {
    font-family: 'Space Mono', monospace;
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 10px;
  }
  
  .unlimited-cta-subtitle {
    color: var(--light-text);
    font-size: 1rem;
    margin-bottom: 20px;
  }

  /* Fix for the main "Play today's Physicle" button */
/* Main button styles */
#start-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 15px 50px;
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    margin: 30px auto;
    display: block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
    font-family: 'Outfit', sans-serif;
}
  
#start-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.4);
}
  
#start-button:active {
    transform: translateY(1px);
}
  
  /* Fix for the modals/popups */
  .success-modal, .failure-modal {
    position: fixed !important;
    top: 20% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background-color: var(--card-bg);
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 1000;
    text-align: center;
    width: 90%;
    max-width: 400px;
  }


  /* Styling for dual buttons in modals */
.modal-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
  }
  
  .modal-btn {
    flex: 1;
    margin: 0 5px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
  }
  
  .modal-btn.primary {
    background-color: var(--primary-color);
  }
  
  .modal-btn.accent {
    background-color: var(--accent-color);
  }
  
  .modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }
  
  .modal-btn:active {
    transform: translateY(0);
  }
  
  /* Styling for the play again button in explanation section */
  #explanation-play-again-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 15px;
    display: inline-block;
    transition: all 0.3s ease;
  }
  
  #explanation-play-again-button:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
  }
  
  /* Styling for unlimited mode header in explanation */
  .unlimited-mode-indicator {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-left: 10px;
    vertical-align: middle;
  }

/* Improved styling for the special hint about math symbols */
.special-hint {
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    position: relative;
    border-left: 3px solid var(--primary-color);
}

/* Remove the default bullet from the guide steps list item */
.guide-steps li.special-hint::before {
    display: none;
}

/* Adjust the special-hint to remove the default padding-left from guide-steps */
.guide-steps li.special-hint {
    padding-left: 15px;
}

.special-hint strong {
    color: var(--primary-color);
    font-family: 'Space Mono', monospace;
    margin-right: 5px;
}

.symbol-examples {
    list-style-type: none;
    margin-top: 10px;
    margin-left: 0;
    padding-left: 0;
}

.symbol-examples li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 20px;
}

.symbol-examples li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.math-symbol {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 2px;
    font-family: 'KaTeX_Math', serif;
    color: var(--accent-color);
}


