@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Source+Sans+3:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
    --bg: #06080d;
    --bg-elev: #0c111a;
    --card: #121823;
    --card-2: #0e131c;
    --ink: #f3f6fb;
    --muted: #8b95a8;
    --line: rgba(148, 173, 220, 0.14);
    --acc: #2f6fed;
    --acc-hi: #6aa1ff;
    --acc-soft: rgba(47, 111, 237, 0.18);
    --ok: #3ecf8e;
    --bad: #f07178;
    --warn: #e8b84a;
    --rail: #080b12;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    --font-display: 'Oswald', 'Arial Narrow', sans-serif;
    --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
    --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(47, 111, 237, 0.16), transparent 55%),
        radial-gradient(900px 500px at -10% 30%, rgba(47, 111, 237, 0.08), transparent 50%),
        linear-gradient(180deg, #070a10 0%, var(--bg) 40%, #05070b 100%);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: '';
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.035;
    background-image:
        linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
    background-size: 48px 48px;
}
body > * { position: relative; z-index: 1; }

a { color: var(--acc-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea {
    font: inherit; color: inherit; color-scheme: dark;
}

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 1.25rem;
    padding: 0.95rem clamp(1rem, 3vw, 2rem);
    background: rgba(6, 8, 13, 0.78);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px) saturate(1.2);
    animation: barIn .6s var(--ease) both;
}
.home .topbar {
    position: absolute; left: 0; right: 0;
    background: linear-gradient(180deg, rgba(6,8,13,.72), rgba(6,8,13,.15));
    border-bottom-color: transparent;
}
.brand {
    display: flex; align-items: center; gap: 0.85rem;
    color: #fff; text-decoration: none; min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    flex-shrink: 0;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    background: rgba(47, 111, 237, 0.12);
    border: 1px solid rgba(106, 161, 255, 0.28);
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.brand-mark img,
.brand img {
    width: 34px; height: 34px; object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.45));
}
.brand > img {
    width: 42px; height: 42px;
}
.brand b {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 1.8vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.05;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar nav { display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; justify-content: flex-end; }
.topbar nav a {
    color: #a7b0c0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.6rem 0.85rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: color .2s, background .2s, border-color .2s;
}
.topbar nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
    text-decoration: none;
}
.topbar nav a.cta-nav {
    color: #fff;
    background: var(--acc);
    border-color: transparent;
    margin-left: 0.35rem;
}
.topbar nav a.cta-nav:hover { background: #2458d4; }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    align-items: end;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(6,8,13,.88) 0%, rgba(6,8,13,.55) 45%, rgba(6,8,13,.35) 100%),
        linear-gradient(180deg, rgba(6,8,13,.25) 0%, rgba(6,8,13,.15) 40%, rgba(6,8,13,.92) 100%),
        url('/assets/gate-bg.jpg') center/cover no-repeat;
}
.hero::after {
    content: '';
    position: absolute; inset: auto 0 0 0; height: 140px;
    background: linear-gradient(180deg, transparent, var(--bg));
    pointer-events: none;
}
.hero-inner {
    width: min(1120px, calc(100% - 2.5rem));
    margin: 0 auto;
    padding: 7.5rem 0 4.5rem;
    animation: rise .9s var(--ease) .1s both;
}
.hero-brand {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1.35rem;
}
.hero-brand img {
    width: clamp(56px, 8vw, 78px);
    height: auto;
    filter: drop-shadow(0 10px 24px rgba(0,0,0,.5));
}
.hero h1 {
    margin: 0;
    max-width: 14ch;
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 9vw, 5.6rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 0.95;
    text-transform: uppercase;
    text-shadow: 0 10px 40px rgba(0,0,0,.45);
}
.hero .lead {
    max-width: 32rem;
    margin: 1.15rem 0 0;
    color: #c9d1df;
    font-size: clamp(1.02rem, 2vw, 1.18rem);
    font-weight: 400;
}
.hero-actions {
    display: flex; gap: 0.75rem; flex-wrap: wrap;
    margin-top: 1.85rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 0.9rem 1.25rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    transition: transform .2s var(--ease), background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: var(--acc);
    color: #fff;
    box-shadow: 0 10px 28px rgba(47, 111, 237, 0.35);
}
.btn-primary:hover { background: #2458d4; color: #fff; }
.btn-discord {
    background: #5865f2;
    color: #fff;
    box-shadow: 0 10px 28px rgba(88, 101, 242, 0.35);
}
.btn-discord:hover { background: #4752c4; color: #fff; }
.discord-gate {
    margin-top: 1.2rem;
    padding: 1.2rem 0 0.2rem;
}
.discord-gate p { color: var(--muted); margin: 0 0 1rem; max-width: 36rem; }
.discord-userbar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 1.1rem 0 1.35rem;
    padding: 0.85rem 1rem;
    background: rgba(88, 101, 242, 0.08);
    border: 1px solid rgba(88, 101, 242, 0.28);
}
.discord-userbar img {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.discord-userbar strong {
    display: block;
    font-size: 0.95rem;
    line-height: 1.2;
}
.discord-userbar span {
    color: var(--muted);
    font-size: 0.85rem;
}
.discord-userbar .btn { margin-left: auto; }
.btn-ghost {
    background: rgba(255,255,255,0.04);
    color: #fff;
    border-color: rgba(255,255,255,0.16);
}
.btn-ghost:hover {
    border-color: rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.07);
    color: #fff;
}
.btn-danger {
    background: rgba(240, 113, 120, 0.1);
    color: var(--bad);
    border-color: rgba(240, 113, 120, 0.28);
}
.btn-danger:hover {
    background: rgba(240, 113, 120, 0.18);
    border-color: rgba(240, 113, 120, 0.45);
    color: #ff9aa0;
}
.upd-modal .btn-danger {
    background: linear-gradient(180deg, #d4555c, #b53d45);
    border-color: rgba(240, 113, 120, 0.45);
    color: #fff;
}
.upd-modal .btn-danger:hover {
    background: linear-gradient(180deg, #e0666d, #c4474f);
    color: #fff;
}
.btn-sm { padding: 0.55rem 0.85rem; font-size: 0.66rem; }

/* ---------- Content ---------- */
.wrap {
    width: min(1120px, calc(100% - 2.5rem));
    margin: 0 auto;
    padding: 3rem 0 4.5rem;
}
.page-hero {
    padding: 3.5rem 0 0.5rem;
    animation: rise .7s var(--ease) both;
}
.page-hero .label { margin-bottom: 0.55rem; }
.page-hero h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1;
}
.page-hero p {
    margin: 0.85rem 0 0;
    max-width: 38rem;
    color: var(--muted);
    font-size: 1.05rem;
}

.section-head {
    display: flex; align-items: end; justify-content: space-between; gap: 1rem;
    margin-bottom: 1.4rem;
}
.section-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.notice-list { display: grid; gap: 0.85rem; }
.notice-item {
    display: grid; gap: 0.4rem;
    padding: 1.15rem 1.25rem;
    background: linear-gradient(180deg, rgba(18,24,35,.95), rgba(14,19,28,.95));
    border: 1px solid var(--line);
    border-left: 3px solid var(--acc);
    color: inherit;
    text-decoration: none;
    transition: border-color .2s, transform .25s var(--ease), box-shadow .25s;
}
.notice-item:hover {
    text-decoration: none;
    border-color: rgba(106, 161, 255, 0.35);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.notice-item.pinned { border-left-color: var(--warn); }
.notice-item h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.notice-item p { margin: 0; color: var(--muted); }
.notice-meta { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; }

.tag {
    display: inline-flex;
    padding: 0.22rem 0.5rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: var(--acc-soft);
    color: var(--acc-hi);
}
.tag.warn { background: rgba(232, 184, 74, 0.14); color: var(--warn); }
.tag.ok { background: rgba(62, 207, 142, 0.12); color: var(--ok); }
.tag.bad { background: rgba(240, 113, 120, 0.12); color: var(--bad); }

.panel {
    background: linear-gradient(180deg, rgba(18,24,35,.98), rgba(12,17,26,.98));
    border: 1px solid var(--line);
    padding: clamp(1.2rem, 2.5vw, 1.75rem);
    box-shadow: 0 16px 40px rgba(0,0,0,.25);
    animation: rise .65s var(--ease) both;
}
.panel + .panel { margin-top: 1rem; }
.panel h1, .panel h2 { margin-top: 0; }
.lead-box {
    margin-bottom: 1.35rem;
    padding: 1.05rem 1.15rem;
    background: var(--acc-soft);
    border: 1px solid rgba(47, 111, 237, 0.28);
    color: #d8e5ff;
}
.lead-box strong { color: #fff; }

.form-grid { display: grid; gap: 1.05rem; }
.field { display: grid; gap: 0.45rem; }
.field label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}
.field label .req { color: var(--bad); }
.field input, .field textarea, .field select {
    width: 100%;
    background: rgba(6, 9, 14, 0.85);
    border: 1px solid var(--line);
    padding: 0.9rem 1rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: rgba(106, 161, 255, 0.55);
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.14);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input[type="checkbox"] { width: auto; }
.field .hint {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}
.form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.35rem; }

.alert {
    padding: 0.9rem 1.05rem;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.03);
}
.alert.ok { border-color: rgba(62, 207, 142, 0.35); color: var(--ok); }
.alert.err { border-color: rgba(240, 113, 120, 0.35); color: var(--bad); }

.article-title {
    margin: 0 0 1.1rem;
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.05;
}
.article-body {
    white-space: pre-wrap;
    color: #d7deea;
    font-size: 1.05rem;
}

.site-foot {
    border-top: 1px solid var(--line);
    padding: 1.75rem clamp(1rem, 3vw, 2rem) 2.25rem;
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.9rem;
    background: rgba(0,0,0,0.22);
}
.site-foot div { display: flex; align-items: center; gap: 0.65rem; }
.site-foot img { width: 26px; height: 26px; }
.site-foot b {
    color: #fff;
    font-family: var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}
.site-foot p { margin: 0; }

/* ---------- Admin ---------- */
.admin-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 70px);
}
.admin-rail {
    background: var(--rail);
    border-right: 1px solid var(--line);
    padding: 1.1rem 0.8rem;
}
.admin-rail .ns {
    padding: 0.85rem 0.7rem 0.4rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #5d6678;
}
.admin-rail a {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.7rem 0.75rem;
    margin-bottom: 2px;
    color: #9aa3b2;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.admin-rail a:hover { color: #fff; background: rgba(255,255,255,0.04); }
.admin-rail a.on {
    color: #fff;
    background: var(--acc-soft);
    box-shadow: inset 3px 0 0 var(--acc);
}
.admin-main { padding: 1.5rem clamp(1rem, 2vw, 1.75rem) 2.75rem; }
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    background: var(--card);
}
table.upd { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.upd th, table.upd td {
    padding: 0.85rem 0.95rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
table.upd th {
    font-size: 0.65rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    background: rgba(0,0,0,0.25);
}
table.upd tr:hover td { background: rgba(255,255,255,0.025); }
.answer-block { margin: 0 0 1.1rem; }
.answer-block dt {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}
.answer-block dd { margin: 0.3rem 0 0; white-space: pre-wrap; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        linear-gradient(105deg, rgba(6,8,13,.88) 20%, rgba(6,8,13,.55) 100%),
        url('/assets/gate-bg.jpg') center/cover no-repeat;
    padding: 1.5rem;
}
.login-card {
    width: min(440px, 100%);
    background: rgba(12, 17, 26, 0.92);
    border: 1px solid var(--line);
    padding: 1.7rem 1.5rem 1.45rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    animation: rise .7s var(--ease) both;
}
.login-card .gate-brand {
    display: flex; align-items: center; gap: 0.85rem;
    margin-bottom: 1.2rem;
}
.login-card .gate-brand img { width: 48px; height: 48px; }
.login-card .gate-brand b {
    display: block;
    font-family: var(--font-display);
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.1;
}
.login-card h1 {
    margin: 0 0 0.4rem;
    font-family: var(--font-display);
    font-size: 2.15rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.login-card p { color: var(--muted); margin: 0 0 1.1rem; }

.filters { display: flex; gap: 0.55rem; flex-wrap: wrap; margin-bottom: 1rem; }
.empty {
    padding: 2.4rem 1.2rem;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    background: rgba(255,255,255,0.015);
}

@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}
@keyframes barIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-rail {
        display: flex; gap: 0.2rem; overflow-x: auto;
        border-right: 0; border-bottom: 1px solid var(--line);
    }
    .admin-rail .ns { display: none; }
    .admin-rail a { white-space: nowrap; }
    .brand b { max-width: 52vw; }
    .hero-inner { padding-top: 6.5rem; }
    .topbar nav a { padding: 0.5rem 0.55rem; letter-spacing: 0.1em; }
}

/* ---------- Modal ---------- */
body.upd-modal-open { overflow: hidden; }
.upd-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(3, 5, 10, 0.72);
    backdrop-filter: blur(8px) saturate(1.1);
    animation: modalFade .22s var(--ease) both;
}
.upd-modal-overlay[hidden] { display: none !important; }
.upd-modal {
    width: min(420px, 100%);
    background: linear-gradient(180deg, #141b28 0%, #0e141e 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.03) inset;
    padding: 1.55rem 1.45rem 1.35rem;
    animation: modalRise .28s var(--ease) both;
}
.upd-modal-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 0.95rem;
    color: var(--warn);
    background: rgba(232, 184, 74, 0.12);
    border: 1px solid rgba(232, 184, 74, 0.28);
}
.upd-modal h3 {
    margin: 0 0 0.45rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.upd-modal-msg {
    margin: 0 0 1.25rem;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.5;
}
.upd-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
}

@keyframes modalFade {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalRise {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
