/* ---------- Alynx at the door */

/* the scene is on */
.door { display: none; }
body.has-alynx .auth-art { transform: none !important; display: grid; place-items: center; }
body.has-alynx .auth-art img { display: none; }
body.has-alynx .door { display: block; }

.door { position: relative; width: 9.6rem; height: 14.6rem; margin: 0.4rem auto 1.6rem; animation: art-in 0.9s var(--ease-bounce) 0.1s both; }
.door-frame { position: absolute; inset: 0; border-radius: 22px 22px 8px 8px; background: #f7f8f3; border: 3.5px solid #0b0b0b; box-shadow: 7px 7px 0 #0b0b0b; perspective: 620px; perspective-origin: 30% 50%; }
/* the doorway: lime light from inside */
.door-hole { position: absolute; inset: 11px 11px 0; border-radius: 14px 14px 0 0; overflow: hidden; border: 3px solid #0b0b0b; border-bottom: 0;
  background: radial-gradient(120% 80% at 50% 100%, #f1ffe2 0%, #c8f7a0 38%, #9fe870 70%, #7fd14e 100%); }
.door-glow { position: absolute; inset: 0; background: radial-gradient(60% 40% at 50% 92%, rgba(255,255,255,0.9), transparent 70%); opacity: 0; transition: opacity 0.4s; }
.door.is-bright .door-glow { opacity: 1; }
/* the leaf swings toward you on a left hinge */
.door-leaf { position: absolute; inset: 11px 11px 0; border-radius: 14px 14px 0 0; border: 3px solid #0b0b0b; border-bottom: 0; transform-origin: 0 50%;
  background: linear-gradient(100deg, #ffffff 0%, #f4f6ef 55%, #e6eadf 100%); transform: rotateY(calc(var(--open, 0) * -82deg)); backface-visibility: hidden;
  box-shadow: inset -6px 0 0 rgba(11,11,11,0.06); will-change: transform; }
.door-panel { position: absolute; left: 14%; right: 14%; border: 2.5px solid #0b0b0b; border-radius: 9px; background: linear-gradient(180deg, #fbfcf8, #eef1e8); box-shadow: inset 2px 2px 0 #fff; }
.door-panel:nth-child(1) { top: 9%; height: 36%; }
.door-panel:nth-child(2) { bottom: 8%; height: 33%; }
.door-knob { position: absolute; right: 11%; top: 52%; width: 15px; height: 15px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #5a5a5a, #0b0b0b 60%); border: 2px solid #0b0b0b; }
.door-knob::after { content: ""; position: absolute; left: -5px; top: 3px; width: 6px; height: 5px; background: #0b0b0b; border-radius: 2px; }
.door-mat { position: absolute; left: 50%; bottom: -1.05rem; translate: -50% 0; width: 7.2rem; padding: 0.15rem 0 0.2rem; border-radius: 6px; background: #0b0b0b; color: #9fe870;
  font-weight: 800; font-size: 0.72rem; letter-spacing: 0.18em; text-align: center; text-transform: lowercase; box-shadow: 3px 3px 0 rgba(11,11,11,0.25); }
.door.is-thud { animation: door-thud 0.22s var(--ease-smooth); }
@keyframes door-thud { 25% { translate: 2px 0; } 50% { translate: -2px 1px; } 75% { translate: 1px 0; } }

/* ---------- Alynx ---------- */
.alx { position: fixed; left: 0; top: 0; width: 72px; height: 83px; z-index: 40; pointer-events: none; will-change: transform; }
.alx-in { position: absolute; inset: 0; transform-origin: 50% 100%; }
.alx svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: auto; cursor: pointer; }
.alx-ground { position: absolute; left: 50%; bottom: -5px; width: 54px; height: 9px; translate: -50% 0; border-radius: 50%; background: rgba(11,11,11,0.22); transition: opacity 0.2s; }
.alx [data-eyes] { transition: transform 0.12s linear; }
.alx [data-hand] { transition: transform 0.28s var(--ease-bounce); transform-box: fill-box; transform-origin: 50% 100%; }   /* a paw turns on its own base, not the drawing's corner */
.alx [data-shut], .alx [data-dizzy], .alx [data-zig] { opacity: 0; transition: opacity 0.12s; }
.alx.is-shut [data-shut], .alx.is-buzz [data-shut] { opacity: 1; }
.alx.is-shut [data-eyes], .alx.is-buzz [data-eyes], .alx.is-dizzy [data-eyes] { opacity: 0; }
.alx.is-dizzy [data-dizzy] { opacity: 1; }
.alx.is-dizzy [data-dizzy] g { animation: alx-spin 0.6s linear infinite; transform-box: fill-box; transform-origin: center; }
.alx.is-ouch [data-cheek] { fill: #ff4d6d; opacity: 0.9; }
@keyframes alx-spin { to { rotate: 360deg; } }

/* zapped: it shakes on the spot */
.alx.is-buzz .alx-in { animation: alx-buzz 0.05s steps(2) infinite; }
.alx.is-buzz svg { animation: alx-flicker 0.14s steps(1) infinite; }
.alx.is-buzz [data-zig], .alx.is-dizzy [data-zig] { opacity: 1; }
.alx.is-buzz [data-smile], .alx.is-dizzy [data-smile] { opacity: 0; }
.alx.is-buzz [data-sprout] { transform: translateY(-5px) scaleY(1.25); transform-box: fill-box; transform-origin: 50% 100%; }
.alx.is-buzz .alx-ground { animation: alx-buzz 0.05s steps(2) infinite reverse; }
.alx.is-singed [data-skin] { fill: #dcdcd2; transition: fill 1.2s; }
.alx.is-singed [data-cheek] { fill: #8a8a80; }
@keyframes alx-buzz { 0% { transform: translate(-2.5px, 1px) rotate(-1.5deg); } 50% { transform: translate(2.5px, -1px) rotate(1.5deg); } 100% { transform: translate(-1px, -2px); } }
@keyframes alx-flicker { 0% { filter: none; } 50% { filter: invert(1) drop-shadow(0 0 6px #ffe14d); } }
.alx-bolt { position: fixed; z-index: 41; width: 20px; height: 32px; pointer-events: none; animation: alx-bolt 0.16s steps(2) infinite; }
.alx-bolt svg { width: 100%; height: 100%; display: block; }
@keyframes alx-bolt { 0% { opacity: 1; scale: 1; } 50% { opacity: 0.2; scale: 0.8; } }
/* the spark from the knob: a jagged yellow line that flashes twice */
.alx-arc { position: fixed; z-index: 41; height: 10px; margin-top: -5px; transform-origin: 0 50%; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5 L6 1 L12 9 L18 2 L24 8 L30 1 L36 7 L40 5' fill='none' stroke='%23ffe14d' stroke-width='2.4' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0 / 100% 100%;
  filter: drop-shadow(0 0 4px #fff59a) drop-shadow(0 0 1px #0b0b0b); animation: alx-arc 0.38s steps(1) both; }
@keyframes alx-arc { 0% { opacity: 1; } 25% { opacity: 0; } 50% { opacity: 1; } 75%, 100% { opacity: 0; } }
.alx-smoke { position: fixed; z-index: 41; width: 16px; height: 16px; border-radius: 50%; background: rgba(90,90,90,0.55); pointer-events: none; opacity: 0; animation: alx-smoke 1.2s ease-out both; }
@keyframes alx-smoke { 0% { opacity: 0.8; transform: translate(0,0) scale(0.6); } 100% { opacity: 0; transform: translate(6px,-38px) scale(1.8); } }
/* the dash inside: a blur of speed */
.alx.is-dash svg { filter: blur(0.6px); }
.alx.is-dash .alx-ground { opacity: 0; }
/* inside the doorway: the frame hides it and the closing door covers it */
.alx.is-inside { position: absolute; z-index: 0; }
.alx.is-inside .alx-say { display: none; }

/* a knock: three short strokes flash where the hand hit the door */
.door-knock { position: absolute; z-index: 2; width: 26px; height: 26px; translate: -50% -50%; pointer-events: none; opacity: 0; }
.door-knock i { position: absolute; left: 50%; top: 50%; width: 3px; height: 8px; margin: -4px 0 0 -1.5px; border-radius: 2px; background: #0b0b0b; }
.door-knock i:nth-child(1) { transform: rotate(-50deg) translateY(-12px); }
.door-knock i:nth-child(2) { transform: translateY(-13px); }
.door-knock i:nth-child(3) { transform: rotate(50deg) translateY(-12px); }
.door-knock.is-on { animation: door-knock 0.28s ease-out; }
@keyframes door-knock { 0% { opacity: 1; scale: 0.7; } 100% { opacity: 0; scale: 1.25; } }

/* what it says */
.alx-say { position: absolute; left: 50px; bottom: calc(100% - 6px); width: max-content; max-width: 230px; padding: 0.55rem 0.8rem; border-radius: 16px 16px 16px 5px;
  background: #0b0b0b; color: #f7f7f4; border: 2px solid #0b0b0b; box-shadow: 3px 3px 0 #9fe870; font-size: 0.82rem; font-weight: 700; line-height: 1.3;
  opacity: 0; scale: 0.6; transform-origin: 0 100%; transition: opacity 0.18s, scale 0.3s var(--ease-bounce); pointer-events: none; }
.alx-say::after { content: ""; position: absolute; left: 6px; bottom: -8px; width: 11px; height: 11px; background: #0b0b0b; rotate: 45deg; border-radius: 0 0 3px 0; }
.alx-say.is-on { opacity: 1; scale: 1; }
.alx-say.is-err { box-shadow: 3px 3px 0 #ff6b6b; }
html[data-theme="dark"] .alx-say { border-color: rgba(255,255,255,0.2); }


/* the footer switch: on = ink, off = faded */
.auth-alynx + .auth-theme { margin-left: 0.4rem; }
.auth-alynx svg { width: 1.05rem; height: 1.05rem; }
.auth-alynx[aria-pressed="false"] { opacity: 0.5; }
.auth-alynx:hover { transform: rotate(10deg); }
