@font-face { font-family: "Oswald"; src: url("fonts/Oswald.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "Golos"; src: url("fonts/GolosText.ttf") format("truetype"); font-weight: 400 900; font-display: swap; }

:root {
  --night: #120c2e; --indigo: #1d1447; --violet: #8f6cf0; --pink: #ff7ab8; --peach: #ffb58f; --lemon: #ffeeb0; --teal: #5fd9d2; --mint: #8dffb0;
  --ink: #fffaf2; --ink-dim: rgba(255, 250, 242, 0.66); --line: rgba(255, 255, 255, 0.14);
  --sunset: linear-gradient(90deg, var(--lemon), var(--peach) 34%, var(--pink) 68%, var(--violet));
  --f-d: "Oswald", "Arial Narrow", sans-serif; --f-b: "Golos", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--night); }
html, body { margin: 0; height: 100%; color: var(--ink); font: 16px/1.4 var(--f-b); }
body { overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg img { width: 100%; height: 100%; object-fit: cover; filter: saturate(1.1); }
.bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18, 12, 46, 0.1), rgba(18, 12, 46, 0.55) 30%, rgba(18, 12, 46, 0.92) 55%, rgba(18, 12, 46, 0.97)); }

.view { min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); }

/* ---------- Вход ---------- */
#join { display: flex; flex-direction: column; justify-content: flex-end; gap: 18px; max-width: 480px; margin: 0 auto; }
.j-head { margin-bottom: 4px; animation: up 0.8s var(--ease) both; }
.j-k { font: 600 13px/1 var(--f-d); letter-spacing: 0.22em; text-transform: uppercase; color: var(--lemon); }
.j-logo { margin: 10px 0 8px; font: 700 46px/0.92 var(--f-d); text-transform: uppercase; letter-spacing: 0.01em; }
.j-logo b { background: var(--sunset); -webkit-background-clip: text; background-clip: text; color: transparent; }
.j-sub { margin: 0; color: var(--ink-dim); }
.j-card { padding: 20px; border-radius: 28px; background: rgba(36, 26, 78, 0.7); border: 1px solid var(--line); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); animation: up 0.8s 0.08s var(--ease) both; }
.j-label { display: block; margin: 0 0 10px; font: 600 12px/1 var(--f-d); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-dim); }
.j-input { width: 100%; height: 52px; margin-bottom: 20px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--line); background: rgba(10, 6, 30, 0.55); font-size: 17px; outline: none; transition: border-color 0.2s; }
.j-input:focus { border-color: var(--lemon); }
.j-input::placeholder { color: rgba(255, 250, 242, 0.38); }
.j-avas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.j-ava { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; transition: transform 0.25s var(--ease); }
.j-ava img { width: 100%; height: 100%; border-radius: 50%; display: block; opacity: 0.6; transition: opacity 0.2s; }
.j-ava::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 3px solid var(--lemon); opacity: 0; transform: scale(0.9); transition: opacity 0.2s, transform 0.3s var(--ease); }
.j-ava[aria-checked="true"] img { opacity: 1; }
.j-ava[aria-checked="true"]::after { opacity: 1; transform: scale(1); }
.j-ava:active { transform: scale(0.92); }
.j-rules { margin: 0 4px; font-size: 13px; color: rgba(255, 250, 242, 0.5); animation: up 0.8s 0.16s var(--ease) both; }

.btn { width: 100%; height: 56px; border: 0; border-radius: 18px; background: var(--sunset); color: #1a1038; font: 700 18px/1 var(--f-d); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; transition: transform 0.15s, filter 0.2s; }
.btn:active { transform: scale(0.98); filter: brightness(0.95); }

.err { min-height: 0; margin: 0 0 12px; font-size: 14px; color: #ff9db0; }
.err:empty { display: none; }

/* ---------- Чат ---------- */
#chat { display: flex; flex-direction: column; height: 100dvh; padding-top: 0; padding-bottom: 0; max-width: 560px; margin: 0 auto; }
.c-head { display: flex; align-items: center; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 0 14px; border-bottom: 1px solid var(--line); }
.ava { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.c-who { flex: 1; min-width: 0; }
.c-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-on { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-dim); }
.c-on i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.c-on.off i { background: #ff9db0; }
.c-edit { padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: none; font-size: 13px; color: var(--ink-dim); cursor: pointer; }

.c-list { flex: 1; overflow-y: auto; padding: 16px 0 8px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.c-list::before { content: ""; margin-top: auto; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 88%; animation: pop 0.45s var(--ease) both; }
.msg .ava { width: 34px; height: 34px; }
.msg-b { padding: 9px 14px 10px; border-radius: 20px 20px 20px 6px; background: rgba(36, 26, 78, 0.78); border: 1px solid var(--line); overflow-wrap: anywhere; }
.msg-n { font: 600 12px/1.2 var(--f-d); letter-spacing: 0.08em; text-transform: uppercase; color: var(--peach); margin-bottom: 3px; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .msg-b { border-radius: 20px 20px 6px 20px; background: var(--lemon); color: #1a1038; border-color: transparent; }
.msg.me .msg-n { color: #7a4fd6; }
.msg.gone { animation: gone 0.4s var(--ease) both; }
.c-empty { margin: auto; text-align: center; color: var(--ink-dim); font-size: 15px; }

.c-send { padding: 8px 0 max(12px, env(safe-area-inset-bottom)); }
.c-err { margin: 0 4px 8px; }
.c-row { display: flex; gap: 10px; align-items: center; }
.c-input { flex: 1; min-width: 0; height: 52px; padding: 0 18px; border-radius: 26px; border: 1px solid var(--line); background: rgba(36, 26, 78, 0.8); font-size: 17px; outline: none; transition: border-color 0.2s; }
.c-input:focus { border-color: var(--lemon); }
.c-input::placeholder { color: rgba(255, 250, 242, 0.4); }
.c-go { position: relative; flex: none; width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--sunset); color: #1a1038; cursor: pointer; transition: transform 0.15s, filter 0.3s; }
.c-go:active { transform: scale(0.92); }
.c-arrow { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.2s; }
.c-ring { position: absolute; inset: 0; width: 100%; height: 100%; rotate: -90deg; opacity: 0; }
.c-ring circle { fill: none; stroke: var(--lemon); stroke-width: 3; stroke-dasharray: 138.2; stroke-dashoffset: 0; }
.c-wait { position: absolute; inset: 0; display: grid; place-items: center; font: 700 20px/1 var(--f-d); color: var(--lemon); opacity: 0; }
.c-go.cool { background: rgba(36, 26, 78, 0.9); filter: none; }
.c-go.cool .c-arrow { opacity: 0; }
.c-go.cool .c-ring, .c-go.cool .c-wait { opacity: 1; }
.c-go.cool .c-ring circle { animation: ring var(--cool, 5s) linear both; }
.c-count { text-align: right; padding: 4px 66px 0 0; font-size: 12px; color: rgba(255, 250, 242, 0.35); }
.c-count.hot { color: var(--peach); }

@keyframes up { from { opacity: 0; transform: translateY(18px); } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes gone { to { opacity: 0; transform: scale(0.96); } }
@keyframes ring { to { stroke-dashoffset: 138.2; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
