/* Elite Option MiniApp — фиолетовый неон в стиле постера Elite Signals */

:root {
  --bg0: #0b0418;
  --bg1: #170a2e;
  --panel: rgba(38, 21, 74, .55);
  --panel-solid: #201040;
  --border: rgba(168, 85, 247, .22);
  --border-strong: rgba(168, 85, 247, .5);
  --text: #efe9ff;
  --muted: #9b8fc7;
  --purple: #a855f7;
  --violet: #7c3aed;
  --magenta: #e34ff2;
  --cyan: #5ec9ff;
  --gold: #ffc93c;
  --green: #3ddc84;
  --red: #ff4d5e;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg0);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100vh;
  overscroll-behavior-y: none;
}

body {
  background:
    radial-gradient(900px 420px at 85% -8%, rgba(124, 58, 237, .32), transparent 60%),
    radial-gradient(720px 380px at -12% 14%, rgba(227, 79, 242, .16), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0) 42%);
  background-attachment: fixed;
}

/* неоновая сетка как на постере — тает книзу */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(168, 85, 247, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 85, 247, .055) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.4) 45%, transparent 78%);
          mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.4) 45%, transparent 78%);
}

#app {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 14px calc(28px + env(safe-area-inset-bottom));
}

/* ---------------- Шапка ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 2px 10px;
  margin: 0 -14px; padding-left: 14px; padding-right: 14px;
  background: linear-gradient(180deg, rgba(11, 4, 24, .92), rgba(11, 4, 24, .75) 70%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.logo { display: flex; align-items: center; gap: 8px; min-width: 0; }

.logo-badge {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(124, 58, 237, .3), rgba(227, 79, 242, .14));
  border: 1px solid var(--border-strong);
  box-shadow: 0 0 18px rgba(168, 85, 247, .35), inset 0 0 12px rgba(168, 85, 247, .12);
}
.logo-badge svg { filter: drop-shadow(0 0 5px rgba(168, 85, 247, .6)); }

.logo-text {
  font-size: 19px; font-weight: 800; letter-spacing: .4px;
  background: linear-gradient(180deg, #ffffff, #cdb6ff 85%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 22px rgba(168, 85, 247, .45);
  white-space: nowrap;
}
.logo-text em {
  font-style: normal;
  background: linear-gradient(180deg, #aee6ff, #5ec9ff 80%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.btn-channel {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  color: #fff; font: 700 13px/1 inherit; letter-spacing: .3px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(160, 60, 240, .45), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-channel:active { transform: scale(.95); box-shadow: 0 2px 10px rgba(160, 60, 240, .4); }

.btn-flag {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(168, 85, 247, .22);
  transition: transform .12s ease;
}
.btn-flag:active { transform: scale(.9); }

/* ---------------- Поиск ---------------- */

.search-wrap {
  position: relative;
  margin: 6px 0 12px;
}
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
#search {
  width: 100%;
  padding: 13px 40px 13px 41px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: 600 15px/1 inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#search::placeholder { color: var(--muted); font-weight: 500; }
#search:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .14), 0 0 22px rgba(168, 85, 247, .22);
}
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px;
  border: none; border-radius: 50%;
  background: rgba(168, 85, 247, .18);
  color: var(--muted); font-size: 17px; line-height: 1;
  cursor: pointer;
}

/* ---------------- Категории ---------------- */

.cats {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; flex: none;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font: 700 13px/1 inherit; letter-spacing: .2px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease, transform .12s ease;
}
.chip:active { transform: scale(.95); }
.chip .chip-ico { font-size: 13px; line-height: 1; }
.chip.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  box-shadow: 0 4px 16px rgba(160, 60, 240, .45), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.chip .chip-count {
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 201, 60, .18);
  color: var(--gold);
  font-size: 10.5px; line-height: 17px; text-align: center;
}
.chip.active .chip-count { background: rgba(0, 0, 0, .25); color: #ffe9ad; }

/* ---------------- Список пар ---------------- */

#list { display: flex; flex-direction: column; gap: 8px; }

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(46, 26, 90, .5), rgba(30, 16, 60, .55));
  transition: border-color .15s ease, transform .1s ease;
}
.row:active { transform: scale(.985); border-color: var(--border-strong); }
.row { cursor: pointer; }
.row.closed { opacity: .5; cursor: default; }

