/* Earny's terminal (hl.js): tape, mood, pounce feed, yarn-ball book. Tokens from style.css :root only. */

/* ---------- tape ---------- */
.tape { position: relative; display: flex; align-items: center; }
.hl-tape-track { display: flex; width: max-content; animation: hl-marquee 48s linear infinite; }
.tape:hover .hl-tape-track, .tape:focus-within .hl-tape-track { animation-play-state: paused; }
.hl-tape-grp { display: flex; flex: none; }
.hl-ti { display: inline-flex; align-items: baseline; gap: .55em; padding: 10px 22px; white-space: nowrap; font: 500 14px var(--f-mono); color: var(--text); border-right: 1px solid var(--line); }
.hl-tn { font-weight: 700; color: var(--mint); letter-spacing: .03em; }
.hl-tc { font-size: 13px; color: var(--muted); }
.hl-ti-src { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
@keyframes hl-marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .hl-tape-track { animation: none; width: 100%; }
  .hl-tape-grp:not(.hl-dup) { flex-wrap: wrap; justify-content: center; width: 100%; }
  .hl-dup { display: none; }
}

/* ---------- frame ---------- */
.hl-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 16px; }
.hl-pill { min-width: 7.5em; justify-content: center; }
.hl-pill.pill-live { color: var(--long); border-color: color-mix(in srgb, var(--long) 45%, transparent); }
.hl-pill[data-state="offline"], .hl-pill[data-state="reconnecting"] { color: var(--warn); }
.hl-src { color: var(--muted); font: 500 13px var(--f-mono); }
.hl-nfa { color: var(--dim); }
.hl-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.hl .panel { position: relative; display: flex; flex-direction: column; min-width: 0; background: linear-gradient(180deg, var(--panel2), var(--panel) 120px); }
.hl-ph { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.hl-ph h3 { margin: 0; font: 600 20px/1.1 var(--f-display); color: var(--text); }
.hl-ph .k { text-align: right; }
.hl-fine, .hl-note { margin: 14px 0 0; color: var(--dim); font-size: 12px; line-height: 1.5; }
.hl-note { margin-top: auto; padding-top: 10px; }
.hl-stale .hl-big, .hl-stale .hl-tt, .hl-stale .hl-ladder, .hl-stale .hl-yarns { opacity: .55; transition: opacity .3s; }

/* price tick flash */
.hl-fu { animation: hl-fu .7s ease-out; }
.hl-fd { animation: hl-fd .7s ease-out; }
@keyframes hl-fu { from { color: var(--long); text-shadow: 0 0 14px var(--long); background: color-mix(in srgb, var(--long) 16%, transparent); } }
@keyframes hl-fd { from { color: var(--short); text-shadow: 0 0 14px var(--short); background: color-mix(in srgb, var(--short) 16%, transparent); } }

/* ---------- mood ---------- */
.hl-mood-main { display: flex; align-items: center; gap: 16px; }
.hl-face { flex: none; width: 128px; height: 128px; object-fit: cover; border-radius: 22px; border: 2px solid var(--line2); box-shadow: var(--glow); background: var(--panel2); }
.hl-face[data-mood="zoomies"] { border-color: var(--long); animation: hl-hop 1.1s ease-in-out infinite; }
.hl-face[data-mood="purring"] { border-color: var(--mint2); }
.hl-face[data-mood="grumpy"] { border-color: var(--warn); }
.hl-face[data-mood="crying"] { border-color: var(--short); }
.hl-face[data-mood="asleep"] { filter: saturate(.6) brightness(.85); }
@keyframes hl-hop { 50% { transform: translateY(-6px) rotate(-2deg); } }
.hl-mood-px { min-width: 0; }
.hl-big { display: inline-block; padding: 0 4px; margin-left: -4px; border-radius: 6px; font: 700 clamp(34px, 3.6vw, 46px)/1.05 var(--f-mono); color: var(--text); letter-spacing: -.02em; }
.hl-chg { margin-top: 4px; font: 600 18px var(--f-mono); }
.hl-mood-tag { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line2); font: 600 12px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mint); }
.hl-mood-tag[data-mood="zoomies"] { color: var(--long); }
.hl-mood-tag[data-mood="grumpy"] { color: var(--warn); }
.hl-mood-tag[data-mood="crying"] { color: var(--short); }
.hl-mood-line { margin: 14px 0 12px; min-height: 3em; color: var(--cream); font: 500 15px/1.5 var(--f-body); }
.hl-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.hl-stats div { padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line); }
.hl-stats dd { margin: 4px 0 0; font-size: 17px; font-weight: 600; color: var(--text); }

