/* Send a Virtual Hug. Mobile first; tokens only so dark mode works. The figure is driven by --p (0 apart, 1 hugging). */
.tool.hg { gap: 18px; scroll-margin-top: 88px; }
.tool.hg .tool-note, .tool.hg .tool-hint { color: rgb(var(--ink) / .7); }
.tool .hg-compose, .tool .hg-receive { display: flex; flex-direction: column; gap: 18px; }
.tool .hg-top { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 16px 18px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }

.tool .hg-stage { --p: 0; position: relative; width: 100%; max-width: 300px; aspect-ratio: 240 / 170; margin-bottom: 22px; }
.tool .hg-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tool .hg-glow { fill: rgb(var(--accent) / .14); transform-origin: 120px 96px; transform: scale(calc(.7 + var(--p) * .35)); opacity: var(--p); }
.tool .hg-body { fill: #C77DFF; }
.tool .hg-head { fill: #FFD6B8; }
.tool .hg-b .hg-body { fill: #F08BB4; }
.tool .hg-b .hg-head { fill: #F5C29E; }
.tool .hg-eye { fill: none; stroke: #4A2340; stroke-width: 2.4; stroke-linecap: round; }
.tool .hg-cheek { fill: #F59AB0; opacity: .7; }
.tool .hg-a { transform: translateX(calc(var(--p) * 8px)) rotate(calc(var(--p) * 5deg - 2deg)); transform-origin: 88px 170px; }
.tool .hg-b { transform: translateX(calc(var(--p) * -8px)) rotate(calc(var(--p) * -5deg + 2deg)); transform-origin: 152px 170px; }
.tool .hg-arm { fill: none; stroke-width: 15; stroke-linecap: round; stroke-dasharray: 80; stroke-dashoffset: calc(80px - var(--p) * 80px); }
.tool .hg-arm-a { stroke: #C77DFF; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .18)); }
.tool .hg-arm-b { stroke: #F08BB4; }
.tool .hg-heart { fill: #E0357F; transform-origin: 120px 40px; transform: translateY(calc(10px - var(--p) * 10px)) scale(calc(var(--p) * var(--p))); opacity: var(--p); }
.tool .hg-stage.is-live .hg-heart { animation: hg-beat .9s ease-in-out infinite; }
.tool .hg-stage:not(.is-live) .hg-a, .tool .hg-stage:not(.is-live) .hg-b, .tool .hg-stage:not(.is-live) .hg-arm, .tool .hg-stage:not(.is-live) .hg-heart, .tool .hg-stage:not(.is-live) .hg-glow {
  transition: transform .5s var(--ease-out), stroke-dashoffset .5s var(--ease-out), opacity .4s ease;
}
.tool .hg-secs { position: absolute; left: 0; right: 0; bottom: -28px; text-align: center; font-size: 22px !important; line-height: 28px !important; font-weight: 900 !important; color: rgb(var(--ink) / .8) !important; font-variant-numeric: tabular-nums; }
@keyframes hg-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.12); } }

.tool .hg-hold {
  position: relative; width: 100%; max-width: 360px; min-height: 64px; border-radius: 32px; overflow: hidden;
  background: var(--ramp); color: #fff; font-size: 18px; font-weight: 850; box-shadow: 0 10px 28px rgb(121 35 192 / .35);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  transition: transform .2s var(--ease-out), box-shadow .2s ease;
}
.tool .hg-hold.is-down { transform: scale(.97); box-shadow: 0 4px 14px rgb(121 35 192 / .3); }
.tool .hg-hold-ring { position: absolute; inset: 0; background: rgb(255 255 255 / .18); transform-origin: left; transform: scaleX(0); }
.tool .hg-hold.is-down .hg-hold-ring { animation: hg-fill 10s linear forwards; }
.tool .hg-stage.is-live .hg-svg { animation: hg-squeeze 1.8s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes hg-squeeze { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025, .985); } }
.tool .hg-hold-l { position: relative; }
@keyframes hg-fill { to { transform: scaleX(1); } }
.tool .hg-hint { font-size: 15px !important; line-height: 22px !important; text-align: center; color: rgb(var(--ink) / .75) !important; max-width: 340px; }
.tool .hg-result { font-size: 15px !important; font-weight: 800 !important; text-align: center; color: var(--link) !important; }

.tool .hg-block { display: flex; flex-direction: column; gap: 8px; }
.tool .hg-note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tool .hg-sample { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 20px; background: var(--surface-2); color: var(--link); font-size: 14px; font-weight: 800; }
.tool .hg-sample .tool-icon { width: 16px; height: 16px; }
.tool .hg-names { grid-template-columns: 1fr 1fr !important; gap: 10px; }
.tool .hg-send { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px; border-radius: 24px; background: var(--surface); }
.tool .hg-summary { font-size: 16px !important; font-weight: 800 !important; color: rgb(var(--ink)) !important; }
.tool .hg-imgbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tool .hg-imgbtn .tool-icon { width: 20px; height: 20px; }

.tool .hg-text { display: flex; flex-direction: column; gap: 8px; }
.tool .hg-text-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool .hg-text-grid button { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 0 12px 0 14px; border-radius: 16px; background: var(--surface); color: rgb(var(--ink)); font-size: 15px; font-weight: 700; }
.tool .hg-text-grid button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .hg-text-grid .tool-icon { width: 16px; height: 16px; flex: 0 0 auto; color: rgb(var(--ink) / .45); }
@media (min-width: 600px) { .tool .hg-text-grid { grid-template-columns: repeat(4, 1fr); } }

/* Receive */
.tool .hg-receive { align-items: center; text-align: center; padding: 22px 16px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.tool .hg-eyebrow { font-size: 13px !important; line-height: 18px !important; font-weight: 850 !important; letter-spacing: .04em; text-transform: uppercase; color: var(--link) !important; }
.tool .hg-r-title { font-size: 22px !important; line-height: 30px !important; text-wrap: balance; margin-top: -10px !important; }
.tool .hg-receive .tool-meter { width: 100%; max-width: 360px; }
.tool .hg-msg { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 22px; background: var(--surface-2); width: 100%; }
.tool .hg-msg.is-new { animation: card-in .5s var(--ease-out) both; }
.tool .hg-msg-t { font-size: 20px !important; line-height: 28px !important; font-weight: 800 !important; color: rgb(var(--ink)) !important; white-space: pre-wrap; overflow-wrap: anywhere; }
.tool .hg-msg-f { font-size: 15px !important; font-weight: 750 !important; color: var(--link) !important; }
.tool .hg-after { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.tool .hg-chain { font-size: 14px !important; font-weight: 800 !important; color: rgb(var(--ink) / .7) !important; }
.tool .hg-stage.is-done .hg-heart { animation: hg-beat 1.4s ease-in-out 2; }

@media (prefers-reduced-motion: reduce) {
  .tool .hg-stage *, .tool .hg-hold, .tool .hg-hold-ring { transition: none !important; animation: none !important; }
  .tool .hg-msg.is-new { animation: none; }
}

/* Round 2 */
.tool .hg-stage { margin-bottom: 30px; }
.tool .hg-secs { bottom: -34px; }
.tool .hg-steps { display: flex; justify-content: center; gap: 6px 16px; flex-wrap: wrap; }
.tool .hg-steps li { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: rgb(var(--ink) / .75); }
.tool .hg-steps b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 11px; background: rgb(var(--accent)); color: #fff; font-size: 12px; }
.tool .hg-jump { align-self: center; min-height: 40px; background: transparent; color: var(--link); font-size: 14px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; margin-top: -8px; }
.tool .hg-block .tool-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
.tool .hg-block .tool-chips::-webkit-scrollbar { display: none; }
.tool .hg-block .tool-chips button { flex: 0 0 auto; }
@media (min-width: 600px) { .tool .hg-block .tool-chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; } }
.tool .hg-words { grid-template-columns: 1fr !important; }
.tool .hg-words button span { white-space: normal; text-align: left; }
.tool .hg-badge { margin-left: 8px; padding: 2px 8px; border-radius: 10px; background: rgb(var(--accent)); color: #fff; letter-spacing: 0; }
.tool .hg-r-how { font-size: 15px !important; line-height: 22px !important; color: rgb(var(--ink) / .75) !important; max-width: 340px; margin-top: -8px !important; }
.tool .hg-after .hg-hold { align-self: center; }
@media (min-width: 600px) { .tool .hg-receive .tool-actions .btn { flex: 1; } }
.tool.hg .btn-secondary { color: rgb(var(--ink)); box-shadow: inset 0 0 0 1px rgb(var(--ink) / .14); }
.tool .hg-send .tool-note { font-size: 15px; line-height: 22px; }

/* Round 3 */
.tool .hg-rest { fill: none; stroke-width: 13; stroke-linecap: round; opacity: calc(1 - var(--p) * 1.6); }
.tool .hg-stage:not(.is-live):not(.is-done) .hg-svg { animation: hg-breathe 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes hg-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.012, 1.02); } }
.tool .hg-block .tool-chips { flex-wrap: wrap !important; overflow: visible !important; margin: 0 !important; padding: 0 !important; -webkit-mask-image: none !important; mask-image: none !important; }
.tool .hg-result:empty { display: none; }
.tool .hg-jump { margin-top: -10px; }
.tool .hg-words button { min-height: 52px; padding-top: 10px; padding-bottom: 10px; }
.tool .hg-text-grid .tool-icon { color: var(--link); width: 18px; height: 18px; }
.tool .hg-hist { font-size: 14px !important; font-weight: 750 !important; color: rgb(var(--ink) / .7) !important; font-variant-numeric: tabular-nums; }
.tool .hg-receive { padding-top: 26px; }
.tool .hg-after .tool-actions .btn { min-height: 48px; }

/* Round 4 */
.tool .hg-stage { max-width: 250px; }
.tool .hg-top { padding-top: 14px; gap: 10px; }
.tool.hg .tool-note, .tool.hg .tool-hint, .tool .hg-hint, .tool .hg-r-how, .tool .hg-hist, .tool .hg-chain { color: rgb(var(--ink) / .82) !important; }
.tool .hg-hold:focus-visible { outline: 3px solid rgb(var(--accent) / .6); outline-offset: 4px; }
.tool.hg .tool-chips button[aria-pressed="true"] { background: rgb(var(--accent)); color: #fff; }
.tool .hg-stage[data-kind="sleepy"] .hg-glow { fill: rgb(60 70 160 / .22); }
.tool .hg-stage[data-kind="well"] .hg-glow { fill: rgb(60 180 140 / .2); }
.tool .hg-stage[data-kind="bday"] .hg-glow, .tool .hg-stage[data-kind="yay"] .hg-glow { fill: rgb(240 180 40 / .25); }
.tool .hg-stage[data-kind="sorry"] .hg-glow, .tool .hg-stage[data-kind="hard"] .hg-glow { fill: rgb(90 150 230 / .2); }
.tool .hg-links { display: flex; justify-content: center; gap: 4px 18px; flex-wrap: wrap; }
.tool .hg-textlink { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 6px; background: transparent; color: var(--link); font-size: 15px; font-weight: 800; align-self: center; }
.tool .hg-textlink .tool-icon { width: 18px; height: 18px; }
.tool .hg-sendbar { position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 26px; background: rgb(var(--ink)); color: var(--surface); box-shadow: 0 12px 32px rgb(var(--ink) / .3); }
.tool .hg-sendbar span { font-size: 15px; font-weight: 800; color: var(--surface); }
.tool .hg-sendbar .btn { width: auto !important; min-height: 44px; padding: 0 22px; }
.tool .hg-text-grid button span { white-space: normal; text-align: left; }
.tool .hg-histbox { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tool .hg-bars { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.tool .hg-bar { width: 22px; border-radius: 8px 8px 4px 4px; background: #F08BB4; display: flex; align-items: flex-start; justify-content: center; }
.tool .hg-bar.is-you { background: #C77DFF; }
.tool .hg-bar small { font-size: 10px; font-weight: 900; color: #fff; margin-top: 3px; }
.tool .hg-eyebrow .hg-badge { margin: 0 8px 0 0; }

/* Round 5 */
.tool .hg-rest.hg-arm-a { stroke: #A95BE8; }
.tool .hg-rest.hg-arm-b { stroke: #E0709C; }
.tool .hg-hint, .tool.hg .tool-note { font-size: 16px !important; line-height: 24px !important; color: rgb(var(--ink) / .85) !important; }
.tool .hg-block .tool-chips { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tool .hg-block .tool-chips button { padding: 6px 8px; min-height: 48px; line-height: 18px; text-wrap: balance; }
.tool textarea { resize: none; }
.tool .hg-top[data-kind="sleepy"] { background: #1D1A4A; }
.tool .hg-top[data-kind="sleepy"] .hg-hint, .tool .hg-top[data-kind="sleepy"] .hg-result, .tool .hg-top[data-kind="sleepy"] .hg-secs { color: #E9E4FF !important; }
.tool .hg-receive .hg-hold:not(:disabled) { animation: hg-pulse 2.2s ease-in-out infinite; }
@keyframes hg-pulse { 0%, 100% { box-shadow: 0 10px 28px rgb(121 35 192 / .35), 0 0 0 0 rgb(167 60 255 / .35); } 50% { box-shadow: 0 10px 28px rgb(121 35 192 / .35), 0 0 0 10px rgb(167 60 255 / 0); } }
.tool .hg-bars { height: auto; align-items: flex-end; gap: 8px; }
.tool .hg-barcol { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tool .hg-bar { width: 34px; }
.tool .hg-bar small { font-size: 11px; margin-top: 5px; }
.tool .hg-who { font-size: 12px; font-weight: 900; color: rgb(var(--ink) / .75); }
.tool .hg-text-grid button span { font-size: 15px; }
.tool .hg-text-grid:not(.hg-words) button:nth-child(2), .tool .hg-text-grid:not(.hg-words) button:nth-child(8) { grid-column: 1 / -1; }
@media (prefers-reduced-motion: reduce) { .tool .hg-receive .hg-hold { animation: none !important; } }
