/* ==========================================================================
   Хулгайн кино — нэвтрэх / бүртгүүлэх хуудас (бие даасан, main.css-гүй)
   ========================================================================== */
:root {
    --au-bg: #0b0c0e;
    --au-panel: #121417;
    --au-line: #2a2d33;
    --au-text: #f5f5f6;
    --au-muted: #8c919a;
    --au-red: #fa233b;
    --au-red-hover: #ff4055;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.kh-auth {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 96px 16px 64px;
    overflow-x: hidden;
    background: var(--au-bg);
    color: var(--au-text);
    font-family: Manrope, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--au-red); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- Кино театрын гэрэл ---------- */
.kh-stage {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: #070708;
    pointer-events: none;
}

/* Дээд талын проекторын эх үүсвэр */
.kh-stage__glow {
    position: absolute;
    top: -140px;
    left: 50%;
    width: 520px;
    height: 280px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(closest-side, #ff5a6a 0%, #fa233bcc 25%, #fa233b33 60%, transparent 100%);
    filter: blur(20px);
    animation: kh-flicker 6s steps(1) infinite;
}

/* Доош тэлэх гэрлийн цацраг */
.kh-stage__beam {
    position: absolute;
    top: 0;
    left: 50%;
    width: 150vmax;
    height: 120vh;
    transform: translateX(-50%);
    clip-path: polygon(47% 0, 53% 0, 82% 100%, 18% 100%);
    background: linear-gradient(180deg, #fa233b59 0%, #fa233b1f 35%, #fa233b0a 70%, transparent 100%);
    filter: blur(14px);
    mix-blend-mode: screen;
    animation: kh-flicker 6s steps(1) infinite;
}
.kh-stage__beam--soft {
    clip-path: polygon(45% 0, 55% 0, 100% 100%, 0 100%);
    background: linear-gradient(180deg, #ff6b7a26 0%, #fa233b0d 45%, transparent 90%);
    filter: blur(40px);
    animation-duration: 9s;
    animation-delay: -2s;
}

@keyframes kh-flicker {
    0%, 100% { opacity: 1; }
    7% { opacity: .86; }
    8% { opacity: 1; }
    41% { opacity: .93; }
    42% { opacity: 1; }
    73% { opacity: .8; }
    74% { opacity: .97; }
}

/* Гэрэлд хөвөх тоосонцор */
.kh-stage__dust span {
    position: absolute;
    left: var(--x);
    bottom: -10px;
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: #ffd5da;
    box-shadow: 0 0 6px #ff8a97;
    opacity: 0;
    animation: kh-dust var(--d) linear var(--t) infinite;
}
@keyframes kh-dust {
    0% { opacity: 0; transform: translate(0, 0); }
    15% { opacity: .7; }
    80% { opacity: .45; }
    100% { opacity: 0; transform: translate(var(--drift), -105vh); }
}

/* Дэлгэцийн гэрлийн ойлт (картын доор) */
.kh-stage__floor {
    position: absolute;
    left: 50%;
    bottom: -220px;
    width: 1100px;
    height: 420px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(closest-side, #fa233b29, transparent 75%);
    filter: blur(30px);
}

/* Хальсны шир */
.kh-stage__grain {
    position: absolute;
    inset: -100%;
    opacity: .09;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: kh-grain .9s steps(4) infinite;
}
@keyframes kh-grain {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-3%, 2%); }
    50% { transform: translate(2%, -3%); }
    75% { transform: translate(-2%, -1%); }
    100% { transform: translate(0, 0); }
}

.kh-stage__vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 40%, #000000d9 100%);
}

/* ---------- Brand + footer ---------- */
.kh-auth__brand {
    position: absolute;
    top: 22px;
    left: 50%;
    z-index: 2;
    width: 190px;
    height: 56px;
    transform: translateX(-50%);
}
.kh-auth__brand img { width: 100%; height: 100%; object-fit: contain; }

.kh-auth__foot {
    position: relative;
    z-index: 2;
    margin: 26px 0 0;
    font-size: 11px;
    color: #6f737c;
}
.kh-auth__foot a { text-decoration: none; }
.kh-auth__foot a:hover { color: #fff; }

/* ---------- Card ---------- */
.kh-auth__card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 430px;
    padding: 34px 32px 28px;
    border: 1px solid #ffffff14;
    border-top: 3px solid var(--au-red);
    border-radius: 6px 6px 12px 12px;
    background: #101215eb;
    backdrop-filter: blur(18px);
    box-shadow: 0 30px 80px #000000a6;
}

.kh-mode { display: none; animation: kh-in .35s ease; }
body[data-mode="signin"] [data-mode-panel="signin"],
body[data-mode="signup"] [data-mode-panel="signup"],
body[data-mode="forgot"] [data-mode-panel="forgot"] { display: block; }
@keyframes kh-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.kh-auth__eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 16px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.1px;
    color: var(--au-red);
}
.kh-auth__eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--au-red); }

