.unity-master-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 30px 0;
}

.unity-master-wrapper:fullscreen {
    width: 100vw;
    height: 100vh;
    margin: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    align-items: stretch;
    position: relative;
    z-index: 9999;
}

.unity-master-wrapper:fullscreen .unity-game-container {
    width: 100%;
    aspect-ratio: auto !important;
    border-radius: 0;
    flex: 1;
    max-width: none !important;
}

.unity-master-wrapper:fullscreen .unity-game-container iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    display: block;
    pointer-events: auto;
    isolation: isolate;
}

.unity-master-wrapper:fullscreen .unity-bottom-panel {
    width: 100%;
    border-radius: 0;
    flex-shrink: 0;
    max-width: none !important;
    box-sizing: border-box;
    z-index: 10000;
}

.unity-game-container {
    position: relative;
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 0;
    overflow: hidden;
}

@supports not (aspect-ratio: 1 / 1) {
    .unity-game-container {
        height: 0;
        padding-top: 56.25%;
    }
    .unity-game-container iframe {
        position: absolute;
        inset: 0;
    }
}

.unity-game-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    pointer-events: auto;
    z-index: 1;
}

.unity-bottom-panel {
    width: 100%;
    max-width: 960px;
    background:  #17383e;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 18px;
    gap: 10px;
    border-radius: 0;
    box-sizing: border-box;
    flex-wrap: nowrap;
}

.panel-group { display: flex; align-items: center; gap: 7px; }
.panel-left { flex: 0 0 auto; }
.panel-center { flex: 0 0 auto; display: none; margin: 0 auto; }
.panel-right { flex: 0 0 auto; margin-left: auto; }

