/* ===========================================
   AUTH PAGES (login / signup / verify)
   Matches the Otakul dark + blurred-orb theme.
=========================================== */

.auth-body{
    font-family:"Montserrat", sans-serif;
    background:#0d1117;
    color:white;
    min-height:100vh;
    overflow-x:hidden;
    position:relative;
    display:flex;
    flex-direction:column;   /* card above, site footer below — never side-by-side */
    align-items:center;
    justify-content:flex-start;
    padding:40px 20px;
}

/* Auth pages must size everything with border-box: without it the
   full-width inputs add padding on top of 100% and overflow their card. */
.auth-body *,
.auth-body *::before,
.auth-body *::after{
    box-sizing:border-box;
}

.auth-body .background{
    position:fixed;
    inset:0;
    z-index:-2;
    overflow:hidden;
}

.auth-body .circle{
    position:absolute;
    border-radius:50%;
    filter:blur(90px);
    opacity:.20;
}

.auth-body .one{ width:420px; height:420px; background:#00c16a; top:-120px; left:-100px; }
.auth-body .two{ width:340px; height:340px; background:#3b82f6; right:-100px; top:120px; }
.auth-body .three{ width:300px; height:300px; background:#9333ea; bottom:-120px; left:35%; }

.auth-wrapper{
    width:100%;
    max-width:484px;
    /* Card floats centered above the footer. Auto margins collapse to
       zero when the page is taller than the screen, so nothing clips
       at the top on small phones. */
    margin:auto;
}

.auth-brand{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    margin-bottom:28px;
    text-decoration:none;
    font-weight:800;
    font-size:22px;
    color:white;
}

.auth-brand .brand-anime{ color:#00c16a; }
.auth-brand .brand-chat{ color:#3b82f6; }

.auth-card{
    background:rgba(255,255,255,.04);
    border:1px solid rgba(255,255,255,.09);
    border-radius:26px;
    padding:42px 38px;
    backdrop-filter:blur(18px);
    box-shadow:0 24px 70px rgba(0,0,0,.5);
}

/* The shared site footer on auth pages must stretch full-width under
   the card instead of being squeezed beside it. */
.auth-body > .site-footer{
    width:100%;
    max-width:100%;
    flex-shrink:0;
    margin-top:44px;
}

.auth-card h1{
    font-size:26px;
    font-weight:800;
    margin-bottom:6px;
    text-align:center;
}

.auth-subtitle{
    text-align:center;
    color:rgba(255,255,255,.55);
    font-size:14px;
    margin-bottom:30px;
}

.auth-field{
    margin-bottom:18px;
}

.auth-field label{
    display:block;
    font-size:13px;
    font-weight:600;
    color:rgba(255,255,255,.7);
    margin-bottom:8px;
}

.auth-field input{
    width:100%;
    padding:14px 16px;
    border-radius:14px;
    border:1px solid rgba(255,255,255,.12);
    background:rgba(255,255,255,.05);
    color:white;
    font-family:inherit;
    font-size:14.5px;
    outline:none;
    transition:.25s;
}

.auth-field input::placeholder{
    color:rgba(255,255,255,.35);
}

.auth-field input:focus{
    border-color:#3b82f6;
    box-shadow:0 0 0 4px rgba(59,130,246,.18);
    background:rgba(255,255,255,.07);
}

.auth-hint{
    font-size:12px;
    color:rgba(255,255,255,.4);
    margin-top:6px;
}

/* ---------- live username availability ---------- */

.username-status{
    font-size:12px;
    font-weight:600;
    margin-top:6px;
    min-height:16px;
}
.username-status.ok{
    color:#22c55e;
}
.username-status.bad{
    color:#f87171;
}
.username-status.checking{
    color:rgba(255,255,255,.45);
}

/* ---------- password show/hide toggle ---------- */

.password-wrap{
    position:relative;
}

.password-wrap input{
    padding:14px 36px 14px 16px;
}

.pw-toggle{
    position:absolute;
    top:50%;
    right:12px;
    transform:translateY(-50%);
    display:flex;
    align-items:center;
    justify-content:center;
    background:none;
    border:none;
    color:rgba(255,255,255,.55);
    cursor:pointer;
    padding:2px;
    border-radius:6px;
    transition:color .2s, background .2s;
}

.pw-toggle:hover{
    color:#fff;
    background:rgba(255,255,255,.08);
}

.auth-submit{
    width:100%;
    padding:15px;
    border:none;
    border-radius:40px;
    cursor:pointer;
    color:white;
    background:linear-gradient(135deg, #7B2EFF, #3F8CFF);
    font-weight:700;
    font-size:15px;
    font-family:inherit;
    margin-top:8px;
    transition:.3s;
}

.auth-submit:hover{
    transform:translateY(-2px);
    box-shadow:0 0 25px rgba(123,46,255,.55);
}

.auth-switch{
    text-align:center;
    margin-top:26px;
    font-size:14px;
    color:rgba(255,255,255,.55);
}

.auth-switch a{
    color:#00c16a;
    text-decoration:none;
    font-weight:700;
}

.auth-switch a:hover{
    text-decoration:underline;
}

/* ---------- flash messages ---------- */

.flash-list{
    margin-bottom:20px;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.flash{
    padding:12px 16px;
    border-radius:12px;
    font-size:13.5px;
    line-height:1.4;
}

.flash-error{
    background:rgba(239,68,68,.12);
    border:1px solid rgba(239,68,68,.35);
    color:#fca5a5;
}

.flash-success{
    background:rgba(0,193,106,.12);
    border:1px solid rgba(0,193,106,.35);
    color:#7ee9b8;
}

/* ---------- check-your-email panel ---------- */

.mail-icon{
    width:70px;
    height:70px;
    border-radius:50%;
    background:linear-gradient(135deg, rgba(0,193,106,.25), rgba(59,130,246,.25));
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:30px;
    margin:0 auto 20px;
}

.dev-link-box{
    margin-top:22px;
    padding:16px;
    border-radius:14px;
    background:rgba(245,158,11,.1);
    border:1px dashed rgba(245,158,11,.5);
    font-size:13px;
    line-height:1.5;
}

.dev-link-box p{
    color:#fcd34d;
    margin-bottom:10px;
}

.dev-link-box a{
    color:#3b82f6;
    word-break:break-all;
}

.dev-error{
    color:#f87171;
    font-size:12px;
    word-break:break-word;
}

.resend-form{
    margin-top:24px;
    display:flex;
    gap:10px;
}

.resend-form input{
    flex:1;
    padding:12px 14px;
    border-radius:12px;
    border:1px solid rgba(255,255,255,.12);
    background:rgba(255,255,255,.05);
    color:white;
    font-family:inherit;
}

.resend-form button{
    padding:12px 18px;
    border:none;
    border-radius:12px;
    background:rgba(255,255,255,.08);
    color:white;
    font-weight:600;
    cursor:pointer;
    white-space:nowrap;
}

.resend-form button:hover{
    background:rgba(255,255,255,.14);
}

/* ===========================================
   NAV AUTH WIDGET
   Used inside the existing site navbars once
   a person is logged in / out.
=========================================== */

.nav-auth-widget{
    display:flex;
    align-items:center;
    gap:14px;
}

.nav-user-pill{
    display:flex;
    align-items:center;
    gap:10px;
    padding:6px 16px 6px 6px;
    border-radius:40px;
    background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.1);
    text-decoration:none;
    color:inherit;
    transition:.25s;
}
.nav-user-pill:hover{
    border-color:rgba(143,91,255,.55);
    background:rgba(143,91,255,.12);
}

.nav-user-avatar{
    width:30px;
    height:30px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:12px;
    font-weight:700;
    color:white;
}

.nav-user-name{
    font-weight:600;
    font-size:14px;
}

.nav-logout-btn,
.nav-login-btn{
    text-decoration:none;
    color:white;
    font-weight:700;
    font-size:14px;
    padding:10px 22px;
    border-radius:40px;
    transition:.3s;
}

.nav-logout-btn{
    background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.12);
}

.nav-logout-btn:hover{
    background:rgba(239,68,68,.18);
    border-color:rgba(239,68,68,.4);
}

.nav-login-btn{
    background:linear-gradient(135deg, #7B2EFF, #3F8CFF);
}

.nav-login-btn:hover{
    transform:translateY(-2px);
    box-shadow:0 0 25px rgba(123,46,255,.6);
}

/* ---------- chat login gate ---------- */

.chat-login-gate{
    padding:22px;
    text-align:center;
    border-top:1px solid rgba(255,255,255,.08);
    background:rgba(255,255,255,.02);
}

.chat-login-gate p{
    color:rgba(255,255,255,.65);
    font-size:14.5px;
}

.chat-login-gate i{
    margin-right:8px;
    color:#f59e0b;
}

.chat-login-gate a{
    color:#00c16a;
    font-weight:700;
    text-decoration:none;
}

.chat-login-gate a:hover{
    text-decoration:underline;
}

@media (max-width:520px){
    .auth-body{
        padding:28px 14px;
    }
    .auth-brand{
        margin-bottom:20px;
    }
    .auth-card{
        padding:32px 24px;
    }
    .resend-form{
        flex-direction:column;
    }
}

/* ===========================================
   NAV PROFILE DROPDOWN (Crunchyroll-style)
   Avatar pill opens Settings / History / Lists / Logout.
=========================================== */

.nav-user-wrap{
    position:relative;
}

.nav-user-trigger{
    cursor:pointer;
    font-family:'Montserrat',sans-serif;
    display:flex;
    align-items:center;
    gap:10px;
    padding:6px 14px 6px 6px;
    border-radius:40px;
    background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.1);
    color:inherit;
    transition:.25s;
}
.nav-user-trigger:hover,
.nav-user-trigger[aria-expanded="true"]{
    border-color:rgba(143,91,255,.55);
    background:rgba(143,91,255,.12);
    box-shadow:0 0 18px rgba(143,91,255,.4);
}

.nav-user-caret{
    font-size:11px;
    color:#8f94b0;
    transition:transform .25s;
}
.nav-user-trigger[aria-expanded="true"] .nav-user-caret{
    transform:rotate(180deg);
}

.nav-user-menu{
    position:absolute;
    top:calc(100% + 12px);
    right:0;
    z-index:3000;
    min-width:235px;
    background:#141a2e;
    border:1px solid rgba(143,91,255,.35);
    border-radius:16px;
    padding:8px;
    box-shadow:0 22px 60px rgba(0,0,0,.7),0 0 30px rgba(123,46,255,.15);
    animation:navDrop .22s ease;
}
.nav-user-menu[hidden]{
    display:none;
}
@keyframes navDrop{
    from{opacity:0;transform:translateY(-8px) scale(.97);}
    to{opacity:1;transform:translateY(0) scale(1);}
}

.nav-user-menu-head{
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 14px;
    border-radius:12px;
    text-decoration:none;
    color:white;
    transition:.2s;
    margin-bottom:4px;
}
.nav-user-menu-head:hover{
    background:linear-gradient(135deg,rgba(143,91,255,.26),rgba(63,140,255,.16));
    box-shadow:0 0 18px rgba(143,91,255,.4);
}
.nav-user-menu-name{
    font-weight:700;
    font-size:15px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    max-width:150px;
}

.nav-user-menu-item{
    display:flex;
    align-items:center;
    gap:12px;
    width:100%;
    box-sizing:border-box;
    padding:11px 14px;
    border-radius:10px;
    text-decoration:none;
    color:#d8d8d8;
    font-size:13.5px;
    font-weight:600;
    cursor:pointer;
    transition:.2s;
}
.nav-user-menu-item i{
    width:18px;
    text-align:center;
    color:#8f94b0;
    font-size:14px;
    flex-shrink:0;
    transition:.2s;
}
.nav-user-menu-item:hover{
    background:linear-gradient(135deg,rgba(143,91,255,.3),rgba(63,140,255,.18));
    color:white;
    box-shadow:0 0 20px rgba(143,91,255,.5),inset 0 0 12px rgba(143,91,255,.15);
    transform:translateX(3px);
}
.nav-user-menu-item:hover i{
    color:#c9a8ff;
    filter:drop-shadow(0 0 6px rgba(201,168,255,.8));
}
.nav-user-menu-item.danger{
    color:#ff5c7a;
}
.nav-user-menu-item.danger:hover{
    background:linear-gradient(135deg,rgba(255,59,107,.32),rgba(255,122,89,.16));
    color:#ff9db1;
    box-shadow:0 0 20px rgba(255,59,107,.55),inset 0 0 12px rgba(255,59,107,.15);
    transform:translateX(3px);
}
.nav-user-menu-item.danger:hover i{
    color:#ff8fa3;
    filter:drop-shadow(0 0 6px rgba(255,143,163,.8));
}

/* ==========================================================
   AVATAR PICKER (Tohoku-style, Otakul-themed)
   ========================================================== */
.nav-user-avatar-img,
.user-avatar-img,
.thr-avatar-img {
    object-fit: cover;
    display: inline-block;
    border-radius: 50%;
}
.nav-user-avatar-img { width: 30px; height: 30px; }
.user-avatar-img { width: 44px; height: 44px; }
.thr-avatar-img { width: 32px; height: 32px; }

.profile-avatar .settings-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-picker-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}
.selected-avatar-box {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(143, 91, 255, .6);
    box-shadow: 0 0 18px rgba(143, 91, 255, .35);
    flex-shrink: 0;
}
.selected-avatar-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.choose-avatar-btn {
    background: linear-gradient(135deg, rgba(143, 91, 255, .25), rgba(90, 200, 160, .18));
    border: 1px solid rgba(143, 91, 255, .55);
    color: #e6dcff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .08em;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s ease;
}
.choose-avatar-btn:hover {
    background: linear-gradient(135deg, rgba(143, 91, 255, .45), rgba(90, 200, 160, .3));
    box-shadow: 0 0 18px rgba(143, 91, 255, .5);
}

.avatar-popup {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(8, 6, 18, .82);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.avatar-popup[hidden] { display: none; }
.avatar-popup-content {
    width: min(560px, 94vw);
    max-height: 82vh;
    background: linear-gradient(160deg, #191233, #0e0a1e);
    border: 1px solid rgba(143, 91, 255, .35);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .6), 0 0 40px rgba(143, 91, 255, .18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.avatar-popup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 22px 12px;
    border-bottom: 1px solid rgba(143, 91, 255, .18);
}
.avatar-popup-header h2 {
    margin: 0 0 4px;
    font-size: 20px;
    color: #fff;
}
.avatar-popup-header p {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, .6);
}
.close-avatar-popup {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .7);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.close-avatar-popup:hover { color: #fff; }
.avatar-scroll {
    overflow-y: auto;
    padding: 12px 22px 22px;
}
.avatar-category { margin-top: 16px; }
.avatar-category h3 {
    margin: 0 0 10px;
    font-size: 13px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
}
.avatar-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.avatar-option {
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .18s ease;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, .05);
}
.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.avatar-option:hover {
    border-color: rgba(143, 91, 255, .8);
    transform: scale(1.04);
    box-shadow: 0 0 16px rgba(143, 91, 255, .45);
}
.avatar-option.selected {
    border-color: #8f5bff;
    box-shadow: 0 0 20px rgba(143, 91, 255, .6);
}

/* Per-category avatar sizing:
   - Tall pixel-art avatars (gyaru / fantasy7): zoom on the head + upper
     body (object-position:top) so the face is always visible, in the
     picker and in the circular previews.
   - White-background square avatars (chibi / fantasy / profile): zoom in
     so the character fills the card and the white padding is trimmed. */
.avatar-option.gyaru img,
.avatar-option.fantasy.tall img{
    object-fit: cover;
    object-position: top center;
    transform: none;
}
.avatar-option.chibi img{
    transform: scale(1.55);
}
.avatar-option.fantasy img{
    transform: scale(1.4);
}
.avatar-option.profile img{
    transform: scale(1.15);
}

/* Anywhere tall avatars appear in circles (selected preview, confirm
   popup, navbar, profile): keep them framed on the face, not the torso. */
img[src*="gyaru"],
img[src*="fantasy7"]{
    object-position: top center;
}

.avatar-confirm-popup {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: rgba(8, 6, 18, .85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.avatar-confirm-popup[hidden] { display: none; }
.avatar-confirm-box {
    width: min(340px, 92vw);
    background: linear-gradient(160deg, #191233, #0e0a1e);
    border: 1px solid rgba(143, 91, 255, .4);
    border-radius: 18px;
    padding: 26px;
    text-align: center;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .6), 0 0 40px rgba(143, 91, 255, .2);
}
.avatar-confirm-box h3 { margin: 0 0 6px; color: #fff; font-size: 18px; }
.avatar-confirm-box p { margin: 0 0 16px; font-size: 13px; color: rgba(255, 255, 255, .6); }
.confirm-avatar-preview {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 18px;
    border: 3px solid rgba(143, 91, 255, .7);
    box-shadow: 0 0 24px rgba(143, 91, 255, .5);
}
.confirm-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.avatar-confirm-buttons {
    display: flex;
    gap: 10px;
}
.cancel-avatar-btn,
.confirm-avatar-btn {
    flex: 1;
    padding: 11px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .08em;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .18s ease;
}
.cancel-avatar-btn {
    background: rgba(255, 255, 255, .07);
    color: rgba(255, 255, 255, .75);
    border-color: rgba(255, 255, 255, .15);
}
.cancel-avatar-btn:hover { background: rgba(255, 255, 255, .14); }
.confirm-avatar-btn {
    background: linear-gradient(135deg, #8f5bff, #5ac8a0);
    color: #fff;
}
.confirm-avatar-btn:hover {
    box-shadow: 0 0 18px rgba(143, 91, 255, .55);
    transform: translateY(-1px);
}

/* ==========================================================
   6-DIGIT CODE ENTRY
   ========================================================== */
.code-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 10px 0 12px;
}
.code-inputs input {
    width: 52px;
    height: 58px;
    border-radius: 12px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(143, 91, 255, .4);
    outline: none;
    transition: all .15s ease;
}
.code-inputs input:focus {
    border-color: #8f5bff;
    box-shadow: 0 0 14px rgba(143, 91, 255, .5);
    background: rgba(143, 91, 255, .12);
}
.verification-timer {
    font-size: 13px;
    color: rgba(255, 255, 255, .55);
    margin: 4px 0 10px;
}
.verification-timer #timer {
    color: #ffb45c;
    font-weight: 700;
}
.resend-code-area {
    font-size: 13px;
    color: rgba(255, 255, 255, .6);
    margin-bottom: 16px;
}
.resend-code-btn {
    background: none;
    border: none;
    color: #8f5bff;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}
.resend-code-btn:hover { color: #b18cff; }
.dev-code {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: .18em;
    color: #5ac8a0;
    display: inline-block;
    margin-top: 6px;
}
.forgot-link {
    color: #8f5bff;
    font-weight: 600;
    text-decoration: none;
}
.forgot-link:hover { text-decoration: underline; }

/* Profile settings form tweaks */
.profile-settings-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}
.settings-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.profile-settings-id {
    display: flex;
    align-items: center;
    gap: 20px;
}
@media (max-width: 560px) {
    .avatar-gallery { grid-template-columns: repeat(3, 1fr); }
    .code-inputs input { width: 44px; height: 52px; font-size: 20px; }
}

/* ============================================================
   AUTH — tiny screens (prevent iOS zoom, keep cards snug)
   ============================================================ */
@media (max-width: 420px) {
    .auth-card { padding: 30px 18px; }
    .auth-card input, .auth-card input[type=text], .auth-card input[type=password], .auth-card input[type=email] { font-size: 16px; }
    .auth-wrapper { padding: 18px 10px; }
}
