/* ============================================================
   Wethic Keystone — Identity Gate
   Escena de acceso standalone. Tokens heredados del sistema WCA.
   ============================================================ */

:root {
    --wca-bg-deep: #070b16;
    --wca-bg-panel: #0d1526;
    --wca-bg-hover: #182643;
    --wca-border: rgba(148, 163, 184, 0.16);
    --wca-border-strong: rgba(99, 102, 241, 0.35);
    --wca-accent: #6366f1;
    --wca-cyan: #22d3ee;
    --wca-ok: #34d399;
    --wca-danger: #fb7185;
    --wca-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
    --wca-sans: 'Outfit', 'Segoe UI', sans-serif;
    --wca-glow: 0 0 24px rgba(34, 211, 238, 0.35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.wkey-gate {
    margin: 0;
    min-height: 100vh;
    background: var(--wca-bg-deep);
    color: #e2e8f0;
    font-family: var(--wca-sans);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(99, 102, 241, 0.45); color: #fff; }

.wkey-mono { font-family: var(--wca-mono); }

/* ---------- Escena de fondo ---------- */

.wkey-stage {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 60% at 20% -10%, rgba(99, 102, 241, 0.16), transparent 60%),
        radial-gradient(ellipse 70% 55% at 85% 110%, rgba(34, 211, 238, 0.10), transparent 60%),
        var(--wca-bg-deep);
}

.wkey-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 45%, #000 30%, transparent 78%);
    mask-image: radial-gradient(ellipse 90% 80% at 50% 45%, #000 30%, transparent 78%);
}

.wkey-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
    pointer-events: none;
    animation: wkey-drift 18s ease-in-out infinite alternate;
}

.wkey-orb-a { width: 420px; height: 420px; left: -120px; top: 12%; background: rgba(99, 102, 241, 0.35); }
.wkey-orb-b { width: 360px; height: 360px; right: -100px; bottom: 6%; background: rgba(34, 211, 238, 0.22); animation-delay: -9s; }

@keyframes wkey-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(40px, -30px, 0) scale(1.08); }
}

.wkey-starfield { position: absolute; inset: 0; width: 100%; height: 100%; }

.wkey-scanline {
    position: absolute;
    left: 0; right: 0;
    height: 120px;
    background: linear-gradient(to bottom, transparent, rgba(34, 211, 238, 0.05), transparent);
    animation: wkey-scan 9s linear infinite;
}

@keyframes wkey-scan {
    from { top: -140px; }
    to   { top: 110vh; }
}

/* ---------- Header ---------- */

.wkey-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 46px 34px 18px;
    gap: 16px;
    flex-wrap: wrap;
}

.wkey-logo { display: block; max-width: 190px; max-height: 42px; object-fit: contain; }

.wkey-brand-name {
    font-family: var(--wca-mono);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.34em;
    color: #fff;
    text-shadow: 0 0 18px rgba(99, 102, 241, 0.8);
}

.wkey-top-meta {
    font-family: var(--wca-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #7c88a3;
    display: flex;
    align-items: center;
    gap: 9px;
}

.wkey-led {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--wca-ok);
    box-shadow: 0 0 10px var(--wca-ok);
    animation: wkey-pulse 2.2s ease-in-out infinite;
}

@keyframes wkey-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* ---------- Centro ---------- */

