body { touch-action: manipulation; /* масштабирование отключено */ }

:root {
    --ui-bg: rgba(0,0,0,0.5);
    --slot-bg: rgba(255,255,255,0.1);
    --slot-bg-has: rgba(255,255,255,0.3);
}
html, body {
    margin: 0;
    height: 100%;
    background: #000;
    overflow: hidden;
    color: #fff;

    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
}
body { margin: 0; overflow: hidden; background: black;}
canvas { display: block; margin: auto; background: #000; z-index: 0; position: relative; }

canvas {
    display: flex;
    margin: 0 auto;
    background: #000;
}
#thoughts {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #fff;
    padding: 10px 20px;
    background: var(--ui-bg);
    border-radius: 10px;
    text-align: center;
    max-width: 70%;
    pointer-events: none;
    display: none;
}
#inventory {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(50%);
    display: flex;
    gap: 10px;
}
.slot {
    position: relative;
    width: 4vw;
    height: 7vh;
    border: 2px solid #fff;
    background: var(--slot-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff0;
    font-size: 40px;
    font-weight: 700;
    transition: .12s;
    user-select: none;
}
.slot::after {
    content: attr(data-key);
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 14px;
    color: #fff;
    font-weight: 400;
}
.selected {
    border: 3px solid lime;
    background: var(--slot-bg-has) !important;
}
#controls {
    position: absolute;
    top: 10px;
    font-size: 15px;
    color: #fff;
    background: var(--ui-bg);
    padding: 10px 15px;
    border-radius: 10px;
    line-height: 1.4;
    user-select: none;
}
#screamer {
    position: fixed;     /* поверх всего */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    display: none;       /* скрыт до вызова */
    justify-content: center;
    align-items: center;
    z-index: 9999;       /* поверх canvas и других дивов */
}
#screamer video {
    width: 100%;
    height: 100%;
    object-fit: cover;   /* растягивает на весь экран */
}
.button {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3vw; /* немного отступа от нижнего края */
    position: absolute;
    bottom: 10px;

}
/* Стили кнопок */
.bu {
    z-index: 9998;
    font-size: 200%;
    width: 4vw;
    height: 7vh;
    background: transparent;
    color: #fafafa;
    border: 2px solid #fafafa;
    border-radius: 20px;
    margin: 0 15px; /* расстояние между кнопками */
    cursor: pointer;
}

.hidden{
    display: none; !important;
}
#buttons {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9996;
}

.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}


.middle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.block#action {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#bd {
    width: 70px;
    height: 70px;
    font-size: 180%;
}
.bu:hover{
    border: 4px solid #fafafa;
}
.slot:hover{
    border: 4px solid #fff;
}
#poln{
    display: inline-block;
    background-color:blueviolet;
    cursor: pointer;
    padding: 20px 40px;
    font-size: 40px;
    font-weight: 400;
}
#pred{
    display: inline-block;
    font-size: 40px;
    font-weight: 400;
}
.telegra{
    display: block;
    font-size: 30px;
    background-color: rgba(255, 50, 50, 0.9);
    color: #000000;
    border: rgba(250, 0, 0, 0.5) 2px solid;
    border-radius: 15px;
    width: 220px;
    padding:10px;
    text-decoration: none;
}
.option{
    display: block;
    position:absolute;
    top: 10px;
    right: 0px;
    font-size: 50px;
    vertical-align: text-top;
    background-color: red;
    cursor: pointer;
    z-index: 9997;
}
.telegra:hover{
    background-color: yellow;
    transition-property:all;
    transition-duration: 1s;
}
.controls{
    display: block;
    width: 500px;
    right: 50px;
}
#opt{
    display: flex;
    position: absolute;
    border: white 2px solid;
    border-radius: 15px;
    top: 3%;
    right: 3%;
    width:95%;
    height: 95%;
    background-color: rgba(142, 156, 178, 0.5);
    z-index: 9998;
}
.coke{
    font-size:30px;
    width: 490px;!important;
    height: 60px;!important;
}
#prim{
    cursor: pointer;
    width: 12vw;
    height: 6vh;
    position: absolute;
    margin-top: 60vh;
    border-radius: 15px;
    font-size: 1.1rem;
    background-color: rebeccapurple;
    color: white;
    text-align: center;
}
#saves{
    width: 15%;
    display: block;
    border-radius: 15px;
    height: 42%;
}
#save{
    font-size: 20px;
    border-radius: 15px;
    width: 100%;
    height: 50%;
}
#download{
    width: 100%;
    font-size: 20px;
    height: 50%;
    border-radius: 15px;
}
#uved{
    display: block;
    width: 14vw;height: 24vh;
    background-color: green;
    border-radius: 15px;
}
.opt_l{
    display: inline-block;
    font-size: 1.1rem;
}
.pwh{
    display: block;
    width: 4vw;height: 4vh!important;
}
#uved_size{
    display: inline-block;
    width: 8vw;height: 4vh!important;
    border-radius: 15px;
}
.opt_i{
    display: block;
    width: 14vw;height: 18vh;
    background-color: green;
    border-radius: 15px;
}
#poln_or{
    cursor: pointer;
    width: 16vw;
    height: 10vh;
    position: absolute;
    margin-top: 50vh;
    border-radius: 15px;
    font-size: 1.1rem;
    background-color: #ff0000;
    color: white;
    text-align: center;
}