.row-icon {
  position: relative;
  width: 40px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.flag {
  position: absolute;
  width: 21px; height: 21px;
  font-size: 20px; line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .55));
}
.flag.a { left: 0; top: 1px; z-index: 1; }
.flag.b { right: 0; bottom: 0; }
.flag-lang { width: 20px; height: 20px; display: block; font-size: 18px; line-height: 1; }
.mono {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, rgba(124, 58, 237, .5), rgba(227, 79, 242, .3));
  border: 1px solid var(--border-strong);
  font-weight: 800; font-size: 11px; letter-spacing: .3px;
  color: #f4edff;
  text-shadow: 0 0 8px rgba(168, 85, 247, .8);
}
.mono.sz2 { font-size: 14px; }

.row-main { flex: 1 1 auto; min-width: 0; }
.row-name {
  font-weight: 700; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}
.badge-otc {
  flex: none;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(94, 201, 255, .14);
  border: 1px solid rgba(94, 201, 255, .3);
  color: var(--cyan);
  font-size: 9.5px; font-weight: 800; letter-spacing: .6px;
}

.row-payout {
  flex: none;
  font-weight: 800; font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--green);
  text-shadow: 0 0 14px rgba(61, 220, 132, .45);
}
.row.closed .row-payout { color: var(--muted); text-shadow: none; font-size: 12.5px; font-weight: 700; }

.star-btn {
  width: 38px; height: 38px; flex: none;
  margin-right: -4px;
  border: none; background: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #6d5f9e;
  transition: transform .12s ease, color .15s ease;
}
.star-btn:active { transform: scale(.82); }
.star-btn svg { display: block; }
.star-btn svg path { fill-opacity: 0; transition: fill-opacity .15s ease; }
.star-btn.active svg path { fill-opacity: 1; }
.star-btn.active { color: var(--gold); }
.star-btn.active svg { filter: drop-shadow(0 0 7px rgba(255, 201, 60, .75)); }
.star-btn.pop svg { animation: star-pop .32s ease; }
@keyframes star-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.45) rotate(-8deg); }
  100% { transform: scale(1); }
}

/* ---------------- Пустое состояние ---------------- */

.empty {
  padding: 56px 24px 40px;
  text-align: center;
  color: var(--muted);
}
.empty-star {
  font-size: 44px; line-height: 1;
  margin-bottom: 12px;
  color: var(--purple);
  text-shadow: 0 0 24px rgba(168, 85, 247, .6);
}
.empty-text { font-size: 13.5px; max-width: 260px; margin: 0 auto; }

/* ---------------- Модалка «Время экспирации» ---------------- */

.modal { position: fixed; inset: 0; z-index: 60; }
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(6, 2, 14, .62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .22s ease;
}
.modal.open .modal-backdrop { opacity: 1; }

/* окно по центру приложения, поверх интерфейса */
.modal-sheet {
  position: absolute; left: 14px; right: 14px; top: 50%;
  max-width: 560px; margin: 0 auto;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 16px 16px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #251349, #170a2e 65%);
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 48px rgba(124, 58, 237, .4), inset 0 1px 0 rgba(255, 255, 255, .06);
  transform: translateY(-50%) scale(.92);
  opacity: 0;
  transition: transform .24s cubic-bezier(.32, .72, .28, 1), opacity .2s ease;
}
.modal.open .modal-sheet { transform: translateY(-50%) scale(1); opacity: 1; }

.sheet-grab { display: none; }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.sheet-title {
  font-size: 17px; font-weight: 800; letter-spacing: .3px;
  background: linear-gradient(180deg, #ffffff, #cdb6ff 85%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 22px rgba(168, 85, 247, .45);
}
.sheet-close {
  width: 32px; height: 32px; flex: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .12s ease;
}
.sheet-close:active { transform: scale(.88); }

.sheet-pair {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 14px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(20, 10, 42, .6);
}
.sheet-pair-main {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 14.5px;
  white-space: nowrap; overflow: hidden;
}
.sheet-pair-payout {
  flex: none;
  font-weight: 800; font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--green);
  text-shadow: 0 0 14px rgba(61, 220, 132, .45);
}

