:root {
    --bg-night: #020b1f;
    --bg-deep: #07173c;
    --ink: #f5fbff;
    --ink-dim: #b7d6ec;
    --cyan: #25d2ff;
    --yellow: #ffd73a;
    --orange: #ff8f1f;
    --panel: rgba(5, 19, 46, 0.84);
    --panel-border: rgba(88, 222, 255, 0.46);
    --success: #43d58c;
    --danger: #ff5f7d;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: radial-gradient(circle at 22% 8%, #0f2f66 0%, var(--bg-night) 58%);
    color: var(--ink);
    font-family: "Manrope", "Segoe UI", sans-serif;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    background: rgba(2, 10, 26, 0.86);
    border-bottom: 1px solid rgba(126, 206, 255, 0.28);
    backdrop-filter: blur(10px);
}

.brand-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    font-weight: 800;
}

.brand-inline img {
    width: 1.9rem;
    height: 1.9rem;
    object-fit: contain;
}

.top-nav {
    display: inline-flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

.top-nav a {
    text-decoration: none;
    color: var(--ink-dim);
}

.top-nav a:hover {
    color: #ffffff;
}

.top-nav form {
    margin: 0;
}

.top-nav button {
    border: 0;
    background: transparent;
    color: var(--ink-dim);
    font: inherit;
    cursor: pointer;
    padding: 0;
}

.top-nav button:hover {
    color: #ffffff;
}

.flash-stack {
    position: fixed;
    top: 4.2rem;
    right: 1rem;
    z-index: 60;
    display: grid;
    gap: 0.5rem;
    transition: opacity 420ms ease, transform 420ms ease;
}

.flash-stack.is-fading {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

.mode-home-guest .flash-stack {
    top: 1rem;
    right: 1rem;
}

.flash {
    max-width: 24rem;
    border-radius: 0.85rem;
    padding: 0.75rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(2, 8, 23, 0.92);
}

.flash-success {
    border-color: rgba(67, 213, 140, 0.68);
}

.flash-error {
    border-color: rgba(255, 95, 125, 0.72);
}

.guest-hero-shell {
    min-height: 100dvh;
}

.guest-hero {
    --guest-frame-gap: clamp(18px, 3vw, 40px);
    position: relative;
    min-height: 100dvh;
    background: #000;
    padding: var(--guest-frame-gap);
    overflow: hidden;
}

.guest-hero::before {
    content: "";
    position: absolute;
    inset: var(--guest-frame-gap);
    z-index: 1;
    border-radius: 0.9rem;
    background-image: var(--hero-image);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.guest-hero-overlay {
    position: absolute;
    inset: var(--guest-frame-gap);
    z-index: 2;
    border-radius: 0.9rem;
    background:
        linear-gradient(140deg, rgba(2, 10, 28, 0.18), rgba(4, 14, 36, 0.05) 45%, rgba(1, 7, 20, 0.2)),
        radial-gradient(circle at 88% 16%, rgba(35, 210, 255, 0.1), transparent 38%),
        radial-gradient(circle at 12% 85%, rgba(255, 211, 58, 0.08), transparent 38%);
    pointer-events: none;
}

.guest-controls {
    position: absolute;
    top: calc(var(--guest-frame-gap) + 0.2rem);
    right: calc(var(--guest-frame-gap) + 0.2rem);
    z-index: 4;
}

.login-chip {
    appearance: none;
    border: 1px solid rgba(187, 226, 247, 0.24);
    border-radius: 999px;
    background: linear-gradient(165deg, rgba(6, 21, 50, 0.3), rgba(3, 12, 30, 0.2));
    color: #d7eafb;
    padding: 0.43rem 0.9rem;
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    backdrop-filter: blur(12px) saturate(1.2);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
    transition: background 180ms ease, transform 180ms ease, border-color 180ms ease, color 180ms ease;
}

.login-chip:hover {
    background: linear-gradient(165deg, rgba(8, 27, 64, 0.48), rgba(3, 15, 38, 0.34));
    border-color: rgba(224, 245, 255, 0.42);
    color: #f1fbff;
    transform: translateY(-1px);
}

.login-chip:focus-visible {
    outline: 2px solid rgba(191, 237, 255, 0.6);
    outline-offset: 2px;
}

.guest-login-backdrop {
    position: absolute;
    inset: 0;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    background: rgba(2, 8, 21, 0.64);
    backdrop-filter: blur(4px);
}

.guest-login-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.guest-login-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 6;
    width: min(27.5rem, calc(100% - (2 * var(--guest-frame-gap))));
    border: 1px solid rgba(171, 217, 243, 0.25);
    border-radius: 1.25rem;
    padding: 1.72rem 1.6rem 1.75rem;
    background:
        linear-gradient(170deg, rgba(8, 19, 40, 0.9), rgba(4, 11, 26, 0.92)),
        radial-gradient(circle at 86% 0%, rgba(40, 200, 255, 0.1), transparent 40%);
    box-shadow:
        0 26px 54px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -46%);
    transition: transform 230ms ease, opacity 230ms ease;
}

.guest-login-modal.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.modal-brand-title {
    margin: 0 0 1.35rem;
    text-align: center;
    font-family: "Montserrat", "Manrope", "Segoe UI", sans-serif;
    font-size: clamp(1.2rem, 2.4vw, 1.55rem);
    font-weight: 100;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    background: linear-gradient(90deg, #ffe95f 0%, #ff9a3c 52%, #ff4f4f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.14);
}

.hero-shell {
    min-height: calc(100dvh - 4rem);
}

.hero-banner {
    position: relative;
    min-height: clamp(30rem, 80vh, 56rem);
    display: grid;
    align-items: end;
    padding: clamp(1rem, 3vw, 2.4rem);
    background-image: var(--hero-image);
    background-size: cover;
    background-position: center;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(130deg, rgba(1, 8, 30, 0.8), rgba(6, 23, 55, 0.2) 48%, rgba(1, 8, 30, 0.84)),
        radial-gradient(circle at 75% 82%, rgba(255, 211, 58, 0.33), transparent 50%);
}

.hero-content {
    position: relative;
    z-index: 1;
    width: min(54rem, 100%);
    border: 1px solid var(--panel-border);
    border-radius: 1.2rem;
    background: var(--panel);
    padding: clamp(1rem, 2vw, 2rem);
    box-shadow: 0 0 32px rgba(37, 210, 255, 0.25);
}

.hero-kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #b6ebff;
    font-size: 0.73rem;
    font-weight: 800;
}

h1,
h2,
h3 {
    font-family: "Bungee", "Manrope", sans-serif;
    line-height: 1.08;
    margin: 0.6rem 0 0.8rem;
}

h1 {
    font-size: clamp(2rem, 7.3vw, 4.35rem);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), 0 0 21px rgba(37, 210, 255, 0.34);
}

