html {
    height: 100%;
    font-size: 2.2vh;
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
     -khtml-user-select: none; /* Konqueror HTML */
       -moz-user-select: none; /* Old versions of Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Edge, Opera and Firefox */
}
body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    font-family: Arial;
    overflow: hidden;
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
     -khtml-user-select: none; /* Konqueror HTML */
       -moz-user-select: none; /* Old versions of Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Edge, Opera and Firefox */
}
div {
    
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
     -khtml-user-select: none; /* Konqueror HTML */
       -moz-user-select: none; /* Old versions of Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Edge, Opera and Firefox */
}
.game-menu {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    font-family: 'Arial', sans-serif;
}
.game-menu.show {
    display: flex;
}

.menu-title {
    color: #ffffff;
    font-size: 3rem;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.player-stat {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    position: relative; 
    display: flex; 
    align-items: center; 
    gap: 8px;
}
.info-icon {
    cursor: pointer;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #dddddd;
    color: #dddddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-style: normal;
    font-size: 14px;
}
.info-tooltip {
    display: none; 
    position: absolute; 
    top: 100%; 
    left: 0; 
    background: rgba(0,0,0,0.8); 
    color: #ffffff; 
    padding: 1rem; 
    border-radius: 5px; 
    margin-top: 8px; 
    max-width: 300px; 
    font-size: 1.2rem;
    z-index: 1;
}
.shop-link .info-tooltip {
    left: initial;
    top: initial;
    right: 0px;
    bottom: 40px;
}
.player-stat:hover .info-tooltip {
    display: block;
}
.shop-link:not(.answered):hover .info-tooltip {
    display: block;
}

.menu-description {
    font-size: 1rem;
    color: #dddddd;
    font-weight: 100;
    margin-bottom: 1rem;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-button {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}
.menu-button.favorite {
    margin-bottom: 2rem;
    padding: 0.5rem 1.5rem;
    background-color: #2c65a9;
}

.menu-button:hover {
    transform: scale(1.05);
    background-color: #357abd;
}

.menu-button:active {
    transform: scale(0.95);
}

.game {
    display: none;
}
.game.show {
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.page-title {
    text-align: center;
    color: #ffffff;
    font-size: 0.7rem;
    height: 7vh;
    text-shadow: 0px 0px 9px #171e37;
    position: relative;
    z-index: 1;
    width: calc(100% - 18vh);
    left: 9vh;
}

.back-button {
    position: absolute;
    top: 1vh;
    left: 1vh;
    width: 7vh;
    height: 7vh;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #181e38;
    font-size: 6vh;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-button {
    position: absolute;
    top: 1vh;
    right: 1vh;
    width: 7vh;
    height: 7vh;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #181e38;
    font-size: 6vh;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-images {
    position: relative;
    flex: 1;
    overflow: hidden;
}

.image-slider {
    height: 100%;
    display: flex;
    transition: transform 0.3s;
    background: #171f38;
}

.slider-image {
    min-width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.slider-image.active {
    display: block;
}

.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: none/*flex*/;
    gap: 8px;
    background: #0000005c;
    padding: 2px 5px;
    border-radius: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
}

.dot.active {
    background: white;
}

.product-info {
    padding: 15px;
    background: white;
    border-radius: 0 0 10px 10px;
    position: relative;
}

.product-title {
    margin: 0 30px 0 0;
    font-size: 1.1rem;
    color: #333;
}

.product-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.action-btn.shop-link {
    float: right;
    position: absolute;
    top: calc(50% - 18px);
    right: 5px;
}
.action-btn.favorite {
    position: absolute;
    top: 5px;
    right: 5px;
}
.action-btn.favorite.active path {
    fill: #e31a1a;
}

.action-btn:hover {
    background: #e0e0e0;
}

.action-btn svg {
    color: #666;
}

.quiz-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 4%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.quiz-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.quiz-product {
    width: 100%;
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 10px;
    overflow: hidden;
}

.price-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.price-option {
    font-size: 1.2rem;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #4a90e2;
    transition: transform 0.2s, background-color 0.2s;
    white-space: nowrap;
    height: 3rem;
    width: 9rem;
}
.price-option.inactive {
    cursor: initial;
    background-color: #cfcfcf;
}
.price-option.true {
    cursor: initial;
    background-color: #4CAF50;
    transform: scale(1.05);
}
.price-option.false {
    cursor: initial;
    background-color: #eb4646;
    transform: scale(1.05);
}

.price-option:not(.inactive):not(.true):not(.false):hover {
    transform: scale(1.05);
    background-color: #357abd;
}

.price-option:not(.inactive):not(.true):not(.false):active {
    transform: scale(0.95);
}

.next-button {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    position: absolute;
    top: calc(50% + 27vh);
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    transition: top 0.2s, transform 0.2s, background-color 0.2s;
}
.next-button.hidden {
    top: 200%;
}
.next-button:hover {
    background-color: #2d73b8;
}
.next-button:active {
    background-color: #3d7dbd;
}

#page2 .quiz-content {
    gap: 1rem;
}
#page2 .price-option {
    padding: 0.3rem 0.5rem;
}
#page2 .quiz-product {
    height: 32vh;
    gap: 1rem;
    padding: 0 1rem;
}
#page2 .product-card {
    width: calc(100% - 4rem);
    min-width: calc(100% - 4rem);
}
#page2 .product-images {
    border-radius: 10px 10px 0 0;
}
#page2 .product-title {
    font-size: 1rem;
}
#page2 .quiz-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #16203c;
    width: 100%;
    text-align: right;
}
.next-button-wrap {
    width: 95%;
    max-width: 600px;
    top: 50%;
    left: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
}
#page2 .next-button {
    top: 50%;
    right: 0;
    transform: translate(0, -50%);
    left: initial;
    transition: right 0.2s, transform 0.2s, background-color 0.2s;
}
#page2 .next-button.hidden {
    right: -200%;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 54%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}
