:root {
    color-scheme: dark;
    --bg: #080b12;
    --panel: rgba(15, 20, 32, 0.92);
    --panel-2: #111827;
    --border: rgba(255, 255, 255, 0.11);
    --text: #f2f5fb;
    --dim: #a4aec2;
    --violet: #8b7cff;
    --cyan: #39e0d0;
    --danger: #ff7b8a;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}
[hidden] { display: none !important; }

.aurora {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.aurora span {
    position: absolute;
    width: 46vw;
    height: 46vw;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.24;
}
.aurora__one {
    top: -18vw;
    left: -10vw;
    background: var(--violet);
}
.aurora__two {
    right: -14vw;
    bottom: -20vw;
    background: var(--cyan);
}

.shell {
    position: relative;
    z-index: 1;
    width: min(920px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0;
}
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 30px 90px -45px rgba(0, 0, 0, 0.95);
    padding: clamp(20px, 4vw, 42px);
    backdrop-filter: blur(18px);
}
.landing { max-width: 640px; margin: 8vh auto 0; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(28px, 5vw, 48px); line-height: 1.08; margin-bottom: 16px; }
h2 { font-size: 20px; margin-bottom: 8px; }
.eyebrow {
    color: var(--cyan);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.lead { color: var(--dim); font-size: clamp(15px, 2vw, 18px); max-width: 56ch; }
.fineprint { color: var(--dim); font-size: 12px; margin: 16px 0 0; }
.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}
.facts span {
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--dim);
    font-size: 12px;
    padding: 6px 10px;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, textarea:disabled { opacity: 0.45; cursor: not-allowed; }
.primary, .secondary, .ghost {
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 11px 16px;
    font-weight: 700;
    transition: 0.2s ease;
}
.primary {
    background: linear-gradient(135deg, var(--violet), #5f8cff);
    color: #fff;
}
.primary:hover:not(:disabled) { filter: brightness(1.1); }
.secondary, .ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
    color: var(--text);
}
.secondary:hover:not(:disabled), .ghost:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.3); }
.danger { color: var(--danger); }
.error { color: var(--danger); margin-top: 14px; }

.room-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
    margin-bottom: 18px;
}
.room-head h1 { font-size: clamp(22px, 4vw, 32px); margin: 0; }
.notice {
    background: rgba(139, 124, 255, 0.08);
    border: 1px solid rgba(139, 124, 255, 0.25);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}
.notice p { color: var(--dim); font-size: 13px; margin: 4px 0 10px; }
.link-row { display: flex; gap: 8px; }
.link-row input {
    min-width: 0;
    flex: 1;
    background: #080b12;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    font-size: 12px;
}
.status { color: var(--dim); font-size: 13px; }
.security {
    border: 1px solid rgba(57, 224, 208, 0.25);
    border-radius: 16px;
    background: rgba(57, 224, 208, 0.05);
    padding: 16px;
    margin: 18px 0;
}
.security p { color: var(--dim); font-size: 13px; }
.security-code {
    display: block;
    margin: 14px 0;
    padding: 14px;
    border: 1px dashed rgba(57, 224, 208, 0.5);
    border-radius: 12px;
    color: var(--cyan);
    font-size: clamp(15px, 3vw, 22px);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    word-spacing: 0.3em;
    user-select: all;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chat { margin-top: 12px; }
.messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 180px;
    max-height: 52vh;
    overflow-y: auto;
    padding: 8px 2px 16px;
}
.message {
    max-width: min(78%, 560px);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 9px 12px;
    background: var(--panel-2);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.message.mine {
    align-self: flex-end;
    border-color: rgba(139, 124, 255, 0.35);
    background: rgba(139, 124, 255, 0.16);
}
.message.system {
    align-self: center;
    max-width: 100%;
    color: var(--dim);
    background: transparent;
    border: 0;
    font-size: 12px;
    text-align: center;
}
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
    flex: 1;
    min-height: 44px;
    max-height: 140px;
    resize: vertical;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 11px 13px;
}
.composer textarea:focus, .link-row input:focus {
    outline: 2px solid rgba(57, 224, 208, 0.55);
    outline-offset: 1px;
}
.send { min-height: 44px; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .shell { width: min(100% - 20px, 920px); padding: 20px 0; }
    .panel { border-radius: 18px; padding: 18px; }
    .landing { margin-top: 4vh; }
    .room-head { flex-direction: column; }
    .room-head .ghost { width: 100%; }
    .link-row, .composer { flex-direction: column; align-items: stretch; }
    .message { max-width: 88%; }
}
