:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;
}

body {
  display: grid;
  place-items: center;
  padding: 10px;
}

.hot-words-overlay {
  --hw-accent: #ff8a5b;
  --hw-hot: #ff4b2b;
  --hw-live-ring: rgba(255, 75, 43, .12);
  --hw-glow: rgba(255, 75, 43, .45);
  --hw-panel-primary: rgba(255, 83, 24, .19);
  --hw-panel-secondary: rgba(255, 181, 71, .13);
  --hw-panel-border: rgba(255, 135, 78, .24);
  --hw-haze: rgba(255, 62, 24, .12);
  --hw-badge-border: rgba(255, 104, 55, .3);
  --hw-badge-bg: rgba(255, 78, 36, .11);
  width: min(300px, 100%);
  transform-origin: center;
  transition: opacity 260ms ease, transform 320ms cubic-bezier(.2, .8, .2, 1);
}

.hot-words-overlay[data-resolution="qhd"] {
  zoom: 1.333333;
}

.hot-words-overlay[data-resolution="uhd"] {
  zoom: 2;
}

.hot-words-overlay[data-palette="ice"] {
  --hw-accent: #7dd3fc;
  --hw-hot: #3b82f6;
  --hw-live-ring: rgba(59, 130, 246, .13);
  --hw-glow: rgba(56, 189, 248, .42);
  --hw-panel-primary: rgba(37, 99, 235, .21);
  --hw-panel-secondary: rgba(34, 211, 238, .13);
  --hw-panel-border: rgba(96, 165, 250, .27);
  --hw-haze: rgba(37, 99, 235, .14);
  --hw-badge-border: rgba(96, 165, 250, .34);
  --hw-badge-bg: rgba(37, 99, 235, .13);
}

.hot-words-overlay[data-palette="violet"] {
  --hw-accent: #c4b5fd;
  --hw-hot: #d946ef;
  --hw-live-ring: rgba(217, 70, 239, .13);
  --hw-glow: rgba(192, 38, 211, .42);
  --hw-panel-primary: rgba(168, 85, 247, .2);
  --hw-panel-secondary: rgba(236, 72, 153, .12);
  --hw-panel-border: rgba(196, 181, 253, .27);
  --hw-haze: rgba(168, 85, 247, .13);
  --hw-badge-border: rgba(196, 181, 253, .32);
  --hw-badge-bg: rgba(126, 34, 206, .13);
}

.hot-words-overlay[data-palette="emerald"] {
  --hw-accent: #6ee7b7;
  --hw-hot: #84cc16;
  --hw-live-ring: rgba(132, 204, 22, .13);
  --hw-glow: rgba(16, 185, 129, .4);
  --hw-panel-primary: rgba(5, 150, 105, .2);
  --hw-panel-secondary: rgba(163, 230, 53, .11);
  --hw-panel-border: rgba(110, 231, 183, .25);
  --hw-haze: rgba(5, 150, 105, .13);
  --hw-badge-border: rgba(110, 231, 183, .31);
  --hw-badge-bg: rgba(5, 150, 105, .12);
}

.hot-words-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.985);
}

.hot-words-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 0;
  padding: 16px 18px 12px;
  border: 1px solid var(--hw-panel-border);
  border-radius: 19px;
  color: #fff8f3;
  background:
    radial-gradient(circle at 88% 12%, var(--hw-panel-primary), transparent 34%),
    radial-gradient(circle at 9% 110%, var(--hw-panel-secondary), transparent 38%),
    linear-gradient(145deg, rgba(19, 12, 17, .94), rgba(9, 8, 14, .96));
  box-shadow:
    0 24px 70px rgba(0, 0, 0, .48),
    inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(20px);
}

.hot-words-overlay[data-background="transparent"] .hot-words-card {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .9);
}

.heat-haze {
  position: absolute;
  z-index: -1;
  top: -160px;
  right: -80px;
  width: 420px;
  height: 320px;
  border-radius: 50%;
  background: var(--hw-haze);
  filter: blur(45px);
  animation: heat-breathe 3.8s ease-in-out infinite alternate;
}

