/* Login and signup. Loaded after style.css, whose tokens, buttons, fields,
   modal and avatar grid these pages reuse; only the page layout lives here. */

html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}
/* The page scrolls here, so the background must cover the whole of it. */
html { background: var(--bg); }
body { min-height: 100vh; padding-bottom: calc(70px + var(--safe-b)); }

.auth-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px clamp(16px, 4vw, 40px);
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 440px);
    align-items: center;
    gap: clamp(28px, 5vw, 72px);
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px clamp(16px, 4vw, 40px) 60px;
}

.auth-title {
    margin: 0;
    font-size: clamp(2rem, 4.4vw, 3.2rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.03em;
}
.auth-title .accent {
    background: linear-gradient(90deg, var(--mint), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.auth-sub { margin: 14px 0 0; color: var(--text-2); font-size: 1.05rem; max-width: 560px; }

/* A little room: real background, real avatars, a few speech bubbles. */
.auth-scene {
    position: relative;
    margin-top: 28px;
    aspect-ratio: 16 / 8;
    border-radius: 24px;
    overflow: hidden;
    background: url('/images/rooms/room2.webp') center / cover;
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-lg);
}
.auth-scene::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(12, 10, 29, 0) 55%, rgba(12, 10, 29, 0.55) 100%);
    pointer-events: none;
}
.scene-actor {
    position: absolute;
    bottom: 6%;
    width: 18%;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: bob 3.2s ease-in-out infinite;
    z-index: 1;
}
.scene-actor img { width: 100%; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.35)); }
.scene-figure { width: 100%; aspect-ratio: 2 / 3; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.35)); }
.scene-actor .user-name { font-size: clamp(0.6rem, 1.1vw, 0.8rem); }
.scene-actor:nth-child(2) { animation-delay: -1.1s; }
.scene-actor:nth-child(3) { animation-delay: -2.2s; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.scene-bubble {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 200px;
    padding: 7px 12px;
    border-radius: 14px;
    background: #fff;
    color: #1b1640;
    font-size: clamp(0.65rem, 1.1vw, 0.85rem);
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    animation: scene-bubble 9s ease-in-out infinite;
}
.scene-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    margin-left: -7px;
    border-width: 7px 7px 0;
    border-style: solid;
    border-color: #fff transparent transparent;
}
.scene-actor:nth-child(2) .scene-bubble { animation-delay: 3s; }
.scene-actor:nth-child(3) .scene-bubble { animation-delay: 6s; }
@keyframes scene-bubble {
    0%, 4% { opacity: 0; transform: translate(-50%, 6px); }
    8%, 30% { opacity: 1; transform: translate(-50%, 0); }
    36%, 100% { opacity: 0; transform: translate(-50%, -4px); }
}

.auth-points {
    list-style: none;
    margin: 26px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.auth-points li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 0.9rem; }
.auth-points .ic {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    padding: 7px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-text);
}
.auth-points strong { display: block; color: var(--text); font-size: 0.95rem; margin-bottom: 2px; }

.auth-card {
    padding: 30px;
    border-radius: 24px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-lg);
}
.auth-card h2 { margin: 0 0 4px; font-size: 1.5rem; font-weight: 800; }
.auth-card .lead { margin: 0 0 20px; color: var(--text-3); font-size: 0.92rem; }
.auth-card input[type="text"], .auth-card input[type="email"], .auth-card input[type="password"] {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: var(--bg-2);
    color: var(--text);
    outline: none;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-card input:focus { border-color: rgba(139, 124, 255, 0.7); box-shadow: 0 0 0 4px rgba(139, 124, 255, 0.14); }
.auth-card .field { margin-bottom: 12px; }
.auth-card .btn { width: 100%; min-height: 48px; }
.auth-card .btn + .btn { margin-top: 10px; }
.auth-card .seg { margin-bottom: 16px; }
.auth-card .seg span { display: flex; align-items: center; justify-content: center; gap: 6px; }
.auth-card .seg .ic { width: 16px; height: 16px; }

.auth-msg { display: none; margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; font-size: 0.9rem; }
.auth-msg.error { background: var(--danger-soft); color: #ffc2c8; }
.auth-msg.success { background: rgba(61, 220, 151, 0.12); color: #a8f0cf; }

.or-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--text-3);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line-strong); }

.btn-google { color: #1f1f1f; background: #fff; }
.btn-google:hover { background: #f1f1f6; }
.btn-google svg { width: 18px; height: 18px; }

.auth-foot { margin: 20px 0 0; text-align: center; color: var(--text-3); font-size: 0.92rem; }
.auth-foot a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

.auth-single { max-width: 560px; margin: 0 auto; padding: 10px 16px 60px; }
.auth-single .avatar-grid { margin-bottom: 16px; }

#pwa-install-btn {
    position: fixed;
    left: 16px;
    bottom: calc(16px + var(--safe-b));
    display: none;
    z-index: 50;
}
#ios-install-steps {
    position: fixed;
    left: 16px;
    bottom: calc(70px + var(--safe-b));
    max-width: 340px;
    padding: 16px 18px;
    border-radius: 16px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-lg);
    color: var(--text-2);
    font-size: 0.88rem;
    z-index: 50;
}
#ios-install-steps h4 { margin: 0 0 8px; color: var(--text); }
#ios-install-steps ol { margin: 0; padding-left: 18px; }

@media (max-width: 960px) {
    .auth-layout { grid-template-columns: 1fr; }
    .auth-card { order: -1; }
    .auth-points { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .auth-top { padding-top: 14px; padding-bottom: 6px; }
    .auth-top .brand-word { display: inline; font-size: 1rem; }
    .auth-card { padding: 22px 18px; }
    .auth-title { font-size: 2rem; }
    /* A phone always gets the text view, so there is nothing to choose. */
    .entry-mode { display: none; }
}

/* The live head count under the scene. */
.live-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.live-strip[hidden] { display: none; }
.live-head { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 0.95rem; }
.live-strip .live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6); animation: live-pulse 2s infinite; }
.live-strip .live-dot.idle { background: var(--text-3); animation: none; }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }
.live-room { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 0.82rem; }
.live-room b { color: var(--mint); }
@media (prefers-reduced-motion: reduce) { .live-strip .live-dot { animation: none; } }
