.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
    z-index: 9999;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-content {
    position: relative;
    width: min(750px, 90%);
    background-color: var(--cardBg);
    border-radius: var(--radius-lg);
    border-radius: 0px;
    padding: 30px;
    transform: scale(.9);
    transition: transform .3s ease;
    /* box-shadow: 0px 6px 0px 0px var(--shadowColor); */
}
.modal h2{
    font-family: var(--secondary-font);
    font-size: 32px;
    font-weight: 800;
    color: var(--textLink);
    line-height: 1.1;
    margin-bottom: 10px;
}
.modal ul,
.modal p{
    color: var(--textHeading);
    font-size: var(--textBodySmall);
    font-weight: 700;
}
.modal .text-highlight{
    color: var(--textLink);
}
.modal ul{
    margin: 0 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal .btn-row{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 20px;
    margin-top: 30px;
}
.modal .btn-row .btn{
    width: 100%;
    max-width: 240px;
}
.modal-content .videoPlayer{
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    border-radius: 20px;
    background: #011D62;
}
.modal-content .videoPlayer iframe,
.modal-content .videoPlayer video{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.modal-content .videoPlayer video{
    object-fit: contain;
    background: #000;
}
#gamePreviewModal .modal-content:not(.videoOverlayContent){
    background-color: #011D62
}

/* Home Stairs Game video overlay — Figma 960×692 player */
.modal.videoOverlay {
    background: rgba(1, 29, 98, 0.72);
    transition: opacity 150ms ease-out, visibility 150ms ease-out;
}

.modal.videoOverlay .modal-content.videoOverlayContent {
    width: min(960px, 92%);
    padding: 0;
    background-color: transparent;
    border-radius: 28px;
    overflow: visible;
    transform: scale(0.96);
    transition: transform 150ms ease-out, opacity 150ms ease-out;
    box-shadow: none;
}

.modal.videoOverlay.show .modal-content.videoOverlayContent {
    transform: scale(1);
}

.modal.videoOverlay .videoPlayer.customVideoPlayer {
    padding-top: 0;
    width: 100%;
    height: auto;
    aspect-ratio: 960 / 692;
    overflow: hidden;
    border-radius: 28px;
    background: #111;
}

.modal.videoOverlay .videoPlayer.customVideoPlayer video {
    object-fit: cover;
    background: #111;
}

.modal.videoOverlay .videoPlayer.customVideoPlayer video::-webkit-media-controls {
    display: none !important;
}

.modal.videoOverlay .close-modal {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: #8FD3F5;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    z-index: 3;
    box-shadow: none;
}

.videoPlayOverlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92px;
    height: 92px;
    border: none;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0 0 0 6px;
    z-index: 2;
    transition: opacity 150ms ease, background 150ms ease;
}

.videoPlayOverlay:hover {
    background: rgba(20, 20, 20, 0.62);
}

.customVideoPlayer.isPlaying .videoPlayOverlay {
    opacity: 0;
    pointer-events: none;
}

.videoControls {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    height: 44px;
    padding: 0 16px;
    background: #2d2d2d;
    border-radius: 8px;
    z-index: 2;
}

.videoControls .videoTime {
    flex: 0 0 auto;
    color: #fff;
    font-family: var(--secondary-font);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.videoControls .videoProgress {
    flex: 1 1 auto;
    min-width: 0;
    height: 14px;
    margin: 0;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

.videoControls .videoProgress::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(to right, #fff var(--progress, 0%), #6b6b6b var(--progress, 0%));
}

.videoControls .videoProgress::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    margin-top: -4px;
    border: none;
    border-radius: 50%;
    background: #fff;
}

.videoControls .videoProgress::-moz-range-track {
    height: 4px;
    border: none;
    border-radius: 4px;
    background: #6b6b6b;
}

.videoControls .videoProgress::-moz-range-progress {
    height: 4px;
    border-radius: 4px;
    background: #fff;
}

.videoControls .videoProgress::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 50%;
    background: #fff;
}