.exp-auto {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: 800 14px/1 inherit; letter-spacing: .4px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.exp-auto svg { color: var(--gold); filter: drop-shadow(0 0 6px rgba(255, 201, 60, .6)); }
.exp-auto:active { transform: scale(.97); }
.exp-auto.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  color: #fff;
  box-shadow: 0 4px 20px rgba(160, 60, 240, .5), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.exp-auto.active svg { color: #ffe9ad; }

.exp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.exp-btn {
  padding: 13px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: 800 14px/1 inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
.exp-btn:active { transform: scale(.93); }
.exp-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  color: #fff;
  box-shadow: 0 4px 16px rgba(160, 60, 240, .5), inset 0 1px 0 rgba(255, 255, 255, .2);
}

/* ---------------- Окно сигнала ---------------- */

/* --- получаю данные --- */

.sig-loading { padding: 4px 0 6px; text-align: center; }
.sig-fetch-text { font-weight: 700; font-size: 14.5px; margin: 8px 0 14px; }

.sig-chart-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(20, 10, 42, .6);
  overflow: hidden;
  padding: 8px 6px;
}
.sig-chart-wrap svg { display: block; width: 100%; height: auto; }
.sig-grid-line { stroke: rgba(168, 85, 247, .12); stroke-width: 1; }
.sig-path {
  fill: none;
  stroke: url(#sig-grad);
  stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(94, 201, 255, .5));
  stroke-dasharray: 700;
  animation: sig-draw 2.4s ease-in-out infinite;
}
@keyframes sig-draw {
  0% { stroke-dashoffset: 700; }
  60% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}
.sig-dot {
  fill: var(--magenta);
  filter: drop-shadow(0 0 6px rgba(227, 79, 242, .9));
  animation: sig-pulse 1.1s ease-in-out infinite;
}
@keyframes sig-pulse { 50% { opacity: .35; } }
.sig-scan {
  position: absolute; top: 0; bottom: 0;
  width: 54px; left: -60px;
  background: linear-gradient(90deg, transparent, rgba(94, 201, 255, .14), rgba(227, 79, 242, .2), transparent);
  animation: sig-scan 1.6s linear infinite;
  pointer-events: none;
}
@keyframes sig-scan { from { left: -60px; } to { left: 100%; } }
.sig-analyzing {
  margin-top: 12px;
  font-size: 12.5px; color: var(--muted);
  animation: sig-blink 1.2s ease-in-out infinite;
}
@keyframes sig-blink { 50% { opacity: .45; } }

/* --- сигнал --- */

.sig-result .sheet-pair { margin: 8px 0 10px; }

.sig-meta { display: flex; justify-content: center; margin: 0 0 6px; }
.sig-chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px; font-weight: 700;
}
.sig-chip b { color: #fff; margin-left: 2px; }

.sig-arrow {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 8px 0 14px;
}
.sig-arrow .arr {
  width: 92px; height: 92px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.sig-arrow.up .arr {
  color: var(--green);
  border: 1px solid rgba(61, 220, 132, .55);
  background: radial-gradient(circle at 50% 38%, rgba(61, 220, 132, .30), rgba(61, 220, 132, .05) 72%);
  box-shadow: 0 0 36px rgba(61, 220, 132, .35), inset 0 0 18px rgba(61, 220, 132, .12);
}
.sig-arrow.down .arr {
  color: var(--red);
  border: 1px solid rgba(255, 77, 94, .55);
  background: radial-gradient(circle at 50% 62%, rgba(255, 77, 94, .30), rgba(255, 77, 94, .05) 72%);
  box-shadow: 0 0 36px rgba(255, 77, 94, .35), inset 0 0 18px rgba(255, 77, 94, .12);
}
.sig-arrow svg { filter: drop-shadow(0 0 10px currentColor); }
.sig-arrow.up svg { animation: sig-nudge-up 1.1s ease-in-out infinite; }
.sig-arrow.down svg { animation: sig-nudge-down 1.1s ease-in-out infinite; }
@keyframes sig-nudge-up { 50% { transform: translateY(-5px); } }
@keyframes sig-nudge-down { 50% { transform: translateY(5px); } }
.sig-dir-label { font-size: 21px; font-weight: 900; letter-spacing: 2.5px; }
.sig-arrow.up .sig-dir-label { color: var(--green); text-shadow: 0 0 18px rgba(61, 220, 132, .6); }
.sig-arrow.down .sig-dir-label { color: var(--red); text-shadow: 0 0 18px rgba(255, 77, 94, .6); }

/* --- отсчёт до входа в сделку --- */

/* «Вход через 3 / 2 / 1» — спокойный белый текст по центру. */
.sig-enter {
  margin: 0 0 10px;
  text-align: center;
  font-size: 14px; font-weight: 800; letter-spacing: .4px;
  color: #fff;
  font-variant-numeric: tabular-nums;
  transition: opacity .45s ease, transform .45s ease;
}
/* Момент входа: жёлтая надпись с неоновым свечением. */
.sig-enter.now {
  font-size: 20px; font-weight: 900; letter-spacing: 3px;
  color: var(--gold);
  text-shadow: 0 0 6px rgba(255, 201, 60, .95),
               0 0 16px rgba(255, 201, 60, .7),
               0 0 30px rgba(255, 170, 20, .45);
  animation: sig-enter-pop .45s ease-out, sig-enter-glow 1s ease-in-out infinite .45s;
}
/* Момент прошёл — плавно убираем, чтобы не мешала таймеру сделки. */
.sig-enter.gone { opacity: 0; transform: translateY(-4px); pointer-events: none; }

@keyframes sig-enter-pop {
  0% { transform: scale(.8); opacity: .4; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes sig-enter-glow {
  50% { text-shadow: 0 0 9px rgba(255, 201, 60, 1),
                     0 0 24px rgba(255, 201, 60, .85),
                     0 0 44px rgba(255, 170, 20, .6); }
}

@media (prefers-reduced-motion: reduce) {
  .sig-enter.now { animation: none; }
}

/* --- уверенность сигнала --- */

.sig-conf {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(20, 10, 42, .6);
  font-size: 12.5px; color: var(--muted); font-weight: 700;
}
.sig-conf .pct {
  font-size: 17px; font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.sig-conf.hi .pct { color: var(--green); text-shadow: 0 0 14px rgba(61, 220, 132, .55); }
.sig-conf.mid .pct { color: var(--gold); text-shadow: 0 0 14px rgba(255, 201, 60, .5); }
.sig-conf.lo .pct { color: #ff8c5a; text-shadow: 0 0 14px rgba(255, 140, 90, .5); }

/* --- таймер-строка --- */

.sig-count { margin: 2px 0 4px; }
.sig-count-top {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted);
  margin-bottom: 6px;
}
.sig-count-time {
  font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: 13.5px; color: #fff;
}
.sig-count-bar {
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(168, 85, 247, .12);
  overflow: hidden;
}
.sig-count-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta));
  box-shadow: 0 0 12px rgba(124, 58, 237, .6);
  transition: width .15s linear;
}
.sig-count.low .sig-count-fill {
  background: linear-gradient(90deg, #ff8c5a, var(--red));
  box-shadow: 0 0 12px rgba(255, 77, 94, .6);
}

/* --- истёк / ошибка --- */

.sig-result.expired .sig-arrow { opacity: .35; filter: grayscale(.5); }
.sig-result.expired .sig-arrow svg { animation: none; }
.sig-expired { text-align: center; padding: 12px 0 2px; }
.sig-expired-text { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

.sig-btn {
  width: 100%;
  padding: 13px;
  border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  color: #fff;
  font: 800 14px/1 inherit; letter-spacing: .4px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(160, 60, 240, .45), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform .12s ease;
}
.sig-btn:active { transform: scale(.97); }

.sig-error { text-align: center; padding: 12px 0 6px; }
.sig-error-ico { font-size: 34px; margin-bottom: 8px; }
.sig-error-text { font-weight: 700; margin-bottom: 6px; }
.sig-error-hint { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
