.game-container {
    width: 100%;
    position: relative;
}

.game-frame {
    width: 100%;
    aspect-ratio: 14/9;
    border: none;
    display: block;
    background-color: #000;
    position: relative;
}

.game-frame--blurred-bg {
    overflow: hidden;
}

.game-frame--blurred-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--game-frame-background, #000) center/cover no-repeat;
    filter: blur(18px);
    transform: scale(1.1);
    z-index: 0;
}

.game-frame--blurred-bg>* {
    position: relative;
    z-index: 1;
}

.game-frame--video {
    position: relative;
    overflow: hidden;
}

.game-frame--video>* {
    position: relative;
    z-index: 1;
}

.game-frame__bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.game-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #fff;
    font-size: 1rem;
    letter-spacing: 0.02em;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    z-index: 1;
}

.game-loading__spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #38ffd7;
    animation: game-loading-spin 1s linear infinite;
}

@keyframes game-loading-spin {
    to { transform: rotate(360deg); }
}

.fs-top-toolbar {
    position: absolute;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 10;
    width: 100%;
    flex-shrink: 0;
}

.fs-top-toolbar.hidden {
    display: none !important;
}

.fs-toolbar-title {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}

.fs-close-button {
    background: #034445;
    border: none;
    border-radius:  6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
}

.game-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: #022d2f;
    color: #fff;
    font-size: 0.9rem;
    border-radius: 0 0 0.5rem 0.5rem;
}

.toolbar-title {
    flex: 1;
    margin: 0 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toolbar-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.toolbar-toggle input {
    accent-color: #1abc9c;
}

.game-container.is-fullscreen {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.game-container.is-fullscreen .game-frame {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
}

.icon-button {
    background: #034445;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
}

.icon {
    width: 20px;
    height: 20px;
    stroke: #fff;
}

.login-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.overlay-content {
    text-align: center;
    color: #fff;
    padding: 2rem;
    border-radius: 0.75rem;
    max-width: 400px;
}

.overlay-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #1abc9c;
    color: #fff;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: bold;
}

.overlay-btn:hover {
    background: #16a085;
}

.script-errors {
    white-space: pre-wrap;
    color: #fff;
    background: rgba(176, 0, 32, 0.9);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 2;
    max-height: 30%;
    overflow: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.9rem;
}

body.mobile-fullscreen-lock {
    overflow: hidden;
}

/* --- Mobile / CSS Fullscreen Overrides --- */

.game-container.mobile-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 99999 !important;
    background: #000;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.game-container.is-fullscreen .game-page-title {
    display: none !important;
}

.game-container.is-fullscreen {
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    height: 100%;
    background: #000;
}

.game-container.is-fullscreen .game-frame,
.game-container.mobile-fullscreen .game-frame {
    width: 100% !important;
    height: auto !important;
    flex: 1 !important;
    aspect-ratio: auto !important;
}

.game-toolbar.mobile-fullscreen-hidden {
    display: none !important;
}

.game-container.mobile-fullscreen .game-page-title {
    display: none !important;
}

.game-container.mobile-fullscreen .game-page-wrapper {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
}

.game-container.mobile-fullscreen .game-iframe-container,
.game-container.is-fullscreen   .game-iframe-container {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
}

.game-container.mobile-fullscreen .game-iframe-container iframe,
.game-container.is-fullscreen   .game-iframe-container iframe {
    flex: 1 1 auto !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
}

.game-container.mobile-fullscreen .game-preview-container,
.game-container.is-fullscreen   .game-preview-container {
    display: none !important;
}

.game-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 600px;
    overflow: hidden;
}

.toolbar-title {
    min-height: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-play-btn--overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    z-index: 5;
    transition: none !important;
}

.game-play-btn--overlay:hover {
    transform: translate(-50%, -50%) !important;
    filter: brightness(1.1);
    box-shadow: 0 8px 28px rgba(245, 197, 24, 0.55);
}

.game-play-btn--overlay:active {
    transform: translate(-50%, -50%) !important;
    filter: brightness(0.95);
}

.game-page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.game-page-title {
    width: 100%;
    text-align: center;
    padding: 16px 16px 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0;
}

.game-preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 300px;
    overflow: hidden;
    background: #000;
}

.game-preview-container .game-frame__bg-video,
.game-preview-container .game-poster-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.game-play-area {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 16px;
    width: 100%;
}

.game-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 48px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    background: var(--color-yellow, #f5c518);
    color: #000;
    box-shadow: 0 4px 20px rgba(245, 197, 24, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
}

.game-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(245, 197, 24, 0.55);
}

.game-play-btn:active {
    transform: translateY(0);
}

.game-play-btn svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.game-iframe-container {
    display: none;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 600px;
    overflow: hidden;
}

.game-iframe-container.is-active {
    display: block;
}

.game-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #000;
    color: #fff;
    z-index: 2;
}

.game-loading__spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.game-iframe-container iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.game-deposit-overlay {
    width: 100%;
}

.game-error-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.game-error-overlay.is-visible {
    display: flex;
}

.game-container.is-fullscreen .game-page-wrapper{
    display:flex !important;
    flex-direction:column !important;
    justify-content:center !important;
    align-items:center !important;
    height:100% !important;
}

.game-container.is-fullscreen .game-iframe-container{
    display:flex !important;
    justify-content:center !important;
    align-items:center !important;
    width:100% !important;
    height:100% !important;
}

.game-container.is-fullscreen iframe{
    position:relative !important;
    inset:auto !important;
    margin:auto !important;
}
#game-wrapper-panel.mobile-fullscreen,
#game-wrapper-panel.is-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 9999999 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: #000 !important;
    display: flex !important;
    flex-direction: column !important;
}

#game-wrapper-panel.mobile-fullscreen #game-container,
#game-wrapper-panel.mobile-fullscreen .game-page-wrapper,
#game-wrapper-panel.mobile-fullscreen .game-iframe-container {
    width: 100% !important;
    height: 100% !important;
    flex: 1 !important;
    aspect-ratio: auto !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #000 !important;
}

#game-wrapper-panel.mobile-fullscreen iframe {
    width: 100% !important;
    height: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    display: block !important;
}

/* И заставляем сам фрейм занять всё место */
#game-wrapper-panel.mobile-fullscreen iframe {
    width: 100% !important;
    height: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    display: block !important;
}

/* Скрываем нижнюю панель в фулскрине */
#game-wrapper-panel.mobile-fullscreen .bg-\[\#0b1b1e\]\.border-t {
    display: none !important;
}

/* На случай, если у панели есть другой селектор, используй этот универсальный фикс для фулскрина: */
#game-wrapper-panel.mobile-fullscreen > .bg-\[\#0b1b1e\]\.border-t\.border-brand-border {
    display: none !important;
}
/* Ультимативный фикс: скрываем нижнюю панель внутри game-wrapper-panel в фулскрине */
#game-wrapper-panel.mobile-fullscreen > .bg-\[\#0b1b1e\]\.border-t\.border-brand-border,
#game-wrapper-panel.mobile-fullscreen > .bg-\[\#0b1b1e\] {
    display: none !important;
}

/* На случай, если фулскрин активируется через is-fullscreen */
#game-wrapper-panel.is-fullscreen > .bg-\[\#0b1b1e\]\.border-t\.border-brand-border,
#game-wrapper-panel.is-fullscreen > .bg-\[\#0b1b1e\] {
    display: none !important;
}
@media (min-width: 768px) {
    .mobile-only { display: none !important; }
    .desktop-only { display: block !important; }
}

@media (max-width: 767px) {
    .mobile-only { display: block !important; }
    .desktop-only { display: none !important; }
}