.videoControls button {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.videoControls .videoSpeed {
    width: auto;
    min-width: 28px;
    font-family: var(--secondary-font);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.videoControls .videoVolume .volumeOff,
.videoControls .videoVolume.isMuted .volumeOn {
    display: none;
}

.videoControls .videoVolume.isMuted .volumeOff {
    display: block;
}

.customVideoPlayer:fullscreen,
.customVideoPlayer:-webkit-full-screen {
    aspect-ratio: auto;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.customVideoPlayer:fullscreen video,
.customVideoPlayer:-webkit-full-screen video {
    object-fit: contain;
    border-radius: 0;
}

@media screen and (max-width: 767px) {
    .modal.videoOverlay .modal-content.videoOverlayContent {
        width: min(960px, 94%);
        border-radius: 18px;
    }

    .modal.videoOverlay .videoPlayer.customVideoPlayer {
        border-radius: 18px;
    }

    .modal.videoOverlay .close-modal {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .videoPlayOverlay {
        width: 72px;
        height: 72px;
    }

    .videoPlayOverlay svg {
        width: 28px;
        height: 30px;
    }

    .videoControls {
        left: 10px;
        right: 10px;
        bottom: 10px;
        height: 38px;
        gap: 8px;
        padding: 0 10px;
    }

    .videoControls .videoTime {
        font-size: 12px;
    }

    .videoControls .videoSpeed {
        font-size: 12px;
    }
}

.close-modal {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    font-size: 25px;
    color: #fff;
    font-weight: 700;
}

/* Tell a Friend — scoped to #gameModal1 so other modals stay unchanged */
#gameModal1 {
    background: rgba(0, 0, 0, 0.55);
    overflow-y: auto;
    padding: 24px 16px;
}

#gameModal1 .close-modal {
    display: none;
}

#gameModal1 .modal-content.tellFriendModal {
    display: flex;
    flex-direction: column;
    width: min(629px, 100%);
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    margin: auto;
    padding: 36px 40px 32px;
    background-color: #EAF6FF;
    border-radius: 40px;
    box-shadow: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#gameModal1 .modal-content.tellFriendModal::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

#gameModal1 .tellFriendModal h2 {
    font-family: var(--base-font);
    font-size: 32px;
    font-weight: 700;
    color: var(--textLink);
    line-height: 1.15;
    margin: 0 0 14px;
}

#gameModal1 .tellFriendModal ul {
    margin: 0 0 18px;
    padding-left: 20px;
    gap: 6px;
    list-style: disc;
}

#gameModal1 .tellFriendModal ul li {
    font-family: var(--secondary-font);
    font-size: 14px;
    font-weight: 600;
    color: var(--textBody);
    line-height: 1.35;
}

#gameModal1 .tellFriendModal ul li::marker {
    color: var(--textLink);
}

#gameModal1 .tellFriendForm {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    gap: 14px;
}

#gameModal1 .tellFriendField {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#gameModal1 .tellFriendField label {
    font-family: var(--secondary-font);
    font-size: 16px;
    font-weight: 700;
    color: var(--textHeading);
}

#gameModal1 .tellFriendField input,
#gameModal1 .tellFriendField textarea,
#gameModal1 .tellFriendMessage {
    width: 100%;
    max-width: 100%;
    font-family: var(--secondary-font);
    font-size: 15px;
    font-weight: 400;
    color: var(--textHeading);
    line-height: 1.45;
    background-color: var(--surfaceBase);
    border: 1.5px solid var(--borderColor);
    border-radius: 999px;
    padding: 11px 20px;
    outline: none;
    box-sizing: border-box;
}

#gameModal1 .tellFriendField input::placeholder {
    color: var(--textMute);
}

#gameModal1 .tellFriendField input:focus,
#gameModal1 .tellFriendField textarea:focus,
#gameModal1 .tellFriendMessage:focus {
    border-color: var(--borderActiveColor);
}

#gameModal1 .tellFriendField textarea,
#gameModal1 .tellFriendMessage {
    min-height: 132px;
    height: auto;
    resize: none;
    overflow: hidden;
    border-radius: 22px;
    padding: 12px 18px;
}

#gameModal1 .tellFriendMessage a {
    color: var(--textLink);
    text-decoration: underline;
}

#gameModal1 .tellFriendSubmit {
    width: 100%;
    max-width: none;
    margin-top: 4px;
    min-height: 52px;
    padding: 12px 24px;
    font-family: var(--base-font);
    font-size: 20px;
    font-weight: 700;
    border-radius: 999px;
}

@media screen and (max-width: 767px) {
    #gameModal1 .modal-content.tellFriendModal {
        width: min(629px, 100%);
        padding: 24px 18px 20px;
        border-radius: 28px;
    }

    #gameModal1 .tellFriendModal h2 {
        font-size: 26px;
    }

    #gameModal1 .tellFriendSubmit {
        min-height: 46px;
        font-size: 18px;
    }
}

/* Logout confirmation modal — scoped to #logoutModal only */
#logoutModal {
    background: rgba(1, 29, 98, 0.55);
  }
  
  #logoutModal .modal-content {
    width: min(620px, 92%);
    padding: 48px 40px 40px;
    background-color: #f4faff;
    border-radius: 32px;
    box-shadow: 0 18px 40px rgba(2, 101, 245, 0.16);
  }
  
  #logoutModal .close-modal {
    display: none;
  }
  
  #logoutModal .logoutModal {
    max-width: none;
    margin: 0;
    text-align: center;
  }
  
  #logoutModal .logoutModalIcon {
    display: block;
    width: 96px;
    height: 96px;
    margin: 0 auto 24px;
    object-fit: contain;
  }
  
  #logoutModal h2 {
    font-family: var(--base-font);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--textHeading);
    margin: 0 auto 12px;
    max-width: 515px;
  }
  
  #logoutModal p {
    font-family: var(--secondary-font);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--textBody);
    margin: 0 auto 32px;
    max-width: 480px;
  }
  
  #logoutModal .btn-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 0;
  }
  
  #logoutModal .btn-row .btn {
    width: auto;
    min-width: 160px;
    max-width: none;
    padding: 12px 36px;
    font-family: var(--base-font);
    font-size: 20px;
    font-weight: 700;
    border-radius: 999px;
  }
  
  @media screen and (max-width: 767px) {
    #logoutModal .modal-content {
      padding: 36px 20px 28px;
      border-radius: 24px;
    }
  
    #logoutModal .logoutModalIcon {
      width: 80px;
      height: 80px;
      margin-bottom: 20px;
    }
  
    #logoutModal h2 {
      font-size: 24px;
    }
  
    #logoutModal p {
      font-size: 16px;
      margin-bottom: 24px;
    }
  
    #logoutModal .btn-row {
      flex-direction: column;
      gap: 12px;
    }
  
    #logoutModal .btn-row .btn {
      width: 100%;
      min-width: 0;
      font-size: 18px;
      max-width: 300px;
    }
  }