.hot-words-header,
.hot-words-footer,
.hot-words-meta {
  display: flex;
  align-items: center;
}

.hot-words-header {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.hot-words-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--hw-accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .18em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--hw-hot);
  box-shadow: 0 0 0 5px var(--hw-live-ring), 0 0 16px var(--hw-hot);
  animation: live-pulse 1.55s ease-out infinite;
}

.hot-words-meta {
  flex: none;
  gap: 8px;
}

.status-badge,
.timer-badge {
  min-height: 31px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.status-badge {
  color: var(--hw-accent);
  border: 1px solid var(--hw-badge-border);
  background: var(--hw-badge-bg);
}

.status-badge.is-finished {
  color: #ffe2a8;
  border-color: rgba(255, 196, 92, .28);
  background: rgba(255, 182, 58, .1);
}

.timer-badge {
  min-width: 55px;
  color: rgba(255, 255, 255, .75);
  text-align: center;
  background: rgba(255, 255, 255, .06);
}

.timer-badge:empty {
  display: none;
}

.hot-words-results {
  display: grid;
  gap: 6px;
}

.hot-words-results.has-many {
  grid-template-columns: 1fr;
}

.hot-words-results.has-many .hot-word-row {
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 4px;
}

.hot-words-results.has-many .temperature {
  font-size: 21px;
}

.hot-words-results.has-many .word {
  font-size: 18px;
}

.hot-words-results.has-many .flames {
  min-width: 25px;
}

.hot-words-results.has-many .flame:not(:first-child) {
  display: none;
}

.hot-word-row {
  --heat: 0;
  --heat-color: hsl(42 94% 58%);
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 3px 6px 3px 10px;
  border: 1px solid color-mix(in srgb, var(--heat-color) 25%, transparent);
  border-radius: 13px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--heat-color) 12%, transparent), rgba(255, 255, 255, .025));
}

.hot-word-row.is-hottest {
  box-shadow: inset 3px 0 0 var(--heat-color), 0 0 28px color-mix(in srgb, var(--heat-color) 11%, transparent);
}

.temperature {
  color: var(--heat-color);
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  text-shadow: 0 0 18px color-mix(in srgb, var(--heat-color) 38%, transparent);
}

