:root {
    --text: #f6f2ff;
    --muted: rgba(240, 232, 255, 0.66);
    --dim: rgba(240, 232, 255, 0.42);
    --line: rgba(230, 215, 255, 0.14);
    --line-2: rgba(230, 215, 255, 0.26);
    --glass: rgba(18, 12, 38, 0.56);
    --glass-2: rgba(255, 255, 255, 0.06);
    --pink: #ff8fd0;
    --lav: #b69dff;
    --sky: #8fe3ff;
    --ok: #86f5ae;
    --bad: #ff7b98;
    --warn: #ffd27a;
    --grad: linear-gradient(120deg, #ff8fd0 0%, #b69dff 50%, #8fe3ff 100%);
    --display: Outfit, Inter, system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: #120d24; }

body {
    margin: 0;
    min-height: 100svh;
    font: 400 15px / 1.45 Inter, system-ui, sans-serif;
    color: var(--text);
    background: #120d24;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

[hidden] { display: none !important; }

button,
input { font: inherit; color: inherit; }

a { color: inherit; }

svg.ic {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
}

.veil {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(4, 2, 12, 0.6) 100%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px);
}

.glass {
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(4, 2, 14, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    backdrop-filter: blur(18px) saturate(1.2);
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    flex: none;
    border-radius: 50%;
    background: var(--dim);
}

.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(134, 245, 174, 0.16), 0 0 10px rgba(134, 245, 174, 0.55); }
.dot.off { background: var(--bad); }
.dot.wait { background: var(--warn); }

.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn.primary { border: 0; background: var(--grad); color: #1b1033; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

.link {
    appearance: none;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.link:hover { color: var(--text); text-decoration-color: currentColor; }

input:not([type="checkbox"]) {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: rgba(8, 5, 20, 0.55);
    font-size: 15px;
}

input::placeholder { color: var(--dim); }
input:focus { outline: none; border-color: var(--lav); box-shadow: 0 0 0 3px rgba(182, 157, 255, 0.22); }

.btn:focus-visible,
.link:focus-visible,
.door:focus-visible,
.send:focus-visible {
    outline: 2px solid var(--sky);
    outline-offset: 3px;
}

.err { min-height: 1.2em; margin: 0; color: var(--bad); font-size: 13px; }

/* ---------- layout ---------- */

.page {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    gap: 28px;
    max-width: 1320px;
    min-height: 100svh;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 48px);
}

.home { display: grid; align-content: center; gap: 24px; min-width: 0; }

/* ---------- hero ---------- */

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    font: 600 12.5px var(--mono);
    color: var(--muted);
}

.title {
    position: relative;
    margin: 14px 0 0;
    font: 900 clamp(76px, 13vw, 168px) / 0.85 var(--display);
    letter-spacing: -0.035em;
    background: linear-gradient(110deg, #fff 0%, #ffd9f1 35%, #e7dcff 60%, #d6f6ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(-4px 0 0 rgba(255, 60, 160, 0.55)) drop-shadow(4px 0 0 rgba(60, 220, 255, 0.55));
}

.tagline {
    max-width: 46ch;
    margin: 18px 0 0;
    font-size: clamp(16px, 1.6vw, 19px);
    color: var(--muted);
}

/* ---------- right now ---------- */

.now {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) auto;
    align-items: center;
    gap: 18px;
    padding: 16px 20px;
}

.now-item { display: flex; align-items: center; gap: 12px; min-width: 0; }

.now-av { position: relative; width: 46px; height: 46px; flex: none; }

.now-av img {
    display: block;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--glass-2);
    object-fit: cover;
}

.now-av.square img { border-radius: 14px; }

.pip {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 15px;
    height: 15px;
    border: 3px solid #1d1538;
    border-radius: 50%;
    background: #7a7393;
}

.pip.online { background: var(--ok); }
.pip.idle { background: var(--warn); }
.pip.dnd { background: var(--bad); }

.now-copy { min-width: 0; }
.now-title { font: 700 16px / 1.2 var(--display); }
.state { margin-left: 4px; font: 600 12px Inter, sans-serif; color: var(--muted); }
.now-sub { margin-top: 2px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-item.time { display: block; text-align: right; }
.now-big { font: 700 26px / 1 var(--mono); letter-spacing: -0.02em; }

/* ---------- doors ---------- */

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

.door {
    position: relative;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 18px;
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.door::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.09) 45%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.door:hover { transform: translateY(-3px); border-color: var(--line-2); background: rgba(30, 20, 60, 0.62); }
.door:hover::after { transform: translateX(100%); }

.door-art {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: rgba(255, 143, 208, 0.16);
    color: var(--pink);
}

.door-art svg { width: 26px; height: 26px; }
.door.bot .door-art { background: rgba(182, 157, 255, 0.18); color: var(--lav); }
.door.add .door-art { background: var(--grad); color: #1b1033; }

.door-copy { display: grid; gap: 2px; min-width: 0; }
.door-copy strong { font: 700 19px / 1.15 var(--display); }
.door-copy span { color: var(--muted); font-size: 13.5px; }

.door-tag {
    padding: 5px 10px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    color: var(--muted);
    font: 600 11.5px / 1 var(--mono);
    white-space: nowrap;
}

.door-tag.open { color: var(--ok); border-color: rgba(134, 245, 174, 0.35); background: rgba(134, 245, 174, 0.08); }

/* ---------- lobby ---------- */

.lobby {
    position: sticky;
    top: clamp(20px, 4vw, 48px);
    display: flex;
    flex-direction: column;
    height: calc(100svh - 2 * clamp(20px, 4vw, 48px));
    min-height: 520px;
    overflow: hidden;
}

.lobby-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 12px;
}

.lobby-head h2 { margin: 0; font: 800 24px / 1 var(--display); letter-spacing: -0.01em; }
.lobby-sub { display: flex; align-items: center; gap: 7px; margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

.faces { display: flex; flex-direction: row-reverse; }

.face {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin-left: -8px;
    border: 2px solid #1b1336;
    border-radius: 50%;
    background: var(--c, var(--lav));
    color: #1b1033;
    font: 800 11px / 1 var(--display);
}

.face.more { background: rgba(255, 255, 255, 0.12); color: var(--text); }

.people { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 12px; border-bottom: 1px solid var(--line); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 5px 10px 5px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 12.5px;
}

.chip .swatch { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--c, var(--lav)); }
.chip b { font-weight: 700; }
.chip span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.me { border-color: var(--line-2); }

.chat-log {
    flex: 1;
    min-height: 0;
    padding: 14px 16px 8px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.msg { display: grid; justify-items: start; gap: 3px; margin-top: 3px; }
.msg.first { margin-top: 14px; }
.msg.mine { justify-items: end; }

.msg-head {
    display: flex;
    align-items: baseline;
    gap: 7px;
    padding: 0 6px;
    font-size: 12px;
    color: var(--dim);
}

.msg-head b { color: var(--c, var(--text)); font-size: 13px; }

.badge {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--grad);
    color: #1b1033;
    font: 800 9.5px / 1.2 Inter, sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bubble {
    position: relative;
    max-width: 88%;
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 16px 16px 16px 6px;
    background: rgba(255, 255, 255, 0.07);
    overflow-wrap: anywhere;
}

.msg.mine .bubble {
    border: 0;
    border-radius: 16px 16px 6px 16px;
    background: linear-gradient(120deg, rgba(255, 143, 208, 0.9), rgba(182, 157, 255, 0.9));
    color: #1b1033;
    font-weight: 500;
}

.bubble .del {
    position: absolute;
    top: -8px;
    right: -8px;
    display: none;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    background: #2a1f4a;
    color: var(--text);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.bubble:hover .del,
.bubble .del:focus-visible { display: block; }

.chat-empty { display: grid; place-items: center; height: 100%; padding: 30px; text-align: center; color: var(--muted); }

.composer {
    display: flex;
    gap: 8px;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--line);
}

.send {
    appearance: none;
    display: grid;
    place-items: center;
    width: 46px;
    height: 44px;
    flex: none;
    border: 0;
    border-radius: 14px;
    background: var(--grad);
    color: #1b1033;
    cursor: pointer;
}

.send svg { width: 19px; height: 19px; }
.send:disabled { opacity: 0.55; cursor: default; }

.join { display: grid; gap: 9px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.join-title { margin: 0; font: 800 18px var(--display); }
.join-sub { margin: 0 0 4px; color: var(--muted); font-size: 13px; }

.lobby-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 18px 12px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--muted);
}

.foot-actions { display: flex; gap: 14px; }

.admin { max-height: 40%; overflow-y: auto; padding: 4px 18px 14px; border-top: 1px solid var(--line); }
.admin-title { margin: 10px 0 8px; font: 700 12px var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.grant-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 13.5px;
}

.grant-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grant-row label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.grant-row input { accent-color: var(--lav); width: 16px; height: 16px; }

/* ---------- gate ---------- */

.gate {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    min-height: 100svh;
    padding: 24px 16px;
}

.gate-card { width: min(440px, 100%); padding: 26px 26px 22px; }

.back { color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.back:hover { color: var(--text); }

.gate-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 18px 0 14px;
    border-radius: 20px;
    background: var(--grad);
    color: #1b1033;
}

.gate-icon svg { width: 30px; height: 30px; }
.gate-card h1 { margin: 0; font: 800 32px / 1.05 var(--display); letter-spacing: -0.01em; }
.gate-sub { margin: 8px 0 18px; color: var(--muted); }
.gate-form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.who { display: grid; gap: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.hint { margin: -4px 0 0; font-size: 12.5px; color: var(--dim); }
.signed { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- motion ---------- */

@keyframes rise { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }

.hero,
.now,
.doors,
.lobby,
.gate-card { animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.now { animation-delay: 0.08s; }
.doors { animation-delay: 0.16s; }
.lobby { animation-delay: 0.12s; }

/* ---------- smaller screens ---------- */

@media (max-width: 1080px) {
    .page { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
    .lobby { position: relative; top: 0; height: min(78svh, 680px); }
}

@media (max-width: 640px) {
    .page { gap: 18px; padding: 18px 16px 24px; }
    .now { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .now-item.time { display: flex; align-items: baseline; gap: 10px; text-align: left; }
    .now-big { font-size: 20px; }
    .doors { grid-template-columns: minmax(0, 1fr); }
    .door { padding: 14px; grid-template-columns: 46px minmax(0, 1fr) auto; }
    .door-art { width: 46px; height: 46px; }
    .lobby { height: 72svh; min-height: 460px; }
}

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

/* ---------- /up (downsize uploads) ---------- */

.up-card { display: grid; gap: 14px; }
.up-card .gate-icon { margin: 0; }
.up-card .gate-sub { margin: 0; }

.drop {
    position: relative;
    display: grid;
    place-items: center;
    gap: 4px;
    min-height: 150px;
    padding: 22px 16px;
    border: 2px dashed var(--line-2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.drop:hover,
.drop.over { border-color: var(--lav); background: rgba(182, 157, 255, 0.1); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop input:disabled { cursor: not-allowed; }
.drop-title { font: 700 17px / 1.3 var(--display); overflow-wrap: anywhere; }
.drop-sub { color: var(--muted); font-size: 13px; }

.meter { display: grid; gap: 8px; }
.meter-row { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.meter-row span:last-child { font: 600 13px var(--mono); color: var(--text); }
.meter .bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.meter .bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--grad); transition: width 0.3s ease; }
