
* {
    box-sizing: border-box;
}

:root {
    font-family: Arial, Helvetica, sans-serif;
    background: #ffffff;
    color: #202020;
}

html, body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #161719;
}

body {
    min-height: 100dvh;
}

button {
    font-family: inherit;
}

.app {
    width: min(100%, 900px);
    height: 100vh;
    height: 100dvh;
    margin: auto;
    padding: 18px 20px 14px;

    display: flex;
    flex-direction: column;

    position: relative;
    background: #161719;
}

/* Верхняя панель */

.topbar {
    height: 42px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 2.5px;
}

.area-counter {
    display: flex;
    align-items: baseline;
    gap: 9px;

    font-size: 17px;
    font-weight: 700;
}

.area-label {
    font-size: 9px;
    color: #999999;
    letter-spacing: 1.5px;
}
#areaCount {
    color: #ffffff;
}

/* Окно мира */

.world-container {
    position: relative;

    flex: 1;
    min-height: 0;

    margin: 10px 0 8px;

    border: 1px solid #ededed;
    border-radius: 13px;

    overflow: hidden;
    background: #ffffff;

    touch-action: none;
}

#world {
    width: 100%;
    height: 100%;
    display: block;

    touch-action: none;
}

.world-hint {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;

    text-align: center;

    font-size: 8px;
    letter-spacing: 1.5px;
    color: #c0c0c0;

    pointer-events: none;
}


/* Панель инструментов */

.tools {
    position: absolute;
    right: -500px;
    top: 70px;
    left: auto;
    bottom: auto;
    z-index: ;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
}

/* Кнопки инструментов */

.tool-button {
    width: 43px;
    height: 43px;

    border: 1px solid #e8e8e8;
    border-radius: 50%;

    background: #ffffff;

    display: grid;
    place-items: center;

    cursor: pointer;

    color: #333333;
    font-size: 23px;
    font-weight: 300;

    box-shadow: 0 2px 12px #0000000a;

    transition: background 0.15s, transform 0.15s;
}

.tool-button:active {
    transform: scale(0.91);
    background: #f3f3f3;
}

.tool-button svg {
    width: 20px;
    height: 20px;

    fill: none;
    stroke: #333333;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Кнопка TAP */

.tap-controls {
    height: 135px;
    flex-shrink: 0;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
}

.tap-button {
    position: relative;
    width: 135px;
    height: 135px;

    border: 0;
    padding: 0;

    background: transparent;
    cursor: pointer;

    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;

    transition: transform 0.11s ease;
}

.tap-button:active {
    transform: scale(0.94);
}

.tap-button img {
    width: 100%;
    height: 100%;

    display: block;
    object-fit: contain;

    user-select: none;
    pointer-events: none;
}

.tap-button .tap-pressed {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.tap-button:active .tap-pressed {
    opacity: 1;
}

.tap-label {
    font-size: 9px;
    letter-spacing: 2.5px;
    color: #999999;
}

/* Компьютеры */

@media (min-width: 700px) {

    .app {
        padding-left: 28px;
        padding-right: 28px;
    }

    .tap-controls {
        height: 145px;
    }

    .tap-button {
        width: 112px;
        height: 112px;
    }

   .tools {
    position: fixed;
    top: 1 px;
    right: max(30px, calc((100vw - 900px) / 2 + 20px));
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
}

}

/* Небольшие экраны */

@media (max-height: 600px) {

    .app {
        padding-top: 9px;
        padding-bottom: 6px;
    }

    .tap-controls {
        height: 104px;
    }

    .tap-button {
        width: 78px;
        height: 78px;
    }

    .tools {
        bottom: 120px;
    }

}
/* ПЛАШКА ВАЛЮТЫ */

.topbar {
    position: relative;
}

.currency {
    position: absolute;
    top: 0;
    right: 0;

    width: 120px;
    height: 39px;

    background-image: url("assets/currency-pill.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
} .currency {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    padding: 0 12px;
    box-sizing: border-box;
}

.currency-icon {
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.site-icon {
    position: fixed;

    top: 6px;
    left: 30px;

    width: 120px;
    height: 120px;

    object-fit: contain;
    z-index: 1000;
}

.menu-container {
    position: relative;
    width: 42px;
    height: 42px;
}

.menu-container.open {
    height: 132px;
}

.menu-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
}

.menu-toggle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    z-index: 3;
    pointer-events: auto;
}

.menu-items {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 7px 0;
    z-index: 2;
    pointer-events: auto;
}

.menu-items[hidden] {
    display: none;
}

.menu-item {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    color: #000000;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.menu-item img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}
/* Раскрывающееся меню */

.menu-container {
    position: relative;
    width: 42px;
    height: 42px;
}

.menu-container.open {
    height: 132px;
}

.menu-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
}

.menu-toggle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    z-index: 1;
}

.menu-items {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 7px 0;
    z-index: 2;
}

.menu-items[hidden] {
    display: none;
}

.menu-item {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.menu-item img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}
.menu-toggle {
    cursor: grab;
    touch-action: none;
}

.menu-toggle:active {
    cursor: grabbing;
}
#currencyCount {
    color: white;
    font-weight: bold;
}
.currency-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}
/* Запрет выделения и перетаскивания текста */
body {
    user-select: none;
    -webkit-user-select: none;
}

/* Запрет перетаскивания изображений */
img {
    -webkit-user-drag: none;
    user-drag: none;
}
/* Группа балансов */
.balance-group {
    position: absolute;
    top: 0;
    right: 0;

    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
}

/* Основной Wordly */
.balance-group .currency {
    position: relative;
    top: auto;
    right: auto;
    flex-shrink: 0;
}

/* Второй баланс */
.gram-balance {
    width: 120px;
    height: 39px;
    flex-shrink: 0;
}

