/* KJO website login: crimson crystals + glass card. No libraries, no WebGL. */
:root {
  --bg: #050102;
  --crimson: #c90024;
  --hot: #ff3152;
  --text: #f7f0f1;
  --muted: #c2abb0;
  --field-line: rgba(255, 255, 255, 0.16);
  --mx: 0;          /* pointer -1..1 (set by web.js) */
  --my: 0;
  --cx: 50%;
  --cy: 50%;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; overflow-x: clip; }   /* clip: no sideways scroll even from focus */
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, system-ui, -apple-system, "Noto Sans Arabic", "Geeza Pro", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100svh;
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- scene: black stage, crimson light, the reference crystals ---------- */
.scene { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0;
  background:
    radial-gradient(62% 52% at 50% 46%, rgba(0, 0, 0, 0.85), transparent 74%),
    radial-gradient(120% 70% at 50% 122%, rgba(150, 0, 22, 0.40), transparent 62%),
    radial-gradient(42% 48% at 3% 10%, rgba(201, 0, 36, 0.32), transparent 72%),
    radial-gradient(38% 42% at 99% 4%, rgba(201, 0, 36, 0.26), transparent 72%),
    linear-gradient(180deg, #0c0204 0%, #040101 56%, #080103 100%);
}
/* soft crimson light: radial gradients instead of filter: blur() (same look, far cheaper to paint) */
.glow { position: absolute; border-radius: 50%; opacity: .55; will-change: transform; }
.glow-a { width: 46vmax; height: 46vmax; left: -14vmax; top: -10vmax; background: radial-gradient(circle, rgba(158, 0, 28, .75), rgba(158, 0, 28, 0) 68%);
  transform: translate3d(calc(var(--mx) * -14px), calc(var(--my) * -10px), 0); animation: breathe 9s ease-in-out infinite; }
.glow-b { width: 40vmax; height: 40vmax; right: -12vmax; bottom: -16vmax; background: radial-gradient(circle, rgba(122, 0, 22, .75), rgba(122, 0, 22, 0) 68%);
  transform: translate3d(calc(var(--mx) * 12px), calc(var(--my) * 10px), 0); animation: breathe 11s ease-in-out infinite reverse; }
@keyframes breathe { 50% { opacity: .18; } }
.streak { position: absolute; width: 2px; height: 140vh; top: -20vh;
  background: linear-gradient(180deg, transparent, rgba(255, 49, 82, .6), transparent); transform-origin: top; opacity: .42; }
.streak-1 { right: 17%; transform: rotate(28deg); }
.streak-2 { right: 8%; transform: rotate(31deg); opacity: .24; width: 1px; }
.streak-3 { left: 29%; transform: rotate(-24deg); opacity: .16; width: 1px; }

.crystals { position: absolute; bottom: 0; background-repeat: no-repeat; background-size: contain;
  mix-blend-mode: screen; will-change: transform; transition: transform .2s linear; }
.crystals-left { left: 0; width: min(37vw, 620px); aspect-ratio: 600 / 1019; background-image: url("/web/assets/crystals-left.webp");
  background-position: left bottom; transform: translate3d(calc(var(--mx) * -12px), calc(var(--my) * -7px), 0); }
.crystals-right { right: 0; width: min(25vw, 420px); aspect-ratio: 400 / 570; background-image: url("/web/assets/crystals-right.webp");
  background-position: right bottom; transform: translate3d(calc(var(--mx) * 9px), calc(var(--my) * -5px), 0); }
.floor { position: absolute; left: 0; right: 0; bottom: 0; height: 28vh;
  background: radial-gradient(55% 100% at 50% 100%, rgba(255, 49, 82, .18), transparent 70%),
              linear-gradient(180deg, transparent, rgba(0, 0, 0, .6)); }
.cursor-light { position: absolute; width: 460px; height: 460px; left: var(--cx); top: var(--cy); margin: -230px 0 0 -230px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255, 49, 82, .13), transparent 65%); opacity: 0; transition: opacity .4s; }
body.pointer .cursor-light { opacity: 1; }

