/* -------------------------------------------
   BACKGROUND IMAGE + GLOBAL PAGE STYLING
   ------------------------------------------- */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    overflow: hidden; /* Prevent scrolling on main menu */
    height: 100vh; /* Lock to viewport height */
}

* {
    box-sizing: border-box;
}

/* Remove the duplicate body.game-active rules and body::before stays the same */

/* Keep your existing body background and font styles */
body {
    background-image: url("images/PvZ Background.webp");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
}

body.game-active {
    overflow-y: auto; /* Allow scrolling when game is active */
    min-height: 100vh;
}

* {
    box-sizing: border-box;
}

@font-face {
    font-family: 'Cafeteria';
    src: url('fonts/Cafeteria-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

body {
    background-image: url("images/PvZ Background.webp");
    background-size: cover;
    background-position: top;
    background-repeat: no-repeat;
    background-attachment: fixed;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
}

/* -------------------------------------------
   PAGE LAYOUT & TITLE
   ------------------------------------------- */

.container {
    text-align: center;
    margin-top: 2%;
    min-height: calc(100vh - 100px);
    position: relative;
    padding-bottom: 20px; /* Small default padding */
}

.title {
    display: inline-block;
    margin-top: -1%;
    margin-bottom: -2%;
    margin-left: 2.5%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.title img {
    width: 500px; /* Increased from 400px */
    left: 1000px;
    height: auto;
    filter: drop-shadow(3px 3px 6px black);
}

.title:hover {
    transform: scale(1.05);
}

/* -------------------------------------------
   GAME MODE BUTTONS WITH SIDE ICONS
   ------------------------------------------- */

/* -------------------------------------------
   GAME MODE BUTTONS WITH SIDE ICONS
   ------------------------------------------- */

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -2%;
    margin-left: 5%;
}

.menu-btn-combo {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
    margin-bottom: -20px; /* Reduced spacing between buttons */
}

/* Menu button styling */
.menu-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 35px 100px; /* Reduced from 40px to 25px */
    margin: 0;
    font-size: 28px;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background-color: transparent;
    background-image: url('images/button.webp');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    transition: 0.2s ease;
    text-align: center;
    position: relative;
    z-index: 1;
    min-width: 300px;
    pointer-events: none; /* Let the combo handle clicks */
}

.menu-btn span {
    position: relative;
    top: -1px; /* Adjusted from -3px */
    pointer-events: none;
}

/* Menu icon styling */
.menu-icon {
    object-fit: contain;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.5));
    position: absolute;
    z-index: 2;
    transition: transform 0.2s ease;
    pointer-events: none; /* Let the combo handle clicks */
}

/* Specific icon positioning and sizing */

/* Classic Icon */
.classic-icon {
    width: 75px;
    height: 75px;
    left: -85px; /* Position to the left of the button */
    top: 50%;
    transform: translateY(-50%);
}

/* Plant Icon */
.plant-icon {
    width: 65px;
    height: 65px;
    left: -80px; /* Position to the left of the button */
    top: 50%;
    transform: translateY(-50%);
}

/* Zombie Icon */
.zombie-icon {
    width: 65px;
    height: 65px;
    left: -80px; /* Position to the left of the button */
    top: 50%;
    transform: translateY(-50%);
}

/* Hover effects - apply to both button and icon when combo is hovered */
.menu-btn-combo:hover .menu-btn {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.menu-btn-combo:hover .menu-icon {
    transform: translateY(-50%) scale(1.1);
}

/* -------------------------------------------
   GUESS BAR WITH IMAGE BUTTON
   ------------------------------------------- */

/* Guess bar layout */
.guess-bar {
    margin-top: -10px; /* Moved way up - adjust this value as needed */
    display: none;
    justify-content: center;
    position: relative;
}

.guess-bar.active {
    display: flex;
}

/* Wrapper around input and image button */
.guess-wrapper {
    position: relative;
    display: inline-block;
}

/* Input box */
.guess-wrapper input {
    padding: 10px 150px 10px 15px;
    font-size: 24px;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    font-weight: bold;
    border: 4px solid purple;
    border-radius: 8px;
    text-align: left;
}

.guess-wrapper input::placeholder {
    padding-left: 0;
    text-align: left;
}  

.guess-wrapper input:focus {
    outline: none;
    border-color: #9C27B0;
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.5);
}

/* Guess image button inside input box */
.guess-button {
    position: absolute;
    top: 12.5%;
    right: 5px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.guess-img {
    width: 45px;
    height: auto;
    display: block;
}

.guess-button:hover .guess-img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* -------------------------------------------
   AUTOCOMPLETE DROPDOWN
   ------------------------------------------- */

#autocompleteDropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background-color: white;
    border: 4px solid purple;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

#autocompleteDropdown.active {
    display: block;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    text-align: left;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    font-size: 18px;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #7CB342;
    color: white;
}

