/* «Need help?» (js/help.js): the 3D Splayn character in the corner, its speech bubble and the panel. */

.help { position: fixed; right: 22px; bottom: 20px; z-index: 75; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

/* ---------- the character: the logo's five printed layers, with depth and a face ---------- */
.hb {
  --u: 0.78px; --rx: 0deg; --ry: 0deg; --ex: 0px; --ey: 0px;
  position: relative; display: block; width: calc(84 * var(--u)); height: calc(98 * var(--u) + 14px);
  perspective: 420px;
}
.hb-body {
  position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; align-items: center;
  gap: calc(3 * var(--u)); transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.35s var(--ease-out, ease-out);
  animation: hb-float 3.6s ease-in-out infinite;
}
.hb-layer {
  position: relative; display: block; width: calc(var(--w) * var(--u)); height: calc(16 * var(--u));
  border-radius: 999px; transform-style: preserve-3d;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), transparent 45%),
              linear-gradient(90deg, #ffb86b, #ff7a3d 55%, #ff5f7e);
  box-shadow: inset 0 -3px 4px rgba(150, 30, 10, 0.35);
  animation: hb-print 0.5s var(--ease-out, ease-out) backwards;
  animation-delay: calc((4 - var(--i)) * 0.08s);
}
.hb-layer:first-child { background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 50%), linear-gradient(90deg, #ffc98a, #ff8a4c); }
/* the thickness: the same layer twice behind, darker, so it turns like a solid thing */
.hb-layer::before, .hb-layer::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, #c4512a, #a8341f);
}
.hb-layer::before { transform: translateZ(-5px); }
.hb-layer::after { transform: translateZ(-10px); background: #7a2516; }
.hb-face {
  position: absolute; left: 50%; top: calc(38 * var(--u)); width: calc(44 * var(--u)); height: calc(36 * var(--u));
  transform: translate(-50%, 0) translateZ(3px) translate(var(--ex), var(--ey));
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; justify-items: center; row-gap: 3px;
  transition: transform 0.25s ease-out;
}
.hb-eye {
  width: calc(9 * var(--u)); height: calc(13 * var(--u)); border-radius: 50%; background: #2a1209;
  box-shadow: inset 2px 2px 0 -0.5px #fff;
  animation: hb-blink 4.2s infinite;
}
.hb-mouth {
  grid-column: 1 / -1; width: calc(14 * var(--u)); height: calc(7 * var(--u)); margin-top: 1px;
  border: 2.2px solid #2a1209; border-top: 0; border-radius: 0 0 999px 999px;
}
.hb-shadow {
  position: absolute; left: 50%; bottom: 0; width: 60%; height: 9px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.45), transparent);
  transform: translateX(-50%); animation: hb-shadow 3.6s ease-in-out infinite;
}
@keyframes hb-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
@keyframes hb-shadow { 0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; } 50% { transform: translateX(-50%) scale(0.78); opacity: 0.6; } }
@keyframes hb-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes hb-print { from { opacity: 0; transform: translateY(-8px) scaleX(0.6); } }

.hb-sm { --u: 0.4px; height: calc(98 * var(--u) + 4px); }
.hb-sm .hb-shadow { display: none; }
.hb-sm .hb-layer::after { transform: translateZ(-6px); }
.hb-sm .hb-mouth { border-width: 1.5px; }
.hb-happy .hb-body { animation: hb-hop 0.9s var(--ease-out, ease-out) 2; }
@keyframes hb-hop { 0%, 100% { translate: 0 0; } 40% { translate: 0 -12px; rotate: -6deg; } 70% { translate: 0 0; rotate: 4deg; } }