/* ---------- the glass card ---------- */
.stage { position: relative; z-index: 1; min-height: 100svh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 32px 16px calc(28px + env(safe-area-inset-bottom)); overflow-x: clip; }
.card {
  position: relative; width: min(100%, 560px); padding: 44px 54px 34px; border-radius: 42px; isolation: isolate;
  /* clear glass: very little fill, the scene shows through blurred */
  background:
    linear-gradient(155deg, rgba(255, 255, 255, .13) 0%, rgba(255, 255, 255, .035) 28%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(200deg, rgba(255, 49, 82, .10) 0%, rgba(20, 3, 7, .38) 45%, rgba(255, 49, 82, .09) 100%);
  backdrop-filter: blur(22px) saturate(165%) brightness(1.05);
  -webkit-backdrop-filter: blur(22px) saturate(165%) brightness(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),            /* top edge catches the light */
    inset 0 -1px 0 rgba(255, 49, 82, .55),
    inset 0 0 0 1px rgba(255, 255, 255, .07),
    inset 0 0 38px rgba(255, 49, 82, .16),              /* light trapped inside the glass */
    0 0 0 1px rgba(255, 49, 82, .35),
    0 0 26px rgba(255, 49, 82, .45),
    0 0 80px rgba(201, 0, 36, .32),
    0 40px 90px rgba(0, 0, 0, .7);
  transform: perspective(1300px) rotateX(calc(var(--my) * -2.2deg)) rotateY(calc(var(--mx) * 3deg));
  transition: transform .25s ease-out;
}
/* crystal edge: a bright, faceted ring (white -> crimson -> white) */
.card::before { content: ""; position: absolute; inset: -1.5px; border-radius: inherit; padding: 2px; pointer-events: none; z-index: 2;
  background: conic-gradient(from 210deg, rgba(255, 255, 255, .95), rgba(255, 49, 82, .95) 10%, rgba(255, 255, 255, .12) 24%,
              rgba(255, 49, 82, .7) 38%, rgba(255, 255, 255, .85) 50%, rgba(255, 49, 82, .9) 62%, rgba(255, 255, 255, .1) 76%,
              rgba(255, 49, 82, .8) 88%, rgba(255, 255, 255, .95));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  filter: drop-shadow(0 0 6px rgba(255, 49, 82, .8)); }
/* reflection of the card's glow on the black floor */
.card::after { content: ""; position: absolute; left: 6%; right: 6%; top: calc(100% + 6px); height: 90px; pointer-events: none; z-index: -1;
  background: radial-gradient(50% 100% at 50% 0, rgba(255, 49, 82, .42), rgba(255, 49, 82, .08) 55%, transparent 75%); filter: blur(10px); }
.card-rim { position: absolute; left: 10%; right: 10%; bottom: -2px; height: 3px; border-radius: 3px; z-index: 3;
  background: linear-gradient(90deg, transparent, var(--hot), #fff, var(--hot), transparent); filter: blur(.4px);
  box-shadow: 0 0 18px var(--hot), 0 0 46px rgba(255, 49, 82, .7); }
/* slow light sweep across the glass */
.card-sheen { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 1; }
/* moved with transform (composited): animating "left" re-ran layout every frame and counted as layout shift */
.card-sheen::before { content: ""; position: absolute; top: -40%; bottom: -40%; width: 38%; left: 0;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .10) 45%, rgba(255, 255, 255, .22) 50%, rgba(255, 255, 255, .10) 55%, transparent);
  transform: translateX(-160%) rotate(14deg); animation: sheen 7.5s ease-in-out infinite; will-change: transform; }
@keyframes sheen { 0%, 55% { transform: translateX(-160%) rotate(14deg); } 85%, 100% { transform: translateX(360%) rotate(14deg); } }
/* thick glass slab: a second, inner bevel line + a soft top reflection, like the reference */
.card-slab { position: absolute; inset: 11px; border-radius: 32px; pointer-events: none; z-index: 1;
  border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 24px rgba(255, 49, 82, .10), 0 0 0 1px rgba(0, 0, 0, .35);
  background: linear-gradient(180deg, rgba(255, 255, 255, .075) 0%, rgba(255, 255, 255, .02) 18%, transparent 34%,
              transparent 82%, rgba(255, 49, 82, .07) 100%); }
/* glints where the crystal edge turns */
.glint { position: absolute; width: 90px; height: 90px; pointer-events: none; z-index: 3;
  background: radial-gradient(circle, rgba(255, 255, 255, .9) 0, rgba(255, 140, 160, .45) 8%, transparent 42%); }
.glint::after { content: ""; position: absolute; left: 50%; top: 50%; width: 120px; height: 1.5px; margin: -.75px 0 0 -60px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent); }
.glint-tl { top: -44px; left: -44px; }
.glint-br { bottom: -44px; right: -44px; opacity: .75; }
.card > *:not(.card-rim):not(.card-sheen):not(.card-slab):not(.glint) { position: relative; z-index: 4; }

.logo-wrap { display: block; }
.logo { display: block; width: 196px; height: auto; margin: 0 auto 14px; filter: drop-shadow(0 8px 22px rgba(201, 0, 36, .55)); }
.title { margin: 4px 0 0; text-align: center; font-size: 32px; font-weight: 800; letter-spacing: .2px;
  text-shadow: 0 2px 18px rgba(255, 49, 82, .25); }
.title-line { display: block; width: 120px; height: 3px; margin: 14px auto 26px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--hot), transparent); box-shadow: 0 0 14px var(--hot); }
.hint { color: var(--muted); font-size: 15px; line-height: 1.8; margin: 0 0 16px; text-align: center; }
.hint.strong { color: var(--text); }