.ctrl-btn {
    background: none;
    border: none !important;
    color: #e2e8f0;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all .2s;
    white-space: nowrap;
    user-select: none;
    outline: none !important;
    box-shadow: none !important;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    position: relative;
    min-width: 40px;
    min-height: 40px;
    box-sizing: border-box;
   -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:hover  { transform: translateY(-1px); }
.ctrl-btn:active { transform: translateY(0); }
.ctrl-btn svg    { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.logo-container .game-logo-image {
    width: auto;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.logo-container .logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    outline: none;
}

.ctrl-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: rgba(20,20,40,0.85);
    color: #e2e8f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s ease, visibility 0.1s ease;
    z-index: 1000;
    border: 1px solid rgba(255,255,255,0.1);
}

.ctrl-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

@media (hover: none) {
    .ctrl-btn:hover::after {
        opacity: 0;
        visibility: hidden;
    }
}

body.is-touch-device .ctrl-btn:hover::after,
body.is-touch-device .ctrl-btn:focus::after,
body.is-touch-device .ctrl-btn:active::after {
    opacity: 0 !important;
    visibility: hidden !important;
}

.ctrl-btn:focus {
    outline: none;
}

.ctrl-btn.tooltip-transparent::after {
    opacity: 0 !important;
    visibility: hidden !important;
}

.ctrl-btn.tooltip-transparent:hover::after {
    opacity: 0 !important;
    visibility: hidden !important;
}

.btn-like:hover    { color: #4ade80; }
.btn-like.active   { color: #4ade80; }
.btn-like.active svg { fill: #4ade80; stroke: none; }

.btn-dislike:hover  { color: #f87171; }
.btn-dislike.active { color: #f87171; }
.btn-dislike.active svg { fill: #f87171; stroke: none; }

.btn-favorite { position: relative; display: flex; align-items: center; }
.btn-favorite:hover  { color: #fbbf24; }
.btn-favorite.active { color: #fbbf24; }
.btn-favorite svg    { fill: none; width: 15px; height: 15px; }
.btn-favorite.active svg { fill: #fbbf24; stroke: none; }

.unity-fav-reg-modal {
    position: absolute;
    bottom: 48px;
    left: 0;
    background: #17383e;
    border-radius: 12px;
    padding: clamp(12px, 3vw, 20px);
    display: none;
    flex-direction: column;
    gap: clamp(8px, 2vw, 16px);
    z-index: 10;
    min-width: clamp(240px, 60vw, 280px);
    max-width: 90vw;
    border: 1px solid rgba(255,255,255,0.08);
    box-sizing: border-box;
}
.unity-fav-reg-modal.show { display: flex; }

@media (max-width: 557px) {
    .btn-favorite {
        position: static !important;
    }
    
    .btn-game-controls {
        position: static !important;
    }
    
    .unity-bottom-panel {
        position: relative;
    }
    
    .unity-fav-reg-modal {
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }
    
    .unity-game-controls-modal {
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }
}

.view-count-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    padding: 8px 12px;
    min-width: 40px;
    min-height: 40px;
    box-sizing: border-box;
}
.view-count-display svg {
    width: 15px; height: 15px;
    fill: none; stroke: #94a3b8;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    flex-shrink: 0;
}

.btn-like.loading, .btn-dislike.loading, .btn-favorite.loading {
    opacity: 0.5;
    pointer-events: none;
}


.btn-sound { display: flex; align-items: center; }
.vol-icon-btn {
    background: none; border: none !important; color: #fff;
    cursor: pointer; padding: 8px 12px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; transition: color .2s;
    outline: none !important; box-shadow: none !important;
    position: relative;
    min-width: 40px;
    min-height: 40px;
    box-sizing: border-box;
}
.vol-icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }


input[type=range] {
    -webkit-appearance: none; appearance: none;
    width: 100px; height: 4px; border-radius: 99px;
    background: rgba(255,255,255,0.15); outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px; height: 13px; border-radius: 50%;
    background: #6366f1;
    cursor: pointer; transition: transform .15s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.25); }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #6366f1; border: none; cursor: pointer; }

.vol-muted input[type=range] { opacity: .4; pointer-events: none; }

.vol-popup {
    position: absolute;
    bottom: 40px;
    background: #17383e;
    border-radius: 12px;
    padding: 6px 12px;
    display: none;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
    border: 1px solid rgba(255,255,255,0.08);
    z-index: 10;
}
.vol-popup.show { display: flex; }
.vol-popup-controls { display: flex; align-items: center; gap: 8px; }
.vol-popup input[type=range] { flex: 1; width: auto; }

.btn-fullscreen { color: #fff; position: relative; display: flex; align-items: center; }

.unity-reg-modal {
    position: absolute;
    bottom: 48px;
    right: 0;
    background: #17383e;
    border-radius: 12px;
    padding: clamp(12px, 3vw, 20px);
    display: none;
    flex-direction: column;
    gap: clamp(8px, 2vw, 16px);
    z-index: 10;
    min-width: clamp(240px, 60vw, 280px);
    max-width: 90vw;
    border: 1px solid rgba(255,255,255,0.08);
    box-sizing: border-box;
}
.unity-reg-modal.show { display: flex; }
.unity-reg-content {
    text-align: center;
}
.unity-reg-icon {
    width: clamp(32px, 8vw, 40px); 
    height: clamp(32px, 8vw, 40px);
    margin: 0 auto clamp(8px, 2vw, 12px);
    background: #6366f1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: clamp(14px, 3.5vw, 18px);
}
.unity-reg-title {
    color: #fff;
    font-size: clamp(14px, 4vw, 16px);
    font-weight: 600;
    margin-bottom: clamp(6px, 1.5vw, 8px);
    font-family: -apple-system, sans-serif;
}
.unity-reg-message {
    color: #94a3b8;
    font-size: clamp(11px, 3vw, 12px);
    line-height: 1.4;
    margin-bottom: clamp(12px, 3vw, 16px);
    font-family: -apple-system, sans-serif;
}
.unity-reg-buttons {
    display: flex;
    gap: clamp(6px, 1.5vw, 8px);
    justify-content: center;
    flex-wrap: wrap;
}
.unity-reg-btn {
    padding: clamp(4px, 1.5vw, 8px) clamp(8px, 3vw, 16px);
    border-radius: 6px;
    border: none;
    font-size: clamp(10px, 3vw, 12px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: -apple-system, sans-serif;
    flex: 1;
    min-width: clamp(80px, 20vw, 100px);
}
.unity-reg-btn-primary {
    background: #6366f1;
    color: white;
}
.unity-reg-btn-primary:hover {
    transform: translateY(-1px);
}
.unity-reg-btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.2);
}
.unity-reg-btn-secondary:hover {
    background: rgba(255,255,255,0.15);
}

.btn-hide-panel {
    display: none;
    color: #94a3b8;
    gap: 6px;
}

.btn-hide-panel:hover {
    color: #e2e8f0;
    transform: translateY(-1px);
}

.btn-hide-panel .hide-panel-text {
    font-size: 12px;
    font-weight: 500;
}

.unity-master-wrapper:fullscreen .panel-center {
    display: flex;
    flex: 0 0 auto;
    margin: 0 auto;
}

.unity-master-wrapper:fullscreen .btn-hide-panel {
    display: flex;
}

.unity-game-controls-modal {
    position: absolute;
    bottom: 48px;
    right: 0;
    background: #17383e;
    border-radius: 12px;
    padding: clamp(12px, 3vw, 20px);
    display: none;
    flex-direction: column;
    gap: clamp(8px, 2vw, 16px);
    z-index: 10;
    min-width: clamp(240px, 60vw, 280px);
    max-width: 90vw;
    border: 1px solid rgba(255,255,255,0.08);
    box-sizing: border-box;
}
.unity-game-controls-modal.show { display: flex; }
.unity-game-controls-content {
    text-align: left;
    font-size: clamp(11px, 3vw, 14px);
    line-height: 1.4;
    color: #e2e8f0;
    font-family: -apple-system, sans-serif;
}
.unity-game-controls-content * {
    max-width: 100%;
    box-sizing: border-box;
}
.btn-game-controls { display: flex; align-items: center; }
.btn-game-controls .game-controls-btn svg {
    stroke-width: 1 !important;
}


.btn-game-controls:has(.unity-game-controls-modal.show) {
    z-index: 10002;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    background: transparent;
    pointer-events: auto;
    display: none;
}

.modal-overlay.show {
    display: block;
}

.unity-master-wrapper:fullscreen .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    background: transparent;
    pointer-events: auto;
}


.space-hidden { display: none !important; }
