/* Splash intro + High Seas lobby background overlay */

html.page-splash-active,
html.page-splash-active body {
    height: 100%;
    overflow: hidden;
    margin: 0;
}

.page-lobby {
    min-height: 100vh;
    overflow: hidden;
}

/* ── Splash ── */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #040810;
    background-image: var(--splash-bg);
    background-size: 115%;
    background-position: center center;
    background-repeat: no-repeat;
    transition: opacity 0.9s ease, visibility 0.9s ease;
}

.splash-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(4, 12, 24, 0.35) 0%,
        rgba(4, 12, 24, 0.55) 50%,
        rgba(4, 12, 24, 0.75) 100%
    );
    pointer-events: none;
}

.splash-screen.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-logo {
    position: relative;
    z-index: 1;
    max-width: min(520px, 85vw);
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    transform: translateX(-120vw);
    opacity: 0;
    filter: drop-shadow(0 12px 40px rgba(0, 0, 0, 0.6));
}

.splash-screen.logo-in .splash-logo {
    animation: logoSlideIn 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes logoSlideIn {
    0% {
        transform: translateX(-120vw) scale(0.92);
        opacity: 0;
    }
    70% {
        transform: translateX(0) scale(1.02);
        opacity: 1;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* ── Lobby with background art ── */
.lobby-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease, visibility 1s ease;
    background: #061018;
}

.lobby-screen.show {
    opacity: 1;
    visibility: visible;
}

.lobby-screen.hidden {
    display: block !important;
}

.lobby-bg {
    position: fixed;
    inset: 0;
    background-size: 115%;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.lobby-bg-dim {
    position: fixed;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(4, 12, 24, 0.6) 0%,
        rgba(4, 12, 24, 0.8) 45%,
        rgba(4, 12, 24, 0.95) 100%
    );
}

.lobby-bg-picker {
    background-size: cover;
    background-position: center center;
}

.lobby-bg-dim-picker {
    background: linear-gradient(
        180deg,
        rgba(8, 16, 32, 0.28) 0%,
        rgba(8, 16, 32, 0.42) 45%,
        rgba(6, 12, 24, 0.62) 100%
    );
}

.lobby-bg-naval {
    background-size: cover;
    background-position: center center;
}

.lobby-bg-dim-naval {
    background: linear-gradient(
        180deg,
        rgba(4, 10, 18, 0.45) 0%,
        rgba(4, 12, 22, 0.62) 50%,
        rgba(2, 8, 14, 0.82) 100%
    );
}

.lobby-overlay {
    position: relative;
    z-index: 2;
    height: 100%;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    padding: clamp(12px, 3vh, 28px) clamp(16px, 4vw, 40px);
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.lobby-create-controls {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.lobby-create-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.lobby-create-actions .btn-gold,
.lobby-create-actions .btn-primary {
    width: 100%;
    margin: 0;
}

.lobby-overlay-header {
    text-align: center;
    flex-shrink: 0;
    animation: overlayFadeUp 0.8s ease 0.3s both;
}

.lobby-overlay-header h1 {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    margin: 0 0 6px;
    color: #ffd36b;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8);
}

.lobby-overlay-header .tagline {
    margin: 0;
    color: #c8dce8;
    font-size: 0.95rem;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
}

.lobby-panels-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(16px, 3vw, 32px);
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    flex: 1;
    align-items: center;
    animation: overlayFadeUp 0.8s ease 0.55s both;
}

.lobby-panel-left {
    justify-self: start;
    width: 100%;
    max-width: 380px;
}

.lobby-panel-right {
    justify-self: end;
    width: 100%;
    max-width: 380px;
}

.lobby-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: clamp(8px, 2vh, 20px);
    animation: overlayFadeUp 0.8s ease 0.75s both;
}

.lobby-footer .analytics-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lobby-how-btn {
    width: auto !important;
    min-width: 180px;
    padding: 12px 28px !important;
    font-size: 1rem !important;
    margin: 0 !important;
}

.lobby-ad-free-btn.is-owned,
.lobby-ad-free-btn:disabled {
    opacity: 0.75;
    cursor: default;
    filter: none;
}

.lobby-ad-free-btn.is-owned:hover,
.lobby-ad-free-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.88);
    color: #ffffff;
}

.payments-test-mode-hint {
    width: 100%;
    margin: 0 0 8px;
    font-size: 0.82rem;
    color: rgba(255, 211, 107, 0.85);
    text-align: center;
}

@media (max-width: 720px) {
    .lobby-overlay {
        justify-content: flex-start;
        gap: 10px;
        height: auto;
        min-height: 100dvh;
        max-height: none;
        padding: max(10px, env(safe-area-inset-top, 0px)) 12px max(16px, env(safe-area-inset-bottom, 0px));
    }

    .lobby-overlay-header {
        margin-bottom: 2px;
    }

    .lobby-overlay-header h1 {
        font-size: clamp(1.35rem, 7vw, 1.85rem);
        margin-bottom: 2px;
    }

    .lobby-overlay-header .tagline {
        font-size: 0.82rem;
        line-height: 1.25;
    }

    .lobby-panels-row {
        grid-template-columns: 1fr;
        max-width: min(440px, 100%);
        flex: 0 0 auto;
        align-content: start;
        align-items: stretch;
        gap: 12px;
        margin: 0 auto;
        overflow: visible;
    }

    .lobby-panel-left,
    .lobby-panel-right {
        justify-self: stretch;
        max-width: none;
    }

    .lobby-panel-left {
        order: 1;
    }

    .lobby-panel-right {
        order: 2;
    }

    .lobby-create-actions {
        position: sticky;
        bottom: 0;
        z-index: 3;
        padding-top: 8px;
        margin-top: 8px;
        background: linear-gradient(180deg, transparent, rgba(8, 22, 38, 0.96) 28%);
    }

    .lobby-footer {
        order: 3;
        gap: 8px;
        padding-top: 4px;
    }
}

/* Short phones (portrait) — keep Create / Quick Play above the fold */
@media (max-width: 768px) and (max-height: 740px) {
    .lobby-overlay-header h1 {
        font-size: 1.25rem;
    }

    .lobby-panel-right .rank-plaque,
    .lobby-panel-right .name-claim-status,
    .lobby-panel-right .login-streak-hint {
        display: none;
    }

    .lobby-panel h2 {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .auth-logged-in-bar {
        padding: 6px 8px;
    }
}

.overlay-panel {
    background: rgba(8, 22, 38, 0.88);
    border: 1px solid rgba(255, 211, 107, 0.35);
    backdrop-filter: blur(8px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    margin-bottom: 0;
    padding: 18px;
}

.overlay-panel h2 {
    margin-top: 0;
    font-size: 1.2rem;
}

.overlay-panel button {
    margin-top: 10px;
}

.rank-badge {
    margin: 6px 0 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 211, 107, 0.12);
    border: 1px solid rgba(255, 211, 107, 0.35);
    color: #ffe8a0;
    font-size: 0.82rem;
    line-height: 1.35;
}

.overlay-btn-small {
    width: auto !important;
    display: inline-block;
    margin-top: 8px !important;
    padding: 8px 14px !important;
    font-size: 0.85rem !important;
}

@keyframes overlayFadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rules-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    padding: 16px;
    box-sizing: border-box;
}

.rules-overlay.hidden {
    display: none !important;
}

.rules-overlay .modal.tutorial-modal.tutorial-premium {
    max-width: min(920px, 96vw);
    max-height: 90vh;
}

.page-lobby .sea-bg {
    display: none;
}

.page-lobby .lobby-wrap {
    display: none;
}