.loading.active {
    display: flex;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loading-countdown {
    position: absolute;
    color: white;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.categories-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 54%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}
.categories-layer.active {
    display: flex;
}
.categories-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    min-width: 240px;
    z-index: 1000;
}

.categories-header {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.categories-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 60vh;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.category-item:hover {
    background: #f5f5f5;
}

.category-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.category-item span {
    color: #444;
    font-size: 0.9rem;
}

.favorite-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.favorite-layer.active {
    display: flex;
}

.favorite-layer.active {
    display: flex;
}

.favorite-panel {
    background: white;
    width: 90%;
    max-width: 400px;
    max-height: 70vh;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translate(-50%, -50%);
    top: 50%;
    left: 50%;
    position: fixed;
}

.favorite-header {
    padding: 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.favorite-header h3 {
    margin: 0;
    color: #333;
}

.favorite-list {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}

.favorite-item {
    display: flex;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    background: white;
    text-decoration: none;
}
.favorite-item.disabled {
    filter: grayscale(1);
    background: #0000004f;
}

.favorite-image {
    width: 100px;
    height: 100px;
    margin-right: 15px;
    border-radius: 4px;
    overflow: hidden;
}

.favorite-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorite-info {
    flex: 1;
    position: relative;
}

.favorite-title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: #333;
}

.favorite-price {
    font-size: 1.2rem;
    color: #4a90e2;
    font-weight: bold;
}

.favorite-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 8px;
}

.favorite-actions .action-btn {
    width: 32px;
    height: 32px;
}

.remove-favorite svg path {
    fill: #e31a1a;
}
.favorite-item-template {
    display: none;
}
.empty-template {
    display: none;
}

.server-error-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.server-error-layer.active {
    display: flex;
}

.server-error-panel {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.server-error-message h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.server-error-message p {
    color: #666;
    margin-bottom: 2rem;
}

.server-error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.server-error-actions .action-btn {
    padding: 1.5rem 3.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    font-size: 1.0em;
}

.try-again-btn {
    background: #3498db;
    color: white;
}

.try-again-btn:hover {
    background: #2980b9;
}

.play-offline-btn {
    background: #2ecc71;
    color: white;
}

.play-offline-btn:hover {
    background: #27ae60;
}