/* DOU Dragon floating oracle — cream + ruby, Pucky-style */
.dou-fab{
  position:fixed;right:calc(14px + env(safe-area-inset-right,0px));
  bottom:calc(14px + env(safe-area-inset-bottom,0px));
  z-index:120;width:62px;height:62px;border-radius:50%;
  border:2.5px solid #F3C14B;background:linear-gradient(145deg,#ff5a8a,#E0115F 55%,#8E0A3C);
  cursor:pointer;padding:6px;box-shadow:0 10px 28px rgba(224,17,95,.38);
  display:grid;place-items:center;transition:transform .18s,box-shadow .2s;
}
.dou-fab:hover{transform:translateY(-2px) scale(1.04)}
.dou-fab img,.dou-fab .dou-fab-ico{width:100%;height:100%;object-fit:contain;border-radius:50%}
.dou-fab .dou-fab-ico{font-size:28px;line-height:1;display:grid;place-items:center}
.dou-fab .badge{position:absolute;top:-4px;right:-4px;background:#F3C14B;color:#3b1a0a;font-size:.62rem;font-weight:900;border-radius:99px;padding:2px 6px;border:1px solid #fff8ec}
.dou-panel{
  position:fixed;right:calc(14px + env(safe-area-inset-right,0px));
  bottom:calc(88px + env(safe-area-inset-bottom,0px));
  z-index:121;width:min(400px,calc(100vw - 24px));max-height:min(78vh,720px);
  display:none;flex-direction:column;overflow:hidden;
  background:#fffdf8;color:#3b1a0a;border:1.5px solid #e8d5b5;border-radius:18px;
  box-shadow:0 24px 64px rgba(142,10,60,.28);
}
.dou-panel.open{display:flex}
.dou-panel .dh{display:flex;align-items:center;gap:.6rem;padding:.7rem .9rem;
  background:linear-gradient(120deg,#8E0A3C,#E0115F 60%,#F3C14B);color:#fff}
.dou-panel .dh img,.dou-panel .dh .dh-ico{width:38px;height:38px;border-radius:10px;object-fit:contain;background:#fff8;flex:none}
.dou-panel .dh .dh-ico{display:grid;place-items:center;font-size:22px}
.dou-panel .bt{flex:1;display:flex;flex-direction:column;line-height:1.15;min-width:0}
.dou-panel .bt b{font-size:15px}.dou-panel .bt small{font-size:.74rem;opacity:.95}
.dou-panel .dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#34d399;margin-right:.35rem;box-shadow:0 0 0 3px rgba(52,211,153,.25)}
.dou-panel .tab{height:32px;min-width:32px;padding:0;border-radius:10px;border:1px solid rgba(255,255,255,.35);background:rgba(255,255,255,.12);color:#fff;font-size:15px;cursor:pointer;font-weight:800}
.dou-panel .db{overflow:auto;padding:.8rem .9rem;flex:1;-webkit-overflow-scrolling:touch}
.dou-panel .ddesc{margin:0 0 .6rem;font-size:.85rem;line-height:1.45;color:#6b4420}
.dou-panel .chips{display:flex;flex-wrap:wrap;gap:.35rem;margin-bottom:.7rem}
.dou-panel .chip{border:1.5px solid #e8d5b5;background:#fff8ec;color:#3b1a0a;border-radius:99px;padding:.32rem .72rem;font:800 .78rem system-ui,sans-serif;cursor:pointer}
.dou-panel .chip:hover{background:#E0115F;color:#fff;border-color:#E0115F}
.dou-panel .chat{display:flex;flex-direction:column;gap:.4rem;margin-bottom:.8rem;min-height:72px}
.dou-panel .bubble{max-width:88%;padding:.5rem .75rem;border-radius:12px;font-size:.88rem;line-height:1.4;overflow-wrap:anywhere}
.dou-panel .bubble.bot{background:#fff4d6;align-self:flex-start;border:1px solid #e8d5b5;color:#3b1a0a}
.dou-panel .bubble.me{background:linear-gradient(#ff5a8a,#E0115F);color:#fff;align-self:flex-end}
.dou-panel .bubble a{color:inherit;font-weight:900;text-decoration:underline}
.dou-panel .blinks{display:grid;gap:.3rem}
.dou-panel .blink{display:flex;align-items:center;gap:.6rem;padding:.55rem .7rem;border-radius:10px;border:1px solid #e8d5b5;background:#fff;color:#3b1a0a;text-decoration:none;font:800 .86rem system-ui,sans-serif;cursor:pointer;text-align:left}
.dou-panel .blink:hover{border-color:#E0115F;background:#fff4d6}
.dou-panel .blink span{width:24px;text-align:center;flex:none}
.dou-panel form{display:flex;gap:.4rem;padding:.6rem .9rem;border-top:1px solid #e8d5b5;background:#fff8ec;align-items:center}
.dou-panel form input{flex:1;min-width:0;min-height:40px;border-radius:10px;border:1.5px solid #e8d5b5;padding:0 10px;font:600 14px system-ui,sans-serif;color:#3b1a0a;background:#fff}
.dou-panel form .btn{min-height:40px;padding:0 14px;border-radius:10px;border:0;background:linear-gradient(#ff5a8a,#E0115F);color:#fff;font:900 13px system-ui,sans-serif;cursor:pointer}
.dou-panel .mic{min-width:40px;height:40px;border-radius:10px;border:1.5px solid #e8d5b5;background:#fff;cursor:pointer;font-size:16px}
.dou-panel .mic.live{background:#E0115F;color:#fff;border-color:#E0115F;animation:douPulse 1.2s infinite}
.dou-panel .human{display:block;text-align:center;padding:.55rem;font-size:.82rem;color:#E0115F;font-weight:800;text-decoration:none;background:#fff8ec;border-top:1px solid #e8d5b5}
.dou-panel .tip-row{display:flex;flex-wrap:wrap;gap:6px;margin:.4rem 0 .2rem}
.dou-panel .tip-row button{border:1.5px solid #e8d5b5;background:#fff;border-radius:10px;padding:8px 10px;font:800 12px system-ui,sans-serif;cursor:pointer;color:#3b1a0a}
.dou-panel .tip-row button:hover{border-color:#E0115F;background:#ffe0ec}
@keyframes douPulse{0%,100%{box-shadow:0 0 0 0 rgba(224,17,95,.45)}70%{box-shadow:0 0 0 10px rgba(224,17,95,0)}}
@media(max-width:560px){
  .dou-fab{width:52px;height:52px}
  .dou-panel{left:8px;right:8px;width:auto;bottom:calc(72px + env(safe-area-inset-bottom,0px));max-height:calc(100dvh - 96px - env(safe-area-inset-bottom,0px))}
}
/* sit above mobile reg bar on lobby */
body.has-app .dou-fab{bottom:calc(72px + env(safe-area-inset-bottom,0px))}
body.has-app .dou-panel{bottom:calc(140px + env(safe-area-inset-bottom,0px))}
@media(min-width:901px){
  body.has-app .dou-fab{bottom:calc(14px + env(safe-area-inset-bottom,0px))}
  body.has-app .dou-panel{bottom:calc(88px + env(safe-area-inset-bottom,0px))}
}

/* Ruby dragon dark — fab stays bright gold-rimmed; panel stays cream-readable */
html[data-theme="dark"] .dou-fab{
  border-color:#F3C14B; background:linear-gradient(145deg,#ff6b9a,#E0115F 50%,#8E0A3C);
  box-shadow:0 12px 32px rgba(243,193,75,.35), 0 8px 24px rgba(142,10,60,.45);
}
html[data-theme="dark"] .dou-fab .badge{ background:#F3C14B; color:#3b1a0a; border-color:#fff6e2; }
html[data-theme="dark"] .dou-panel{
  background:#fffdf8; color:#3b1a0a; border-color:#F3C14B88;
  box-shadow:0 24px 64px rgba(142,10,60,.45);
}
html[data-theme="dark"] .dou-panel .dh{
  background:linear-gradient(120deg,#8E0A3C,#E0115F 55%,#F3C14B);
}

.dou-shop .tip-row button.soon{border-style:dashed;opacity:.95}
.dou-panel .bubble .fine{display:block;margin-top:4px;font-size:.78rem;opacity:.8}
.dou-panel code{font-size:.8rem;overflow-wrap:anywhere}
html[data-theme="dark"] .dou-shop .ddesc{color:#5a3218}

/* Keep the FAB off lobby filters / last table rows on phones */
@media (max-width:560px){
  body.has-app .dou-fab{
    bottom:calc(18px + env(safe-area-inset-bottom,0px));
    right:calc(12px + env(safe-area-inset-right,0px));
    width:48px;height:48px
  }
  body.has-app .dou-panel{
    bottom:calc(76px + env(safe-area-inset-bottom,0px))
  }
  /* When the sticky register dock is visible, park the FAB above it, not over tabs */
  body.has-app:has(#mobileRegBar.show) .dou-fab{
    bottom:calc(86px + env(safe-area-inset-bottom,0px))
  }
  body.has-app:has(#mobileRegBar.show) .dou-panel{
    bottom:calc(148px + env(safe-area-inset-bottom,0px))
  }
}