/* Game preview video only (#kmg-game-video-modal). Shared .modal / .close-modal unchanged. */
#kmg-game-video-modal.kmg-game-video-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
}

#kmg-game-video-modal.kmg-game-video-modal[hidden] {
    display: none;
}

#kmg-game-video-modal .modal-content {
    width: min(1072px, 94vw, calc(90vh * 1072 / 720));
    max-width: 1072px;
    height: auto;
    max-height: min(720px, 90vh);
    aspect-ratio: 1072 / 720;
    padding: 0;
    margin: 0;
    background: #000;
    border: 0;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: none;
    transform: none;
}

#kmg-game-video-modal.show .modal-content {
    transform: none;
}

#kmg-game-video-modal .videoPlayer {
    position: absolute;
    top: calc(100% * 120 / 720);
    left: calc((100% - (100% * 803 / 1072)) / 2);
    width: calc(100% * 803 / 1072);
    height: auto;
    aspect-ratio: 833 / 487;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

#kmg-game-video-modal .videoPlayer iframe {
    position: absolute;
    inset: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
    border: 0;
}

#kmg-game-video-modal .kmg-game-video-close {
    top: 22px;
    right: 30px;
    z-index: 4;
    width: 100px;
    min-width: 100px;
    height: 50px;
    padding: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 16px;
    background: #000;
    color: #fff;
    font-family: var(--base-font);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 50px;
    text-transform: uppercase;
    opacity: 0.55;
}

#kmg-game-video-modal .kmg-game-video-close.kmg-game-video-skip {
    position: absolute;
    top: calc(100% * (120 + (803 * 487 / 833)) / 720 + 24px);
    right: calc((100% - (100% * 803 / 1072)) / 2);
    bottom: auto;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 0;
    height: auto;
    padding: 4px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-family: var(--secondary-font);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1;
    text-transform: none;
    cursor: pointer;
}

#kmg-game-video-modal .kmg-game-video-close.kmg-game-video-skip:hover,
#kmg-game-video-modal .kmg-game-video-close.kmg-game-video-skip:focus-visible {
    color: #fff;
}

@media screen and (max-width: 1199px) {
    #kmg-game-video-modal .modal-content {
        width: min(1072px, 92vw, calc(88vh * 1072 / 720));
        border-radius: 28px;
    }

    #kmg-game-video-modal .kmg-game-video-close {
        top: 16px;
        right: 20px;
        width: 88px;
        min-width: 88px;
        height: 42px;
        line-height: 42px;
        font-size: 14px;
        border-radius: 21px;
    }

    #kmg-game-video-modal .kmg-game-video-close.kmg-game-video-skip {
        top: calc(100% * (120 + (803 * 487 / 833)) / 720 + 20px);
        right: calc((100% - (100% * 803 / 1072)) / 2);
        bottom: auto;
        width: auto;
        min-width: 0;
        height: auto;
        line-height: 1;
        font-size: 13px;
        border-radius: 0;
    }
}

@media screen and (max-width: 767px) {
    #kmg-game-video-modal .modal-content {
        width: min(1072px, 96vw, calc(86vh * 1072 / 720));
        border-radius: 20px;
    }

    #kmg-game-video-modal .videoPlayer {
        top: 14%;
        left: 5%;
        width: 90%;
    }

    #kmg-game-video-modal .kmg-game-video-close {
        top: 10px;
        right: 10px;
        width: 76px;
        min-width: 76px;
        height: 36px;
        line-height: 36px;
        font-size: 12px;
        border-radius: 18px;
    }

    #kmg-game-video-modal .kmg-game-video-close.kmg-game-video-skip {
        top: auto;
        right: 5%;
        bottom: 12px;
        width: auto;
        min-width: 0;
        height: auto;
        padding: 8px 4px;
        line-height: 1;
        font-size: 13px;
        border-radius: 0;
    }
}

/* Preview Game modal only (#kmg-preview-game-modal). Other modals unchanged. */
#kmg-preview-game-modal .modal-content {
    background-color: #140C58;
}

#kmg-preview-game-modal .videoPlayer {
    background: #140C58;
}
  