/* ---------- the button around it and the bubble ---------- */
.help-bot {
  display: grid; place-items: center; padding: 6px 6px 0; border: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 14px 18px rgba(255, 90, 40, 0.35));
  transition: transform 0.25s var(--ease-out, ease-out);
}
.help-bot:hover { transform: translateY(-3px) scale(1.06); }
.help-bot:active { transform: scale(0.94); }
.help-bot:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; border-radius: 20px; }
.help.open .hb-mouth { height: calc(9 * var(--u)); width: calc(10 * var(--u)); border-radius: 50%; border-top: 2.2px solid #2a1209; }

.help-bubble {
  position: relative; margin-right: 6px; padding: 10px 16px; border: 0; border-radius: 18px 18px 6px 18px;
  font: inherit; font-weight: 800; font-size: 14px; cursor: pointer; white-space: nowrap;
  background: var(--color-surface, #fff); color: var(--color-text);
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.55), inset 0 0 0 1px var(--color-border);
  opacity: 0; transform: translateY(8px) scale(0.9); transform-origin: 100% 100%; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s var(--ease-out, ease-out);
}
.help-bubble::after {
  content: ""; position: absolute; right: 18px; bottom: -6px; width: 12px; height: 12px; rotate: 45deg;
  background: inherit; box-shadow: 1px 1px 0 0 var(--color-border);
}
.help-bubble.show, .help.quiet:not(.open) .help-bot:hover ~ .help-bubble,
.help.quiet:not(.open):hover .help-bubble {
  opacity: 1; transform: none; pointer-events: auto;
}
.help-bubble.show { animation: hb-wiggle 0.6s 0.4s ease-in-out; }
@keyframes hb-wiggle { 30% { rotate: -4deg; } 60% { rotate: 3deg; } }
.help.open .help-bubble { display: none; }

/* ---------- the panel ---------- */
.help-panel {
  position: fixed; right: 22px; bottom: 112px; width: min(392px, calc(100vw - 24px));
  max-height: min(620px, calc(100vh - 140px)); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 26px; background:
    radial-gradient(120% 50% at 100% 0%, rgba(255, 138, 76, 0.16), transparent 60%), var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7), inset 0 0 0 1px var(--color-border);
  transform-origin: 100% 100%; animation: hp-in 0.35s var(--ease-out, ease-out);
}
.help-panel[hidden] { display: none; }
@keyframes hp-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
.hp-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 12px 20px; }
.hp-head strong { display: block; font-size: 16px; }
.hp-online { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--color-muted); }
.hp-online i { width: 7px; height: 7px; border-radius: 50%; background: var(--color-price, #3ddc84); box-shadow: 0 0 8px var(--color-price, #3ddc84); }
.hp-close {
  margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--pill-bg, rgba(255, 255, 255, 0.06)); color: var(--color-text); font-size: 22px; line-height: 1;
}
.hp-close:hover { background: var(--color-surface-2); }
.hp-tabs { display: flex; gap: 4px; margin: 0 16px; padding: 4px; border-radius: 999px; background: var(--color-surface-2); }
.hp-tabs button {
  flex: 1; padding: 8px 6px; border: 0; border-radius: 999px; background: none; color: var(--color-muted);
  font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; white-space: nowrap; transition: background-color 0.2s, color 0.2s;
}
.hp-tabs button[aria-selected="true"] { background: var(--color-cta); color: var(--color-cta-text); }
.hp-tabs button[hidden] { display: none; }
.hp-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 18px; scrollbar-width: thin; }

.hp-search, .hp-form input, .hp-form select, .hp-form textarea, .hp-reply textarea {
  width: 100%; box-sizing: border-box; padding: 11px 14px; border: 1.5px solid var(--color-border); border-radius: 14px;
  background: var(--color-surface-2); color: var(--color-text); font: inherit; font-size: 14px;
}
.hp-search { border-radius: 999px; padding-left: 16px; margin-bottom: 10px; }
.hp-form textarea, .hp-reply textarea { resize: vertical; min-height: 52px; }
.hp-search:focus, .hp-form :is(input, select, textarea):focus, .hp-reply textarea:focus { outline: none; border-color: var(--color-accent); }

.hp-faq { display: grid; gap: 6px; }
.hp-q { border-radius: 16px; background: var(--color-surface-2); transition: background-color 0.2s; }
.hp-q summary { display: grid; gap: 2px; padding: 11px 38px 11px 14px; cursor: pointer; list-style: none; position: relative; }
.hp-q summary::-webkit-details-marker { display: none; }
.hp-q summary::after {
  content: "+"; position: absolute; right: 14px; top: 50%; translate: 0 -50%; font-size: 18px; font-weight: 700;
  color: var(--color-muted); transition: rotate 0.25s;
}
.hp-q[open] summary::after { rotate: 45deg; color: var(--color-accent); }
.hp-q b { font-size: 14px; }
.hp-q-topic { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-accent); }
.hp-q p { margin: 0; padding: 0 14px 13px; font-size: 13.5px; line-height: 1.55; color: var(--color-muted); }
.hp-q[open] p { animation: hp-in 0.25s ease-out; }
.hp-empty { color: var(--color-muted); text-align: center; padding: 18px 8px; margin: 0; }
.hp-cta {
  width: 100%; margin-top: 12px; padding: 12px; border: 1.5px dashed var(--color-border-strong); border-radius: 16px;
  background: none; color: var(--color-text); font: inherit; font-weight: 800; font-size: 14px; cursor: pointer;
}
.hp-cta:hover { border-color: var(--color-accent); color: var(--color-accent); }