.hero-tagline {
    margin: 0;
    font-size: clamp(1.1rem, 2.4vw, 1.72rem);
    color: #ffe27a;
    font-weight: 800;
}

.hero-blurb {
    max-width: 40rem;
    margin: 0.78rem 0 0;
}

.hero-actions {
    margin-top: 1.1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 0.72rem 1.05rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 160ms ease, filter 160ms ease;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.btn-primary {
    background: linear-gradient(135deg, var(--yellow), var(--orange));
    color: #101422;
    box-shadow: 0 10px 26px rgba(255, 161, 35, 0.35);
}

.btn-enter {
    background: linear-gradient(100deg, #ffe151 0%, #ff9932 52%, #ff4f42 100%);
    color: #ffffff;
    box-shadow: none;
}

.btn-ghost {
    background: rgba(7, 24, 59, 0.7);
    color: #e9f7ff;
    border: 1px solid rgba(183, 233, 255, 0.44);
}

.btn-danger {
    background: rgba(255, 95, 125, 0.2);
    color: #ffd8e0;
    border: 1px solid rgba(255, 95, 125, 0.55);
    border-radius: 0.65rem;
    padding: 0.45rem 0.75rem;
}

.plain-shell {
    padding: clamp(1rem, 2.6vw, 2rem);
    display: grid;
    gap: 1rem;
}

.panel,
.card,
.preview-card {
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    background: linear-gradient(165deg, rgba(6, 23, 55, 0.9), rgba(4, 11, 28, 0.94));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.panel,
.card {
    padding: 1rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
    padding: clamp(1rem, 2.6vw, 2rem);
}

.preview-card {
    padding: 0.92rem;
}

.preview-card p {
    margin-top: 0;
}

.badge {
    display: inline-block;
    margin: 0 0 0.55rem;
    padding: 0.22rem 0.54rem;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 0.07em;
    font-size: 0.72rem;
}

.badge-published {
    background: rgba(67, 213, 140, 0.22);
    color: #a5ffd0;
    border: 1px solid rgba(67, 213, 140, 0.55);
}

.badge-development {
    background: rgba(37, 210, 255, 0.2);
    color: #aeeeff;
    border: 1px solid rgba(37, 210, 255, 0.52);
}

.badge-private {
    background: rgba(255, 95, 125, 0.2);
    color: #ffd3dd;
    border: 1px solid rgba(255, 95, 125, 0.5);
}

.stack-form {
    display: grid;
    gap: 0.64rem;
}

.modal-form {
    gap: 1.05rem;
    padding-top: 0.12rem;
}

.modal-input {
    height: 3.18rem;
    border-radius: 0.82rem;
    border-color: rgba(152, 203, 230, 0.35);
    background: rgba(8, 20, 44, 0.92);
    padding-inline: 0.86rem;
}

.modal-input::placeholder {
    color: rgba(190, 216, 232, 0.64);
}

.modal-input:focus {
    border-color: rgba(194, 234, 255, 0.68);
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 168, 255, 0.18);
}

.modal-enter {
    width: 100%;
    margin-top: 0.8rem;
    min-height: 3.1rem;
    font-weight: 800;
    font-size: 1.08rem;
    letter-spacing: 0.02em;
}

.modal-enter:hover {
    transform: none;
    filter: none;
}

/* Keep browser autofill aligned with the dark modal theme */
.modal-input:-webkit-autofill,
.modal-input:-webkit-autofill:hover,
.modal-input:-webkit-autofill:focus,
.modal-input:-webkit-autofill:active {
    -webkit-text-fill-color: #e9f4ff;
    caret-color: #e9f4ff;
    border-color: rgba(169, 220, 247, 0.55);
    -webkit-box-shadow: 0 0 0 1000px rgba(8, 20, 44, 0.96) inset;
    box-shadow: 0 0 0 1000px rgba(8, 20, 44, 0.96) inset;
    transition: background-color 9999s ease-out 0s, color 9999s ease-out 0s;
}

.modal-input:-moz-autofill {
    color: #e9f4ff;
    box-shadow: 0 0 0 1000px rgba(8, 20, 44, 0.96) inset;
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

label {
    font-size: 0.91rem;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border-radius: 0.7rem;
    border: 1px solid rgba(145, 216, 255, 0.42);
    background: rgba(4, 14, 37, 0.95);
    color: var(--ink);
    padding: 0.62rem 0.72rem;
    font: inherit;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.62rem;
}

.checkbox-row input {
    width: auto;
}

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

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

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

th,
td {
    text-align: left;
    border-bottom: 1px solid rgba(142, 206, 255, 0.2);
    padding: 0.56rem 0.46rem;
    vertical-align: top;
}

.mode-admin h1,
.mode-admin h2,
.mode-admin h3,
.mode-library h1,
.mode-library h2,
.mode-library h3,
.mode-game h1,
.mode-game h2,
.mode-game h3,
.state-panel h1,
.state-panel h2 {
    font-family: "Manrope", "Segoe UI", sans-serif;
    text-shadow: none;
    letter-spacing: 0;
}

.app-shell {
    padding: clamp(1rem, 2.6vw, 2rem);
    display: grid;
    gap: 1rem;
}

.hub-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.admin-header-panel {
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    background: linear-gradient(165deg, rgba(6, 23, 55, 0.86), rgba(4, 11, 28, 0.93));
    padding: 1rem;
}

.hub-header h1 {
    margin: 0.2rem 0 0.25rem;
    font-size: clamp(1.5rem, 3vw, 2.15rem);
}

.hub-subtitle {
    margin: 0;
    color: #b9d8ec;
    max-width: 58ch;
}

.kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    color: #9fd9f4;
    font-weight: 700;
}

.hub-actions {
    display: inline-flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.7rem;
}

.metric-strip-compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
    border: 1px solid rgba(131, 212, 255, 0.35);
    border-radius: 0.9rem;
    background: linear-gradient(165deg, rgba(6, 20, 47, 0.86), rgba(3, 9, 24, 0.92));
    padding: 0.8rem 0.85rem;
}

.metric-label {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-size: 0.7rem;
    color: #9cc7df;
}

.metric-value {
    margin: 0.25rem 0 0;
    font-size: 1.38rem;
    line-height: 1.1;
    font-weight: 800;
}

.metric-note {
    margin: 0.28rem 0 0;
    color: #a8cce2;
    font-size: 0.82rem;
}

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

.admin-panel {
    border: 1px solid rgba(111, 201, 250, 0.35);
    border-radius: 1rem;
    background: linear-gradient(165deg, rgba(6, 23, 55, 0.9), rgba(4, 11, 28, 0.94));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    padding: 1rem;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}

.panel-head h2 {
    margin: 0;
    font-size: 1.18rem;
}

.panel-subtle {
    margin: 0.25rem 0 0;
    color: #a9cde3;
    font-size: 0.9rem;
}

.admin-form {
    gap: 0.82rem;
}

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

.field-block {
    display: grid;
    gap: 0.35rem;
}

.field-block > span {
    font-size: 0.83rem;
    font-weight: 700;
    color: #b8d8ea;
}

.field-block.span-2 {
    grid-column: 1 / -1;
}

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

.data-table th {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    color: #9ec7de;
    font-weight: 700;
}

.data-table td {
    font-size: 0.92rem;
    color: #edf7ff;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    font-weight: 800;
    text-transform: uppercase;
    border: 1px solid rgba(152, 211, 247, 0.35);
    background: rgba(7, 20, 48, 0.9);
}

.status-role {
    color: #d0e9f9;
}

.status-published {
    color: #aef8cf;
    border-color: rgba(67, 213, 140, 0.55);
    background: rgba(67, 213, 140, 0.16);
}

.status-development {
    color: #b8ebff;
    border-color: rgba(37, 210, 255, 0.5);
    background: rgba(37, 210, 255, 0.14);
}

.status-private {
    color: #ffd3dc;
    border-color: rgba(255, 95, 125, 0.5);
    background: rgba(255, 95, 125, 0.14);
}

.admin-action-form {
    margin: 0;
}

.btn-small {
    border-radius: 0.58rem;
    padding: 0.42rem 0.68rem;
    font-size: 0.83rem;
}

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

.library-group {
    display: grid;
    gap: 0.8rem;
}

.library-group-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}

