@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/of-inter-tight-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/of-inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/of-jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --field: #151513;
  --lime: #faff69;
  --grey: #414141;
  --panel: #1c1c19;
  --panel-hi: #242420;
  --ink: #f4f4ef;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

.ticker {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(16px, 2.6vw, 34px) clamp(16px, 4vw, 56px) 0;
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.2vw, 22px);
}

/* ---- top bar ---- */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--panel-hi);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: "Inter Tight", "Inter", sans-serif;
  font-weight: 800;
  font-size: 11.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  white-space: nowrap;
}
.mark { color: var(--lime); }
.prod { color: var(--ink); opacity: 0.4; font-weight: 400; letter-spacing: 0.13em; }

.keyform {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-left: auto;
}

.klabel {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.5;
}

.kinput {
  width: 15ch;
  padding: 7px 10px;
  background: var(--panel);
  border: 1px solid var(--panel-hi);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  border-radius: 2px;
}
.kinput:focus {
  outline: none;
  border-color: var(--lime);
}
.kinput::placeholder { color: var(--ink); opacity: 0.3; }

.kbtn,
.drq,
.copy {
  appearance: none;
  padding: 7px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-hi);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 120ms linear, color 120ms linear, background 120ms linear;
}
.kbtn:hover,
.drq:hover,
.copy:hover { border-color: var(--grey); }
.kbtn:focus-visible,
.drq:focus-visible,
.copy:focus-visible { outline: none; border-color: var(--lime); }

.khint {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink);
  opacity: 0.34;
  white-space: nowrap;
}

.ctrls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drq[aria-pressed="true"] {
  border-color: var(--lime);
  color: var(--lime);
}

.copy.copied {
  border-color: var(--lime);
  color: var(--lime);
}

/* ---- drq note ---- */

.drqnote {
  margin: -4px 0 0;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  opacity: 0.42;
}
.drqnote code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  opacity: 1;
}

/* ---- the tape ---- */

.tapewrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tapelabel {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.6;
}
.tapelabel .stext { color: var(--ink); opacity: 1; }
.tapelabel .scount { font-variant-numeric: tabular-nums; }
.tapelabel .swait { text-transform: none; letter-spacing: 0.02em; opacity: 0.7; }

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.3;
  flex: none;
}
.tapelabel[data-state="open"] .led { background: var(--lime); opacity: 1; box-shadow: 0 0 0 3px rgba(250, 255, 105, 0.12); }
.tapelabel[data-state="connecting"] .led { background: var(--lime); opacity: 0.6; animation: pulse 1s steps(1) infinite; }
.tapelabel[data-state="closed"] .led { background: #ff6b57; opacity: 0.9; }

@keyframes pulse {
  0%, 49% { opacity: 0.2; }
  50%, 100% { opacity: 0.75; }
}

.tapelane {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--panel-hi);
  border-left: 2px solid var(--lime);
  border-radius: 2px;
  padding: 14px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 46px, #000 calc(100% - 46px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 46px, #000 calc(100% - 46px), transparent 100%);
}

.tapetrack {
  display: flex;
  align-items: center;
  gap: 30px;
  width: max-content;
  padding-left: 24px;
  will-change: transform;
  animation: ticker 28s linear infinite;
}

.tapetrack[data-speed="b30"]  { animation-duration: 30s; }
.tapetrack[data-speed="b50"]  { animation-duration: 50s; }
.tapetrack[data-speed="b70"]  { animation-duration: 70s; }
.tapetrack[data-speed="b90"]  { animation-duration: 90s; }
.tapetrack[data-speed="b120"] { animation-duration: 120s; }
.tapetrack[data-speed="b160"] { animation-duration: 160s; }

.copybox {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

.tapelane:hover .tapetrack { animation-play-state: paused; }

@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-50% - 15px)); }
}

.item {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.4;
}

.item::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 16px;
  border-radius: 50%;
  background: var(--grey);
  transform: translateY(-2px);
}

.item .ts {
  color: var(--ink);
  opacity: 0.4;
  font-size: 0.86em;
}
.item .lv {
  text-transform: lowercase;
  letter-spacing: 0.02em;
  font-size: 0.86em;
  color: var(--ink);
  opacity: 0.55;
  min-width: 4.5ch;
}
.item .tx {
  color: var(--ink);
  opacity: 0.92;
}

.item.is-info .lv { color: var(--ink); opacity: 0.5; }
.item.is-warn .lv { color: var(--lime); opacity: 1; }
.item.is-error .lv { color: #ff6b57; opacity: 1; }
.item.is-warn .tx { opacity: 1; }

.item.is-new { animation: flash 1.1s ease-out 1; }
@keyframes flash {
  0% { background: rgba(250, 255, 105, 0.14); }
  100% { background: transparent; }
}

/* ---- the stacked tail ---- */

.tail {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--panel-hi);
  border-radius: 2px;
  background: var(--panel);
  overflow: hidden;
}

.tailhead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--panel-hi);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.5;
}

.tailrows {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 0 10px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: var(--grey) transparent;
}
.tailrows::-webkit-scrollbar { width: 8px; }
.tailrows::-webkit-scrollbar-thumb { background: #2c2c28; border-radius: 4px; }
.tailrows::-webkit-scrollbar-track { background: transparent; }

.row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 3px 14px;
  align-items: baseline;
}
.row .ts {
  color: var(--ink);
  opacity: 0.36;
  font-size: 0.88em;
  white-space: nowrap;
}
.row .lv {
  font-size: 0.88em;
  text-transform: lowercase;
  white-space: nowrap;
}
.row .tx {
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.row.is-warn .lv { color: var(--lime); }
.row.is-error .lv { color: #ff6b57; }
.row.is-info .lv { color: var(--ink); opacity: 0.55; }

.row.is-new { animation: flash 1.1s ease-out 1; }

.empty {
  padding: 14px;
  color: var(--ink);
  opacity: 0.3;
  font-size: 12.5px;
}

/* ---- foot ---- */

.foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0 16px;
  border-top: 1px solid var(--panel-hi);
  font-family: var(--sans);
  font-size: 12px;
}
.hint { color: var(--ink); opacity: 0.32; letter-spacing: 0.03em; }
.site {
  color: var(--ink);
  opacity: 0.58;
  text-decoration: none;
  border-bottom: 1px solid var(--grey);
  padding-bottom: 1px;
  transition: opacity 120ms linear, border-color 120ms linear;
}
.site:hover, .site:focus-visible { opacity: 1; border-bottom-color: var(--lime); outline: none; }

/* ---- phone ---- */

@media (max-width: 680px) {
  .bar { gap: 10px 14px; }
  .brand { font-size: 9.5px; letter-spacing: 0.14em; }
  .keyform {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .kinput { width: auto; min-width: 0; }
  .khint { display: none; }
  .ctrls { width: 100%; }
  .drq { flex: 1 1 auto; }
  .tapetrack { font-size: 13px; }
  .item { font-size: 13px; }
  .row { grid-template-columns: auto auto minmax(0, 1fr); gap: 9px; padding: 3px 11px; }
  .row .tx { font-size: 12.5px; }
}

/* ---- reduced motion: static single line ---- */

@media (prefers-reduced-motion: reduce) {
  .tapetrack {
    animation: none;
    transform: none;
    padding-left: 20px;
  }
  .tapetrack .dup { display: none; }
  .tapetrack .item:not(.is-last) { display: none; }
  .item.is-new,
  .row.is-new { animation: none; }
  .tapelabel[data-state="connecting"] .led { animation: none; }
  .site { transition: none; }
}
