:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #657085;
    --line: #dfe4ec;
    --primary: #1359c7;
    --primary-strong: #0e3f91;
    --danger: #b42318;
    --shadow: 0 18px 60px rgba(23, 32, 51, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(19, 89, 199, 0.12), transparent 32rem),
        linear-gradient(180deg, #fbfcff 0%, var(--bg) 45%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 3rem);
    border-bottom: 1px solid rgba(223, 228, 236, 0.82);
    background: rgba(251, 252, 255, 0.9);
    backdrop-filter: blur(18px);
}

.brand,
.account,
.top-nav,
.card-actions,
.section-heading,
.row-app {
    display: flex;
    align-items: center;
}

.brand {
    gap: 0.75rem;
    min-width: 0;
}

.brand-mark {
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    border-radius: 0.5rem;
    background: var(--ink);
    color: #fff;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.row-app small {
    color: var(--muted);
}

.top-nav {
    gap: 0.35rem;
    padding: 0.25rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
}

.top-nav a {
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 700;
}

.top-nav a.active {
    background: var(--ink);
    color: #fff;
}

.account {
    justify-content: flex-end;
    gap: 0.75rem;
    color: var(--muted);
    font-weight: 700;
}

main {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4rem) 0;
}

.hero,
.auth-layout,
.admin-grid {
    display: grid;
    gap: 2rem;
}

.hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    margin-bottom: 2rem;
}

.hero h1,
.auth-layout h1,
.section-heading h1 {
    margin: 0;
    max-width: 780px;
    font-size: clamp(2.35rem, 5vw, 5rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.section-heading.compact h1 {
    font-size: 1.6rem;
    line-height: 1.15;
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lede {
    max-width: 650px;
    margin: 1.25rem 0 0;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1.65;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.app-groups {
    display: grid;
    gap: 2rem;
}

.app-group-section {
    display: grid;
    gap: 1rem;
}

.group-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.65rem;
}

.group-heading h2 {
    margin: 0;
    font-size: 1.35rem;
}

.group-heading span {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
}

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

.app-card,
.server-card,
.panel,
.empty-state,
.notice {
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.app-card {
    display: flex;
    min-height: 280px;
    flex-direction: column;
    padding: 1.15rem;
}

.server-card {
    display: grid;
    gap: 1.25rem;
    padding: 1.25rem;
}

.server-card h2 {
    margin: 0;
    font-size: 1.45rem;
}

.server-card p {
    margin: 0.55rem 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.server-fields {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

.server-fields div {
    display: grid;
    grid-template-columns: minmax(110px, 0.35fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
    padding: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    background: #fbfcff;
}

.server-fields dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.server-fields dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 800;
}

.app-group-admin,
.game-server-admin {
    margin-bottom: 2rem;
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-icon,
.app-dot {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    background: color-mix(in srgb, var(--accent), white 82%);
    color: var(--accent);
}

.app-icon img,
.app-dot img {
    display: block;
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.app-icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.5rem;
}

.app-dot {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.45rem;
}

svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-card h2 {
    margin: 1.25rem 0 0.5rem;
    font-size: 1.4rem;
}

.app-card p {
    flex: 1;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: capitalize;
}

.button {
    display: inline-flex;
    min-height: 2.45rem;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}

.button.primary {
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-strong);
}

.button.ghost {
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
}

.button.danger {
    border-color: rgba(180, 35, 24, 0.22);
    background: #fff5f4;
    color: var(--danger);
}

.card-actions {
    gap: 0.65rem;
    margin-top: 1rem;
}

.linked-apps {
    display: grid;
    gap: 0.55rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.linked-apps span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 900;
    text-transform: uppercase;
}

.linked-apps a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink);
    font-weight: 800;
}

.linked-apps svg {
    width: 1rem;
    height: 1rem;
}

.linked-apps img {
    width: 1rem;
    height: 1rem;
    object-fit: contain;
}

.auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    align-items: center;
}

.panel,
.empty-state,
.notice {
    padding: 1.25rem;
}

.auth-card,
.editor {
    display: grid;
    gap: 1rem;
}

label {
    display: grid;
    gap: 0.45rem;
    color: var(--ink);
    font-weight: 800;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.check-row input {
    width: 1rem;
    height: 1rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    background: #fff;
    color: var(--ink);
    padding: 0.72rem 0.78rem;
}

textarea {
    resize: vertical;
}

.admin-grid {
    grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
    align-items: start;
}

.section-heading {
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.wide {
    grid-column: 1 / -1;
}

.app-table {
    display: grid;
    gap: 0.75rem;
}

.row-app {
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    background: #fbfcff;
}

.row-app div {
    flex: 1;
    min-width: 0;
}

.row-app strong,
.row-app small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    max-width: 560px;
}

.empty-state p {
    color: var(--muted);
}

.notice {
    margin-bottom: 1rem;
}

.notice.error {
    border-color: rgba(180, 35, 24, 0.24);
    background: #fff5f4;
    color: var(--danger);
}

@media (max-width: 820px) {
    .site-header,
    .hero,
    .auth-layout,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .top-nav,
    .account {
        justify-content: flex-start;
    }

    .site-header {
        position: static;
    }

    .hero {
        align-items: start;
    }

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

@media (max-width: 560px) {
    main {
        width: min(100% - 1rem, 1180px);
        padding-top: 1.5rem;
    }

    .form-grid,
    .apps-grid,
    .server-grid,
    .server-fields div {
        grid-template-columns: 1fr;
    }

    .row-app {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .account {
        flex-wrap: wrap;
    }
}