.autocomplete-item.no-match {
    cursor: default;
    color: #999;
    text-align: center;
}

.autocomplete-item.no-match:hover {
    background-color: transparent;
    color: #999;
}

.autocomplete-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
}

/* -------------------------------------------
   BOX CONTAINER
   ------------------------------------------- */

#boxContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 0;
    transition: margin-bottom 0.3s ease;
}

.box-row {
    display: flex;
    gap: 5px;
}

@media (max-width: 768px) {
    .box {
        width: 50px;
        height: 50px;
        font-size: 12px;
    }
    
    .header-label {
        width: 50px;
        font-size: 16px;
    }
    
    .title img {
        width: 300px;
    }
    
    .menu-btn {
        padding: 20px 60px;
        font-size: 20px;
        min-width: 200px;
    }
    
    .guess-wrapper input {
        font-size: 18px;
        padding: 8px 120px 8px 12px;
    }
}

.box {
    width: 70px;
    height: 70px;
    border: 2px solid purple;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.25);
}

.box:hover {
    transform: scale(1.08);
}

.box.green { background-color: #11b519; color: white; }
.box.yellow { background-color: #FFC107; color: black; }
.box.red { background-color: #c11f1f; color: white; }

.box.green:hover { background-color: #19cf23; }
.box.red:hover { background-color: #d62828; }
.box.yellow:hover { background-color: #ffd94a; }

/* -------------------------------------------
   HEADER LABELS
   ------------------------------------------- */

.header-row {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.header-label {
    width: 70px;
    text-align: center;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px black;
    position: relative;
    padding-bottom: 6px;
}

.header-label::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0%;
    width: 70px;
    height: 3px;
    background-color: #ffffff;
    border-radius: 2px;
}

/* Icon boxes */
.icon-box {
    background-color: transparent !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
    filter: none !important;
    text-shadow: none !important;
}

.card-icon-box {
    width: 70px;
    height: 70px;
    object-fit: contain;
    transform: translate(6px, -3.5px);
}

/* -------------------------------------------
   ARROWS AND NUMBERS
   ------------------------------------------- */

.arrow-up-icon,
.arrow-down-icon {
    position: absolute;
    width: 60%;
    height: 100%;
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
    filter: drop-shadow(0 0 1px black);
}

.arrow-up-icon { margin-top: 10px; }
.arrow-down-icon { margin-bottom: 10px; }

.number-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-text {
    position: relative;
    z-index: 2;
    font-size: 22px;
    text-align: center;
    line-height: 1;
}

/* -------------------------------------------
   VICTORY SCREEN
   ------------------------------------------- */

.victory-box {
    background-color: rgba(29, 180, 27, 0.8);
    border: 3px solid purple;
    border-radius: 12px;
    padding: 30px 45px;
    text-align: center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
    max-width: 375px;
    margin: 22px auto;
}

.victory-title,
.victory-card-name,
.victory-tries,
.victory-next-label,
.victory-countdown,
.victory-timezone {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    color: white;
    text-shadow: 2px 2px 4px black;
}

.victory-title { font-size: 32px; margin-bottom: 15px; }
.victory-card-name { font-size: 27px; margin-bottom: 18px; }
.victory-tries { font-size: 21px; margin: 18px 0; }
.victory-next-label { font-size: 24px; margin-top: 22px; margin-bottom: 11px; }
.victory-countdown { font-size: 42px; font-weight: bold; margin: 15px 0; }
.victory-timezone { font-size: 15px; margin-top: 8px; }

.victory-icon {
    width: 150px;
    height: 150px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

.victory-next-mode-label {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    color: white;
    text-shadow: 2px 2px 4px black;
    font-size: 24px;
    margin: 15px 0 10px 0;
}

.victory-mode-icon-clickable {
    width: 75px;
    height: 75px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 15px 0;
}

.victory-mode-icon-clickable:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.6));
}

.victory-mode-name {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    color: white;
    text-shadow: 2px 2px 4px black;
    font-size: 28px;
    font-weight: bold;
    margin: 5px 0;
}

.victory-proceed-text {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 1px 1px 2px black;
    font-size: 16px;
    margin-top: 8px;
    font-style: italic;
}

/* -------------------------------------------
   SHARE BOX (SEPARATE FROM VICTORY)
   ------------------------------------------- */

.share-box {
    background-color: rgba(0, 0, 0, 0.7);
    border: 3px solid rgba(50, 46, 46, 0.7);
    border-radius: 12px;
    padding: 45px 30px;
    text-align: center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
    margin: 20px auto;
    margin-bottom: 100px; /* Add space below share box for bottom icons */
}


.share-title {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    color: #FFD700;
    text-shadow: 2px 2px 4px black;
    font-size: 32px;
    margin-bottom: 10px;
}

.share-subtitle {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    color: white;
    text-shadow: 2px 2px 4px black;
    font-size: 24px;
    margin-bottom: 20px;
}

.share-results-box {
    background-color: rgba(15, 13, 13, 0.6);
    border: #232723c8 solid 2px;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    color: white;
    text-align: left;
    white-space: pre-line;
    font-size: 16px;
    line-height: 1.2;
}

.share-copy-button {
    background-color: #4CAF50;
    color: white;
    border: 3px solid #2E7D32;
    border-radius: 8px;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    margin-top: 15px;
}

.share-copy-button:hover {
    background-color: #66BB6A;
    transform: scale(1.05);
}

.share-copy-button:active {
    transform: scale(0.98);
}

/* -------------------------------------------
   TEST BUTTON
   ------------------------------------------- */

.test-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    background-color: #FFC107;
    color: #333;
    border: 2px solid #FFA000;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: all 0.2s;
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
}

.test-button:hover {
    background-color: #FFA000;
    transform: scale(1.05);
}

.endless-icon {
    width: 120px;
    height: 120px;
    left: -97px; /* Position to the left of the button */
    top: 43%;
    transform: translateY(-50%);
}

/* -------------------------------------------
   HARD MODE BUTTON (STATIC POSITION)
   ------------------------------------------- */

.top-ui {
    position: absolute;
    top: 3px;
    left: 80px;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 2000;
    pointer-events: none;
}

.hard-mode-btn {
    position: relative;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;

    background-color: #4CAF50;
    color: white;
    border: 3px solid #2E7D32;
    border-radius: 8px;

    box-shadow: 0 4px 6px rgba(0,0,0,0.3);

    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);

    transition: all 0.2s ease;
    pointer-events: auto;
    margin-left: 320px;
}

.hard-mode-btn:hover {
    background-color: #66BB6A;
    transform: scale(1.05);
}

.hard-mode-btn.active {
    background-color: #F44336;
    border-color: #C62828;
}

.hard-mode-btn.active:hover {
    background-color: #E57373;
}

.hard-mode-btn.locked {
    cursor: not-allowed;
    opacity: 0.9;
}

.hard-mode-btn.locked:hover {
    transform: scale(1.0);
}

/* Tooltip styling */
.hard-mode-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 14px;
    font-weight: normal;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 3000;
    text-shadow: none;
}

.hard-mode-btn:hover::after {
    opacity: 1;
}

/* -------------------------------------------
   BOTTOM CENTER ICONS
   ------------------------------------------- */

.bottom-left-icons {
    position: absolute;
    bottom: 20px; /* Default position when game starts */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    justify-content: center;
    z-index: 10;
    transition: bottom 0.3s ease; /* Smooth movement */
}

/* When on main menu (not game-active) */
body:not(.game-active) .bottom-left-icons {
    position: fixed;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
}

.icon-button {
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    text-decoration: none;
    padding: 0;
    overflow: hidden;
}

.icon-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.icon-button:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.7);
}

