/* =========================================================
   CREATE MULTIPLAYER GAME
   ========================================================= */

.create-game-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
}

.create-game-panel {
    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);
}

.create-game-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.create-game-heading h2 {
    margin: 0 0 10px;
    color: var(--primary-dark);
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
}

.create-game-heading p:not(.eyebrow) {
    max-width: 620px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 46px;
    padding: 11px 17px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    color: var(--primary-dark);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.secondary-button:hover,
.secondary-button:focus-visible {
    border-color: var(--primary);
    background: var(--surface-soft);
}

.create-game-form {
    display: grid;
    gap: 24px;
}

.form-field {
    min-width: 0;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary-dark);
    font-weight: 800;
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="url"],
.form-field select {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: white;
    color: var(--primary-dark);
    font: inherit;
}

.form-field input:focus,
.form-field select:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(35, 111, 170, 0.14);
}

.field-help {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.score-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.range-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 8px;
}

.range-heading label {
    margin: 0;
}

.range-heading output {
    min-width: 48px;
    padding: 6px 10px;
    border-radius: 9px;
    background: var(--surface-soft);
    color: var(--primary-dark);
    font-weight: 800;
    text-align: center;
}

.form-field input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.range-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.8rem;
}

.optional-label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.checkbox-field input {
    width: 20px;
    height: 20px;
    margin: 0;
}

.checkbox-field label {
    margin: 0;
    cursor: pointer;
}

.form-actions {
    padding-top: 4px;
}

.primary-button {
    min-height: 48px;
    padding: 12px 20px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.primary-button:hover,
.primary-button:focus-visible {
    filter: brightness(0.94);
}

@media (max-width: 880px) {
    .create-game-page {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .create-game-panel {
        padding: 22px 14px;
        border-radius: 18px;
    }

    .create-game-heading {
        display: block;
    }

    .create-game-heading .secondary-button {
        margin-top: 18px;
    }

    .score-fields {
        grid-template-columns: 1fr;
    }

    .primary-button {
        width: 100%;
    }
}

/* Compact create-game layout */
.create-game-panel {
    padding: 26px 30px;
}

.create-game-heading {
    margin-bottom: 20px;
}

.create-game-form {
    gap: 16px;
}

.field-help {
    margin-top: 5px;
    line-height: 1.35;
}

.form-field label {
    margin-bottom: 5px;
}

@media (max-width: 620px) {
    .create-game-panel {
        padding: 20px 14px;
    }
}

/* Compact input widths */
.create-game-form > .form-field input[type="text"],
.create-game-form > .form-field select,
.create-game-form > .form-field input[type="range"],
.create-game-form > .form-field .range-scale {
    width: 100%;
    max-width: 320px;
}

.score-fields {
    grid-template-columns: repeat(2, 160px);
}

.score-fields input[type="number"] {
    width: 140px;
    max-width: 100%;
}

@media (max-width: 620px) {
    .score-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Activity left, form right */
.create-game-page {
    grid-template-columns: 300px minmax(0, 1fr);
}

.create-game-panel {
    grid-column: 2;
    grid-row: 1;
}

.create-game-page > aside {
    grid-column: 1;
    grid-row: 1;
}

/* Keep slider value aligned with slider */
.range-heading {
    max-width: 320px;
}

/* More room for score labels */
.score-fields {
    grid-template-columns: repeat(2, minmax(0, 230px));
    gap: 20px;
}

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

    .create-game-panel,
    .create-game-page > aside {
        grid-column: 1;
        grid-row: auto;
    }
}

/* Two-column create game form */
.create-game-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
    row-gap: 22px;
    align-items: start;
}

.create-game-form > .form-field,
.create-game-form > .score-fields {
    min-width: 0;
}

.create-game-form > .form-field input[type="text"],
.create-game-form > .form-field select {
    width: 100%;
    max-width: 320px;
}

.create-game-form > .clues-field {
    grid-column: 1 / -1;
}

.create-game-form > .score-fields {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
}

.create-game-form > .form-actions {
    grid-column: 1 / -1;
}

@media (max-width: 620px) {
    .create-game-form {
        grid-template-columns: 1fr;
    }

    .create-game-form > .clues-field,
    .create-game-form > .score-fields,
    .create-game-form > .form-actions {
        grid-column: 1;
    }

    .create-game-form > .score-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

/* Final create-game layout */

.create-game-panel {
    background: #f4f7fa;
}

.create-game-heading {
    display: block;
    text-align: center;
    margin-bottom: 24px;
}

.create-game-heading h2 {
    font-size: 32px;
    color: #32629e;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.create-game-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 24px;
}

.create-game-form > .form-field:has(#turnTimeLimit) {
    grid-column: 2;
    grid-row: 2;
}

.create-game-form > .score-fields {
    grid-row: 3;
    gap: 24px;
}

.create-game-form > .clues-field {
    grid-row: 4;
}

.create-game-form > .form-field input[type="text"],
.create-game-form > .form-field select,
.score-fields input[type="number"],
.range-heading,
.create-game-form > .form-field input[type="range"],
.create-game-form > .form-field .range-scale {
    width: 100%;
    max-width: 100%;
}

.form-field label[for="correctScore"] {
    color: #23966b;
}

#correctScore {
    border-color: #23966b;
    color: #23966b;
}

.form-field label[for="wrongPenalty"] {
    color: #df893b;
}

#wrongPenalty {
    border-color: #df893b;
    color: #bd702b;
}

.range-heading output {
    background: #32629e;
    color: white;
}

.form-actions {
    text-align: center;
}

.form-actions .primary-button {
    min-width: 205px;
    background: #32629e;
    text-transform: uppercase;
}

@media (max-width: 620px) {
    .create-game-form {
        grid-template-columns: 1fr;
    }

    .create-game-form > .form-field:has(#turnTimeLimit),
    .create-game-form > .score-fields,
    .create-game-form > .clues-field {
        grid-column: 1;
        grid-row: auto;
    }
}

.create-game-heading {
    border-bottom: 2px solid #32629e;
    padding-bottom: 14px;
    margin-bottom: 22px;
}

.create-game-heading h2 {
    margin-bottom: 0;
}

.create-game-heading {
    border-bottom: none;
    padding-bottom: 0;
}

.create-game-heading h2 {
    display: inline-block;
    border-bottom: 2px solid #32629e;
    padding-bottom: 5px;
    margin-bottom: 0;
}

/* Final spacing adjustments */
.create-game-panel {
    padding-top: 22px;
    padding-bottom: 22px;
}

.create-game-heading {
    margin-bottom: 18px;
}

.create-game-form {
    row-gap: 12px;
}

.create-game-form .form-field input[type="text"],
.create-game-form .form-field select {
    min-height: 42px;
    padding: 8px 12px;
}

.form-actions {
    padding-top: 0;
}
