:root {
    color-scheme: dark;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #101411;
    color: #edf4ef;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(circle at top, #1d3325 0, #101411 34rem);
    min-height: 100vh;
}

a { color: #a9e7bd; }

.topbar {
    min-height: 64px;
    padding: 0 5vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 18, 12, .92);
    border-bottom: 1px solid #294332;
}

.brand {
    color: white;
    font-size: 1.25rem;
    font-weight: 800;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

nav a, .linkbutton {
    color: #dce9df;
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.container {
    width: min(1100px, 92vw);
    margin: 2.5rem auto;
}

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

.card, .auth-card {
    background: rgba(24, 34, 27, .96);
    border: 1px solid #31483a;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
}

.auth-card {
    width: min(440px, 100%);
    margin: 8vh auto;
}

.narrow { max-width: 620px; }

label {
    display: block;
    margin: 1rem 0;
    font-weight: 600;
}

input, select {
    width: 100%;
    margin-top: .4rem;
    padding: .78rem .85rem;
    border-radius: 10px;
    border: 1px solid #405546;
    background: #0e1510;
    color: white;
    font: inherit;
}

button, .button {
    display: inline-block;
    border: 0;
    border-radius: 10px;
    background: #62c47d;
    color: #07100a;
    padding: .72rem 1rem;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
}

button.secondary {
    background: #273b2e;
    color: #e6f0e9;
    border: 1px solid #405546;
}

.inline { display: inline; }

.muted { color: #9caf9f; }

.status {
    font-weight: 800;
    margin-bottom: 1rem;
}

.online { color: #70da8c; }
.offline { color: #ff8c8c; }

dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .65rem 1.2rem;
}

dt { color: #9caf9f; }
dd { margin: 0; }

.flash {
    border-radius: 10px;
    padding: .9rem 1rem;
    margin-bottom: 1rem;
}

.flash.success {
    background: #193c25;
    border: 1px solid #39784c;
}

.flash.error {
    background: #421d1d;
    border: 1px solid #8c4141;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: .8rem;
    border-bottom: 1px solid #314239;
    vertical-align: middle;
}

.table-wrap { overflow-x: auto; }

.actions {
    min-width: 240px;
}

.actions form {
    margin-right: .35rem;
}

.badge {
    display: inline-block;
    border-radius: 99px;
    padding: .18rem .45rem;
    margin-left: .4rem;
    font-size: .72rem;
}

.badge.master {
    background: #806517;
    color: #fff3bb;
}

.badge.protected {
    background: #27446b;
    color: #dbeaff;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(210px,1fr));
    gap: 0 1rem;
    align-items: end;
}

footer {
    text-align: center;
    color: #63766a;
    padding: 3rem;
}

@media (max-width: 680px) {
    .topbar {
        align-items: flex-start;
        gap: 1rem;
        padding-top: 1rem;
        padding-bottom: 1rem;
        flex-direction: column;
    }

    nav {
        flex-wrap: wrap;
    }
}


/* CubeEmpire Phase 2A */

code {
    font-family:
        ui-monospace,
        SFMono-Regular,
        Consolas,
        monospace;

    font-size: .9em;
}

.toggle-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(220px, 1fr)
        );

    gap: .8rem;
    margin: 1.3rem 0;
}

label.check {
    display: flex;
    align-items: center;
    gap: .65rem;

    padding: .8rem;

    background: #101a13;
    border: 1px solid #31483a;
    border-radius: 10px;

    margin: 0;
}

label.check input {
    width: auto;
    margin: 0;
}

.danger-zone {
    border-color: #604a35;
}

.linked-account {
    margin-bottom: .5rem;
}

td form select {
    margin-bottom: .45rem;
}

.button-row {
    display: flex;
    gap: .7rem;
    flex-wrap: wrap;
}

.minecraft-permission {
    margin-bottom: .5rem;
    color: #9caf9f;
}

.minecraft-permission strong {
    color: #edf4ef;
}

/* CubeEmpire Worlds */

.world-active-name {
    font-size: 1.6rem;
    font-weight: 700;
    margin: .4rem 0 1rem;
}

.world-grid {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(260px, 1fr)
        );
    gap: 1rem;
}

.world-card {
    padding: 1rem;
    background: #101a13;
    border: 1px solid #31483a;
    border-radius: 12px;
}

.world-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    margin-bottom: 1rem;
}

.world-card-head strong {
    font-size: 1.1rem;
}

.world-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .25rem .6rem;
    font-size: .78rem;
    background: #283a2d;
    color: #d7e7da;
}

.world-badge.active {
    background: #245d34;
    color: #e9ffed;
}

.world-badge.invalid {
    background: #5c2c2c;
    color: #ffe4e4;
}

.world-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .35rem .8rem;
    margin: 0 0 1rem;
}

.world-details dt {
    color: #91a596;
}

.world-details dd {
    margin: 0;
}


/* CubeEmpire Async Action Status */

.global-action-status {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 2000;

    display: flex;
    align-items: center;
    gap: .9rem;

    width: min(420px, calc(100vw - 2rem));

    padding: 1rem 1.1rem;

    background: #132219;
    border: 1px solid #35563e;
    border-radius: 12px;

    box-shadow:
        0 12px 35px
        rgba(0, 0, 0, .42);
}

.global-action-status[hidden] {
    display: none;
}

.global-action-copy {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.global-action-copy strong {
    color: #f0f7f2;
}

.global-action-copy span {
    color: #aec0b2;
    line-height: 1.35;
}

.global-action-spinner {
    flex: 0 0 auto;

    width: 24px;
    height: 24px;

    border: 3px solid
        rgba(255,255,255,.18);

    border-top-color:
        rgba(255,255,255,.9);

    border-radius: 50%;

    animation:
        cubeempire-spin
        .85s linear infinite;
}

.global-action-status.success {
    border-color: #397c4b;
}

.global-action-status.error {
    border-color: #855050;
}

@keyframes cubeempire-spin {
    to {
        transform: rotate(360deg);
    }
}

button[data-action-disabled] {
    opacity: .55;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .global-action-status {
        right: .75rem;
        bottom: .75rem;
        width: calc(100vw - 1.5rem);
    }
}


/* CubeEmpire World Settings */

.world-settings-group {
    margin: 1rem 0;
    padding: .8rem 1rem;

    background: #101a13;
    border: 1px solid #31483a;
    border-radius: 10px;
}

.world-settings-group summary {
    cursor: pointer;
    font-weight: 700;
}

.world-settings-checks {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(240px, 1fr)
        );

    gap: .6rem;
    margin-top: .8rem;
}

.quick-action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}

.quick-action-grid form {
    margin: 0;
}