.library-group-head h2 {
    margin: 0;
    font-size: 1.12rem;
}

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

.game-card {
    border: 1px solid rgba(122, 201, 248, 0.34);
    border-radius: 0.9rem;
    background: linear-gradient(168deg, rgba(6, 21, 51, 0.88), rgba(3, 9, 24, 0.95));
    padding: 0.8rem;
    display: grid;
    gap: 0.5rem;
}

.game-card h3 {
    margin: 0;
    font-family: "Manrope", "Segoe UI", sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
}

.game-card p {
    margin: 0;
    color: #d8ecf9;
    font-size: 0.9rem;
}

.game-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.77rem;
    color: #9ec3db;
}

.game-card-actions {
    margin-top: 0.2rem;
    display: flex;
    gap: 0.5rem;
}

.btn-card {
    padding: 0.52rem 0.82rem;
    font-size: 0.87rem;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1rem;
}

.game-story h2,
.game-meta h2 {
    margin: 0.4rem 0 0.6rem;
    font-size: 1.08rem;
}

.meta-list {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.48rem 0.72rem;
}

.meta-list dt {
    color: #9bc6df;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 700;
}

.meta-list dd {
    margin: 0;
    color: #eff8ff;
    word-break: break-word;
    font-size: 0.92rem;
}

.state-panel {
    max-width: 44rem;
    margin: 0 auto;
}

.mode-home .hero-content {
    animation: glowPulse 2.7s ease-in-out infinite alternate;
}

.reveal-up {
    opacity: 0;
    transform: translateY(14px);
    animation: revealUp 520ms ease forwards;
}

@keyframes revealUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glowPulse {
    from {
        box-shadow: 0 0 20px rgba(37, 210, 255, 0.24);
    }
    to {
        box-shadow: 0 0 32px rgba(255, 211, 58, 0.22), 0 0 34px rgba(37, 210, 255, 0.25);
    }
}

@media (max-width: 980px) {
    .preview-grid,
    .admin-grid,
    .control-grid,
    .detail-layout,
    .form-grid,
    .metric-strip,
    .metric-strip-compact {
        grid-template-columns: 1fr;
    }

    .hub-header {
        align-items: stretch;
    }

    .hero-banner {
        min-height: 72vh;
    }
}
