header {
    position: relative;
    min-height: 260px;
    overflow: hidden;
    isolation: isolate;
    border-bottom: 6px solid #5a8f38;
    background-image:
        linear-gradient(90deg, #0b0e0be8 0%, #0b0e0b9c 42%, #0b0e0b30 75%),
        url('kellercraft-hero.webp');
    background-size: cover;
    background-position: center 54%;
    padding-left: max(1.25rem, calc((100vw - 1155px) / 2));
    padding-right: max(1.25rem, calc((100vw - 1155px) / 2));
    max-width: none;
}

header::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 14px;
    background: linear-gradient(#79bd4d 0 42%, #4e7e30 42% 58%, #704c30 58%);
    z-index: -1;
}

header > div,
header > form {
    position: relative;
    z-index: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .7rem;
}

header h1 small {
    display: block;
    margin-top: .35rem;
    color: #8bd35c;
    font: 900 clamp(.8rem, 1.5vw, 1.15rem)/1 ui-monospace,monospace;
    letter-spacing: .16em;
    text-shadow: 2px 2px #000;
}

.header-actions form {
    margin: 0;
}

.back-link {
    display: inline-block;
    border: 3px solid;
    border-color: #b0e786 #315021 #315021 #b0e786;
    padding: .68rem 1rem;
    background: linear-gradient(#78be4d,#579435);
    color: #10200d;
    font: 800 .84rem/1 ui-monospace,monospace;
    text-transform: uppercase;
    text-decoration: none;
    box-shadow: 3px 3px 0 #0008;
}

.back-link:hover {
    filter: brightness(1.13);
    transform: translateY(-1px);
}

@media (max-width: 650px) {
    header {
        align-items: flex-end;
    }
    .back-link {
        padding: .6rem .7rem;
        font-size: .7rem;
    }
}

.player-list {
    display: grid;
    gap: .55rem;
    max-height: 340px;
    overflow: auto;
}

.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem;
    background: #111516;
    border: 2px inset #4d5557;
}

.player-row small {
    display: block;
    color: #aeb5aa;
    font-size: .7rem;
}

.player-row form {
    display: flex;
    gap: .35rem;
}

button.mini {
    padding: .45rem .55rem;
    font-size: .68rem;
}

input[readonly] {
    color: #8bd35c;
    background: #182018;
    cursor: copy;
}

.check.locked {
    color: #8bd35c;
    cursor: not-allowed;
}

.check.locked input {
    opacity: 1;
}

.help-box {
    margin: 0 0 1rem;
    background: #172018;
    border: 2px solid;
    border-color: #5f7954 #172217 #172217 #5f7954;
}

.help-box summary {
    padding: .7rem .8rem;
    color: #8bd35c;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
}

.help-box summary:hover {
    background: #223022;
}

.help-box > div {
    padding: 0 .9rem .8rem;
    color: #c7cdc1;
    font-size: .82rem;
}

.help-box ol {
    padding-left: 1.3rem;
}

.help-box li,
.help-box p {
    margin: .6rem 0;
}

main {
    max-width: 1420px;
    width: 100%;
}

.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1.35rem;
    align-items: start;
}

.status-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.15rem;
}

.card {
    padding: 1.5rem;
    min-width: 0;
}

.card.wide {
    width: 100%;
}

.buttons button {
    flex: 1 1 145px;
    min-width: 0;
}

.player-row > div:first-child {
    min-width: 180px;
}

.player-row form {
    display: grid;
    grid-template-columns: repeat(2, minmax(94px, 1fr));
    justify-content: flex-end;
}

.player-row button.mini {
    min-width: 94px;
}

.table-wrap table {
    min-width: 780px;
}

.job-watch {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    border: 2px solid #5f7954;
    background: #172018;
    color: #d7dfd1;
}

.job-watch strong {
    color: #8bd35c;
    white-space: nowrap;
}

.job-watch.failed {
    border-color: #a54a43;
    background: #321c1c;
}

.job-watch.failed strong {
    color: #ff8178;
}

.managed-users {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
}

.managed-user {
    padding: 1rem;
    background: #151a1b;
    border: 2px inset #4d5557;
    min-width: 0;
    overflow-wrap: anywhere;
}

.managed-user h3,
.managed-user p {
    margin-top: 0;
}

.managed-user h3 small {
    color: #8bd35c;
}

.managed-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto auto;
    gap: .7rem;
    align-items: end;
}

.managed-email {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: .7rem;
    align-items: end;
    margin-top: .8rem;
}

form,
label,
input,
select,
.audit,
.table-wrap {
    min-width: 0;
    max-width: 100%;
}

@media (max-width: 1050px) {
    .grid {
        grid-template-columns: 1fr !important;
    }

    .status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    header {
        min-height: 190px;
        background-position: 62% center;
        padding: 2.2rem 1rem 1rem;
        align-items: flex-start;
    }

    header h1 {
        font-size: 2.35rem;
    }

    .card {
        padding: 1rem;
        box-shadow: 4px 4px 0 #0008;
    }

    .buttons button {
        flex-basis: 100%;
        width: 100%;
    }

    .player-row {
        align-items: stretch;
        flex-direction: column;
    }

    .player-row form {
        grid-template-columns: 1fr;
        justify-content: stretch;
    }

    .player-row button.mini {
        width: 100%;
        min-width: 0;
    }

    .managed-form,
    .managed-email {
        grid-template-columns: 1fr;
    }

    .job-watch {
        flex-direction: column;
    }

    .status-grid {
        grid-template-columns: 1fr 1fr;
        gap: .7rem;
    }

    .stat {
        padding: .85rem;
        overflow-wrap: anywhere;
    }

    .stat strong {
        font-size: 1rem;
    }

    .table-wrap table {
        min-width: 650px;
    }

    main {
        padding: .75rem .75rem 2rem;
    }

    footer {
        padding: 1.25rem .75rem;
    }
}

@media (max-width: 380px) {
    header h1 {
        font-size: 1.9rem;
    }

    header form button {
        padding: .55rem .65rem;
        font-size: .7rem;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }
}