.kh-auth h1 {
    margin: 0 0 26px;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1.2px;
}
.kh-auth h1 span { color: var(--au-muted); }

/* ---------- Steps ---------- */
.kh-steps {
    display: flex;
    gap: 18px;
    margin: -8px 0 22px;
    padding: 0;
    list-style: none;
    font-size: 11px;
    font-weight: 700;
    color: #5f636b;
}
.kh-steps li { display: flex; align-items: center; gap: 8px; }
.kh-steps b {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1px solid #3a3d44;
    border-radius: 50%;
    font-size: 10px;
}
.kh-steps li.is-on { color: #fff; }
.kh-steps li.is-on b { border-color: var(--au-red); background: var(--au-red); }

/* ---------- Form ---------- */
.kh-form { display: flex; flex-direction: column; gap: 16px; }

.kh-field { display: flex; flex-direction: column; gap: 8px; }
.kh-field > span {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    color: #b8bbc2;
}
.kh-field > span a { color: var(--au-red); text-decoration: none; font-weight: 700; }
.kh-field > span a:hover { text-decoration: underline; }

.kh-input {
    display: flex;
    align-items: center;
    height: 50px;
    border: 1px solid var(--au-line);
    border-radius: 6px;
    background: #0b0c0e;
    transition: border-color .2s, box-shadow .2s;
}
.kh-input:focus-within { border-color: var(--au-red); box-shadow: 0 0 0 3px #fa233b26; }
.kh-input input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 14px;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
}
.kh-input input::placeholder { color: #565a62; font-weight: 500; font-size: 13px; }
.kh-input--phone em {
    padding: 0 0 0 14px;
    font-style: normal;
    font-weight: 700;
    color: var(--au-muted);
}
.kh-input--phone input { letter-spacing: 1px; }
.kh-input__peek {
    height: 100%;
    padding: 0 14px;
    border: 0;
    background: none;
    font-size: 11px;
    font-weight: 700;
    color: var(--au-muted);
}
.kh-input__peek:hover { color: #fff; }

.kh-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #a2a5ad;
    cursor: pointer;
    user-select: none;
}
.kh-check input { position: absolute; opacity: 0; pointer-events: none; }
.kh-check span {
    position: relative;
    width: 32px;
    height: 18px;
    border-radius: 9px;
    background: #2a2d33;
    transition: background .2s;
}
.kh-check span:after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s;
}
.kh-check input:checked + span { background: var(--au-red); }
.kh-check input:checked + span:after { transform: translateX(14px); }
.kh-check input:focus-visible + span { outline: 2px solid var(--au-red); outline-offset: 3px; }

.kh-submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    background: var(--au-red);
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    transition: background .2s;
}
.kh-submit:hover { background: var(--au-red-hover); }
.kh-submit:disabled { opacity: .6; cursor: wait; }
.kh-submit b { font-size: 15px; }