/* Special styling for question mark icon */
.icon-button.question-mark {
    background-color: white !important;
    border: 3px solid black !important;
}

/* -------------------------------------------
   INFO POPUP MODAL
   ------------------------------------------- */

.info-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.info-popup-overlay.active {
    display: flex;
}

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

/* Base spacing for guess grid */
#boxContainer {
    margin-bottom: 0;
    transition: margin-bottom 0.3s ease;
}

/* When extra spacing is needed */
#boxContainer.extra-gap {
    margin-bottom: 10vh; /* 10% of viewport height */
}


.info-popup-content {
    background: linear-gradient(135deg, #000000 0%, rgb(0, 0, 0) 100%);
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

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

/* Add this to your style.css file */

/* -------------------------------------------
   MESSAGE BOX (replaces alerts)
   ------------------------------------------- */

.message-box {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #a90404;
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    font-size: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 5000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    max-width: 500px;
    text-align: center;
}

.message-box.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.info-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.info-title {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    font-size: 36px;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    text-align: center;
}

.info-section {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.info-section h2 {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    font-size: 24px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 12px;
}

.info-section p {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    font-size: 16px;
    color: white;
    line-height: 1.6;
    margin-bottom: 10px;
}

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

.info-section ul li {
    font-family: 'Cafeteria', Arial, Helvetica, sans-serif;
    font-size: 16px;
    color: white;
    margin-bottom: 8px;
    padding-left: 10px;
}

.color-green {
    color: #11b519;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

.color-yellow {
    color: #FFC107;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

.color-red {
    color: #c11f1f;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Scrollbar styling for popup */
.info-popup-content::-webkit-scrollbar {
    width: 10px;
}

.info-popup-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.info-popup-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.info-popup-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}