/* Cardbit standalone site: Ask Latch AI help chat (site-only, loaded only when SITE_HELP=on).
   Bottom-right. The script measures the Daily Rewards launcher (.cb-launch) and sets --cb-help-lift so the
   bubble always sits just above it; community chat stays on the left. */
.cb-help,.cb-help *{box-sizing:border-box}
.cb-help{
  --hc-bg:#0a1214;--hc-panel:#0f1a1d;--hc-raise:#152428;--hc-line:#22363b;--hc-line-2:#2f4a50;
  --hc-text:#f6faf9;--hc-dim:#a9bdbf;--hc-mute:#7d9497;--hc-cyan:#00e6e1;--hc-cyan-2:#7df3ea;--hc-deep:#062022;--hc-focus:#FFB65C;
  --hc-ease:cubic-bezier(.2,.9,.25,1.15);
  position:fixed;right:max(16px,env(safe-area-inset-right));
  bottom:max(calc(16px + env(safe-area-inset-bottom)),var(--cb-help-lift,0px));z-index:901;
  font-family:"Atkinson Hyperlegible Next","Cardbit Atkinson","Cardbit Atkinson Fallback",system-ui,sans-serif;color:var(--hc-text);
  -webkit-font-smoothing:antialiased}
body:has(dialog[open]) .cb-help{display:none}
.cb-help :focus-visible{outline:3px solid var(--hc-focus);outline-offset:2px}
.cb-help-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.cb-help svg{width:18px;height:18px;flex:none;display:block}

