/* ==========================================================================
   FomoFantasy: trade helper page (th-)
   Builds on fomo.css tokens and components. The hero shell (.tool-hero,
   .hero-copy, .bm-install, .bm-note), the feature cards (.feature) and the
   cta band are shared and live in fomo.css. Sections:
   1 hero · 2 preview panel (the page's one orchestrated moment)
   3 features · 4 hotkeys · 5 keyframes · 6 reduced motion
   ========================================================================== */

/* 1. hero ------------------------------------------------------------------- */
.th-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(48px, 7vw, 80px);
  align-items: start;
}

.th-facts {
  display: flex;
  flex-wrap: wrap;
  row-gap: 10px;
  width: 100%;
  max-width: 520px;
  margin: 8px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line-soft);
}

.th-facts__item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding-inline: 18px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-14);
  line-height: 1.3;
  white-space: nowrap;
}

.th-facts__item:first-child {
  padding-left: 0;
  border-left: 0;
}

.th-facts__value {
  color: var(--text-head);
  font-size: 15px;
  font-weight: 500;
}

.th-facts__label {
  white-space: nowrap;
}

/* phones: three tidy columns, value over label, so nothing wraps mid-row */
@media (max-width: 519.98px) {
  .th-facts {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: start;
  }

  .th-facts__item {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding-inline: 16px;
  }
}

@media (max-width: 359.98px) {
  .th-facts__item {
    padding-inline: 10px;
    font-size: var(--fs-12);
  }
}

@media (min-width: 960px) {
  .th-hero__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
    gap: clamp(40px, 5vw, 72px);
  }

  .th-hero__copy {
    padding-top: clamp(24px, 5vw, 64px);
  }
}

/* the copy rides along while the (taller) panel scrolls past */
@media (min-width: 960px) and (min-height: 760px) {
  .th-hero__copy {
    position: sticky;
    top: calc(var(--nav-h) + 40px);
  }
}

/* 2. preview panel ----------------------------------------------------------- */
.th-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  min-width: 0;
}

/* glow behind the panel; horizontal inset stays at 0 so it never widens the
   page on phones (the blur spreads it visually without adding layout overflow) */
.th-stage::before {
  content: "";
  position: absolute;
  inset: 4% 0 30%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 36%, transparent), transparent);
  filter: blur(28px);
  pointer-events: none;
}

@media (min-width: 960px) {
  .th-stage {
    justify-items: end;
  }
}

/* wrapper: scroll/entrance reveal + the rubber-band drag live here so they
   never fight the panel's own backdrop blur */
.th-float {
  --reveal-delay: 420ms;
  width: 100%;
  max-width: 400px;
  transition: transform 700ms cubic-bezier(.34, 1.45, .64, 1);
}

.th-float.is-dragging {
  transition: none;
}

html.js .th-float[data-reveal].is-revealed {
  animation-name: th-panel-in;
  animation-duration: 1000ms;
  animation-timing-function: var(--ease-out);
}

.th-panel {
  --th-pad: 16px;
  --th-row: 34px;
  position: relative;
  isolation: isolate;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  background: var(--surface);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface-2) 86%, transparent),
      color-mix(in srgb, var(--inset) 90%, transparent));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  box-shadow:
    var(--inner-hi),
    var(--shadow-lg),
    0 40px 110px -44px color-mix(in srgb, var(--primary) 75%, transparent);
  font-size: var(--fs-14);
  line-height: 1.45;
}

/* light catching the glass edge: brighter at the top, a hint of blue at the base */
.th-panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 1;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--lavender) 38%, transparent),
    transparent 22%,
    transparent 78%,
    color-mix(in srgb, var(--primary-2) 30%, transparent));
  /* mask colours only need to be opaque; the token keeps literal colours out */
  -webkit-mask: linear-gradient(var(--bg) 0 0) content-box, linear-gradient(var(--bg) 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(var(--bg) 0 0) content-box exclude, linear-gradient(var(--bg) 0 0);
  pointer-events: none;
}

.th-panel p {
  margin: 0;
}

/* title bar (drag handle) */
.th-panel__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 50px;
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--text) 5%, transparent), transparent);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color var(--dur-ui) var(--ease-out), border-radius var(--dur-ui) var(--ease-out);
}

