/* === Main Layout === */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

html.modal-open,
body.modal-open {
    overflow: hidden;
}

.party-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
}

.party-container {
    position: relative;
    margin: 4rem;
    margin: 0 auto;
    max-width: 1100px;
    width: 85%;
    max-width: 1100px;
    padding: 2.5rem;
    border: 1px solid var(--geo-border, rgba(150, 255, 220, 0.18));
    border-radius: var(--geo-radius-large, 18px);
    background: linear-gradient(
        145deg,
        var(--geo-panel, rgba(19, 25, 30, 0.96)),
        var(--geo-panel-alt, rgba(34, 45, 50, 0.9))
    );
    text-align: center;
    box-shadow: 0 18px 38px var(--geo-shadow, rgba(0, 0, 0, 0.28));
}

.party-lobby-title {
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 2px 2px 8px #000;
}

.party-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.party-heading-copy {
    margin: 0.35rem 0 0;
    color: rgba(239, 255, 248, 0.7);
    font-size: 0.9rem;
}

.party-heading-art {
    display: block;
    flex: 0 1 10rem;
    width: 10rem;
    max-width: 24%;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(139, 154, 255, 0.16));
}

.party-header {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-size: 1.2rem;
}

.party-code-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

#party-code {
    position: relative;
    font-weight: bold;
    color: #00ffae;
    cursor: pointer;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
}

/* === Player Section === */
.party-body {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.party-section {
    flex: 1;
    min-width: 320px;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    border-radius: var(--geo-radius-large, 18px);
    box-shadow: none;
    transition:
        transform 0.25s ease,
        border-color 0.25s ease,
        background-color 0.25s ease;
}

.party-section:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 255, 174, 0.4);
    background-color: rgba(0, 255, 174, 0.06);
}

.party-section h3 {
    margin-bottom: 1rem;
    color: #00ffae;
    font-weight: bold;
}

.party-container {
    width: min(900px, 90%);
    margin: 0 auto;
}

.party-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.party-container.team-mode .party-body {
    grid-template-columns: 1fr 1fr;
}

.party-section.players {
    min-height: 300px;
}

.party-container.team-mode #panel-left {
    border-top: 3px solid rgba(0, 153, 255, 0.7);
}

.party-container.team-mode #panel-right {
    border-top: 3px solid rgba(255, 76, 76, 0.7);
}

.party-footer {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Players List */
.players-loading {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.5rem;
    min-height: 300px;
}

.players ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.6rem;
}

.players ul li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.35);
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    color: gray;
    font-family: "Poppins", sans-serif;
    font-size: 0.95rem;
    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.15s ease;
}

.players ul li:hover {
    background-color: rgba(0, 255, 174, 0.15);
    transform: translateY(-2px);
}

.players ul li .left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.players ul li .star {
    font-size: 1.2rem;
}

.players ul li .username {
    font-weight: 500;
}

.players ul li .username.offline {
    color: gray;
}

.players ul li .username.online {
    color: white;
}

.players ul li .points {
    font-weight: 600;
    color: #e0be00;
}

.players ul li.host {
    border: 1.5px solid rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.25);
    background: rgba(255, 215, 0, 0.07);
    transition:
        background-color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.3s ease;
}

.players ul li.host:hover {
    background-color: rgba(255, 215, 0, 0.12);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.35);
    transform: translateY(-2px);
}

#panel-left,
#panel-right {
    display: flex;
    flex-direction: column;
}

#panel-left .players,
#panel-right .players {
    flex: 1;
}

#panel-left .blue-team {
    color: #0099ff;
}

#panel-right .red-team {
    color: #ff4c4c;
}

/* Team Colors */
.players ul li.team-blue {
    border-left: 4px solid #0099ff;
}

.players ul li.team-red {
    border-left: 4px solid #ff4c4c;
}

/* Layouts */
.ffa-layout .party-body {
    justify-content: center;
}

.ffa-layout .party-section {
    width: 90%;
    max-width: 800px;
}

.party-container.team-mode .players ul {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}

