/*
 * Shared Lemon-Web game-page chrome.
 * All hosted game pages use this file instead of page-level <style> blocks.
 */

html,
body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #000;
    font-family: "Lato", Arial, sans-serif;
}

#overlay-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    box-sizing: border-box;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: #000;
    background: #fff !important;
    font-size: 16px;
    transition: opacity 0.5s;
}

#overlay-bar.hidden {
    opacity: 0;
    pointer-events: none;
}

#overlay-bar > div {
    display: flex;
    align-items: center;
}

#menu-button {
    position: fixed;
    top: 5px;
    right: 5px;
    z-index: 10025;
    display: none;
    padding: 8px 12px;
    border: 0;
    border-radius: 5px;
    color: #fff;
    background: darkred;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.ejs_menu_bar {
    display: none !important;
}

.ejs_context_menu {
    display: none !important;
    visibility: hidden !important;
}

#fullscreen-button,
#back-button,
#quick-save,
#quick-load,
#change-disc,
.info-btn {
    box-sizing: border-box;
    padding: 8px 12px;
    border: 0;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

#fullscreen-button,
#quick-save,
#quick-load,
#change-disc,
.info-btn {
    margin-right: 10px;
}

#fullscreen-button {
    color: #fff;
    background: #007bff;
}

#fullscreen-button:hover {
    background: #0056b3;
}

#back-button {
    color: #fff;
    background: #7fbe54;
    white-space: nowrap;
}

#back-button:hover {
    background: #6ba946;
}

#quick-save {
    color: #fff;
    background: #d97e07;
}

#quick-save:hover {
    background: #b36704;
}

#quick-load {
    color: #fff;
    background: #9c0f05;
}

#quick-load:hover {
    background: #6e0a03;
}

#change-disc {
    color: #fff;
    background: #5b3fd0;
}

#change-disc:hover {
    background: #4530a2;
}

.info-btn {
    color: #000;
    background: #dedede;
}

.info-btn:hover {
    color: #fff;
    background: #000;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10030;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
}

.modal {
    width: min(720px, 90vw);
    max-width: 90vw;
    max-height: 85vh;
    box-sizing: border-box;
    overflow: auto;
    padding: 20px 24px;
    border-radius: 15px;
    color: #000;
    background: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-size: 18px;
    text-align: justify;
}

.modal button {
    margin-top: 10px;
    padding: 7px 14px;
    border: 0;
    border-radius: 5px;
    color: #fff;
    background: #7fbe54;
    font-size: 15px;
    cursor: pointer;
}

.modal button:hover {
    background: #6caf4d;
}

/* Multi-disc game modals */
#discSelectOverlay .modal {
    max-width: 460px;
    text-align: left;
}

.modal-header {
    margin-bottom: 10px;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.modal-title i {
    color: #007bff;
}

.modal-subtitle {
    margin: 6px 0 0;
    color: #555;
    font-size: 14px;
}

.disc-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.disc-choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #d0d4e4;
    border-radius: 8px;
    color: #222;
    background: #f5f7fb;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition:
        background 0.2s,
        border-color 0.2s,
        transform 0.1s;
}

.disc-choice-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.disc-choice-main i {
    color: #f7a531;
    font-size: 20px;
}

.disc-label {
    font-weight: 600;
}

.disc-desc {
    color: #555;
    font-size: 13px;
}

.disc-chevron {
    color: #999;
    font-size: 14px;
}

.disc-choice:hover {
    border-color: #007bff;
    background: #e3ecff;
    transform: translateY(-1px);
}

#changeDiscInfoOverlay .modal {
    max-width: 520px;
    font-size: 16px;
}

#changeDiscInfoOverlay ul {
    margin: 10px 0 0 20px;
    padding: 0;
}

#changeDiscInfoOverlay li {
    margin-bottom: 6px;
}

#changeDiscInfoOverlay .modal-title i {
    color: #5b3fd0;
}

/* Version-selection pages */
#modalOverlay .modal {
    width: min(720px, 90vw);
}

#modalOverlay h2 {
    margin-top: 0;
    text-align: center;
}

#modalOverlay .actions,
#versionModal .actions {
    margin-top: 12px;
    text-align: center;
}

#versionModal .modal {
    width: 50vw;
    min-width: 560px;
    max-width: 620px;
}

#versionModal h2 {
    margin: 0 0 10px;
    text-align: center;
}

#versionModal .choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    justify-items: center;
    gap: 20px;
    margin-top: 15px;
}

#versionModal .choice {
    width: clamp(180px, 22vw, 260px);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    border: 2px solid #eee;
    border-radius: 12px;
    background: #f8f8f8;
    cursor: pointer;
    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease;
}

#versionModal .choice:hover,
#versionModal .choice:focus {
    outline: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    transform: translateY(-2px);
}

#versionModal .choice img {
    width: 100%;
    aspect-ratio: 1;
    display: block;
    object-fit: contain;
    background: #111;
}

#versionModal .choice label {
    width: 100%;
    display: block;
    box-sizing: border-box;
    padding: 10px 12px;
    color: #222;
    font-weight: 700;
    text-align: center;
}

@media (max-width: 900px) {
    #versionModal .modal {
        width: 90vw;
        min-width: 0;
        max-width: 600px;
    }

    #versionModal .choice {
        width: clamp(150px, 38vw, 220px);
    }
}

@media (max-width: 600px) {
    #overlay-bar {
        padding: 0 7px;
        font-size: 12px;
    }

    #overlay-text,
    .info-btn {
        display: none;
    }

    #overlay-bar > div {
        width: 100%;
        justify-content: center;
        gap: 4px;
    }

    #fullscreen-button,
    #back-button,
    #quick-save,
    #quick-load,
    #change-disc {
        margin-right: 0;
        padding: 6px 8px;
        font-size: 12px;
    }

    #back-button {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .modal {
        max-width: 90vw;
        font-size: 16px;
    }

    #versionModal .modal {
        width: 90vw;
        max-width: 520px;
    }

    #versionModal .choice {
        width: clamp(140px, 40vw, 200px);
    }
}

@media (max-width: 600px) and (orientation: portrait) {
    #overlay-bar {
        justify-content: flex-end;
    }

    #overlay-bar > div {
        width: auto;
        max-width: 100%;
        margin-left: auto;
        justify-content: flex-end;
    }
}

@media (max-height: 480px) and (orientation: landscape) {
    #versionModal .modal {
        width: 70vw;
        max-width: 680px;
    }

    #versionModal .choice {
        width: clamp(150px, 28vw, 220px);
    }
}
