/* ============================================================
   NICKHUNTER // терминальная тема
   Своя палитра, не наследуем themeParams Telegram.
   Правила: моноширинный шрифт, острые углы, 1px линии,
   ограниченный набор цветов, без градиентных заливок.
   ============================================================ */
:root {
  --bg:      #05080a;   /* почти чёрный */
  --panel:   #0a1014;   /* блоки */
  --line:    #17262c;   /* рамки */
  --text:    #cfe9dc;   /* основной текст */
  --dim:     #4b6b60;   /* второстепенный */
  --acid:    #00ff9c;   /* акцент: свободно, активное */
  --cyan:    #00d9ff;   /* ссылки */
  --red:     #ff3b57;   /* занято */
  --amber:   #ffb62e;   /* резерв */
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background-color: var(--bg);
  /* едва различимая сетка — «миллиметровка» терминала */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px;
  background-position: -1px -1px;
  padding-bottom: 62px;
}
/* фон сетки не должен быть навязчивым */
body::after {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(120% 80% at 50% 0%, transparent 40%, var(--bg) 100%);
  pointer-events: none;
  z-index: 0;
}
/* сканлайны поверх всего */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    to bottom, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px);
  pointer-events: none;
  z-index: 9;
  opacity: .5;
}

#app { position: relative; z-index: 1; padding: 14px 12px 8px; max-width: 640px; margin: 0 auto; }
.screen { animation: boot .18s steps(3) both; }
.hidden { display: none !important; }
@keyframes boot { from { opacity: 0; } to { opacity: 1; } }

/* ---------- заголовки ---------- */
h1 {
  font-size: 15px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--acid);
  margin: 4px 0 16px;
  text-shadow: 0 0 12px rgba(0, 255, 156, .35);
}
h1::before { content: "// "; color: var(--dim); text-shadow: none; }
h2 {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--dim);
  margin: 22px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.muted { color: var(--dim); font-size: 12px; margin: 0; }

.row { display: flex; gap: 8px; margin-bottom: 10px; }
.row input { flex: 1; }

