/* =========================================================
   JOIN MULTIPLAYER GAME
   ========================================================= */

.join-game-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
}

.join-game-panel {
    max-width: 760px;
    width: 100%;
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: var(--shadow);
}

.join-game-heading {
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.join-game-heading h2 {
    margin: 0 0 12px;
    color: var(--primary-dark);
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
}

.join-game-heading p:not(.eyebrow) {
    max-width: 600px;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.join-game-form {
    display: grid;
    gap: 22px;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    color: var(--primary-dark);
    font-weight: 800;
}

.form-group input {
    width: 100%;
    min-height: 50px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: white;
    color: var(--text);
    font: inherit;
}

.form-group input:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(30, 91, 138, 0.13);
}

#joinCode {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.field-help {
    margin: 0;
    color: var(--muted);
    font-size: 0.87rem;
    line-height: 1.5;
}

.form-message {
    margin-bottom: 22px;
    padding: 13px 15px;
    border-radius: 10px;
    font-weight: 700;
    line-height: 1.5;
}

.error-message {
    border: 1px solid #d89a9a;
    background: #fff0f0;
    color: #8c2020;
}

.primary-button {
    min-height: 50px;
    padding: 12px 18px;
    border: 0;
    border-radius: 11px;
    background: var(--primary);
    color: white;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.primary-button:hover {
    filter: brightness(0.95);
}

.join-explanation {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.join-explanation h3 {
    margin: 0 0 12px;
    color: var(--primary-dark);
}

.join-explanation ol {
    margin: 0;
    padding-left: 22px;
    color: var(--text);
    line-height: 1.7;
}

.join-explanation p {
    margin: 14px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 22px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: white;
    color: var(--primary-dark);
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 880px) {
    .join-game-page {
        grid-template-columns: 1fr;
    }

    .join-game-panel {
        max-width: none;
    }
}

@media (max-width: 620px) {
    .join-game-panel {
        padding: 22px 15px;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
    }
}

/* Join page layout */
.join-game-page {
    grid-template-columns: minmax(0, 1fr) 300px;
    max-width: 1200px;
    margin: 0 auto;
}

.join-game-content {
    display: grid;
    gap: 24px;
    min-width: 0;
}

.join-game-panel {
    max-width: none;
}

.join-game-heading h2 {
    font-size: clamp(26px, 3vw, 36px);
}

.public-games-panel {
    padding: 28px;
    background: #ffffff;
    border: 1px solid #dce3eb;
    border-radius: 14px;
}

.public-games-panel h2 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #243247;
}

.public-games-panel > p {
    color: #68778b;
}

.public-games-list {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.public-game-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 18px;
    background: #f7f9fc;
    border: 1px solid #dce3eb;
    border-radius: 12px;
}

.public-game-card p {
    margin: 5px 0;
    font-size: 14px;
    color: #68778b;
}

.public-game-card a {
    padding: 12px 22px;
    background: #27956a;
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 880px) {
    .join-game-page {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .public-games-panel {
        padding: 20px 15px;
    }

    .public-game-card {
        flex-direction: column;
        align-items: stretch;
    }

    .public-game-card a {
        text-align: center;
    }
}

/* Final join page layout */
.join-game-page {
    display: flex;
    flex-direction: column;
    max-width: 850px;
    margin: 0 auto;
    gap: 28px;
}

.join-game-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.join-game-panel {
    box-shadow: none;
}

.join-game-page > aside,
.join-game-page > .sidebar-slot {
    align-self: flex-start;
    width: min(100%, 300px);
}

/* Compact JOIN page */
.join-game-page {
    width: min(850px, calc(100% - 32px));
    padding: 32px 0 60px;
    gap: 22px;
}

.join-page-title {
    margin: 0 0 8px;
    text-align: center;
    font-size: clamp(26px, 3vw, 36px);
    letter-spacing: 2px;
    color: #243247;
}

.join-game-panel,
.public-games-panel {
    width: 100%;
    padding: 25px 30px;
    border: 1px solid #dce3eb;
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
}

.join-game-panel h2,
.public-games-panel h2 {
    margin: 0 0 20px;
    font-size: 21px;
    color: #243247;
}

.join-game-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px 14px;
    align-items: end;
}

.join-game-form label {
    font-weight: 700;
    color: #243247;
}

.join-game-form label[for="joinCode"] { grid-column: 1; grid-row: 1; }
.join-game-form label[for="playerName"] { grid-column: 2; grid-row: 1; }

.join-game-form input,
.public-game-card input[name="player_name"] {
    min-width: 0;
    width: 100%;
    height: 48px;
    padding: 10px 12px;
    border: 1px solid #dce3eb;
    border-radius: 10px;
    background: white;
    font: inherit;
}

.join-game-form #joinCode {
    grid-column: 1;
    grid-row: 2;
    font-size: 16px;
}