.th-float.is-dragging .th-panel__bar {
  cursor: grabbing;
}

.th-panel__grip {
  width: 8px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted-2);
  opacity: .55;
}

.th-panel__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-head);
  font-size: var(--fs-14);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.th-panel__title::before {
  content: "";
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary-2);
  box-shadow: 0 0 10px var(--primary);
}

.th-panel__chip {
  margin-left: auto;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.th-panel__min {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  transition:
    background-color var(--dur-hover) var(--ease-out),
    border-color var(--dur-hover) var(--ease-out),
    color var(--dur-hover) var(--ease-out);
}

.th-panel__min:hover {
  border-color: var(--line);
  background: var(--glass);
  color: var(--text-head);
}

.th-min-icon {
  position: relative;
  width: 12px;
  height: 12px;
}

.th-min-icon::before,
.th-min-icon::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1.6px;
  margin-top: -.8px;
  border-radius: 1px;
  background: currentColor;
  transition: transform var(--dur-ui) var(--ease-out);
}

.th-min-icon::after {
  transform: rotate(90deg) scaleX(0);
}

.th-panel.is-min .th-min-icon::before {
  transform: rotate(180deg);
}

.th-panel.is-min .th-min-icon::after {
  transform: rotate(90deg) scaleX(1);
}

/* collapsible body */
.th-panel__body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 440ms var(--ease-in-out);
}

.th-panel__inner {
  min-height: 0;
  min-width: 0;
  transition: opacity 320ms var(--ease-out);
}

.th-panel.is-min .th-panel__body {
  grid-template-rows: 0fr;
}

.th-panel.is-min .th-panel__inner {
  opacity: 0;
}

.th-panel.is-min .th-panel__inner,
.th-panel.is-toggling .th-panel__inner {
  overflow: hidden;
}

.th-panel.is-min .th-panel__bar {
  border-bottom-color: transparent;
  border-radius: var(--r-2xl);
}

/* shared panel bits */
.th-sec {
  padding: 14px var(--th-pad);
  border-top: 1px solid var(--line-soft);
}

.th-kicker,
.th-panel .label {
  color: var(--lavender);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.th-kicker {
  margin-bottom: 6px;
}

.th-panel .label__hint {
  font-size: 11px;
}

.th-dot {
  color: var(--muted-2);
}

/* a. token header */
.th-token {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px var(--th-pad) 4px;
}

/* --h matches Fomo.avatarHue("$GLORP"), so the avatar looks the same before JS runs */
.th-token__avatar {
  --size: 40px;
  --h: 63;
}

.th-token__id {
  display: grid;
  justify-items: start;
  gap: 3px;
  min-width: 0;
}

.th-token__names {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.th-token__ticker {
  color: var(--text-head);
  font-size: var(--fs-16);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.th-token__name {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 13px;
  text-overflow: ellipsis;
}

.th-ca {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 24px;
  margin-left: -7px;
  padding: 0 7px;
  border-radius: var(--r-xs);
  color: var(--muted);
  font-size: var(--fs-12);
  transition: background-color var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out);
}

.th-ca:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text-head);
}

.th-ca svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.th-ca__done {
  display: none;
  color: var(--green);
}

.th-ca.is-copied {
  color: var(--green);
}

.th-ca.is-copied .th-ca__copy {
  display: none;
}

.th-ca.is-copied .th-ca__done {
  display: block;
}

.th-token__mcap {
  display: grid;
  justify-items: end;
  gap: 3px;
  text-align: right;
}

.th-token__label {
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1;
}