.party-container.ffa-layout .players ul {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    justify-content: center;
    gap: 0.7rem;
}

.settings-modal {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;

    max-height: 85vh;
    overflow-y: auto;

    scrollbar-width: thin;
    scrollbar-color: #00ffae rgba(255, 255, 255, 0.1);
}

/* custom scrollbar for webkit browsers */
.settings-modal::-webkit-scrollbar {
    width: 8px;
}

.settings-modal::-webkit-scrollbar-thumb {
    background-color: #00ffae;
    border-radius: 10px;
}

.settings-modal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.settings-modal h2 {
    margin: 0 0 0.4rem;
    color: #00ffae;
    font-weight: 700;
    font-size: 1.4rem;
    text-align: center;
}

/* Close Button */
.setting-group:nth-child(1) {
    z-index: 100;
}

.setting-group:nth-child(2) {
    z-index: 99;
}

.setting-group:nth-child(3) {
    z-index: 98;
}

.setting-group:nth-child(4) {
    z-index: 97;
}

/* === Setting Groups === */
.setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.45rem 0.9rem;
    transition: all 0.25s ease;
}

.setting-group.disabled {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(24, 24, 24, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.45rem 0.9rem;
    pointer-events: none;
    transition: all 0.25s ease;
}

.setting-group.disabled label {
    color: rgba(255, 255, 255, 0.35);
}

/* Disabled number/text inputs */
.setting-group.disabled input {
    background: rgba(0, 0, 0, 0.3) !important;
    color: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

/* Prevent hover highlight */
.setting-group.disabled:hover {
    background: rgba(40, 40, 40, 0.4);
    border-color: rgba(255, 255, 255, 0.05);
}

.setting-group:hover {
    border-color: rgba(0, 255, 174, 0.5);
    background-color: rgba(255, 255, 255, 0.05);
}

.setting-group label {
    color: #00ffae;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    flex: 1;
    margin-right: 1rem;
    margin-left: 0.2rem;
    white-space: nowrap;
}

.custom-dropdown,
.map-dropdown {
    flex: 1.2;
    position: relative;
}

.map-dropdown {
    position: relative;
    display: flex;
    flex-direction: column;
}

.map-selection-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1.2;
}

.map-selection-summary {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    gap: 0.15rem;
    text-align: left;
}

#map-modal {
    overflow: hidden;
    color: #fff;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-selection-type {
    color: rgba(206, 255, 235, 0.62);
    font-size: 0.75rem;
}

.map-picker-trigger {
    flex: 0 0 auto;
    padding: 0.55rem 0.85rem;
    border: 1px solid rgba(0, 255, 174, 0.3);
    border-radius: 10px;
    background: rgba(0, 255, 174, 0.1);
    color: #c9ffec;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.map-picker-trigger:hover {
    border-color: #00ffae;
    background: rgba(0, 255, 174, 0.2);
}

.app-modal-panel.map-picker-modal {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: min(90%, 70.5rem);
    max-height: 88vh;
    padding: clamp(1.25rem, 3vw, 2rem);
    overflow: hidden;
    text-align: left;
}

#map-picker-modal-overlay {
    z-index: 10001;
}

.map-picker-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding-right: 2rem;
}

.map-picker-heading h2 {
    margin: 0;
    color: #f4fff9;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.map-picker-heading > p {
    max-width: 20rem;
    margin: 0 0 0.2rem;
    color: rgba(239, 255, 248, 0.65);
    font-size: 0.9rem;
}

.map-picker-eyebrow {
    margin: 0 0 0.25rem;
    color: #00ffae;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.map-picker-search-label {
    color: rgba(239, 255, 248, 0.75);
    font-size: 0.82rem;
    font-weight: 600;
}

.map-picker-search {
    box-sizing: border-box;
    width: 100%;
    min-height: 2.9rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(159, 255, 220, 0.22);
    border-radius: 10px;
    background: rgba(5, 14, 18, 0.72);
    color: #fff;
    font: inherit;
}

