/* Front page: join a room by name (Input + Button), or pick an open one (Card + Table). */
body {
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.home {
    display: grid;
    grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
    column-gap: 64px;
    align-items: start;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto auto;
    padding: 0 32px;
}

.home-brand {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 72px;
}

.home-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--text-base);
    font-weight: 500;
}

.home-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-account {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-sm);
    color: var(--muted-foreground);
}

.team-account[hidden] {
    display: none;
}

.team-account strong {
    font-weight: 500;
    color: var(--foreground);
}

/* ---------- New room dialog: one step shown at a time ---------- */

.dialog-step {
    display: none;
    gap: 20px;
}

.room-dialog[data-step="signin"] [data-show="signin"],
.room-dialog[data-step="form"] [data-show="form"],
.room-dialog[data-step="done"] [data-show="done"] {
    display: grid;
}

/* Cloudflare mode has no password form, only an explanation. */
.room-dialog .cf-only,
.room-dialog[data-method="cloudflare-access"] .signin-only {
    display: none;
}

.room-dialog[data-method="cloudflare-access"] .cf-only {
    display: revert;
}

.room-dialog[data-method="cloudflare-access"] a.cf-only {
    display: inline-flex;
    text-decoration: none;
}

.room-dialog .field-hint-tight {
    margin-top: -12px;
}

.done-media {
    margin-bottom: 4px;
    color: var(--primary-foreground);
    background: var(--primary);
}

#join-host {
    text-decoration: none;
}

.btn[aria-busy="true"] {
    opacity: .6;
    cursor: progress;
}

.home-join {
    padding-top: 96px;
}

.navbar-brand {
    margin: 0;
    font-size: var(--text-3xl);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.home-lede {
    margin: 8px 0 32px;
    font-size: var(--text-base);
    color: var(--muted-foreground);
}

.home-row {
    display: flex;
    gap: 8px;
}

.home-row .form-control {
    flex: 1;
    height: 40px;
    padding: 0 16px;
}

.home-row .btn {
    flex: none;
    padding: 0 20px;
}

#errormessage {
    min-height: 20px;
    margin: 12px 0 0;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--destructive);
}

.groups {
    margin-top: 96px;
}

.nogroups {
    display: none;
}

#public-groups-table td {
    height: 44px;
    padding: 0 12px 0 0;
    color: var(--muted-foreground);
    vertical-align: middle;
}

#public-groups-table tr:first-child td {
    border-top: 0;
}

#public-groups-table td:last-child {
    padding-right: 0;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* An upcoming room: when it opens, as a badge. */
.room-when {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-3xl);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--foreground);
}

#public-groups-table tr a {
    margin: 0;
    font-weight: 500;
    color: var(--foreground);
    text-decoration: none;
}

#public-groups-table tr a:hover {
    text-decoration: underline;
}

/* "No open rooms right now." and fetch errors are written into the table. */
#public-groups-table:not(:has(tr)) {
    display: block;
    padding: 12px 0 0;
    color: var(--muted-foreground);
}

@media only screen and (max-width: 800px) {
    .home {
        grid-template-columns: minmax(0, 1fr);
        padding: 0 16px;
    }

    .home-brand {
        height: 60px;
    }

    .team-account {
        display: none !important;
    }

    .room-dialog .field-row {
        grid-template-columns: 1fr;
    }

    .home-join {
        padding-top: 32px;
    }

    .navbar-brand {
        font-size: var(--text-2xl);
    }

    .groups {
        margin-top: 32px;
    }

    .signature {
        padding: 24px 16px;
    }
}