.th-token__value {
  color: var(--text-head);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.th-chg {
  gap: 5px;
  transition: background-color var(--dur-ui) var(--ease-out), border-color var(--dur-ui) var(--ease-out), color var(--dur-ui) var(--ease-out);
}

.th-chg__tf {
  opacity: .7;
}

/* b. live chart */
.th-chart {
  --th-c: var(--green);
  position: relative;
  height: 136px;
  margin-top: 8px;
}

.th-chart.is-down {
  --th-c: var(--red);
}

.th-chart__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* the line draws itself in, left to right (JS adds .is-drawn) */
html.js .th-chart__svg {
  clip-path: inset(-16px 100% -16px 0);
  transition: clip-path 1250ms var(--ease-in-out);
}

html.js .th-chart.is-drawn .th-chart__svg {
  clip-path: inset(-16px -16px -16px -16px);
}

.th-chart__plot,
.th-chart__marks {
  pointer-events: none;
}

.th-chart__grid line {
  stroke: var(--line-soft);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.th-chart__stop {
  stop-color: var(--th-c);
  transition: stop-color 500ms var(--ease-out);
}

.th-chart__stop--top {
  stop-opacity: .3;
}

.th-chart__stop--bottom {
  stop-opacity: 0;
}

.th-chart__area {
  fill: url(#th-chart-fill);
  stroke: none;
}

.th-chart__line,
.th-chart__glow {
  fill: none;
  stroke: var(--th-c);
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  transition: stroke 500ms var(--ease-out);
}

.th-chart__line {
  stroke-width: 1.75;
}

.th-chart__glow {
  stroke-width: 7;
  opacity: .14;
}

.th-chart__level {
  stroke-width: 1;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
  transition: opacity var(--dur-ui) var(--ease-out);
}

.th-chart__level--tp {
  stroke: var(--green);
}

.th-chart__level--sl {
  stroke: var(--red);
}

.th-chart__level.is-pinned {
  opacity: .38;
}

.th-chart__dot {
  fill: var(--th-c);
  stroke: var(--bg);
  stroke-width: 1.5;
  transition: fill 500ms var(--ease-out);
}

.th-chart__halo {
  fill: var(--th-c);
  opacity: .5;
  transform-box: fill-box;
  transform-origin: center;
  animation: th-ping 1.9s var(--ease-out) infinite;
  transition: fill 500ms var(--ease-out);
}

.th-chart__mark {
  stroke: var(--bg);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: th-mark-in 520ms cubic-bezier(.34, 1.56, .64, 1) both;
}

.th-chart__mark--buy {
  fill: var(--green);
}

.th-chart__mark--sell {
  fill: var(--red);
}

.th-chart__tag {
  position: absolute;
  top: 0;
  left: var(--th-pad);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 18px;
  padding: 0 6px;
  border: 1px solid;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  will-change: transform;
  transition: opacity 500ms var(--ease-out);
}

.th-chart__tag b {
  font-weight: 500;
  letter-spacing: .02em;
}

.th-chart__tag-v {
  color: var(--text-head);
}

.th-chart__tag-dir:empty {
  display: none;
}

.th-chart__tag--tp {
  border-color: color-mix(in srgb, var(--green) 38%, transparent);
  background: var(--inset);
  background: color-mix(in srgb, var(--green) 14%, var(--inset));
  color: var(--green);
}

.th-chart__tag--sl {
  border-color: color-mix(in srgb, var(--red) 38%, transparent);
  background: var(--inset);
  background: color-mix(in srgb, var(--red) 14%, var(--inset));
  color: var(--red);
}

html:not(.js) .th-chart__tag,
html:not(.js) .th-chart__level,
html.js .th-chart:not(.is-drawn) .th-chart__tag {
  opacity: 0;
}

html.js .th-chart.is-drawn .th-chart__tag {
  transition-delay: 900ms;
}

/* c. position */
.th-pos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  margin-top: 12px;
}

.th-pos__main,
.th-pos__pnl {
  min-width: 0;
}

.th-pos__size {
  color: var(--text-head);
  font-size: var(--fs-14);
}

.th-pos__entry {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-12);
}

.th-pos__pnl {
  text-align: right;
}

.th-pos__usd {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.th-pos__pct {
  margin-top: 3px;
  font-size: var(--fs-12);
}

/* d + e. quick buy / quick sell */
.th-trade {
  display: grid;
  gap: 16px;
}

.th-trade .field {
  gap: 8px;
}

.th-panel .presets {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.th-panel .preset {
  height: 34px;
  font-size: 13px;
}

.th-buy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.th-buy .input-group {
  height: 40px;
}

.th-buy__btn {
  --btn-h: 40px;
  min-width: 124px;
  padding-inline: 16px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.th-buy__btn svg {
  width: 16px;
  height: 16px;
}

.th-sell {
  display: grid;
  gap: 8px;
}

.th-sell__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.th-sell__btn {
  --btn-h: 34px;
  min-width: 0;
  padding-inline: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
}

/* success pulses after a (simulated) action */
.th-buy__btn.is-hit {
  animation: th-hit-green 700ms var(--ease-out);
}

.th-sell__btn.is-hit {
  animation: th-hit-red 700ms var(--ease-out);
}

.th-panel .preset.is-hit {
  animation: th-hit-primary 600ms var(--ease-out);
}

/* f. exit targets */
.th-exits {
  display: grid;
  gap: 14px;
}

.th-exits__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 14px 20px;
}

.th-target {
  display: grid;
  gap: 6px;
  min-width: 0;
}

/* track fill for the default values before fomo.js syncs it (it writes an inline --fill) */
#th-tp {
  --fill: 27.27%; /* index 15 of 0-55 = +100% */
}

#th-sl {
  --fill: 25%; /* 30 of 10-90 */
}

.th-target__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.th-target__val {
  font-size: 13px;
  font-weight: 500;
}

.th-target__at {
  color: var(--muted);
  font-size: var(--fs-12);
  line-height: 1.4;
}

.th-target__at .num {
  color: var(--text-head);
}

.th-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}

