body {
    margin: 0;
    padding: 0;
    background-color: white; /* ודא שהרקע של הדף הוא לבן */
}
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
.square-game-container {
    width: 94%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: Arial, sans-serif;
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
}

.grid-container {
    margin: 0;
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 300px;
    max-height: 600px;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    box-sizing: border-box;
}

.grid-wrapper {
    display: grid;
    grid-template-columns: 40px repeat(9, 1fr);
    grid-template-rows: 40px repeat(9, 1fr);
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.grid-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    color: #333;
    background: #f7f7f7;
    border: 1px solid #f7f7f7;
    box-sizing: border-box;
}

.grid-label:first-child {
    background-image: url('https://stock-home.co.il/wp-content/uploads/2025/04/logo-עגול-1.jpg');
    background-size: cover;
    background-position: center;
    border: none;
}

.square {
    border: 1px solid #f7f7f7;
    background: transparent;
    box-sizing: border-box;
}

.square:not(.selected):hover {
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.square.selected {
    background: #fff;
}

.square.animate-break {
    animation: break 1s ease-in-out;
}

@keyframes break {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.9); opacity: 0.7; filter: brightness(0.8); }
    100% { transform: scale(1); opacity: 1; filter: brightness(1); }
}

.chat-container {
    margin-top: 20px;
}

.chat-messages div {
    font-family: system-ui;
    font-size: 28px;
    text-shadow: #000000 0px 1px 1px;
    color: #a27c1b;
    background: #ffffff;
    padding: 10px 20px;
    margin: 10px 0;
    font-weight: 500;
}

.chat-messages {
    height: auto !important;
    overflow-y: auto;
    border-bottom: 0 !important;
    border: 10px solid #f9f9f9;
    padding: 0 15px 10px;
    background: #f9f9f9;
    border-radius: 4px;
    direction: rtl;
}

.chat-messages div {
    direction: rtl;
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.chat-icon {
    margin: 0 10px 0;
    width: 40px;
    height: 40px;
    vertical-align: middle;
}

.chat-input {
    display: flex;
    margin: 20px 15px 0 0;
}

.chat-input input {
    flex: 1;
    outline: none;
    margin: 0 0 0 10px;
}

.chat-input button {
    padding: 0 20px;
    border: 1px solid #a27c1b;
    color: #a27c1b;
    border-radius: 2px;
    cursor: pointer;
    margin: 2px 0 0 10px;
    height: 36px;
    line-height: 34px;
    min-height: 36px;
    background: #fff;
}



.chat-input button:disabled {
    background: #fff;
    cursor: not-allowed;
}

.block-message {
    color: red;
    margin-top: 10px;
}

.timer-message {
    margin: 10px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 4px;
    color: #333;
    font-size: 14px;
}

.timer-content p {
    margin: 0;
    font-weight: bold;
}

.timer {
    color: #a27c40;
}

.coupon-text {
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 18px;
    color: #a27c40;
}

.popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup-content {
    background: white;
    padding: 20px 20px 30px;
    border-radius: 8px;
    width: 85%;
    min-height: 190px;
    max-width: 310px;
    text-align: center;
    direction: rtl;
    color: #333;
}

.popup-content h2 {
    font-size: 22px;
    background: #f0f0f0;
    color: #333;
    width: 92%;
    margin: 10px auto;
    padding: 1px 0 2px;
}

.popup-content .close-button {
    padding: 0 16px;
    margin: 0;
    border-radius: 4px;
    cursor: pointer;
    background: #f0f0f0;
    color: #333333;
    width: 92%;
}

.coupon-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.coupon-input {
    width: 120px !important;
    border: 1px solid #a27c40 !important;
    border-radius: 4px !important;
    margin: 0 10px 0;
    text-align: center;
    font-family: monospace;
    background: #f9f9f9;
    color: #a27c40 !important;
}

.tooltip {
    position: relative;
    display: inline-block;
}

.coupon-button {
    font-size: 14px;
    padding: 0 16px;
    margin: 2px 0 0;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #a27c1b;
    color: #a27c1b;
    height: 31px;
    line-height: 29px;
    min-height: 31px;
}

.coupon-button p {
    margin: 0;
    color: #a27c1b;
    font-size: 90%;
}

.coupon-button:hover {
    background: #fbfbfb;
}

.tooltip .tooltiptext {
    display: none;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 50%;
    margin-right: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

.coupon-button:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

@media screen and (max-width: 600px) {
    .grid-container {
        min-height: 250px;
        max-height: 400px;
    }

    .grid-wrapper {
        grid-template-columns: 30px repeat(9, 1fr);
        grid-template-rows: 30px repeat(9, 1fr);
    }

    .grid-label {
        font-size: 14px;
    }

    .square-game-container {
        padding: 10px;
    }

    .chat-messages {
        max-height: 117px;
    }
}

@media screen and (max-width: 400px) {
    .grid-container {
        min-height: 200px;
        max-height: 300px;
    }

    .grid-wrapper {
        grid-template-columns: 25px repeat(9, 1fr);
        grid-template-rows: 25px repeat(9, 1fr);
    }

    .grid-label {
        font-size: 12px;
    }
}