:root {
    --bg: #fff;
    --card-bg: #8a2be2;
    --accent: #8a2be2;
    --text: #808080;
    --text-muted: #aaa;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
}
.header.hidden {
    transform: translateY(-100%);
  }
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fffffff2;
    transition: box-shadow .2s ease-in-out;
    will-change: transform;
}
.header-show {
    box-shadow: 0 4px 5px 0 rgba(0, 0, 0, .14), 
                0 1px 10px 0 rgba(0, 0, 0, .12), 
                0 2px 4px -1px rgba(0, 0, 0, .2);
}
.btn-search{
    position: relative;
    text-align: center;
    background: #fff;
    color: #5c5c5c;
    border: 1px solid #ddd;
    cursor: pointer;
    border-radius: 30px;
    padding: 10px 20px;
    user-select: none;
}
.active {display: block !important;}
.btn-search:hover{box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);}
.box-header{
    margin: 0 auto;
    max-width: 1296px;
    display: flex;
    flex-direction: row-reverse;
}
.box1 {
    gap: 15px;
    display: flex;
    align-items: center;;
    justify-content: space-between;
}
.box2 {
    display: flex;
    gap: 15px;
    padding: 10px 0px;
    overflow-x: auto;
    width: 100%;
}

.logo {
    text-decoration: none;
    color: #5f6368;
    font-weight: 500;
    display: flex;
    align-items: center;
    min-width: 90px;
    max-width: 100px;
}
.logo img{max-width: 40px;}
#ui-search{
    background: aliceblue;
    z-index: 999;
    position: absolute;
    display: none;
    width: 100%;
    padding: 10px;
}
.search-bar {
    margin: 0px auto;
    max-width: 720px;
    width: 100%;
}

.search-bar input {
    padding: 10px 42px;
    border-radius: 8px;
    font-size: 0.95em;
    color: #5c5c5c;
    border: 1px solid #ddd;
    outline: none;
    width: 100%;
}

.search-bar button {
    padding: 10px 15px;
    border: none;
    border-radius: 8px 0px 0px 8px;
    background: transparent;
    color: white;
    cursor: pointer;
    position: absolute;
}
/* serach start new */
.search-container {
    position: relative;
    display: flex;
}

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