.th-trail .switch {
  font-size: 13px;
}

.th-trail__hint {
  color: var(--muted-2);
  font-size: var(--fs-12);
}

/* g. slippage */
.th-slip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding-block: 12px;
}

.th-slip .seg__option {
  min-width: 42px;
  font-family: var(--font-mono);
  font-weight: 500;
}

/* h. recent */
.th-recent {
  padding-bottom: 12px;
}

.th-log {
  display: block;
  max-height: calc(var(--th-row) * 4);
  margin: 0;
  overflow: hidden;
}

.th-log__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  height: var(--th-row);
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
}

.th-log__row:first-child {
  border-top-color: transparent;
}

.th-log__time {
  color: var(--muted-2);
  font-size: var(--fs-12);
}

.th-log__act {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.th-log__mcap {
  color: var(--muted);
  font-size: var(--fs-12);
}

.th-log__row.is-new {
  animation: th-row-in 460ms var(--ease-out) both;
}

.th-log__row.is-out {
  animation: th-row-out 340ms var(--ease-out) forwards;
}

@media (max-width: 379.98px) {
  .th-panel {
    --th-pad: 14px;
  }

  .th-panel__grip {
    display: none;
  }

  .th-buy__btn {
    min-width: 108px;
    padding-inline: 12px;
  }
}

/* 3. features ------------------------------------------------------------- */
/* the card shell is the shared .feature; this is the chip row at its foot */
.th-feature__spec {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 14px;
}

.th-feature__spec--pnl {
  gap: 10px;
}

.th-feature__spec--pnl > .num {
  font-size: var(--fs-18);
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* 4. hotkeys ------------------------------------------------------------- */
.th-hotkeys__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(8px, 2vw, 16px);
  align-items: center;
}

@media (min-width: 1024px) {
  .th-hotkeys__grid {
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: clamp(40px, 5vw, 72px);
  }

  .th-hotkeys__head {
    margin-bottom: 0;
  }
}

.th-keys-card {
  padding: 10px;
}

.th-keys {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  margin: 0;
}

@media (min-width: 720px) {
  .th-keys {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
  }
}

.th-key {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
  text-align: left;
  transition:
    background-color 700ms var(--ease-out),
    box-shadow 700ms var(--ease-out),
    color var(--dur-hover) var(--ease-out);
}

.th-key:hover {
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--text);
  transition-duration: var(--dur-hover);
}

.th-key:focus-visible {
  outline-offset: 0;
}

/* keys hug the description: right-aligned in a fixed column so rows line up */
.th-key__caps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.th-key .kbd {
  justify-content: center;
  min-width: 26px;
  min-height: 28px;
  padding: 2px 7px;
  font-size: 13px;
  transition:
    background-color 700ms var(--ease-out),
    border-color 700ms var(--ease-out),
    color 700ms var(--ease-out),
    translate 160ms var(--ease-out),
    box-shadow 700ms var(--ease-out);
}

.th-key__plus {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
}

.th-key__desc {
  min-width: 0;
}

.th-key.is-hit {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary-2) 45%, transparent);
  color: var(--text-head);
  transition-duration: 60ms;
}