.view { display: flex; flex-direction: column; }
.view.swap { animation: fade .3s ease; }   /* only when switching views, not on the first paint */
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.field { position: relative; display: block; margin-bottom: 16px; }
.field input { width: 100%; height: 62px; border-radius: 18px; border: 1px solid var(--field-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 -10px 18px rgba(0, 0, 0, .25);
  color: var(--text); font: inherit; font-size: 17px; padding: 0 58px; outline: none; text-align: right;
  transition: border-color .2s, box-shadow .2s, background .2s; }
.field input::placeholder { color: #b7a3a8; text-align: right; direction: rtl; }
.field input:focus { border-color: rgba(255, 49, 82, .8); background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 0 0 3px rgba(255, 49, 82, .2), 0 0 26px rgba(255, 49, 82, .22); }
.field-otp input, #act-code, #act-otp { letter-spacing: 3px; }
.ico { position: absolute; right: 19px; top: 50%; width: 24px; height: 24px; transform: translateY(-50%); color: #efe6e8; opacity: .9; }
.eye { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; color: #efe6e8; cursor: pointer; display: grid; place-items: center; }
.eye svg { width: 24px; height: 24px; }
.eye[aria-pressed="true"] { color: var(--hot); }
.eye:focus-visible, .btn:focus-visible, .links a:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; }

.btn { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 62px; margin-top: 10px;
  border: 0; border-radius: 999px; cursor: pointer; color: #fff; font: inherit; font-size: 20px; font-weight: 800; text-decoration: none;
  background: linear-gradient(180deg, #ff4a66 0%, #e3112f 46%, #a5001b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 0 rgba(0, 0, 0, .25),
              0 12px 32px rgba(201, 0, 36, .55), 0 0 30px rgba(255, 49, 82, .5);
  overflow: hidden; transition: transform .15s, filter .2s; }
.btn::before { content: ""; position: absolute; inset: 2px 22px auto; height: 44%; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .38), transparent); }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.985); }
.btn[disabled] { filter: grayscale(.4) brightness(.8); cursor: wait; }
.btn-ghost { background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 49, 82, .6), 0 0 20px rgba(255, 49, 82, .25); }

.msg { min-height: 22px; margin: 0 0 4px; font-size: 14.5px; text-align: center; color: #ff8fa1; }
.msg.ok { color: #7ee2a8; }
.links { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; font-size: 15.5px; flex-wrap: wrap; }
.links a { color: #ebdfe2; text-decoration: none; }
.links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.sep { width: 1px; height: 15px; background: rgba(255, 255, 255, .28); }

.meter { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); margin: -8px 2px 16px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--hot); transition: width .25s, background .25s; }
.mfa-box { border: 1px solid rgba(255, 49, 82, .35); border-radius: 18px; padding: 12px 12px 2px; margin-bottom: 12px; background: rgba(0, 0, 0, .25); }
.secret { display: block; text-align: center; font-family: Consolas, "Courier New", monospace; font-size: 15px; letter-spacing: 1.5px;
  word-break: break-all; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .06); margin-bottom: 8px; user-select: all; }
.mini { display: block; text-align: center; color: #ffb3c0; font-size: 13px; margin-bottom: 10px; }
.steps { margin: 0 0 16px; padding-inline-start: 22px; line-height: 2; color: #eadde0; font-size: 15.5px; }
.spinner { width: 46px; height: 46px; margin: 10px auto 16px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .12);
  border-top-color: var(--hot); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { margin: 34px 0 0; color: #8d757b; font-size: 12px; letter-spacing: 3px; direction: ltr; }

/* ---------- short desktop windows: keep the whole card on screen ---------- */
@media (min-width: 721px) and (max-height: 780px) {
  .card { padding: 30px 48px 24px; }
  .logo { width: 156px; margin-bottom: 8px; }
  .title { font-size: 28px; }
  .title-line { margin: 10px auto 18px; }
  .field input, .btn { height: 56px; }
  .field { margin-bottom: 12px; }
  .links { margin-top: 16px; }
}

/* ---------- phones: card fills the width, crystals sit in the corners ---------- */
@media (max-width: 720px) {
  .stage { padding: 22px 16px calc(22px + env(safe-area-inset-bottom)); }
  .card { padding: 30px 20px 24px; border-radius: 32px; transform: none; }
  .logo { width: 150px; }
  .title { font-size: 25px; }
  .title-line { margin: 12px auto 20px; }
  .field input { height: 56px; font-size: 16px; padding: 0 48px; border-radius: 16px; }   /* 16px: no zoom on iOS */
  .field input::placeholder { font-size: 14px; }
  .ico { right: 15px; width: 22px; height: 22px; }
  .eye { left: 4px; }
  .btn { height: 56px; font-size: 18px; }
  .links { font-size: 14.5px; gap: 10px; }
  .glint { width: 70px; height: 70px; }
  .card-slab { inset: 8px; border-radius: 25px; }
  .glint-tl { top: -34px; left: -34px; }
  .glint-br { bottom: -34px; right: -34px; }
  .crystals-left { width: 64vw; opacity: .78; }
  .crystals-right { width: 46vw; opacity: .72; }
  .streak-3 { display: none; }
}
@media (max-width: 360px) {
  .card { padding: 26px 16px 20px; }
  .title { font-size: 23px; }
  .field input::placeholder { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card, .crystals, .glow { transform: none !important; }
}