.word {
  --word-slide-duration: 9s;
  --word-slide-offset: 0px;
  overflow: hidden;
  color: #fff;
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 760;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-track {
  display: inline-flex;
  width: max-content;
  min-width: max-content;
  align-items: center;
  transform: translate3d(0, 0, 0);
}

.word-label {
  display: inline-block;
  white-space: nowrap;
}

.word.is-scrolling .word-track {
  animation: word-slide var(--word-slide-duration) ease-in-out infinite;
  will-change: transform;
}

.flames {
  display: flex;
  min-width: 54px;
  justify-content: flex-end;
  gap: 1px;
  filter: drop-shadow(0 3px 8px var(--hw-glow));
}

.flame {
  display: inline-block;
  font-size: 17px;
  animation: flame-dance .7s ease-in-out infinite alternate;
}

.flame:nth-child(2) { animation-delay: -.24s; }
.flame:nth-child(3) { animation-delay: -.48s; }

.hot-words-overlay[data-flames="off"] .flames {
  display: none;
}

.hot-words-overlay[data-flames="off"] .hot-word-row {
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 4px;
}

.hot-words-waiting {
  display: flex;
  min-height: 112px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: rgba(255, 255, 255, .84);
}

.hot-words-waiting[hidden] {
  display: none;
}

.waiting-flame {
  font-size: 38px;
  filter: drop-shadow(0 6px 18px var(--hw-glow));
  animation: flame-dance .75s ease-in-out infinite alternate;
}

.hot-words-waiting strong,
.hot-words-waiting span {
  display: block;
}

.hot-words-waiting strong {
  margin-bottom: 4px;
  font-size: 18px;
}

.hot-words-waiting span {
  color: rgba(255, 255, 255, .5);
  font-size: 13px;
}

.hot-words-footer {
  justify-content: flex-start;
  margin-top: 8px;
  color: rgba(255, 255, 255, .45);
  font-size: 12px;
  font-weight: 650;
}

.hot-words-overlay[data-layout="compact"] {
  width: min(280px, 100%);
}

.hot-words-overlay[data-layout="compact"] .hot-words-card {
  min-height: auto;
  padding: 12px 13px 9px;
  border-radius: 16px;
}

.hot-words-overlay[data-layout="compact"] .hot-words-header {
  gap: 10px;
  margin-bottom: 7px;
}

.hot-words-overlay[data-layout="compact"] .hot-words-eyebrow {
  gap: 6px;
  font-size: 10px;
  letter-spacing: .15em;
}

.hot-words-overlay[data-layout="compact"] .live-dot {
  width: 6px;
  height: 6px;
}

.hot-words-overlay[data-layout="compact"] .status-badge,
.hot-words-overlay[data-layout="compact"] .timer-badge {
  min-height: 26px;
  padding: 5px 8px;
  font-size: 10px;
}

.hot-words-overlay[data-layout="compact"] .hot-words-results {
  gap: 4px;
}

.hot-words-overlay[data-layout="compact"] .hot-word-row,
.hot-words-overlay[data-layout="compact"] .hot-words-results.has-many .hot-word-row {
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 3px;
  min-height: 31px;
  padding: 2px 5px 2px 7px;
  border-radius: 11px;
}

.hot-words-overlay[data-layout="compact"][data-flames="off"] .hot-word-row,
.hot-words-overlay[data-layout="compact"][data-flames="off"] .hot-words-results.has-many .hot-word-row {
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 3px;
}

.hot-words-overlay[data-layout="compact"] .temperature,
.hot-words-overlay[data-layout="compact"] .hot-words-results.has-many .temperature {
  font-size: 16px;
}

.hot-words-overlay[data-layout="compact"] .word,
.hot-words-overlay[data-layout="compact"] .hot-words-results.has-many .word {
  font-size: 15px;
}

.hot-words-overlay[data-layout="compact"] .flames {
  min-width: 42px;
}

.hot-words-overlay[data-layout="compact"] .flame {
  font-size: 15px;
}

.hot-words-overlay[data-layout="compact"] .hot-words-footer {
  margin-top: 6px;
  font-size: 10px;
}

.hot-words-overlay[data-layout="compact"] .hot-words-waiting {
  min-height: 84px;
  gap: 12px;
}

.hot-words-overlay[data-layout="compact"] .waiting-flame {
  font-size: 30px;
}

.hot-words-overlay[data-layout="compact"] .hot-words-waiting strong {
  font-size: 16px;
}

.hot-words-overlay[data-layout="compact"] .hot-words-waiting span {
  font-size: 11px;
}

@keyframes heat-breathe {
  to { transform: translate(-28px, 24px) scale(1.12); opacity: .62; }
}

@keyframes live-pulse {
  70%, 100% { box-shadow: 0 0 0 10px transparent, 0 0 16px var(--hw-hot); }
}

@keyframes flame-dance {
  from { transform: translateY(1px) rotate(-3deg) scale(.94); }
  to { transform: translateY(-2px) rotate(3deg) scale(1.06); }
}

@keyframes word-slide {
  0%, 16% { transform: translate3d(0, 0, 0); }
  42%, 58% { transform: translate3d(var(--word-slide-offset), 0, 0); }
  84%, 100% { transform: translate3d(0, 0, 0); }
}

@media (max-width: 640px) {
  body { padding: 9px; }
  .hot-words-card { padding: 16px 14px 12px; border-radius: 18px; }
  .hot-words-header { align-items: flex-start; gap: 10px; }
  .hot-words-meta { flex-direction: column; align-items: flex-end; gap: 4px; }
  .hot-word-row { grid-template-columns: 64px minmax(0, 1fr) auto; gap: 4px; }
  .flames { min-width: 26px; }
  .flame:not(:first-child) { display: none; }
  .hot-words-results.has-many { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .word.is-scrolling .word-track {
    display: block;
    min-width: 0;
    overflow: hidden;
    animation: none;
    transform: none;
    text-overflow: ellipsis;
    will-change: auto;
  }
}