/* ---------- pounce feed ---------- */
.hl-catch { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg); border: 1px dashed var(--line2); font: 500 14px var(--f-body); color: var(--text); }
.hl-catch img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--mint2); }
.hl-catch b { color: var(--mint); font-size: 16px; }
.hl-catch-k { margin-left: auto; }
.hl-jump { animation: hl-jump .8s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes hl-jump { 30% { transform: translateY(-14px) rotate(-12deg) scale(1.15); } 60% { transform: translateY(0) rotate(6deg); } }
.hl-tt-wrap { position: relative; height: calc(30px + 14 * 27px); overflow: hidden; }
.hl-tt { width: 100%; border-collapse: collapse; table-layout: fixed; font: 500 13px var(--f-mono); }
.hl-tt th { padding: 6px 6px; text-align: right; font: 600 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); border-bottom: 1px solid var(--line); }
.hl-tt th:nth-child(1), .hl-tt th:nth-child(2) { text-align: left; }
.hl-tt th:nth-child(1) { width: 25%; } .hl-tt th:nth-child(2) { width: 13%; } .hl-tt th:nth-child(5) { width: 24%; }
.hl-tt td { height: 27px; padding: 0 6px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); color: var(--text); }
.hl-tt td:nth-child(1), .hl-tt td:nth-child(2) { text-align: left; }
.hl-tt td.hl-t { color: var(--muted); }
.hl-tt tbody tr { animation: hl-in .35s ease-out; }
.hl-tt tr.hl-buy td.hl-usd { color: var(--long); } .hl-tt tr.hl-sell td.hl-usd { color: var(--short); }
.hl-tt tr.hl-bigrow td { background: color-mix(in srgb, var(--mint) 9%, transparent); font-weight: 700; }
.hl-tt tr.hl-bigrow td:first-child { box-shadow: inset 3px 0 0 var(--mint); }
.hl-tt tr.hl-bigrow { animation: hl-in .35s ease-out, hl-bigflash 1.6s ease-out; }
@keyframes hl-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes hl-bigflash { 0%, 30% { box-shadow: 0 0 0 1px var(--mint); } }
.hl-paw { display: inline-block; width: 15px; height: 15px; margin-right: 5px; vertical-align: -2px; animation: hl-pounce .9s cubic-bezier(.2, 1.5, .4, 1) both; }
.hl-paw svg { width: 100%; height: 100%; fill: var(--pink); }
@keyframes hl-pounce { 0% { transform: translate(-40px, -22px) rotate(-40deg) scale(1.8); opacity: 0; } 55% { transform: translate(0, 2px) rotate(8deg) scale(1.2); opacity: 1; } 100% { transform: none; opacity: 1; } }
.hl-empty { position: absolute; inset: 40px 0 auto; margin: 0; text-align: center; color: var(--dim); font: 500 13px var(--f-mono); }

/* ---------- yarn-ball book ---------- */
.hl-yarns { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; height: 186px; padding: 0 4px 6px; border-bottom: 1px solid var(--line); background: radial-gradient(60% 40% at 50% 100%, color-mix(in srgb, var(--mint) 7%, transparent), transparent); }
.hl-y { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.hl-yw { --s: 64px; width: calc(var(--s) * 1.25); height: calc(var(--s) * 1.083); max-width: 100%; transition: width .45s cubic-bezier(.3, 1.3, .5, 1), height .45s cubic-bezier(.3, 1.3, .5, 1); }
.hl-yw svg { width: 100%; height: 100%; overflow: visible; }
.hl-y-bid { color: var(--long); } .hl-y-ask { color: var(--short); }
.hl-y-ask .hl-yw svg { transform: scaleX(-1); }
.hl-yb { fill: currentColor; }
.hl-ys path, .hl-yt { fill: none; stroke: var(--ink); stroke-opacity: .32; stroke-width: 3.2; stroke-linecap: round; }
.hl-yt { stroke: currentColor; stroke-opacity: .9; stroke-width: 2.4; }
.hl-yh path { fill: none; stroke: var(--cream); stroke-opacity: .55; stroke-width: 4; stroke-linecap: round; }
.hl-y figcaption { font: 600 13px var(--f-mono); color: var(--text); white-space: nowrap; }
.hl-spread { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-bottom: 22px; }
.hl-spread b { font: 700 18px var(--f-mono); color: var(--mint); }
.hl-ladder { margin-top: 10px; }
.hl-lh, .hl-lr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hl-lh { grid-template-columns: 1fr 1fr 1fr 1fr; padding: 0 6px 4px; }
.hl-lh .k:nth-child(2) { text-align: right; } .hl-lh .k:nth-child(4) { text-align: right; }
.hl-lc { position: relative; display: flex; justify-content: space-between; align-items: center; height: 23px; padding: 0 6px; font: 500 12.5px var(--f-mono); color: var(--text); overflow: hidden; border-radius: 4px; }
.hl-lc i { position: absolute; top: 2px; bottom: 2px; width: 0; border-radius: 3px; transition: width .25s; }
.hl-lb i { right: 0; background: color-mix(in srgb, var(--long) 22%, transparent); }
.hl-la i { left: 0; background: color-mix(in srgb, var(--short) 22%, transparent); }
.hl-lc span { position: relative; }
.hl-lsz { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hl-book { grid-column: 1 / -1; }
  .hl-book .hl-yarns { max-width: 560px; width: 100%; margin-inline: auto; }
}
@media (max-width: 720px) {
  .hl-grid { grid-template-columns: minmax(0, 1fr); }
  .hl .panel { padding: 14px; }
  .hl-face { width: 104px; height: 104px; border-radius: 18px; }
  .hl-tt { font-size: 12px; }
  .hl-tt th, .hl-tt td { padding: 0 4px; }
  .hl-tt th { padding: 6px 4px; }
  .hl-tt th:nth-child(1) { width: 24%; } .hl-tt th:nth-child(2) { width: 13%; } .hl-tt th:nth-child(5) { width: 22%; }
  .hl-lc { font-size: 12px; padding: 0 4px; }
  .hl-catch-k { display: none; }
}
@media (max-width: 400px) {
  .hl-ti { padding: 9px 16px; font-size: 13px; }
  .hl-src { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .hl-face, .hl-jump, .hl-paw, .hl-tt tbody tr, .hl-fu, .hl-fd { animation: none !important; }
}
