/* ══════════════════════════════════════════════════════════════
   访客准入验证浮层（2026-09-30）

   盖在聊天窗口上，验证通过才撤掉。三种题型共用一套外壳，
   只有中间那块「答题区」按题型换。

   为什么整块盖住而不是插在消息流里：访客一眼要知道「现在不能聊，
   先过这一步」。插在消息里会被当成一条普通消息划过去。
   ══════════════════════════════════════════════════════════════ */
.vgate-mask{
    position:absolute;inset:0;z-index:40;
    display:grid;place-items:center;padding:18px;
    background:rgba(238,241,247,.82);
    -webkit-backdrop-filter:blur(14px) saturate(140%);backdrop-filter:blur(14px) saturate(140%);
    animation:vgate-in .18s ease-out
}
@keyframes vgate-in{from{opacity:0}to{opacity:1}}
.vgate-card{
    width:min(340px,100%);padding:22px 20px 20px;
    border:1px solid rgba(255,255,255,.8);border-radius:20px;
    background:linear-gradient(180deg,rgba(255,255,255,.96),rgba(255,255,255,.9));
    box-shadow:0 22px 54px rgba(24,36,64,.18);
    text-align:center
}
.vgate-mark{
    width:44px;height:44px;margin:0 auto 12px;border-radius:14px;
    display:grid;place-items:center;
    background:color-mix(in srgb,var(--support-color,#635bff) 13%,#fff);
    color:var(--support-color,#635bff)
}
.vgate-mark svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.vgate-card h2{margin:0 0 6px;color:#17203a;font-size:16.5px;font-weight:800;letter-spacing:-.01em}
.vgate-card p.vgate-hint{margin:0 0 16px;color:#6b7690;font-size:12.5px;line-height:1.65}

/* ── 滑块 ── */
.vgate-slider{
    position:relative;height:46px;border-radius:13px;overflow:hidden;
    border:1px solid rgba(120,136,168,.28);background:#f1f3f8;
    touch-action:none;user-select:none;-webkit-user-select:none
}
.vgate-slider-fill{
    position:absolute;inset:0 auto 0 0;width:0;
    background:color-mix(in srgb,var(--support-color,#635bff) 20%,#fff);
    transition:background .16s
}
.vgate-slider-text{
    position:absolute;inset:0;display:grid;place-items:center;
    color:#7a8499;font-size:12.5px;font-weight:650;pointer-events:none
}
.vgate-slider-handle{
    position:absolute;top:2px;left:2px;width:44px;height:40px;
    display:grid;place-items:center;border-radius:11px;
    background:#fff;box-shadow:0 3px 10px rgba(26,40,72,.2);
    color:var(--support-color,#635bff);cursor:grab
}
.vgate-slider-handle svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.vgate-slider.is-dragging .vgate-slider-handle{cursor:grabbing}
.vgate-slider.is-done .vgate-slider-fill{background:color-mix(in srgb,#17a97a 22%,#fff)}
.vgate-slider.is-done .vgate-slider-handle{color:#17a97a}
.vgate-slider.is-done .vgate-slider-text{color:#17a97a}

/* ── 拼图 ── */
.vgate-puzzle{
    position:relative;width:100%;margin-bottom:10px;border-radius:12px;overflow:hidden;
    border:1px solid rgba(120,136,168,.28);background:#e9ecf3;
    user-select:none;-webkit-user-select:none
}
.vgate-puzzle-bg{display:block;width:100%;height:auto;pointer-events:none}
.vgate-puzzle-piece{
    position:absolute;left:0;top:0;height:auto;
    filter:drop-shadow(0 2px 5px rgba(16,26,48,.45));
    pointer-events:none;will-change:left
}
.vgate-puzzle-reload{
    position:absolute;right:7px;top:7px;width:30px;height:30px;
    display:grid;place-items:center;border:0;border-radius:9px;
    background:rgba(255,255,255,.82);color:#41506b;cursor:pointer
}
.vgate-puzzle-reload svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ── 图形码 / 加减法 ── */
.vgate-quiz{display:grid;gap:10px}
.vgate-quiz-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px;align-items:center}
.vgate-quiz-image{
    height:46px;border:1px solid rgba(120,136,168,.28);border-radius:11px;
    background:#f1f3f8 center/contain no-repeat;cursor:pointer;
    display:block;width:100%
}
.vgate-quiz-question{
    height:46px;display:grid;place-items:center;
    border:1px solid rgba(120,136,168,.28);border-radius:11px;background:#f1f3f8;
    color:#17203a;font-size:19px;font-weight:750;letter-spacing:.06em
}
.vgate-quiz-reload{
    width:46px;height:46px;display:grid;place-items:center;
    border:1px solid rgba(120,136,168,.28);border-radius:11px;background:#fff;
    color:#6b7690;cursor:pointer
}
.vgate-quiz-reload svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.vgate-input{
    width:100%;height:46px;padding:0 14px;
    border:1px solid rgba(120,136,168,.3);border-radius:12px;background:#fff;
    color:#17203a;font:700 16px/1 system-ui;text-align:center;letter-spacing:.18em;
    outline:none;-webkit-appearance:none;appearance:none
}
.vgate-input::placeholder{color:#a8b1c4;font-weight:500;letter-spacing:normal}
.vgate-input:focus{border-color:var(--support-color,#635bff);box-shadow:0 0 0 3px color-mix(in srgb,var(--support-color,#635bff) 14%,transparent)}
.vgate-submit{
    width:100%;min-height:44px;margin-top:2px;
    border:0;border-radius:12px;background:var(--support-color,#635bff);
    color:#fff;font:750 13.5px/1 system-ui;cursor:pointer
}
.vgate-submit:disabled{cursor:not-allowed;opacity:.55}

.vgate-note{margin:12px 0 0;min-height:17px;color:#b3261e;font-size:12px;line-height:1.5}
.vgate-note.is-ok{color:#17a97a}
.vgate-foot{margin:13px 0 0;color:#9aa3b6;font-size:11px;line-height:1.55}

/* 一次性校验失败太多进冷却时，把答题区收起来，只留说明 */
.vgate-card.is-locked .vgate-body{display:none}

/* 先验证、后进入：直达页初始化时只露出验证浮层，不先展示可聊天内容。 */
.support-window.gate-pending > :not(.vgate-mask){visibility:hidden;pointer-events:none}
.support-window.gate-pending .vgate-mask{visibility:visible;pointer-events:auto}

/* 客服端频率限制设置 */
.vgate-rate-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:0 0 12px}
.vgate-rate-field{display:grid;gap:6px;padding:12px;border:1px solid rgba(120,136,168,.22);border-radius:12px;background:#fafbfe}
.vgate-rate-field>span{font-size:12px;font-weight:750;color:#33415d}
.vgate-rate-field input{width:100%;height:38px;border:1px solid rgba(120,136,168,.3);border-radius:9px;padding:0 10px;background:#fff;color:#17203a;font:700 15px/1 system-ui}
.vgate-rate-field small{font-size:11px;line-height:1.45;color:#8a94a8}
@media(max-width:640px){.vgate-rate-grid{grid-template-columns:1fr}}

/* 视觉点选 / 顺序点选 */
.vgate-visual{display:grid;gap:9px}
.vgate-visual-hint{margin:0;color:#44516a;font-size:12.5px;font-weight:700;line-height:1.5;text-align:center}
/* 要找的东西：只给图不给名字。题面这张和格子里的同一个物体用不同配色和角度画，
   所以不能靠像素比对，必须比形状。 */
/* 目标图：个数是可配的（现在 4 个），所以不能写死宽度，用 flex 自适应并允许换行 */
.vgate-visual-target{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;padding:8px;border-radius:12px;background:rgba(236,241,249,.9);border:1px dashed rgba(120,136,168,.42)}
.vgate-visual-target-cell{position:relative;display:block;line-height:0;flex:0 1 auto}
.vgate-visual-target-cell img{display:block;width:64px;height:54px;border-radius:9px;box-shadow:0 3px 9px rgba(38,71,120,.16)}
.vgate-visual-target-cell b{position:absolute;left:-4px;top:-4px;z-index:1;min-width:17px;height:17px;display:grid;place-items:center;border-radius:50%;background:var(--support-color,#635bff);color:#fff;font-size:10px;font-weight:800;line-height:1}
.vgate-visual-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.vgate-visual-tile{position:relative;padding:4px;border:1.5px solid rgba(120,136,168,.3);border-radius:11px;background:#f7f8fc;cursor:pointer;display:grid;place-items:center;transition:.15s ease;line-height:0}
.vgate-visual-image{display:block;width:100%;height:auto;aspect-ratio:120/96;object-fit:cover;border-radius:8px}
.vgate-visual-order{position:absolute;right:-3px;top:-3px;min-width:17px;height:17px;display:none;place-items:center;border-radius:50%;background:var(--support-color,#635bff);color:#fff;font-size:10px;font-weight:800;line-height:1}
.vgate-visual-tile.is-selected .vgate-visual-order:not(:empty){display:grid}
.vgate-visual-tile:disabled{cursor:default;opacity:.85}
.vgate-visual-tile:hover,.vgate-visual-tile.is-selected{border-color:var(--support-color,#635bff);background:color-mix(in srgb,var(--support-color,#635bff) 12%,#fff);box-shadow:0 0 0 2px color-mix(in srgb,var(--support-color,#635bff) 15%,transparent)}
@media (max-width:360px){.vgate-visual-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.vgate-visual-target-cell img{width:54px;height:46px}}

@supports not (background:color-mix(in srgb,#000 10%,#fff)){
    .vgate-mark{background:#eef0ff}
    .vgate-slider-fill{background:#e3e4ff}
    .vgate-input:focus{box-shadow:0 0 0 3px rgba(99,91,255,.14)}
}

/* 嵌入式悬浮窗比直达页矮，卡片要更紧凑 */
body.is-embed .vgate-mask{padding:12px}
body.is-embed .vgate-card{padding:18px 16px 16px;border-radius:17px}
body.is-embed .vgate-card h2{font-size:15.5px}
body.is-embed .vgate-card p.vgate-hint{margin-bottom:13px;font-size:12px}

@media (max-height:520px){
    .vgate-mask{place-items:start center;padding-top:14px;overflow:auto}
    .vgate-mark{width:36px;height:36px;margin-bottom:9px;border-radius:12px}
    .vgate-card{padding:16px 15px 15px}
    .vgate-card p.vgate-hint{margin-bottom:12px}
}
@media (max-width:360px){
    .vgate-mask{padding:12px}
    .vgate-card{padding:18px 15px 15px}
}