.gram-balance img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

/* Нижняя панель */
.bottom-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex-shrink: 0;
    margin-top: 8px;
    margin-bottom: 8px;
}

/* Длинное стекло с тремя кнопками */
.glass-menu {
    width: 220px;
    height: 65px;
    background: url("assets/glass-menu.png") center / 100% 100% no-repeat;

    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    box-sizing: border-box;
}

/* Три круглые кнопки */
.round-button {
    width: 48px;
    height: 48px;
    object-fit: contain;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease;
}

/* Наведение мышкой на ПК — увеличение */
@media (hover: hover) and (pointer: fine) {
    .round-button:hover {
        transform: scale(1.12);
    }
}

/* Нажатие мышкой или пальцем — уменьшение */
.round-button:active {
    transform: scale(0.90);
}

.bottom-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.glass-circle {
    display: block;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    object-fit: contain;
}

/* ПЕРЕКЛЮЧЕНИЕ ЭКРАНОВ */
body.market-screen .app > :not(.bottom-panel):not(.site-icon):not(.topbar),
body.cart-screen .app > :not(.bottom-panel):not(.site-icon):not(.topbar):not(.play-screen-button) {
    display: none !important;
}

/* ОДИНАКОВЫЙ ФОН ВСЕХ ОКОН */
html,
body,
.app {
    background: #161719;
}

/* Положение нижней панели на экранах маркета и корзины — ПК */
@media (min-width: 220px) {
    body.market-screen .app > .bottom-panel,
    body.cart-screen .app > .bottom-panel {
        position: absolute;
        left: 50%;
        bottom: 14px;
        transform: translateX(-50%);
        margin: 0;
        z-index: 20;
    }
}

body.market-screen .area-counter,
body.cart-screen .area-counter {
    display: none !important;
}
.play-container {
    position: fixed;
    left: 50%;
    bottom: 115px;
    transform: translateX(-50%);
    z-index: 25;
}
// Play button
.world-container {
    position: relative;
}

.play-button {
    position: absolute;
    left: 50%;
    bottom: 15px;
    transform: translateX(-50%);
    z-index: 10;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.play-button img {
    display: block;
    width: 190px;
    height: auto;
    background: transparent;
}

@media (max-width: 699px) {
    .play-button img {
        width: 155px;
    }
}

/* PLAY скрыта на всех экранах */
.play-screen-button {
    display: none !important;
}

/* PLAY только в окне карт */
body.cart-screen .play-screen-button {
    display: flex !important;
    position: fixed;
    left: 50%;
    bottom: 105px;
    transform: translateX(-50%);
    justify-content: center;
    align-items: center;
    z-index: 30;
}

/* Размер картинки */
body.cart-screen .play-screen-button img {
    display: block;
    width: 220px;
    height: auto;
}

/* WORLDY — система рангов */
.world-rank {
    position: fixed;
    top: 20px;
    right: 100px;
    z-index: 10;

    display: flex;
    align-items: center;
    gap: 0;

    width: 300px;
    height: 90px;
}

.rank-icon {
    position: relative;
    z-index: 3;

    width: 95px;
    height: 95px;
    object-fit: contain;
    flex-shrink: 0;

    margin-right: -35px;
}

.rank-bar {
    position: relative;
    z-index: 1;

    flex: 1;
    height: 25px;
}

.rank-background,
.rank-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.rank-background {
    z-index: 0;
}

.rank-progress {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 0%;
    overflow: hidden;
    transition: width 0.5s ease;
}

.rank-progress img {
    display: block;
    width: 100%;
    height: 22px;
}

.rank-frame {
    z-index: 2;
    pointer-events: none;
}

#rankCounter {
    position: absolute;
    z-index: 3;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #fff;
    font-family: "Trebuchet MS", Arial, sans-serif;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;

    text-shadow:
        0 1px 2px #000,
        0 0 5px rgba(0, 0, 0, 0.8);
}

/* Анимация повышения ранга */
.rank-icon.rank-old {
    animation: rankOld 0.35s ease-in forwards;
}

.rank-icon.rank-new {
    animation: rankNew 0.45s ease-out forwards;
}

@keyframes rankOld {
    from {
        transform: translateY(0);
        filter: brightness(1);
    }
    to {
        transform: translateY(-13px);
        filter: brightness(0) invert(1);
        opacity: 0;
    }
}

@keyframes rankNew {
    from {
        transform: translateY(-13px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
/* ==============================
   СНЕЖИНКИ НА ГЛАВНОМ ЭКРАНЕ WORLDY
   ============================== */

.app {
    position: relative;
    isolation: isolate;
}

.snow-layer {
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: hidden;
    pointer-events: none;
}

.snow-layer[hidden] {
    display: none;
}

/* The clicker covers the snow while the page background stays visible. */
body:not(.market-screen):not(.cart-screen) .app {
    z-index: 1;
    background: transparent;
}

body:not(.market-screen):not(.cart-screen) > .snow-layer {
    z-index: 0;
}

/* Основные элементы меню поверх снега */
.topbar,
.world-container,
.tap-controls {
    position: relative;
    z-index: 2;
}

/* Нижняя панель поверх снега на компьютере */
@media (min-width: 700px) {
    .bottom-panel {
        position: relative;
        z-index: 2;
    }
}


.world-zoom {
    position: absolute;
    right: 3px;
    bottom: 17px;
    display: flex;
    gap: 1px;
}

.world-zoom button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    color: #222b3d;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}

.world-zoom span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid #cacfd8;
    border-radius: 7px;
    background: #f6f7fb;
    font-size: 19px;
    line-height: 1;
    pointer-events: none;
}

.world-zoom button:active span {
    background: #e1e7f1;
}