.wkey-center {
    position: relative;
    z-index: 2;
    min-height: calc(100vh - 170px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}

.wkey-card {
    width: min(460px, 100%);
    background: rgba(13, 21, 38, 0.72);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border: 1px solid var(--wca-border-strong);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(3, 7, 18, 0.75), 0 0 50px rgba(99, 102, 241, 0.10);
    padding: 28px 30px 22px;
    animation: wkey-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes wkey-enter {
    from { opacity: 0; transform: translateY(16px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.wkey-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--wca-border);
    flex-wrap: wrap;
}

.wkey-tag {
    font-family: var(--wca-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.22em;
    color: #a5b4fc;
    text-transform: uppercase;
}

.wkey-state {
    font-family: var(--wca-mono);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    color: #64748b;
    animation: wkey-pulse 3.4s ease-in-out infinite;
}

.wkey-cursor { color: var(--wca-cyan); text-shadow: var(--wca-glow); animation: wkey-blink 1.1s steps(1) infinite; }

@keyframes wkey-blink {
    0%, 55% { opacity: 1; }
    56%, 100% { opacity: 0; }
}

/* ---------- Error ---------- */

.wkey-error {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--wca-mono);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    color: var(--wca-danger);
    background: rgba(251, 113, 133, 0.08);
    border: 1px solid rgba(251, 113, 133, 0.35);
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 18px;
    text-shadow: 0 0 12px rgba(251, 113, 133, 0.45);
}

.wkey-oknote {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-family: var(--wca-mono);
    font-size: 11.5px;
    line-height: 1.6;
    letter-spacing: 0.05em;
    color: var(--wca-ok);
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.35);
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 18px;
    text-shadow: 0 0 12px rgba(52, 211, 153, 0.35);
}

.wkey-card.is-error .wkey-card { animation: none; }

.wkey-card.is-error { animation: wkey-shake 0.45s ease; }

@keyframes wkey-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-9px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(4px); }
}

/* ---------- Formulario ---------- */

.wkey-form { display: flex; flex-direction: column; gap: 16px; }

.wkey-field { display: flex; flex-direction: column; gap: 7px; }

.wkey-label {
    font-family: var(--wca-mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.24em;
    color: #b9c5e0;
    text-transform: uppercase;
}

.wkey-input {
    width: 100%;
    font-family: var(--wca-mono);
    font-size: 14px;
    font-weight: 600;
    color: #f4f7ff;
    background: rgba(10, 16, 32, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    padding: 13px 15px;
    outline: none;
    caret-color: var(--wca-cyan);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.wkey-input::placeholder { color: #65759a; }

.wkey-input:focus {
    border-color: rgba(34, 211, 238, 0.75);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14), var(--wca-glow);
    background: rgba(7, 11, 22, 0.9);
}

.wkey-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #0d1526 inset;
    -webkit-text-fill-color: #e2e8f0;
}

.wkey-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.wkey-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--wca-mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    color: #8b97b3;
    cursor: pointer;
    user-select: none;
}

.wkey-check input { accent-color: var(--wca-cyan); width: 14px; height: 14px; cursor: pointer; }

.wkey-link {
    font-family: var(--wca-mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    color: var(--wca-cyan);
    text-decoration: none;
    transition: text-shadow 0.18s ease;
}

.wkey-link:hover { text-shadow: var(--wca-glow); }

.wkey-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 4px;
    font-family: var(--wca-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(115deg, #6366f1 0%, #4f46e5 45%, #0891b2 100%);
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    box-shadow: 0 10px 34px rgba(79, 70, 229, 0.4);
}

.wkey-submit::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.55s ease;
}

.wkey-submit:hover::before { transform: translateX(120%); }

.wkey-submit:hover { box-shadow: 0 14px 42px rgba(34, 211, 238, 0.45); transform: translateY(-1px); }

.wkey-submit:active { transform: translateY(0); }

.wkey-arrow { font-size: 16px; }

/* ---------- Switch de modo (login/register) ---------- */

.wkey-switch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed var(--wca-border);
    text-align: center;
}

.wkey-switch .wkey-link { font-size: 11px; }

.wkey-switch-note {
    font-family: var(--wca-mono);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    color: var(--wca-ok);
    text-shadow: 0 0 12px rgba(52, 211, 153, 0.4);
}

/* ---------- Pie de tarjeta ---------- */

.wkey-card-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px dashed var(--wca-border);
    font-family: var(--wca-mono);
    font-size: 9.5px;
    letter-spacing: 0.1em;
    color: #55617c;
    flex-wrap: wrap;
}

/* ---------- Footer ---------- */

.wkey-bottom {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 0 34px 26px;
    font-family: var(--wca-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: #46516b;
    flex-wrap: wrap;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .wkey-top { padding: 36px 18px 14px; }
    .wkey-bottom { padding: 0 18px 20px; flex-direction: column; }
    .wkey-card { padding: 22px 20px 18px; }
    .wkey-card-foot { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .wkey-orb, .wkey-scanline, .wkey-led, .wkey-cursor, .wkey-card, .wkey-card.is-error { animation: none !important; }
    .wkey-state { animation: none; }
}