.map-picker-search:focus-visible,
.map-filter-btn:focus-visible,
.map-card:focus-visible,
.map-picker-trigger:focus-visible {
    outline: 2px solid #00ffae;
    outline-offset: 2px;
}

.map-picker-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.map-filter-btn {
    padding: 0.45rem 0.8rem;
    border: 1px solid rgba(159, 255, 220, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(239, 255, 248, 0.72);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease;
}

.map-filter-btn:hover,
.map-filter-btn.active {
    border-color: rgba(0, 255, 174, 0.55);
    background: rgba(0, 255, 174, 0.12);
    color: #aaffdc;
}

.map-picker-count {
    margin: 0;
    color: rgba(239, 255, 248, 0.52);
    font-size: 0.78rem;
}

.map-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.15rem 0.25rem 0.25rem 0;
    scrollbar-color: rgba(0, 255, 174, 0.55) rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
}

.map-card {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    align-items: stretch;
    min-width: 0;
    min-height: 7rem;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(159, 255, 220, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
    color: #f4fff9;
    text-align: left;
    cursor: pointer;
    transition:
        border-color 0.18s ease,
        background-color 0.18s ease,
        transform 0.18s ease;
}

.map-card[hidden] {
    display: none;
}

.map-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 255, 174, 0.55);
    background: rgba(0, 255, 174, 0.07);
}

.map-card.selected {
    border-color: #00ffae;
    background: rgba(0, 255, 174, 0.11);
    box-shadow: 0 0 0 1px rgba(0, 255, 174, 0.2);
}

.map-card-image {
    width: 7rem;
    height: 100%;
    min-height: 7rem;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.2);
}

.map-card-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 0.3rem;
    padding: 0.7rem 0.85rem;
}

.map-card-title {
    overflow: hidden;
    font-size: 0.95rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-card-meta {
    overflow: hidden;
    color: #83eac0;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-card-description {
    display: -webkit-box;
    overflow: hidden;
    color: rgba(239, 255, 248, 0.6);
    font-size: 0.75rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.map-picker-empty {
    margin: 0;
    padding: 2rem 1rem;
    color: rgba(239, 255, 248, 0.65);
    text-align: center;
}

/* === Save Button === */
#save-settings-btn {
    width: 50%;
    height: 80%;
    color: #000;
    background: #00ffae;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    padding: 0.6rem 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 1rem auto 0 auto;
    box-shadow: 0 0 20px rgba(0, 255, 174, 0.3);
    cursor: pointer;
    transition: all 0.25s ease;
}

#save-settings-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 255, 174, 0.5);
}

/* === Subtle Entrance Animation === */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Mobile Adjustments === */
@media (max-width: 600px) {
    .party-heading-art {
        display: none;
    }

    .party-heading-copy {
        font-size: 0.8rem;
    }

    .settings-modal {
        padding: 2rem 1.4rem;
    }

    .settings-modal h2 {
        font-size: 1.4rem;
    }

    .settings-modal select,
    .settings-modal input {
        font-size: 0.95rem;
    }

    .map-selection-control {
        align-items: stretch;
        flex-direction: column;
    }

    .map-picker-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.4rem;
    }

    .map-picker-heading > p {
        max-width: none;
    }

    .map-picker-grid {
        grid-template-columns: 1fr;
    }
}

/* Footer Buttons */
.party-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    background: var(--geo-control-bg, rgba(5, 14, 18, 0.72));
    border: 1px solid var(--geo-control-border, rgba(159, 255, 220, 0.28));
    border-radius: var(--geo-radius, 12px);
    padding: 0.7rem 1rem;
    color: #fff;
    font-family: "Poppins", sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.dropdown-selected:hover {
    border-color: rgba(0, 255, 174, 0.7);
    background-color: var(--geo-control-bg-focus, rgba(8, 22, 25, 0.92));
    box-shadow: var(--geo-focus-ring, 0 0 0 3px rgba(0, 255, 174, 0.12));
}