.kh-note {
    padding: 11px 14px;
    border-left: 3px solid;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.6;
}
.kh-note--err { border-color: var(--au-red); background: #fa233b14; color: #ff98a4; }
.kh-note--ok { border-color: #2fd17a; background: #2fd17a14; color: #8ee8b6; }

.kh-fine { margin: 0; font-size: 11px; line-height: 1.7; color: #7b7f88; }
.kh-fine a { color: #c5c8ce; }
.kh-resend { display: flex; justify-content: center; min-height: 18px; }
.kh-resend a { color: var(--au-red); font-weight: 700; text-decoration: none; }

.kh-sent { margin: 0; font-size: 12px; color: #a2a5ad; }
.kh-sent b { color: #fff; }
.kh-sent a { margin-left: 6px; color: var(--au-red); font-weight: 700; text-decoration: none; }

/* ---------- OTP ---------- */
.kh-otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.kh-otp input {
    width: 100%;
    height: 56px;
    padding: 0;
    border: 1px solid var(--au-line);
    border-radius: 6px;
    outline: none;
    background: #0b0c0e;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    transition: border-color .2s, box-shadow .2s;
}
.kh-otp input:focus { border-color: var(--au-red); box-shadow: 0 0 0 3px #fa233b26; }
.kh-otp.is-bad { animation: kh-shake .4s; }
.kh-otp.is-bad input { border-color: var(--au-red); }
@keyframes kh-shake {
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ---------- Or + Google ---------- */
.kh-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 16px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #5f636b;
}
.kh-or:before, .kh-or:after { content: ''; flex: 1; height: 1px; background: #24272c; }

.kh-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    border: 1px solid #34373e;
    border-radius: 6px;
    background: #f2f2f4;
    color: #131518;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background .2s;
}
.kh-google:hover { background: #fff; }

.kh-switch {
    margin: 22px 0 0;
    padding-top: 18px;
    border-top: 1px solid #1f2226;
    font-size: 12px;
    text-align: center;
    color: #8c919a;
}
.kh-switch a { color: #fff; font-weight: 800; text-decoration: none; border-bottom: 2px solid var(--au-red); }

/* ---------- Нөхцөл / нууцлал (<dialog>) ---------- */
:root { --kh-red: var(--au-red); --kh-red-hover: var(--au-red-hover); --kh-text: var(--au-text); --kh-muted: var(--au-muted); }
.kh-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: min(86vh, 760px);
    padding: 30px 28px 26px;
    overflow-y: auto;
    border: 1px solid #2f3238;
    border-top: 3px solid var(--kh-red);
    border-radius: 6px 6px 12px 12px;
    background: #121417;
    color: var(--kh-text);
    box-shadow: 0 30px 80px #000000b3;
}
.kh-dialog--small { width: min(430px, calc(100vw - 32px)); }
.kh-dialog::backdrop { background: #000000b8; backdrop-filter: blur(6px); }
.kh-dialog[open] { animation: kh-dialog-in .25s ease; }
@keyframes kh-dialog-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.kh-dialog__close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: none;
    font-size: 24px;
    line-height: 1;
    color: #9b9da5;
}
.kh-dialog__close:hover { background: #ffffff12; color: #fff; }
.kh-dialog .kh-eyebrow { margin-bottom: 12px; font-size: 9px; }
.kh-dialog h3 { margin: 0 0 8px; font-size: 22px; font-weight: 800; letter-spacing: -.6px; }
.kh-dialog__lede,
.kh-dialog__meta { margin: 0 0 20px; font-size: 12px; color: var(--kh-muted); }
.kh-dialog__note { margin: 16px 0 0; font-size: 12px; color: #8ee8b6; }

.kh-coupon { display: flex; gap: 8px; }
.kh-coupon input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #3b3e48;
    border-radius: 6px;
    outline: none;
    background: #0b0c0e;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.kh-coupon input:focus { border-color: var(--kh-red); }
.kh-coupon button {
    flex: 0 0 auto;
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    background: var(--kh-red);
    font-size: 12px;
    font-weight: 800;
    color: #fff;
}
.kh-coupon button:hover { background: var(--kh-red-hover); }

.kh-doc h4 { margin: 22px 0 6px; font-size: 13px; font-weight: 800; }
.kh-doc p,
.kh-doc li { font-size: 12px; line-height: 1.8; color: #a5a9b2; }
.kh-doc ul { margin: 6px 0 0 18px; }
.kh-doc a { color: #fff; border-bottom: 1px solid var(--kh-red); }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    .kh-stage__glow { width: 360px; height: 220px; }
    .kh-stage__beam { clip-path: polygon(46% 0, 54% 0, 92% 100%, 8% 100%); }
}
@media (max-width: 480px) {
    body.kh-auth { justify-content: flex-start; padding-top: 92px; }
    .kh-auth__brand { width: 160px; height: 48px; }
    .kh-auth__card { padding: 28px 20px 22px; }
    .kh-auth h1 { font-size: 26px; }
    .kh-otp { gap: 6px; }
    .kh-otp input { height: 50px; font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .kh-stage__glow,
    .kh-stage__beam,
    .kh-stage__grain { animation: none; }
    .kh-stage__dust { display: none; }
    .kh-mode, .kh-otp.is-bad { animation: none; }
}

.kh-eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-size: 9px; font-weight: 800; letter-spacing: 2px; color: var(--au-red); }
.kh-eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--au-red); }