/* ---------- Bubble ---------- */
.cb-help-dock{display:flex;align-items:center;justify-content:flex-end;gap:10px}
.cb-help-btn{position:relative;display:grid;place-items:center;width:64px;height:64px;padding:0;border:0;border-radius:50%;
  background:radial-gradient(circle at 50% 38%,#15474a 0%,#0c2124 62%,#081416 100%);cursor:pointer;
  box-shadow:0 14px 34px #000b,0 0 0 1px #00e6e133,0 0 26px #00e6e140;transition:transform .25s var(--hc-ease),box-shadow .25s}
.cb-help-ring{position:absolute;inset:-3px;border-radius:50%;padding:3px;pointer-events:none;
  background:conic-gradient(from var(--hc-spin,0deg),#00e6e1,#7df3ea 25%,#1a6f70 50%,#00e6e1 75%,#7df3ea);
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;
  animation:cb-help-spin 6s linear infinite}
@property --hc-spin{syntax:"<angle>";inherits:false;initial-value:0deg}
@keyframes cb-help-spin{to{--hc-spin:360deg}}
.cb-help-btn img{position:absolute;left:50%;bottom:3px;width:62px;height:auto;transform:translateX(-50%);transform-origin:50% 100%;
  filter:drop-shadow(0 4px 6px #0009);pointer-events:none;transition:transform .3s var(--hc-ease),opacity .2s;
  clip-path:inset(-40% -10% 0 -10% round 0 0 32px 32px)}
.cb-help-btn:hover{transform:translateY(-2px);box-shadow:0 18px 40px #000c,0 0 0 1px #00e6e166,0 0 34px #00e6e170}
.cb-help-btn:hover img{transform:translateX(-50%) translateY(-3px) rotate(-4deg)}
.cb-help-btn .cb-help-q{font:800 1.6rem/1 "Cardbit Outfit","Cardbit Outfit Fallback",system-ui,sans-serif;color:var(--hc-cyan)}
.cb-help-x{position:absolute;inset:0;display:grid;place-items:center;color:var(--hc-cyan-2);opacity:0;transform:rotate(-90deg) scale(.6);transition:transform .3s var(--hc-ease),opacity .2s}
.cb-help-x svg{width:24px;height:24px}
.cb-help.is-open .cb-help-btn img{opacity:0;transform:translateX(-50%) translateY(10px) scale(.7)}
.cb-help.is-open .cb-help-x{opacity:1;transform:none}
.cb-help-btn.has-chat::after{content:"";position:absolute;top:2px;right:2px;width:13px;height:13px;border-radius:50%;background:var(--hc-cyan);border:2px solid #0c2124;box-shadow:0 0 8px #00e6e1}
.cb-help.is-open .cb-help-btn.has-chat::after{display:none}

.cb-help-hint{padding:9px 14px;border-radius:14px 14px 4px 14px;background:#f6faf9;color:#0b1a1c;font-size:.88rem;line-height:1.2;white-space:nowrap;
  box-shadow:0 10px 26px #000a;opacity:0;transform:translateX(8px) scale(.96);transform-origin:100% 100%;pointer-events:none;transition:opacity .3s,transform .35s var(--hc-ease)}
.cb-help-hint b{font-family:"Cardbit Outfit","Cardbit Outfit Fallback",system-ui,sans-serif;font-weight:800}
.cb-help.is-hinting .cb-help-hint{opacity:1;transform:none}

/* ---------- Panel ---------- */
.cb-help-panel{position:absolute;right:0;bottom:78px;width:min(392px,calc(100vw - 32px));height:min(74vh,640px,calc(100vh - var(--cb-help-lift,16px) - 96px));min-height:340px;display:flex;flex-direction:column;
  border-radius:22px;background:linear-gradient(180deg,#10201f 0%,var(--hc-panel) 120px);border:1px solid var(--hc-line-2);
  box-shadow:0 30px 90px #000d,0 0 0 1px #00e6e114,inset 0 1px 0 #ffffff0d;overflow:hidden;transform-origin:calc(100% - 32px) 100%;
  animation:cb-help-pop .32s var(--hc-ease)}
.cb-help-panel[hidden]{display:none}
@keyframes cb-help-pop{from{opacity:0;transform:translateY(12px) scale(.94)}to{opacity:1;transform:none}}

.cb-help-head{position:relative;display:flex;align-items:center;gap:12px;padding:14px 12px 14px 16px;border-bottom:1px solid var(--hc-line);
  background:radial-gradient(120% 140% at 0% 0%,#00e6e126 0%,transparent 55%),linear-gradient(180deg,#132a2c,#0f1d20)}
.cb-help-grip{display:none}
.cb-help-sp{flex:1;min-width:0}
.cb-help-head h2{margin:0;display:flex;align-items:center;gap:8px;font:800 1.2rem/1.1 "Cardbit Outfit","Cardbit Outfit Fallback",system-ui,sans-serif;letter-spacing:.005em}
.cb-help-head p{margin:4px 0 0;display:flex;align-items:center;gap:6px;font-size:.8rem;color:var(--hc-dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cb-help-live{width:8px;height:8px;border-radius:50%;background:#3ee08f;box-shadow:0 0 0 3px #3ee08f2a;flex:none}
.cb-help-tag{display:inline-block;padding:2px 7px;border-radius:999px;background:#00e6e11f;border:1px solid #00e6e166;color:var(--hc-cyan-2);font:800 .62rem/1.3 "Cardbit Outfit","Cardbit Outfit Fallback",system-ui,sans-serif;text-transform:uppercase;letter-spacing:.08em}
.cb-help-icon{display:grid;place-items:center;width:36px;height:36px;border:0;border-radius:10px;background:transparent;color:var(--hc-dim);cursor:pointer;transition:background .15s,color .15s}
.cb-help-icon:hover{color:var(--hc-text);background:#ffffff12}

/* Avatars */
.cb-help-av{position:relative;flex:none;width:30px;height:30px;border-radius:50%;overflow:hidden;
  background:radial-gradient(circle at 50% 30%,#1c5254,#0b1f22);box-shadow:inset 0 0 0 1.5px #00e6e166}
.cb-help-av img{position:absolute;left:50%;top:8%;width:135%;height:auto;transform:translateX(-50%);pointer-events:none}
.cb-help-av-gap{background:none;box-shadow:none}
.cb-help-av-lg{width:46px;height:46px;box-shadow:inset 0 0 0 2px var(--hc-cyan),0 0 16px #00e6e140}
.cb-help-av-hero{display:block;width:76px;height:76px;margin:0 auto 10px;box-shadow:inset 0 0 0 2px #00e6e1aa,0 0 0 6px #00e6e112,0 0 34px #00e6e133}
.cb-help-av-hero img{top:4%;width:140%;animation:cb-help-bob 3.6s ease-in-out infinite}
@keyframes cb-help-bob{0%,100%{transform:translateX(-50%) translateY(0)}50%{transform:translateX(-50%) translateY(-4px)}}

/* Log */
.cb-help-log{flex:1;min-height:0;overflow:auto;padding:16px 14px 12px;display:flex;flex-direction:column;gap:8px;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#2f4a50 transparent}
.cb-help-hero{text-align:center;padding:6px 10px 10px}
.cb-help-hello{margin:0;font:800 1.08rem/1.3 "Cardbit Outfit","Cardbit Outfit Fallback",system-ui,sans-serif}
.cb-help-hello-fine{margin:6px auto 0;max-width:300px;font-size:.8rem;line-height:1.45;color:var(--hc-dim)}
.cb-help-hello-fine a{color:var(--hc-cyan-2)}
.cb-help-chips{display:grid;gap:8px;margin:4px 0 6px}
.cb-help-chips button{display:flex;align-items:center;gap:10px;width:100%;padding:11px 12px 11px 14px;border-radius:14px;border:1px solid var(--hc-line-2);
  background:linear-gradient(180deg,#14272a,#112023);color:var(--hc-text);font:inherit;text-align:left;cursor:pointer;transition:border-color .15s,transform .15s,background .15s}
.cb-help-chips button span{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.cb-help-chips b{font:800 .9rem/1.25 "Cardbit Outfit","Cardbit Outfit Fallback",system-ui,sans-serif}
.cb-help-chips small{font-size:.76rem;color:var(--hc-mute)}
.cb-help-chips svg{color:var(--hc-cyan);opacity:.7;transition:transform .2s,opacity .2s}
.cb-help-chips button:hover{border-color:#00e6e199;background:linear-gradient(180deg,#173236,#13262a);transform:translateY(-1px)}
.cb-help-chips button:hover svg{opacity:1;transform:translateX(3px)}

.cb-help-row{display:flex;align-items:flex-end;gap:8px}
.cb-help-row-me{justify-content:flex-end}
.cb-help-row.is-new{animation:cb-help-in .3s var(--hc-ease) both}
@keyframes cb-help-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.cb-help-msg{max-width:82%;padding:10px 13px;border-radius:18px;font-size:.92rem;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.cb-help-msg a{color:var(--hc-cyan-2);text-decoration:underline;text-underline-offset:2px}
.cb-help-bot{background:var(--hc-raise);border:1px solid var(--hc-line);border-bottom-left-radius:6px}
.cb-help-me{background:linear-gradient(135deg,#19e9e2,#00bfc0);color:var(--hc-deep);font-weight:600;border-bottom-right-radius:6px;box-shadow:0 6px 18px #00e6e126}
.cb-help-me a{color:var(--hc-deep)}
.cb-help-err{margin:2px auto;max-width:92%;background:#2a1d10;border:1px solid #5c3e1c;color:#ffd1a3;font-size:.84rem;text-align:center;border-radius:12px}
.cb-help-err a{color:#ffd1a3}
.cb-help-typing{display:inline-flex;gap:5px;padding:13px 14px}
.cb-help-typing span{width:7px;height:7px;border-radius:50%;background:var(--hc-cyan-2);opacity:.35;animation:cb-help-dot 1.1s infinite ease-in-out}
.cb-help-typing span:nth-child(2){animation-delay:.15s}.cb-help-typing span:nth-child(3){animation-delay:.3s}
@keyframes cb-help-dot{0%,80%,100%{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}

/* Footer */
.cb-help-foot{padding:12px 12px 12px;border-top:1px solid var(--hc-line);background:var(--hc-bg)}
.cb-help-form{display:flex;align-items:flex-end;gap:6px;padding:5px 5px 5px 14px;border-radius:16px;border:1px solid #33505a;background:#0c1719;transition:border-color .15s,box-shadow .15s}
.cb-help-form:focus-within{border-color:var(--hc-cyan);box-shadow:0 0 0 3px #00e6e124}
.cb-help-form textarea{flex:1;min-width:0;resize:none;max-height:120px;min-height:38px;padding:9px 0;border:0;background:transparent;color:var(--hc-text);font:inherit;font-size:.95rem;line-height:1.35;outline:none}
.cb-help-form textarea::placeholder{color:#6f878a}
.cb-help-form:focus-within textarea:focus-visible{outline:none}
.cb-help-send{display:grid;place-items:center;flex:none;width:40px;height:40px;border:0;border-radius:12px;background:var(--hc-cyan);color:var(--hc-deep);cursor:pointer;transition:transform .15s,background .15s}
.cb-help-send:hover{background:var(--hc-cyan-2);transform:translateY(-1px)}
.cb-help-send[disabled]{opacity:.45;cursor:default;transform:none}
.cb-help-gate{display:flex;flex-direction:column;align-items:center;gap:8px;padding:4px 4px 2px;text-align:center}
.cb-help-gate svg{width:26px;height:26px;color:var(--hc-cyan)}
.cb-help-gate p{margin:0;font-size:.88rem;color:var(--hc-dim)}
.cb-help-gate a{color:var(--hc-cyan-2)}
.cb-help-cta{width:100%;height:46px;padding:0 16px;border:0;border-radius:14px;background:linear-gradient(135deg,#19e9e2,#00c4c4);color:var(--hc-deep);font:800 1rem "Cardbit Outfit","Cardbit Outfit Fallback",system-ui,sans-serif;cursor:pointer;box-shadow:0 8px 22px #00e6e133;transition:transform .15s}
.cb-help-cta:hover{transform:translateY(-1px)}
.cb-help-cta.is-nudge{animation:cb-help-nudge .45s}
@keyframes cb-help-nudge{25%{transform:translateX(-5px)}50%{transform:translateX(5px)}75%{transform:translateX(-3px)}}
.cb-help-meta{display:flex;align-items:flex-start;gap:12px;margin-top:9px;padding:0 2px}
.cb-help-meta p{flex:1;margin:0;font-size:.7rem;line-height:1.4;color:var(--hc-mute)}
.cb-help-meta p a{color:var(--hc-dim)}
.cb-help-mail{display:inline-flex;align-items:center;gap:5px;flex:none;padding:5px 9px;border-radius:9px;border:1px solid var(--hc-line-2);color:var(--hc-cyan-2);font:800 .74rem "Cardbit Outfit","Cardbit Outfit Fallback",system-ui,sans-serif;text-decoration:none;white-space:nowrap}
.cb-help-mail svg{width:14px;height:14px}
.cb-help-mail:hover{border-color:var(--hc-cyan);background:#00e6e112}

/* ---------- Phone: bottom sheet ---------- */
@media (max-width:640px){
  .cb-help-btn{width:58px;height:58px}.cb-help-btn img{width:56px}
  .cb-help-hint{display:none}
  .cb-help.is-open .cb-help-btn{visibility:hidden}
  .cb-help-panel{position:fixed;left:0;right:0;bottom:0;width:auto;height:min(88dvh,700px);border-radius:22px 22px 0 0;border-bottom:0;transform-origin:50% 100%;animation-name:cb-help-sheet}
  .cb-help-grip{display:block;position:absolute;top:6px;left:50%;width:38px;height:4px;margin-left:-19px;border-radius:2px;background:#ffffff2a}
  .cb-help-head{padding-top:18px}
  .cb-help-foot{padding-bottom:max(12px,env(safe-area-inset-bottom))}
  .cb-help-form textarea{font-size:16px} /* no iOS zoom */
}
@keyframes cb-help-sheet{from{transform:translateY(100%)}to{transform:none}}

@media (prefers-reduced-motion:reduce){
  .cb-help *,.cb-help-panel{animation:none!important;transition:none!important}
}

/* Hidden until placed above the Daily Rewards launcher (cardbit-site-help.js adds .is-docked), so it never jumps. */
.cb-help:not(.is-docked){visibility:hidden}
.cb-help.is-docked{animation:cb-help-in .2s ease-out}
@keyframes cb-help-in{from{opacity:0}to{opacity:1}}
@media (prefers-reduced-motion:reduce){.cb-help.is-docked{animation:none}}