.dropdown-options {
    position: absolute;
    top: 110%;
    width: 100%;
    left: 0;
    right: 0;
    background: rgba(12, 25, 31, 0.98);
    border: 1px solid rgba(159, 255, 220, 0.18);
    border-radius: var(--geo-radius, 12px);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.32);
    list-style: none;
    padding: 0.3rem 0;
    margin: 0;
    opacity: 0;
    overflow: hidden;
    max-height: 0px;
    visibility: hidden;
}

.dropdown-search {
    width: 100% !important;
    height: 43px !important;
}

.dropdown-options li {
    padding: 0.7rem 1rem;
    color: #00ffae;
    font-family: "Poppins", sans-serif;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-options.show {
    max-height: 300px;
    opacity: 1;
    visibility: visible;
}

.dropdown-options li:hover {
    background-color: rgba(0, 255, 174, 0.15);
    color: #fff;
}

.party-footer button {
    border: none;
    border-radius: 12px;
    padding: 0.9rem 1.6rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.25s ease;
}

.party-footer .primary {
    display: none;
    background-color: #00ffae;
    color: #000;
    box-shadow: 0 0 10px rgba(0, 128, 255, 0.3);
}

.party-footer .rejoin {
    display: none;
    background-color: #007bff;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.3);
}

.party-footer .secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.party-footer .danger {
    background-color: #ea3535;
    color: white;
    box-shadow: 0 0 10px rgba(255, 76, 76, 0.4);
}

.party-footer button:hover {
    transform: scale(1.05);
}

.party-footer button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* === Disband Modal === */
.disband-modal {
    max-width: 28rem;
    padding: 2.5rem;
    text-align: left;
    animation: slideUp 0.25s ease;
}

.disband-modal h2 {
    margin: 0 0 0.65rem;
    color: #ff7777;
    font-size: 1.55rem;
    letter-spacing: 0;
}

.disband-modal .disband-eyebrow {
    margin: 0 0 0.5rem;
    color: #ff9b9b;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.disband-modal p {
    margin: 0;
    color: rgba(244, 255, 249, 0.75);
    font-size: 0.95rem;
    line-height: 1.5;
}

.disband-modal .disband-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

.disband-modal .disband-actions button {
    min-width: 7.5rem;
    padding: 0.7rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.65rem;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.disband-modal .disband-actions .danger {
    border-color: rgba(255, 117, 117, 0.55);
    background: #a92e38;
    color: #fff;
}

.disband-modal .disband-actions .danger:hover:not(:disabled) {
    background: #c83b46;
    transform: translateY(-1px);
}

.disband-modal .disband-actions .secondary {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.07);
    color: #f4fff9;
}

.disband-modal .disband-actions .secondary:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
}

.disband-modal .disband-actions button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    position: relative;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);

    transition: all 0.25s ease;
}

/* Colors */
.status-dot.online {
    background-color: #00ffae;
    box-shadow: 0 0 8px #00ffae;
}

.status-dot.offline {
    background-color: #ff4c4c;
    box-shadow: 0 0 8px #ff4c4c;
    opacity: 0.7;
}

.status-dot::before,
.status-dot::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 12px;
    background-color: #ff4c4c;
    opacity: 0;
    transform: translate(-50%, -50%);

    transition: all 0.25s ease;
}

.status-dot::after {
    width: 12px;
    height: 2px;
}

.players ul li:hover .status-dot {
    background-color: transparent;
    border-radius: 0;
    transform: rotate(45deg) scale(1.4);
    box-shadow: none;
}

.players ul li:hover .status-dot::before,
.players ul li:hover .status-dot::after {
    opacity: 1;
}

@media (max-width: 700px) {
    .party-section {
        width: 90%;
    }

    .party-footer button {
        width: 100%;
    }

    .disband-modal {
        padding: 2rem 1.4rem;
    }

    .disband-modal .disband-actions {
        flex-direction: column-reverse;
    }

    .disband-modal .disband-actions button {
        width: 100%;
    }
}

@media (max-width: 840px) {
    .party-container.team-mode .party-body {
        grid-template-columns: 1fr;
    }
}

/* The control remains clickable only to explain why party start is blocked. */
.party-footer .start-game-blocked {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.55);
}
