/* Fun calculators unit engine (engine-u06-fun-calculators.js): score ring, meters, icon buttons, element marks. Tokens only. */
.tool .fun-ring { position: relative; width: 148px; height: 148px; flex: none; }
.tool .fun-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tool .fun-ring-bg { fill: none; stroke: rgb(var(--ink) / .08); stroke-width: 10; }
.tool .fun-ring-arc { fill: none; stroke: rgb(var(--accent)); stroke-width: 10; stroke-linecap: round; }
.tool .fun-ring-mid { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 46px; color: rgb(var(--ink)); }
.tool .fun-ring-num { font-size: 48px; line-height: 52px; font-weight: 950; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.tool .fun-ring-pct { font-size: 22px; font-weight: 900; color: rgb(var(--ink) / .5); margin-left: 1px; }

.tool .fun-meters { display: grid; gap: 14px; }
.tool .fun-meter-row { display: grid; gap: 6px; }
.tool .fun-meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tool .fun-meter-label { font-size: 15px; line-height: 20px; font-weight: 850; color: rgb(var(--ink)); }
.tool .fun-meter-val { font-size: 15px; line-height: 20px; font-weight: 850; color: rgb(var(--ink) / .6); font-variant-numeric: tabular-nums; }
.tool .fun-meter-text { font-size: 14px; line-height: 20px; font-weight: 600; color: rgb(var(--ink) / .6); }
.tool .fun-meters .tool-meter { height: 10px; }
.tool .fun-meters .tool-meter > span { transition: width .9s var(--ease-out); }

.tool .fun-icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; padding: 0;
  background: var(--surface); color: rgb(var(--ink) / .7); box-shadow: inset 0 0 0 1px rgb(var(--ink) / .08);
  transition: transform .16s var(--ease-out), background-color .2s ease; touch-action: manipulation;
}
.tool .fun-icon-btn:active { transform: scale(.96); }
.tool .fun-icon-btn .tool-icon { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) { .tool .fun-icon-btn:hover { background: var(--surface-2); } }
.tool .fun-el { flex: none; }
.tool .fun-el-fire { color: #E0533D; } .tool .fun-el-earth { color: #3E9B5F; } .tool .fun-el-air { color: #3A86D6; } .tool .fun-el-water { color: #7B5CE0; }
@media (prefers-color-scheme: dark) {
  .tool .fun-el-fire { color: #FF8A73; } .tool .fun-el-earth { color: #6FD394; } .tool .fun-el-air { color: #7DB8FF; } .tool .fun-el-water { color: #B4A0FF; }
}
.tool button, .tool a { -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: reduce) { .tool .fun-meters .tool-meter > span { transition: none; } }

/* Share image preview (dialog lives on body, outside .tool) */
.fun-dialog { position: fixed; inset: 0; margin: auto; height: fit-content; border: 0; padding: 0; border-radius: 28px; background: var(--surface); color: rgb(var(--ink)); box-shadow: 0 24px 80px rgb(0 0 0 / .35); width: min(92vw, 400px); max-height: 92dvh; }
.fun-dialog::backdrop { background: rgb(18 6 31 / .55); }
.fun-dialog[open] { animation: fun-dlg-in .25s cubic-bezier(.23, 1, .32, 1) both; }
@keyframes fun-dlg-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.fun-dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.fun-dialog-img { width: 100%; height: auto; max-height: 60dvh; object-fit: contain; border-radius: 18px; outline: 1px solid rgb(0 0 0 / .1); }
.fun-dialog-note { margin: 0; font-size: 15px; line-height: 22px; font-weight: 650; color: rgb(var(--ink) / .65); text-align: center; }
.fun-dialog-actions { display: grid; gap: 10px; }
.fun-dialog-actions .btn { width: 100%; }
@media (prefers-reduced-motion: reduce) { .fun-dialog[open] { animation: none; } }
@media (min-width: 1100px) { .tool[data-tool="zodiac-compatibility-calculator"], .tool[data-tool="love-calculator"] { margin-left: -120px; margin-right: -120px; } }
.fun-dialog-fmt { display: flex; gap: 8px; justify-content: center; }
.fun-dialog-fmt button { min-height: 36px; padding: 0 14px; border-radius: 18px; font-size: 14px; font-weight: 800; background: var(--surface-2); color: rgb(var(--ink) / .7); }
.fun-dialog-fmt button[aria-pressed="true"] { background: rgb(var(--ink)); color: var(--surface); }
.fun-dialog-img { aspect-ratio: auto; background: rgb(var(--accent) / .1); min-height: 200px; }

/* Result hero (k.fun.hero): a gradient card made to be screenshotted, the same in light and dark. */
.tool .fun-hero {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 20px 16px; border-radius: 28px; text-align: center; overflow: hidden;
  background: linear-gradient(160deg, #C27BFF 0%, #A73CFF 42%, #6A1BB0 100%); color: #fff; box-shadow: 0 16px 48px rgb(121 35 192 / .35);
}
.tool .fun-hero::before { content: ''; position: absolute; inset: -40% -20% auto auto; width: 70%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, rgb(255 255 255 / .22), transparent); pointer-events: none; }
.tool .fun-hero-marks { display: flex; align-items: center; gap: 6px; }
.tool .fun-hero-mark { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .2); box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .35); font-size: 24px; font-weight: 950; color: #fff; }
.tool .fun-hero-mark .fun-glyph { width: 28px; height: 28px; color: #fff; }
.tool .fun-hero-heart { color: #fff; display: grid; }
.tool .fun-hero-heart .tool-icon { width: 22px; height: 22px; fill: currentColor; }
.tool .fun-hero-names { font-size: 15px; line-height: 20px; font-weight: 850; color: rgb(255 255 255 / .85); overflow-wrap: anywhere; margin-top: 2px; }
.tool .fun-hero .fun-ring { width: 148px; height: 148px; margin: 4px 0; }
.tool .fun-hero .fun-ring-bg { stroke: rgb(255 255 255 / .22); }
.tool .fun-hero .fun-ring-arc { stroke: #fff; }
.tool .fun-hero .fun-ring-mid { color: #fff; }
.tool .fun-hero .fun-ring-pct { color: rgb(255 255 255 / .7); }
.tool .fun-hero-title { font-size: 28px; line-height: 32px; font-weight: 950; letter-spacing: -.02em; color: #fff; outline: 0; text-wrap: balance; }
.tool .fun-hero-line { font-size: 16px; line-height: 23px; font-weight: 650; color: rgb(255 255 255 / .88); max-width: 34ch; text-wrap: pretty; }
.tool .fun-hero-bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; width: 100%; margin-top: 10px; text-align: left; }
.tool .fun-hero-bars:empty { display: none; }
.tool .fun-hero-bar { display: grid; gap: 4px; min-width: 0; }
.tool .fun-hero-bar-top { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; line-height: 16px; font-weight: 800; color: rgb(255 255 255 / .85); }
.tool .fun-hero-bar-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .fun-hero-bar-top b { font-weight: 950; color: #fff; font-variant-numeric: tabular-nums; }
.tool .fun-hero-track { display: block; height: 6px; border-radius: 3px; background: rgb(255 255 255 / .22); overflow: hidden; }
.tool .fun-hero-track span { display: block; height: 100%; border-radius: 3px; background: #fff; transition: width .9s cubic-bezier(.16, 1, .3, 1); }
.tool .fun-hero-note { font-size: 12px; line-height: 16px; font-weight: 700; color: rgb(255 255 255 / .7); margin-top: 6px; }
.tool .fun-hero-foot { font-size: 12px; line-height: 16px; font-weight: 800; letter-spacing: .02em; color: rgb(255 255 255 / .7); margin-top: 6px; }
/* Reveal: marks slide in from the sides, then the rest fades up in order. */
.tool .fun-hero.is-play .fun-hero-mark { transition: transform .6s cubic-bezier(.23, 1, .32, 1), opacity .4s ease; }
.tool .fun-hero.is-play .fun-hero-mark:first-child { transform: translateX(-36px); opacity: 0; }
.tool .fun-hero.is-play .fun-hero-mark:last-child { transform: translateX(36px); opacity: 0; }
.tool .fun-hero.is-play.is-in .fun-hero-mark { transform: none; opacity: 1; }
.tool .fun-hero.is-play .fun-hero-heart { animation: fun-heart .5s cubic-bezier(.34, 1.56, .64, 1) .45s both; }
@keyframes fun-heart { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tool .fun-hero.is-play .fun-hero-title, .tool .fun-hero.is-play .fun-hero-line, .tool .fun-hero.is-play .fun-hero-bars { opacity: 0; transform: translateY(6px); transition: opacity .4s ease, transform .5s cubic-bezier(.23, 1, .32, 1); }
.tool .fun-hero.is-play.is-in .fun-hero-title { opacity: 1; transform: none; transition-delay: 1.05s; }
.tool .fun-hero.is-play.is-in .fun-hero-line { opacity: 1; transform: none; transition-delay: 1.15s; }
.tool .fun-hero.is-play.is-in .fun-hero-bars { opacity: 1; transform: none; transition-delay: .5s; }
@media (max-width: 599px) { .tool .fun-hero-title { font-size: 25px; line-height: 29px; } .tool .fun-hero .fun-ring { width: 136px; height: 136px; } .tool .fun-hero .fun-ring-mid { padding-top: 42px; } .tool .fun-hero .fun-ring-num { font-size: 44px; } }
@media (prefers-reduced-motion: reduce) { .tool .fun-hero * { transition: none !important; animation: none !important; } }
/* Secondary buttons get a visible edge on the tools of this unit. */
.tool .fun-actions .btn-secondary { box-shadow: inset 0 0 0 1.5px rgb(var(--ink) / .14); }
/* Teaser lines while the score counts up; contrast tweaks on the card. */
.tool .fun-hero.is-play.is-teasing .fun-hero-title { opacity: .75; transform: none; transition: none; font-size: 18px; line-height: 32px; font-weight: 800; }
.tool .fun-hero-track { height: 7px; background: rgb(255 255 255 / .3); }
.tool .fun-hero-bar-top { font-size: 13.5px; color: #fff; }
.tool .fun-hero .fun-ring-pct { color: #fff; font-weight: 950; }
.tool .fun-hero-note { font-size: 13px; line-height: 18px; color: rgb(255 255 255 / .85); max-width: 36ch; }
.tool .fun-hero-foot { font-size: 12px; white-space: nowrap; }
/* Reveal v2: keyframes (fill both) so the start state holds even when the card was just unhidden. */
.tool .fun-hero.is-play .fun-hero-mark, .tool .fun-hero.is-play .fun-hero-title, .tool .fun-hero.is-play .fun-hero-line, .tool .fun-hero.is-play .fun-hero-bars { transition: none; opacity: 1; transform: none; }
.tool .fun-hero.is-play .fun-hero-mark:first-child { animation: fun-in-l .6s cubic-bezier(.23, 1, .32, 1) both; }
.tool .fun-hero.is-play .fun-hero-mark:last-child { animation: fun-in-r .6s cubic-bezier(.23, 1, .32, 1) both; }
.tool .fun-hero.is-play .fun-hero-bars { animation: fun-up .45s cubic-bezier(.23, 1, .32, 1) .5s both; }
.tool .fun-hero.is-play .fun-hero-title { animation: fun-up .45s cubic-bezier(.23, 1, .32, 1) 1.05s both; }
.tool .fun-hero.is-play .fun-hero-line { animation: fun-up .45s cubic-bezier(.23, 1, .32, 1) 1.15s both; }
.tool .fun-hero.is-play.is-teasing .fun-hero-title { animation: none; opacity: .75; }
@keyframes fun-in-l { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
@keyframes fun-in-r { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes fun-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* Round 5: bars show their empty tracks from the start; the ring pulses when the count lands; low scores wobble. */
.tool .fun-hero.is-play .fun-hero-bars { animation: none; }
.tool .fun-hero.is-play .fun-ring { animation: fun-land .5s cubic-bezier(.34, 1.56, .64, 1) 1.25s both; }
.tool .fun-hero.is-play.is-low .fun-ring { animation: fun-wobble .6s ease-in-out 1.25s both; }
@keyframes fun-land { 0% { transform: scale(1); filter: none; } 40% { transform: scale(1.06); filter: drop-shadow(0 0 14px rgb(255 255 255 / .6)); } 100% { transform: scale(1); filter: none; } }
@keyframes fun-wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 50% { transform: rotate(4deg); } 75% { transform: rotate(-2deg); } }
.fun-dialog-img { width: auto; max-width: 100%; align-self: center; background: none; min-height: 0; }