.suggestions-dropdown.active {
    display: block;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:hover {
    background: #f5f5f5;
}

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

.suggestion-title {
    font-weight: 500;
    color: #333;
}

.suggestion-meta {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}
.search-bar input:focus{
    /* outline: 2px solid #000; */
    box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
}
/* new search end */
.nav-links { display: flex; gap: 30px; }
.nav-links a {
    color: #5a5a5a;
    text-decoration: none;
    font-size: 0.9em;
    white-space: nowrap;
    padding: 10px;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 30px;
}
.nav-links a:hover {border: 1px solid #ddd;}
a.active-nav{background: aliceblue;color: #5a5a5a !important;cursor: default;}
a.active-nav:hover{border: 1px solid transparent;}

.popular-tags {
    padding: 10px 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.9em;
    color: #8a2be2;
}
.popular-tags a {
    color: #ffffff;
    text-decoration: none;
    background:#8a2be2;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
}

.main-content { padding: 20px 30px; }

.game-section { margin-bottom: 20px; background: #fefefe;margin: 0 auto; max-width: 1056px;}
.game-section h1 {font-size: 1.6em; margin-bottom: 15px;font-weight: 500; color: #111;}
.game-section h2 {
    font-size: 1.1em;
    margin-bottom: 15px;
    font-weight: 500;
    color: #111;
}


.game-flex {
    display: flex;
    gap: 15px;
    overflow-x: scroll;
    padding-bottom: 15px;
}
.game-flex .game-card-mini .game-info-big{display: grid;gap: 10px;}

/* game-card-full */
.game-card-full:hover{
    background: #f8f8ff;
    border-radius: 10px;
}
.game-flex a{text-decoration: none;}
img {width: 100%;}
.game-wallpaper { position: relative;margin-bottom: 5px;}
.game-wallpaper img{ 
    /* aspect-ratio: 4/3;  */
    border-radius: 10px;
    /* max-width: 421px;
    max-height: 237px; */
    min-width: 380px;
    display: block;
    background: #f8f8ff;
}
.game-book {display: flex;}
.game-icon img{ width: 74px; border-radius: 10px;}
.game-play {
    align-items: center;
    display: grid;
}
.play-btn{
    border-radius: 15px; 
    background:var(--accent);
    border: 1px solid #eee;
    padding: 4px 10px;
    color: #fff;
}

/* game-card-mini */
.game-card-mini{max-width: 150px;}
.game-icon-big{
    width: 150px;
    height: 150px;
    border-radius: 30px;
    background: #f5f5f5;
}
img::before,
img::after {
  display: none !important;
}
img{
    color: transparent;
    font-size: 0;
}
.game-icon-big img{
    width: 150px;
    border-radius: 30px;
}
.game-card-mini .game-title{
    font-size: 0.9em;
    font-weight: 500;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #111;
    padding: 2px;
}




.game-card:hover { transform: translateY(-4px); }
.game-thumb {
    position: relative;
    aspect-ratio: 16/10;
    background: #1a1a3e;
    overflow: hidden;
}

.game-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    opacity: 0;
    transition: opacity 0.2s;
}
.game-card:hover .play-overlay { opacity: 1; }

.game-info {
    display: grid;
    justify-content: space-between;
    align-items: center;
    padding: 0px 5px 0 5px;
}

.game-card-full .game-title {
    font-size: 0.9em;
    font-weight: 500;
    /* white-space: nowrap; */
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #111;
}
.game-rating, .game-plays { font-size: 0.8em; color: var(--text-muted); }
.rating-box{
    border-radius: 15px;
    padding: 4px 8px;
    background: #f8f8ff;
    width: 56px;
    color: #676767;
}
.star{color: #8a2be2;}

/* Page Caterory Custom */
.game-grid{
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(3, 1fr);
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: game-counter;
}
.game-grid .game-card-mini {
    counter-increment: game-counter;
    position: relative;
    display: flex;
    align-items: flex-start;
    min-height: 50px;
    padding: 10px 10px 10px 45px; /* место для номера */
}
.game-card-mini:hover{
    background:#f8f8ff;
    border-radius: 20px;
}

.game-grid .game-card-mini::before {
    content: counter(game-counter);
    position: absolute;
    left: 0;
    top: 40%;
    font-size: 16px;
    color: #333;
    width: 30px;
    text-align: right;
}

/* Мобильная версия category page */
@media (max-width: 768px) {
    .game-grid {
        grid-template-columns: 1fr;
    }
}
/* Планшеты - 2 колонки */
@media (min-width: 769px) and (max-width: 1024px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
.game-grid .game-card-mini{
    max-width: max-content;
    text-decoration: none;
}
.game-grid .game-card-mini .game-info-big{
    display: grid;
}
.game-grid .game-book-big{
    display: flex;
    gap: 15px;

}
/* Страница игры */
.game-section-column h2{background: #f8f8ff;display: inline-block; border-radius: 20px;padding: 8px;margin-bottom: 8px;}
.main-page-grid{
    max-width: 1296px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr); /* Одна колонка во всю ширину */
    gap: 20px;
    margin-top: 20px;
}
.game-page .game-layout {
    width: 100%; /* На мобильных игра занимает 100% ширины */
    padding: 5px
}
.game-column{
    display: flex;
    gap: 15px;
    overflow-x: scroll;
    padding-bottom: 15px;
    margin-right: auto;
}
.game-column a{text-decoration: none;}
.game-column .game-wallpaper img{min-width: 272px !important;}
/* Десктопные экраны (от 1024px и выше) */
@media (min-width: 1024px) {
    div.main-page-grid {
        /* Делим экран: 80% под игру и оставшуюся часть (20%) под похожие игры */
        grid-template-columns: 70% 1fr; 
        gap: 24px;
        /* padding: 24px; */
        /* max-width: 1400px; Ограничиваем максимальную ширину сайта */
        margin: 0 auto;
    }

    div.game-layout {
        /* На десктопе игра будет занимать ровно свои 80% от сетки */
        width: 100%; 
    }
    
    /* Стили для блока похожих игр на десктопе */
    div.game-column {
        display: flex;
        flex-direction: column; /* Выстраиваем похожие игры строго в столбик */
        overflow-x: auto;
        margin-right: 5px;
        /* max-height: calc(100vh - 48px); Ограничиваем по высоте экрана */
        /* overflow-y: auto; Добавляем внутреннюю прокрутку, если игр много */
    }
}


.game-player {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9; /* Задает правильные пропорции */
    margin-bottom: 20px;
}

.game-player iframe {
    border: none;
    display: block;
    width: 100%;
    height: 100%;
}

.game-details { margin-bottom: 30px; }
.game-details h1 { font-size: 1.6em; margin-bottom: 10px;color: #111;}
.game-manager{ display: flex; align-items: center; gap: 20px;}
.game-manager .icon img { border-radius: 40px; width: 40px; }
.game-btn {
    display: flex;
    gap: 40px;
    align-items: center;
}
.box-like{display: flex;align-items: center;gap: 0.5px;}
.box-like div{background:#f8f8ff;padding: 10px;cursor: pointer;user-select: none;text-align: center}
.box-like div:hover{background: aliceblue;user-select: none;}
.box-like .like{border-radius: 20px 0px 0px 20px;min-width: 80px;}
.box-like .dislike{border-radius: 0px 20px 20px 0px;min-width: 50px;}

.game-meta1 {
    display: grid;
    color: var(--text-muted);
}
.game-meta2{
    margin-top: 15px;
}

.game-desc { color: var(--text-muted); line-height: 1.5; margin-bottom: 15px;
    padding: 10px;
    margin-top: 10px; }

.game-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85em;
}


.game-category{
    color: #777777;
    font-weight: 300;
}
/* THEME */
.game-section.theme ul{list-style: none;}
/* GENRE  */
.game-section.genre ul{list-style: none;}
.game-section.genre li{
    margin-bottom: 20px;
}
.game-section.genre li a{
    display: block;
    padding: 20px;
    font-weight: 500;
    color: #333;
    background-color: #f8f8ff;
}
.game-section.genre li a:hover{
    background-color: #f0f8ff;
}
/* PWA */
.save-pwa { display: none; background: #fff; color: #5c5c5c;border: 1px solid #ddd; cursor: pointer;}
.save-pwa:hover{box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);}
.saved-pwa { display: none; background: #f5f5f5; color: #696177;border: 1px solid #ddd; cursor: default;}
.btn-pwa{
    border-radius: 30px;
    padding: 10px;
    margin-right: 10px;
    user-select: none;
}
/* fullscreen */
/* Когда контейнер в fullscreen, iframe растягивается на весь экран */
.game-player:fullscreen {
    width: 100vw;
    height: 100vh;
}
.game-player:fullscreen iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Стилизация кнопки внутри fullscreen (опционально, чтобы она была видна поверх игры) */
.game-player:fullscreen .fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 9999;
    bottom: auto;
}
.fullscreen-btn{
    background: #1d1d1d;
    color: #fff;
    border-radius: 30px;
    padding: 9px;
    cursor: pointer;
    width: 80px;
    text-align: center;
    position: absolute;
    bottom: 15px;
    right: 15px;
    top: auto;
    z-index: 2147483647; /* Максимальный z-index, чтобы быть поверх iframe */
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}
.fullscreen-btn:hover{background: #1d1d1dde}

/* SHOW MORE */
.game-desc-wrapper {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 0px 15px 15px 15px;
    margin-top: 20px;
}

.game-desc {
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    max-height: 5.5em; /* Показывает ровно 3 строки текста */
    transition: max-height 0.3s ease;
}

/* Класс, который будет добавляться при раскрытии */
.game-desc.expanded {
    max-height: 1000px; /* Заведомо большая высота с запасом */
}

.desc-toggle-btn {
    background: none;
    border: none;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    padding: 15px 0;
    display: block;
    width: 100%;
    border-radius: 30px;
    background: #f8f8ff;
    user-select: none;
}
