/* Shared parts for the u08 signals and texting tools (engine-u08-signals.js). Tokens only, so dark mode works. */

/* Segmented control with a sliding thumb */
.tool .u8-seg {
  position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 0; padding: 4px; border-radius: 16px;
  background: rgb(var(--ink) / .06); isolation: isolate;
}
.tool .u8-seg button {
  position: relative; z-index: 1; min-height: 40px; padding: 0 4px; border-radius: 12px; background: transparent;
  font-size: 14px; line-height: 18px; font-weight: 800; color: rgb(var(--ink) / .6); transition: color .2s ease, transform .16s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tool .u8-seg button[aria-checked="true"] { color: rgb(var(--ink)); }
.tool .u8-seg button:active { transform: scale(.96); }
.tool .u8-seg button:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: -2px; }
.tool .u8-seg.is-small button { min-height: 36px; font-size: 13px; }
.tool .u8-thumb {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n)); border-radius: 12px;
  background: var(--surface); box-shadow: 0 1px 2px rgb(var(--ink) / .1), 0 2px 8px rgb(var(--ink) / .08);
  transform: translateX(calc(var(--i, 0) * 100%)); opacity: 0; transition: transform .3s var(--ease-out), opacity .15s ease;
}
.tool .u8-seg.has-value .u8-thumb { opacity: 1; }

/* Ready-to-send texts */
.tool .u8-texts { display: grid; gap: 10px; }
.tool .u8-texts li { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 0; background: none; }
.tool .u8-texts.is-in li { animation: u8-in .4s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 60ms); }
.tool .u8-bubble {
  align-self: flex-end; max-width: 92%; padding: 10px 16px; border-radius: 20px 20px 6px 20px; background: var(--ramp, rgb(var(--accent)));
  color: #fff; font-size: 16px; line-height: 23px; font-weight: 650; text-wrap: pretty; user-select: text; -webkit-user-select: text;
}
.tool .u8-text-actions { display: flex; gap: 4px; }
.tool .u8-copy, .tool .u8-fav, .tool .u8-more, .tool .u8-ghost {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 20px; background: transparent;
  font-size: 14px; font-weight: 800; color: rgb(var(--ink) / .6); transition: background-color .15s ease, color .15s ease, transform .16s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tool .u8-copy .tool-icon, .tool .u8-fav .tool-icon, .tool .u8-more .tool-icon, .tool .u8-ghost .tool-icon { width: 18px; height: 18px; }
.tool .u8-fav { width: 40px; padding: 0; justify-content: center; }
.tool .u8-fav[aria-pressed="true"] { color: #C0237A; }
.tool .u8-fav[aria-pressed="true"] path { fill: currentColor; }
.tool .u8-copy.is-done { color: #1F9D62; }
.tool .u8-more { align-self: flex-start; color: var(--link); }
.tool .u8-texts-wrap { display: flex; flex-direction: column; gap: 8px; }
@media (hover: hover) {
  .tool .u8-copy:hover, .tool .u8-fav:hover, .tool .u8-more:hover, .tool .u8-ghost:hover { background: rgb(var(--ink) / .06); }
}
.tool .u8-copy:active, .tool .u8-fav:active, .tool .u8-more:active, .tool .u8-ghost:active { transform: scale(.96); }

/* Gauge */
.tool .u8-gauge { display: block; width: 100%; max-width: 220px; height: auto; margin: 0 auto; overflow: visible; }
.tool .u8-gauge path { fill: none; stroke-width: 12; stroke-linecap: round; }
.tool .u8-gauge-bg { stroke: rgb(var(--ink) / .08); }
.tool .u8-gauge-fg { stroke: rgb(var(--accent)); transition: stroke-dashoffset 1s var(--ease-out); }
.tool .u8-gauge-fg.is-good { stroke: #1F9D62; }
.tool .u8-gauge-fg.is-mid { stroke: #D98A00; }
.tool .u8-gauge-fg.is-low { stroke: #D0335E; }

/* Result card and small parts */
.tool .u8-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.tool .u8-card.is-new { animation: u8-in .45s var(--ease-out) both; }
.tool .u8-eyebrow { font-size: 13px; line-height: 18px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; color: var(--link); }
.tool .u8-h { font-size: 17px; line-height: 24px; font-weight: 900; color: rgb(var(--ink)); }
.tool .u8-honest { padding: 12px 14px; border-radius: 16px; background: rgb(var(--accent) / .08); font-size: 15px; line-height: 22px; font-weight: 650; color: rgb(var(--ink) / .8); }
.tool .u8-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tool .u8-hist { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.tool .u8-hist li { flex: none; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px rgb(var(--ink) / .06); font-size: 13px; line-height: 18px; font-weight: 700; color: rgb(var(--ink) / .55); }
.tool .u8-hist li b { font-size: 14px; color: rgb(var(--ink)); font-weight: 850; }

@keyframes u8-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .tool .u8-thumb, .tool .u8-gauge-fg { transition: none; }
  .tool .u8-texts.is-in li, .tool .u8-card.is-new { animation: none; }
}
@media (prefers-color-scheme: dark) {
  .tool .u8-fav[aria-pressed="true"] { color: #FF7AB8; }
  .tool .u8-copy.is-done { color: #5BD69A; }
  .tool .u8-gauge-fg.is-good { stroke: #5BD69A; }
  .tool .u8-gauge-fg.is-mid { stroke: #F2B13A; }
  .tool .u8-gauge-fg.is-low { stroke: #FF6F93; }
}
.tool .u8-fav { width: auto; padding: 0 12px; }
.tool .u8-saved { display: grid; gap: 6px; }
.tool .u8-saved li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--surface); font-size: 15px; line-height: 21px; font-weight: 650; }
.tool .u8-saved-btn { color: #C0237A; }
.tool .u8-short { display: none; }
@media (max-width: 420px) { .tool .u8-seg .u8-long { display: none; } .tool .u8-seg .u8-short { display: inline; } }
.tool .u8-thumb { transition: transform .18s var(--ease-out), opacity .12s ease; }
@media (prefers-color-scheme: dark) {
  .tool .u8-card { background: var(--surface-2); box-shadow: 0 8px 32px rgb(0 0 0 / .35), inset 0 0 0 1px rgb(255 255 255 / .08); }
  .tool .u8-saved-btn { color: #FF7AB8; }
}
.tool a.u8-copy { text-decoration: none; color: rgb(var(--ink) / .6); }
.tool .u8-gauge-n { font-size: 22px; font-weight: 900; fill: rgb(var(--ink)); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) {
  .tool .u8-gauge-bg { stroke: rgb(var(--ink) / .16); }
  .tool .btn-secondary { box-shadow: inset 0 0 0 1.5px rgb(var(--ink) / .3); }
}