/* ---------- ввод ---------- */
input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  color: var(--acid);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: .06em;
  outline: none;
  caret-color: var(--acid);
  transition: border-color .15s linear;
}
input::placeholder { color: #2f4a42; letter-spacing: .04em; }
input:focus { border-color: var(--acid); box-shadow: inset 0 0 0 1px rgba(0, 255, 156, .25); }

/* ---------- кнопки ---------- */
.btn {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  cursor: pointer;
  transition: background .12s linear, color .12s linear, border-color .12s linear;
}
.btn::before { content: "["; color: var(--dim); margin-right: 6px; }
.btn::after  { content: "]"; color: var(--dim); margin-left: 6px; }
.btn:active:not(:disabled) { background: var(--acid); color: #04120c; border-color: var(--acid); }
.btn:active:not(:disabled)::before, .btn:active:not(:disabled)::after { color: #04120c; }
.btn.primary { border-color: var(--acid); color: var(--acid); }
.btn.danger  { border-color: var(--red);  color: var(--red); }
.btn.danger:active:not(:disabled) { background: var(--red); color: #120406; }
.btn:disabled { opacity: .32; cursor: default; }

/* ---------- индикатор работы ---------- */
.scanner {
  position: relative;
  height: 58px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  margin: 4px 0 12px;
  display: flex; align-items: center; justify-content: center;
}
/* луч, проходящий по блоку */
.scanner .sweep {
  position: absolute; top: 0; bottom: 0; width: 34%;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 156, .16), transparent);
  animation: sweep 1.5s linear infinite;
}
.scanner .label {
  position: relative;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .26em;
  color: var(--acid);
  text-shadow: 0 0 10px rgba(0, 255, 156, .4);
}
.scanner .label::after {
  content: "_";
  animation: blink 1s steps(1) infinite;
}
@keyframes sweep { from { left: -34%; } to { left: 100%; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* строка статуса с курсором */
.statusline { display: flex; align-items: center; gap: 8px; min-height: 18px; margin: 2px 0 4px; }
.statusline::before { content: "$"; color: var(--acid); font-weight: 700; }
.spinner {
  width: 9px; height: 9px; flex: none;
  background: var(--acid);
  animation: pulse .8s steps(1) infinite;
}
@keyframes pulse { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .15; } }

/* ---------- прогресс: сегментные блоки ---------- */
.progress {
  position: relative;
  height: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  margin: 8px 0 12px;
}
.progress-fill {
  height: 100%; width: 0;
  background-image: repeating-linear-gradient(
    90deg, var(--acid) 0 4px, transparent 4px 7px);
  transition: width .3s linear;
}
.progress.indeterminate .progress-fill {
  width: 32%;
  animation: run 1.1s linear infinite;
}
@keyframes run {
  from { transform: translateX(-110%); }
  to   { transform: translateX(330%); }
}

/* ---------- счётчики ---------- */
.counters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.counters span {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 5px 9px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.counters span b { font-weight: 700; margin-left: 6px; color: var(--text); }
.counters span.c-ok   { border-color: rgba(0, 255, 156, .35); }
.counters span.c-ok b   { color: var(--acid); }
.counters span.c-bad  { border-color: rgba(255, 59, 87, .35); }
.counters span.c-bad b  { color: var(--red); }
.counters span.c-warn { border-color: rgba(255, 182, 46, .35); }
.counters span.c-warn b { color: var(--amber); }

/* ---------- живая лента ---------- */
.live { display: flex; flex-direction: column; margin-top: 8px; border-top: 1px solid var(--line); }
.live .line {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  animation: lineIn .12s linear both;
}
.live .line { cursor: pointer; }
.live .line:active { background: rgba(0, 255, 156, .09); }
.live .line .nick { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live .line.cached { opacity: .45; }
.live .line .time { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 11px; }
@keyframes lineIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* метка статуса */
.tag {
  flex: none;
  min-width: 58px;
  text-align: center;
  padding: 2px 6px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em;
  border: 1px solid currentColor;
  text-transform: uppercase;
}
.s-ok   { color: var(--acid); }
.s-bad  { color: var(--red); }
.s-warn { color: var(--amber); }
.s-dim  { color: var(--dim); }

/* подтверждение копирования */
.flash { animation: flash .45s ease-out; }
@keyframes flash {
  0%   { background: rgba(0, 255, 156, .30); }
  100% { background: transparent; }
}

/* панель над списком результатов */
.resultbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding-top: 10px;
  border-top: 1px solid var(--line);
}
.resultbar .btn { padding: 7px 10px; font-size: 10px; }

/* ---------- карточки находок ---------- */
.cards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.card {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 2px solid var(--acid);
  padding: 10px 12px;
  animation: cardIn .16s linear both;
}
/* уголок-засечка в правом верхнем углу */
.card::after {
  content: "";
  position: absolute; top: 0; right: 0;
  border-width: 0 7px 7px 0;
  border-style: solid;
  border-color: transparent var(--line) transparent transparent;
}
.card .nick {
  flex: 1;
  font-weight: 700;
  color: var(--acid);
  letter-spacing: .04em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .nick::before { content: "@"; color: var(--dim); }
.card .score { color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.card a { color: var(--cyan); text-decoration: none; font-size: 11px; letter-spacing: .04em; }
.card a:active { text-decoration: underline; }
.card .copy {
  background: transparent; border: 1px solid var(--line); color: var(--cyan);
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .1em;
  padding: 4px 7px; cursor: pointer;
  transition: background .12s linear, color .12s linear;
}
.card .copy:active { background: var(--cyan); color: #04121a; }
@keyframes cardIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* пустое состояние — текст берётся из data-empty */
.cards[data-empty]:empty::before {
  content: "> " attr(data-empty);
  display: block;
  color: var(--dim);
  font-size: 12px;
  padding: 16px 12px;
  border: 1px dashed var(--line);
}

/* ---------- настройки ---------- */
.field { margin-bottom: 18px; }
.field > label {
  display: block; color: var(--dim);
  font-size: 10px; text-transform: uppercase; letter-spacing: .18em;
  margin-bottom: 8px;
}
.segment { display: flex; gap: 6px; flex-wrap: wrap; }
.segment button {
  flex: 1; min-width: 58px; padding: 9px 6px;
  border: 1px solid var(--line); border-radius: 0;
  background: var(--panel); color: var(--dim);
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  cursor: pointer;
  transition: color .12s linear, border-color .12s linear, background .12s linear;
}
.segment button.active {
  color: var(--acid); border-color: var(--acid);
  background: rgba(0, 255, 156, .07);
}

.flood {
  border: 1px solid var(--amber);
  color: var(--amber);
  background: rgba(255, 182, 46, .07);
  padding: 9px 11px;
  font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase;
  margin: 8px 0;
  animation: pulse 1s steps(1) infinite;
}

/* ---------- нижняя панель ---------- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs .tab {
  flex: 1; background: none; border: none;
  border-right: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  padding: 9px 2px 10px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: color .12s linear, background .12s linear;
}
#tabs .tab:last-child { border-right: none; }
#tabs .tab .k { font-size: 9px; letter-spacing: .1em; opacity: .7; }
#tabs .tab span:last-child { font-size: 10px; font-weight: 700; letter-spacing: .12em; }
#tabs .tab.active { color: var(--acid); background: rgba(0, 255, 156, .06); }
#tabs .tab:active { background: rgba(0, 255, 156, .12); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