.th-key.is-hit .kbd {
  translate: 0 1px;
  border-color: color-mix(in srgb, var(--primary-2) 70%, transparent);
  border-bottom-width: 1px;
  margin-bottom: 1px;
  background: var(--primary);
  box-shadow: 0 0 18px -2px color-mix(in srgb, var(--primary) 85%, transparent);
  color: var(--text);
  transition-duration: 60ms;
}

.th-keys__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  margin-top: 8px;
  padding: 14px 14px 6px;
  border-top: 1px solid var(--line-soft);
}

.th-keys__try {
  min-width: 0;
  color: var(--muted);
  font-size: var(--fs-14);
}

.th-keys__pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 10px;
  vertical-align: 1px;
  border-radius: 50%;
  background: var(--primary-2);
  box-shadow: 0 0 10px var(--primary);
  animation: pulse-dot 1.8s var(--ease-in-out) infinite;
}

.th-touch-only {
  display: none;
}

@media (hover: none) {
  .th-touch-only {
    display: inline;
  }
}

.th-keys__echo {
  min-width: 0;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-variant-numeric: tabular-nums;
  transition: color var(--dur-ui) var(--ease-out);
}

.th-keys__echo.is-live {
  color: var(--text-head);
}

.th-keys__echo .kbd {
  margin-right: 6px;
}

@media (max-width: 419.98px) {
  .th-keys-card {
    padding: 6px;
  }

  .th-key {
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 10px;
    padding-inline: 10px;
  }

  .th-keys__foot {
    padding-inline: 10px;
  }
}

/* 5. keyframes ------------------------------------------------------------ */
@keyframes th-panel-in {
  from {
    opacity: 0;
    scale: .96;
    translate: 0 14px;
    filter: blur(8px);
  }

  55% {
    opacity: 1;
  }

  to {
    opacity: 1;
    scale: 1;
    translate: 0 0;
    filter: none;
  }
}

@keyframes th-ping {
  0% {
    transform: scale(1);
    opacity: .55;
  }

  80%,
  100% {
    transform: scale(3.4);
    opacity: 0;
  }
}

@keyframes th-mark-in {
  from {
    transform: scale(0);
  }

  to {
    transform: scale(1);
  }
}

@keyframes th-row-in {
  from {
    margin-top: calc(var(--th-row) * -1);
    opacity: 0;
  }

  to {
    margin-top: 0;
    opacity: 1;
  }
}

@keyframes th-row-out {
  to {
    opacity: 0;
  }
}

@keyframes th-hit-green {
  from {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent),
      inset 0 0 0 60px color-mix(in srgb, var(--green) 55%, transparent);
  }

  to {
    box-shadow:
      0 0 0 14px transparent,
      inset 0 0 0 60px transparent;
  }
}

@keyframes th-hit-red {
  from {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--red) 60%, transparent),
      inset 0 0 0 40px color-mix(in srgb, var(--red) 45%, transparent);
  }

  to {
    box-shadow:
      0 0 0 12px transparent,
      inset 0 0 0 40px transparent;
  }
}

@keyframes th-hit-primary {
  from {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary-2) 65%, transparent);
  }

  to {
    box-shadow: 0 0 0 10px transparent;
  }
}

/* 6. reduced motion -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .th-chart__halo,
  .th-keys__pulse,
  .th-chart__mark {
    animation: none !important;
  }

  .th-chart__halo {
    opacity: .22;
    transform: scale(2);
  }

  /* log rows appear and leave instantly (JS also skips the classes) */
  .th-log__row.is-new,
  .th-log__row.is-out {
    animation: none !important;
  }

  /* action feedback: a static ring while .is-hit is on, no pulse */
  .th-buy__btn.is-hit,
  .th-sell__btn.is-hit,
  .th-panel .preset.is-hit {
    animation: none !important;
  }

  .th-buy__btn.is-hit {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 70%, transparent);
  }

  .th-sell__btn.is-hit {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 70%, transparent);
  }

  .th-panel .preset.is-hit {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-2) 70%, transparent);
  }

  .th-key.is-hit .kbd {
    translate: none;
  }

  html.js .th-chart__svg {
    transition: none;
  }

  .th-float {
    transition: none;
  }
}