.hp-form { display: grid; gap: 10px; }
.hp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hp-field { display: grid; gap: 5px; margin: 0; }
.hp-field span { font-size: 12.5px; font-weight: 800; }
.hp-send { width: 100%; }
.hp-hint { margin: 0; font-size: 12.5px; color: var(--color-muted); text-align: center; }
.hp-error { margin: 0; color: var(--color-danger, #ff6b6b); font-size: 13px; font-weight: 700; }
.hp-error:empty { display: none; }

.hp-done { display: grid; justify-items: center; gap: 8px; padding: 26px 8px; text-align: center; }
.hp-done .hb { margin-bottom: 6px; }
.hp-done p { margin: 0 0 8px; color: var(--color-muted); }

.hp-tickets { display: grid; gap: 8px; }
.hp-ticket {
  display: grid; gap: 3px; padding: 12px 14px; border: 0; border-radius: 16px; background: var(--color-surface-2);
  color: var(--color-text); font: inherit; text-align: left; cursor: pointer; transition: transform 0.2s;
}
.hp-ticket:hover { transform: translateX(3px); }
.hp-t-last { font-size: 13px; color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-t-status { justify-self: start; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--pill-bg); color: var(--color-muted); }
.hp-t-status.answered { background: var(--color-ok-bg, rgba(61, 220, 132, 0.15)); color: var(--color-price, #3ddc84); }
.hp-back { border: 0; background: none; color: var(--color-muted); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; padding: 0 0 10px; }
.hp-thread { display: grid; gap: 8px; margin-bottom: 12px; }
.hp-msg { max-width: 86%; padding: 9px 13px; border-radius: 16px; background: var(--color-surface-2); }
.hp-msg.me { justify-self: end; border-bottom-right-radius: 5px; background: rgba(255, 138, 76, 0.16); }
.hp-msg.them { border-bottom-left-radius: 5px; }
.hp-msg-who { font-size: 11.5px; font-weight: 800; color: var(--color-accent); }
.hp-msg p { margin: 2px 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hp-msg time { font-size: 11px; color: var(--color-muted); }
.hp-reply { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.hp-reply .hp-error { grid-column: 1 / -1; }

/* the bell's pop-ups move up, above the character */
.nt-toasts { bottom: 128px; }

@media (max-width: 560px) {
  .help { right: 12px; bottom: 12px; }
  .hb:not(.hb-sm) { --u: 0.62px; }
  .help-panel { right: 8px; left: 8px; bottom: 96px; width: auto; max-height: calc(100vh - 120px); border-radius: 22px; }
  .hp-row { grid-template-columns: 1fr; }
  .nt-toasts { bottom: 104px; }
}
@media print { .help { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .hb-body, .hb-shadow, .hb-eye, .hb-layer, .help-bubble.show, .help-panel, .hb-happy .hb-body { animation: none !important; }
}

/* ---------- the admin cabinet: «Підтримка» (cabinet-app/src/AdminSupport.jsx) ---------- */
.sp-list { display: grid; gap: 14px; }
.sp-ticket { display: grid; gap: 12px; }
.sp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sp-head strong { display: block; }
.sp-head a { color: var(--color-accent); }
.sp-thread { display: grid; gap: 8px; max-height: 340px; overflow-y: auto; }
.sp-msg { max-width: 80%; padding: 10px 14px; border-radius: 16px; background: var(--color-surface-2); }
.sp-msg.us { justify-self: end; background: rgba(255, 138, 76, 0.16); border-bottom-right-radius: 5px; }
.sp-msg.them { border-bottom-left-radius: 5px; }
.sp-msg p { margin: 0 0 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-msg time { font-size: 12px; color: var(--color-muted); }
.sp-reply textarea {
  width: 100%; box-sizing: border-box; padding: 12px 16px; border: 1.5px solid var(--color-border); border-radius: 16px;
  background: var(--color-surface-2); color: var(--color-text); font: inherit; resize: vertical;
}
