/* Screen lock (app/lockauth.js): swipe up to unlock, the unlock sheet (PIN pad,
   pattern grid or password), and Settings > Security > Screen lock.
   Moving rules are at the bottom, behind the no-animations prefix. */

/* ---------- Lock screen: the clock follows your finger up ---------- */
#lock-screen.la-v2 > .lock-container {
    transform: translate3d(0, calc(var(--la-drag, 0px) * -0.55), 0);
    opacity: calc(1 - var(--la-p, 0) * 0.75);
}
#lock-screen.la-v2.la-open > .lock-container {
    transform: scale(0.92) translate3d(0, -6%, 0);
    opacity: 0;
    pointer-events: none;
}
#lock-screen.la-v2.la-open #lock-welcome { opacity: 0 !important; pointer-events: none; }
#lock-screen.la-v2 #lock-welcome { cursor: pointer; }
#lock-screen.la-v2 #lock-welcome.is-secure::after {
    content: '';
    width: 13px; height: 13px;
    background: currentColor;
    opacity: 0.75;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2.5'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2.5'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- The unlock sheet ---------- */
#lock-screen.la-v2 #password-container,
#lock-screen.la-v2 #password-container[style*="flex"] {
    position: absolute !important;
    inset: 0 !important;
    z-index: 30;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: color-mix(in srgb, var(--background, #05080c) 55%, transparent);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}
#lock-screen.la-v2 #password-container[style*="none"] { display: none !important; }
#lock-screen.la-v2.la-open #password-container { visibility: visible; opacity: 1; pointer-events: auto; }

.la-sheet {
    position: relative;
    width: 100%;
    max-width: 440px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 10px 22px calc(22px + env(safe-area-inset-bottom, 0px));
    border-radius: 30px 30px 0 0;
    background: color-mix(in srgb, var(--surface, #191d25) 94%, transparent);
    border: 1px solid color-mix(in srgb, var(--on-surface, #fff) 10%, transparent);
    border-bottom: none;
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.35);
    color: var(--on-surface);
    font-family: var(--font-main);
    transform: translate3d(0, 105%, 0);
    max-height: 100%;
    overflow-y: auto;
    scrollbar-width: none;
}
.la-sheet::-webkit-scrollbar { display: none; }
#lock-screen.la-v2.la-open .la-sheet { transform: none; }
.la-grab { width: 40px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--on-surface, #fff) 28%, transparent); margin-bottom: 4px; flex-shrink: 0; }
.la-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; touch-action: none; width: 100%; }
.la-avatar { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: color-mix(in srgb, var(--on-surface, #fff) 10%, transparent); overflow: hidden; }
.la-avatar .acct-avatar { --size: 52px !important; width: 52px !important; height: 52px !important; }
.la-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.la-sub { min-height: 1.2em; font-size: 0.86rem; color: color-mix(in srgb, var(--on-surface, #fff) 65%, transparent); }
.la-sub.is-error { color: var(--error, #f87171); font-weight: 600; }
.la-body { width: 100%; display: flex; flex-direction: column; align-items: center; }
.la-pw { width: 100%; }
/* Full width, so the keypad and pattern size off the sheet, not off their own content
   (shrink-to-fit made the keys tiny after the second lock). */
.la-pad { width: 100%; display: flex; flex-direction: column; align-items: center; }
.la-pw[hidden], .la-pad[hidden] { display: none !important; }
#lock-screen.la-v2 .la-sheet #password-error { display: none; }
.la-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px; }
.la-foot > * { flex: 1 1 0; }
.la-foot .la-forgot-slot { display: flex; justify-content: flex-end; }
.la-link, #lock-screen.la-v2 .la-sheet #forgot-password {
    margin: 0 !important;
    padding: 10px 6px;
    border: none;
    background: none;
    color: color-mix(in srgb, var(--on-surface, #fff) 75%, transparent);
    font: 600 0.88rem var(--font-main);
    cursor: pointer;
    text-align: left;
}
#lock-screen.la-v2 .la-sheet #forgot-password { text-align: right; }
.la-bio { flex: 0 0 auto !important; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; border: none; background: none; color: var(--accent-primary, #6aa4f5); font: 600 0.72rem var(--font-main); cursor: pointer; padding: 4px 8px; }
.la-bio[hidden] { display: none; }
.la-bio svg { box-sizing: content-box; padding: 10px; border-radius: 50%; background: color-mix(in srgb, var(--accent-primary, #6aa4f5) 16%, transparent); }

/* PIN pad */
.la-dots { display: flex; justify-content: center; align-items: center; gap: 14px; height: 22px; margin: 4px 0 16px; flex-wrap: wrap; max-width: 280px; }
.la-dots i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--on-surface, #fff) 50%, transparent); box-sizing: border-box; }
.la-dots i.is-on { background: var(--on-surface, #fff); border-color: var(--on-surface, #fff); }
.la-dots.is-error i { background: var(--error, #f87171); border-color: var(--error, #f87171); }
.la-dots.is-empty::before { content: ''; width: 60px; height: 2px; border-radius: 1px; background: color-mix(in srgb, var(--on-surface, #fff) 18%, transparent); }
.la-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 22px; width: 100%; max-width: 300px; }
.la-key {
    aspect-ratio: 1;
    width: 100%;
    max-width: 78px;
    justify-self: center;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: color-mix(in srgb, var(--on-surface, #fff) 9%, transparent);
    color: var(--on-surface, #fff);
    cursor: pointer;
    font-family: var(--font-main);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
.la-key b { font-size: 1.75rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.la-key small { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.14em; opacity: 0.55; min-height: 0.8em; margin-top: 2px; }
.la-key--fn { background: none; }
.la-key--ok { background: color-mix(in srgb, var(--accent-primary, #6aa4f5) 22%, transparent); color: var(--accent-primary, #6aa4f5); }
.la-key.is-down { background: color-mix(in srgb, var(--on-surface, #fff) 26%, transparent); }
.is-busy .la-key { opacity: 0.6; pointer-events: none; }

/* Pattern grid */
.la-pattern { width: min(78vw, 290px); height: auto; aspect-ratio: 1; touch-action: none; user-select: none; display: block; margin: 0 auto 6px; cursor: crosshair; }
.la-pat-line, .la-pat-tail { stroke: color-mix(in srgb, var(--on-surface, #fff) 70%, transparent); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.la-pat-tail { stroke-opacity: 0.45; visibility: hidden; }
.la-pattern.is-drawing .la-pat-tail { visibility: visible; }
.la-pat-core { fill: color-mix(in srgb, var(--on-surface, #fff) 60%, transparent); transform-box: fill-box; transform-origin: center; }
.la-pat-halo { fill: transparent; transform-box: fill-box; transform-origin: center; }
.la-pat-dot.is-on .la-pat-core { fill: var(--on-surface, #fff); }
.la-pat-dot.is-on .la-pat-halo { fill: color-mix(in srgb, var(--on-surface, #fff) 16%, transparent); }
.la-pattern.is-ok .la-pat-line { stroke: var(--accent-primary, #6aa4f5); }
.la-pattern.is-error .la-pat-line, .la-pattern.is-error .la-pat-tail { stroke: var(--error, #f87171); }
.la-pattern.is-error .la-pat-dot.is-on .la-pat-core { fill: var(--error, #f87171); }
.la-pattern.is-error .la-pat-dot.is-on .la-pat-halo { fill: color-mix(in srgb, var(--error, #f87171) 20%, transparent); }
.la-pattern.is-hidden-path .la-pat-line, .la-pattern.is-hidden-path .la-pat-tail { stroke: transparent; }
.la-pattern.is-hidden-path .la-pat-dot.is-on .la-pat-halo { fill: transparent; }

/* Setup flow password box */
.la-passform { display: flex; align-items: center; gap: 6px; width: 100%; max-width: 360px; margin: 0 auto; padding: 0 6px 0 18px; box-sizing: border-box; height: 52px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--on-surface, #fff) 22%, transparent); background: color-mix(in srgb, var(--background, #05080c) 50%, transparent); }
.la-passform:focus-within { border-color: color-mix(in srgb, var(--accent-primary, #6aa4f5) 70%, transparent); }
.la-passform.is-error { border-color: var(--error, #f87171); }
.la-pass { flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: none; color: var(--on-surface); font: 16px var(--font-main); }
.la-pass-eye { width: 40px; height: 40px; border-radius: 50%; border: none; background: none; color: color-mix(in srgb, var(--on-surface, #fff) 60%, transparent); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Settings > Screen lock ---------- */
.la-page { padding-bottom: 40px; }
.la-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 10px 6px; }
.la-hero h2 { margin: 14px 0 4px; font-size: 1.5rem; letter-spacing: -0.02em; }
.la-hero p { margin: 0; max-width: 320px; font-size: 0.9rem; color: color-mix(in srgb, var(--on-surface, #fff) 65%, transparent); line-height: 1.45; }
.la-hero-phone { width: 74px; height: 128px; border-radius: 18px; padding: 5px; box-sizing: border-box; background: color-mix(in srgb, var(--on-surface, #fff) 14%, transparent); }
.la-hero-screen { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 14px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent-primary, #6aa4f5) 45%, var(--surface, #191d25)), var(--surface, #191d25)); color: var(--on-surface); }
.la-opts { display: flex; flex-direction: column; gap: 8px; }
.la-opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 18px; border: 1.5px solid color-mix(in srgb, var(--on-surface, #fff) 9%, transparent); background: var(--surface-color, var(--surface, #191d25)); color: var(--on-surface); text-align: left; cursor: pointer; font-family: var(--font-main); }
.la-opt.is-on { border-color: var(--accent-primary, #6aa4f5); background: color-mix(in srgb, var(--accent-primary, #6aa4f5) 10%, var(--surface, #191d25)); }
.la-opt-art { flex-shrink: 0; width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: #64748b; }
.la-opt-art--swipe { background: #0ea5e9; }
.la-opt-art--pattern { background: #8b5cf6; }
.la-opt-art--pin { background: #f59e0b; }
.la-opt-art--password { background: #e5534b; }
.la-opt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.la-opt-text b { font-size: 0.98rem; }
.la-opt-text span { font-size: 0.8rem; color: color-mix(in srgb, var(--on-surface, #fff) 60%, transparent); line-height: 1.35; }
.la-opt-check { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--on-surface, #fff) 25%, transparent); display: inline-flex; align-items: center; justify-content: center; color: transparent; box-sizing: border-box; }
.la-opt.is-on .la-opt-check { background: var(--accent-primary, #6aa4f5); border-color: var(--accent-primary, #6aa4f5); color: #fff; }
.la-row { width: 100%; text-align: left; }
.la-row[disabled], .la-row.is-off { opacity: 0.55; }
.la-row.is-busy { opacity: 0.6; pointer-events: none; }
.la-note { margin: 16px 6px 0; font-size: 0.8rem; color: color-mix(in srgb, var(--on-surface, #fff) 55%, transparent); line-height: 1.45; }

/* The "confirm it's you" and "choose a new one" pages */
.la-flow { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px)); box-sizing: border-box; background: var(--background, #0b0e13); overflow-y: auto; }
.la-flow-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--on-surface); font-family: var(--font-main); }
.la-flow-icon { width: 54px; height: 54px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent-primary, #6aa4f5) 18%, transparent); color: var(--accent-primary, #6aa4f5); }
.la-flow-title { margin: 16px 0 6px; font-size: 1.35rem; letter-spacing: -0.01em; }
.la-flow-sub { margin: 0 0 22px; min-height: 2.6em; font-size: 0.9rem; line-height: 1.4; color: color-mix(in srgb, var(--on-surface, #fff) 65%, transparent); }
.la-flow-sub.is-error { color: var(--error, #f87171); font-weight: 600; }
.la-flow-pad { width: 100%; display: flex; flex-direction: column; align-items: center; }
.la-flow-actions { display: flex; gap: 10px; width: 100%; max-width: 360px; margin-top: 24px; }
.la-flow-actions > * { flex: 1; }

/* Lock screen notification count (Hide all notification content) */
.lw-count { align-items: center; }
.lw-count-icons { display: inline-flex; flex-shrink: 0; }
.lw-count-icons .nt-icon { width: 26px !important; height: 26px !important; margin-left: -8px; border: 2px solid var(--surface, #191d25); }
.lw-count-icons .nt-icon:first-child { margin-left: 0; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2 > .lock-container { transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.32s ease; }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2.la-dragging > .lock-container { transition: none; }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2 #lock-welcome { transition: opacity 0.2s ease; }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2 #lock-welcome::before { animation: laHint 2.4s ease-in-out infinite; }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2 #lock-welcome.la-nudge { animation: laNudge 0.5s cubic-bezier(0.3, 1.4, 0.5, 1); }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2 #password-container { transition: opacity 0.28s ease, visibility 0s linear 0.42s; }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2.la-open #password-container { transition: opacity 0.24s ease, visibility 0s; }
    :root:not(.no-animations) body:not(.no-animations) .la-sheet { transition: transform 0.44s cubic-bezier(0.2, 0.95, 0.25, 1); }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2.la-open .la-head { animation: laRise 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) 0.06s both; }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2.la-open .la-key { animation: laKey 0.4s cubic-bezier(0.25, 1.3, 0.5, 1) backwards; animation-delay: calc(0.08s + var(--i, 0) * 0.018s); }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2.la-open .la-pat-dot { animation: laKey 0.4s cubic-bezier(0.25, 1.3, 0.5, 1) both; animation-delay: calc(0.08s + var(--i, 0) * 0.025s); transform-box: fill-box; transform-origin: center; }
    :root:not(.no-animations) body:not(.no-animations) #lock-screen.la-v2.la-unlocking .la-sheet { transform: translate3d(0, 30%, 0) scale(0.96); opacity: 0; transition: transform 0.2s ease-in, opacity 0.16s ease-in; }
    :root:not(.no-animations) body:not(.no-animations) .la-sheet.shake { animation: laShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
    :root:not(.no-animations) body:not(.no-animations) .la-key { transition: background-color 0.18s ease, transform 0.14s ease; }
    :root:not(.no-animations) body:not(.no-animations) .la-key.is-down { transform: scale(0.92); transition-duration: 0.05s; }
    :root:not(.no-animations) body:not(.no-animations) .la-dots i { transition: background-color 0.15s ease, border-color 0.15s ease; }
    :root:not(.no-animations) body:not(.no-animations) .la-dots i.is-new { animation: laPop 0.26s cubic-bezier(0.3, 1.6, 0.5, 1); }
    :root:not(.no-animations) body:not(.no-animations) .la-dots.is-error { animation: laShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
    :root:not(.no-animations) body:not(.no-animations) .la-pat-dot.is-on .la-pat-core { animation: laDot 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); }
    :root:not(.no-animations) body:not(.no-animations) .la-pat-dot.is-on .la-pat-halo { animation: laHalo 0.36s ease-out; }
    :root:not(.no-animations) body:not(.no-animations) .la-pattern.is-error { animation: laShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
    :root:not(.no-animations) body:not(.no-animations) .la-bio.is-scanning svg { animation: laScan 1s ease-in-out infinite; }
    :root:not(.no-animations) body:not(.no-animations) .la-passform.is-error { animation: laShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
    :root:not(.no-animations) body:not(.no-animations) .la-opt { transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.15s ease; animation: laRise 0.4s cubic-bezier(0.2, 0.9, 0.3, 1) backwards; animation-delay: calc(var(--i, 0) * 0.04s); }
    :root:not(.no-animations) body:not(.no-animations) .la-opt:active { transform: scale(0.98); }
    :root:not(.no-animations) body:not(.no-animations) .la-opt-check { transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
    :root:not(.no-animations) body:not(.no-animations) .la-opt.is-on .la-opt-check { animation: laPop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); }
    :root:not(.no-animations) body:not(.no-animations) .la-hero-phone { animation: laRise 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
    :root:not(.no-animations) body:not(.no-animations) .la-hero-screen svg { animation: laPop 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) 0.15s both; }
    :root:not(.no-animations) body:not(.no-animations) .la-flow { animation: laFlowIn 0.32s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
    :root:not(.no-animations) body:not(.no-animations) .la-flow.is-leaving { animation: laFlowOut 0.2s ease-in forwards; }
    :root:not(.no-animations) body:not(.no-animations) .la-flow-title, :root:not(.no-animations) body:not(.no-animations) .la-flow-sub { transition: color 0.2s ease; }
    :root:not(.no-animations) body:not(.no-animations) .la-flow-icon { animation: laPop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) 0.05s both; }
}
@keyframes laHint { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
@keyframes laNudge { 0% { transform: translateY(0); } 40% { transform: translateY(-14px); } 100% { transform: translateY(0); } }
@keyframes laRise { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: none; } }
@keyframes laKey { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes laPop { 0% { transform: scale(0.4); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes laDot { 0% { transform: scale(1); } 50% { transform: scale(1.7); } 100% { transform: scale(1.25); } }
@keyframes laHalo { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes laShake { 10%, 90% { transform: translate3d(-2px, 0, 0); } 20%, 80% { transform: translate3d(4px, 0, 0); } 30%, 50%, 70% { transform: translate3d(-7px, 0, 0); } 40%, 60% { transform: translate3d(7px, 0, 0); } }
@keyframes laScan { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes laFlowIn { from { opacity: 0; transform: translate3d(0, 24px, 0); } to { opacity: 1; transform: none; } }
@keyframes laFlowOut { to { opacity: 0; transform: translate3d(0, 16px, 0); } }

/* The cookie banner sits at the bottom over everything; while the unlock sheet is up it
   would cover the keypad, so it steps aside until the sheet closes. */
body:has(#lock-screen.la-open) #cookie-banner { opacity: 0; pointer-events: none; }