.join-game-form #playerName {
    grid-column: 2;
    grid-row: 2;
}

.join-game-form .primary-button {
    grid-column: 3;
    grid-row: 2;
    min-width: 100px;
    height: 48px;
    background: #3265a8;
}

.public-games-list { margin-top: 0; }

.public-game-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px auto;
    gap: 15px;
    align-items: center;
}

.public-game-card p { margin: 4px 0; }

.public-join-button {
    height: 46px;
    padding: 0 22px;
    border: 0;
    border-radius: 10px;
    background: #27956a;
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.join-activity-area {
    align-self: flex-start;
    width: min(100%, 300px);
}

@media (max-width: 650px) {
    .join-game-panel,
    .public-games-panel { padding: 20px 16px; }

    .join-game-form,
    .public-game-card {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .join-game-form label[for="playerName"] { margin-top: 8px; }

    .join-game-form .primary-button,
    .public-join-button { width: 100%; }
}

.join-page-title {
    font-size: 24px;
    letter-spacing: 0.5px;
}

.public-name-label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 700;
    color: #243247;
}

#publicPlayerName {
    display: block;
    width: min(100%, 340px);
    height: 46px;
    margin-bottom: 18px;
    padding: 10px 12px;
    border: 1px solid #dce3eb;
    border-radius: 10px;
    background: #fff;
    font: inherit;
}

/* Unified Friends Sudoku join design */

.join-game-page {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    width: 100%;
    max-width: 1200px;
    padding: 0;
    gap: 28px;
    align-items: start;
}

.join-activity-area {
    grid-column: 1;
    grid-row: 1;
}

.join-game-content {
    grid-column: 2;
    grid-row: 1;
    padding: 22px 30px;
    background: #f4f7fa;
    border: 1px solid var(--border);
    border-radius: 24px;
    gap: 18px;
}

.join-page-title {
    align-self: center;
    margin: 0 0 4px;
    padding-bottom: 5px;
    border-bottom: 2px solid #23966b;
    color: #23966b;
    font-size: 32px;
    letter-spacing: 1px;
}

.join-game-panel,
.public-games-panel {
    padding: 18px;
    background: white;
    border-radius: 12px;
}

.join-game-panel h2,
.public-games-panel h2 {
    font-size: 18px;
    margin-bottom: 14px;
    color: #23966b;
}

.join-game-form .primary-button,
.public-join-button {
    background: #23966b;
}

.public-game-card {
    grid-template-columns: minmax(0, 1fr) 110px;
    padding: 14px;
}

@media (max-width: 880px) {
    .join-game-page {
        grid-template-columns: minmax(0, 1fr);
    }

    .join-game-content {
        grid-column: 1;
        grid-row: 1;
    }

    .join-activity-area {
        grid-column: 1;
        grid-row: 2;
    }
}

@media (max-width: 650px) {
    .join-game-content {
        padding: 20px 14px;
    }

    .join-page-title {
        font-size: 26px;
    }
}

/* Shared player name */

.shared-player-name label {
    display: block;
    margin-bottom: 6px;
    color: var(--primary-dark);
    font-weight: 800;
}

.shared-player-name input {
    width: 100%;
    max-width: 380px;
    height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: white;
    font: inherit;
}

.join-game-form {
    grid-template-columns: minmax(0, 1fr) 110px;
}

.join-game-form .primary-button {
    grid-column: 2;
    grid-row: 2;
}

.join-game-form #joinCode {
    max-width: 380px;
}


.public-game-info p {
    color: #166534;
}


@media (max-width: 880px) {
    .join-activity-area {
        justify-self: center;
    }
}
