:root {
  --bg-main: #05060a;
  --bg-card: #222327;
  --bg-card-soft: #1a1b1f;
  --bg-control: #16171b;
  --bg-input: #d0d0d1;
  --text-main: #ffffff;
  --text-muted: #a5a6ad;
  --accent: #ffb300;
  --accent-dark: #e28f00;
  --radius-xl: 15px;
  --radius-pill: 999px;
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.55);
  --transition-fast: 0.25s ease;
  --transition-slow: 0.45s ease;
}

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

/* Quiet, usable scrollbars for the page and all nested scroll areas. */
html,
body.tl-body,
body.tl-body * {
  scrollbar-width: thin;
  scrollbar-color: rgba(165, 166, 173, 0.22) transparent;
}
html:hover,
body.tl-body:hover,
body.tl-body *:hover,
body.tl-body *:focus-within {
  scrollbar-color: rgba(165, 166, 173, 0.42) transparent;
}
html::-webkit-scrollbar,
body.tl-body::-webkit-scrollbar,
body.tl-body *::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
html::-webkit-scrollbar-track,
body.tl-body::-webkit-scrollbar-track,
body.tl-body *::-webkit-scrollbar-track,
html::-webkit-scrollbar-corner,
body.tl-body::-webkit-scrollbar-corner,
body.tl-body *::-webkit-scrollbar-corner {
  background: transparent;
}
html::-webkit-scrollbar-thumb,
body.tl-body::-webkit-scrollbar-thumb,
body.tl-body *::-webkit-scrollbar-thumb {
  background: rgba(165, 166, 173, 0.22);
  border-radius: 999px;
}
html::-webkit-scrollbar-thumb:hover,
body.tl-body::-webkit-scrollbar-thumb:hover,
body.tl-body *::-webkit-scrollbar-thumb:hover {
  background: rgba(165, 166, 173, 0.55);
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body.tl-body {
  min-height: 100vh;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* коли сторінка ще "пуста" — блокуємо скрол по Y */
body.tl-body.tl-locked {
  overflow-y: hidden;
}

/* ----- layout ----- */

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition:
    padding-top var(--transition-slow),
    transform var(--transition-slow);
}

/* колапс/експанд анімація */
.wrap-collapsed .hero {
  margin-top: 20vh;
}

.wrap-expanded .hero {
  margin-top: 0;
}

/* заголовок теж змінює розмір */
.title {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffffff;
  text-align: center;
  transition: font-size var(--transition-slow), transform var(--transition-slow);
}

.wrap-expanded .title {
  font-size: clamp(17px, 2.4vw, 26px);
  transform: translateY(-2px);
}

/* main panel анімується */

.wrap-collapsed #main-panel {
  opacity: 0;
  transform: translateY(40px);
  pointer-events: none;
  max-height: 0;
}

.wrap-expanded #main-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  max-height: 9999px;
}

.hero,
#main-panel {
  transition:
    margin-top var(--transition-slow),
    opacity var(--transition-slow),
    transform var(--transition-slow),
    max-height var(--transition-slow);
}

/* ----- header ----- */

.top-header {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

/* ----- control strip ----- */

.hero {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.control-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  row-gap: 16px;
  padding: 8px;
  background: var(--bg-control);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
  max-width: 696px;
  width: 100%;
}
/* рядок з монетою + інтервалом */
.mobile-row {
  display: flex;
  flex-direction: row;
  gap: 10px;
  flex: 1 1 auto;
}

/* всередині: інпут розтягується, інтервал фіксований */
.mobile-row .pair-input-wrapper {
  flex: 1 1 auto;
}

.mobile-row .select-wrapper {
  flex: 0 0 110px;
}


#ema-value{
  display: flex;
  justify-content: space-between;
  width: 100%;
}
/* input + список монет */

.pair-input-wrapper {
  position: relative;
  flex: 1 1 220px;
  display: flex;
  align-items: stretch;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  /* overflow: hidden;  ← забрати */
  overflow: visible;
}


.pair-input {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  color: #000;
}

.pair-input::placeholder {
  color: #555;
}

.pair-toggle {
  border: none;
  background: none;
  width: 40px;
  cursor: pointer;
  font-size: 18px;
  color: #444;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pair-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* suggestions dropdown */

.pair-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #2a2b30;
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  max-height: 260px;
  overflow-y: auto;
  padding: 6px 0;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast);
  z-index: 20;
}

.pair-suggestions.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.pair-option {
  padding: 8px 14px;
  font-size: 14px;
  color: #f5f5f5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.pair-option span.symbol-label {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pair-option span.symbol-main {
  font-weight: 600;
}

.pair-option span.symbol-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.pair-option span.symbol-market {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

.pair-option span.symbol-market--crypto {
  color: #8dd7ff;
}

.pair-option span.symbol-market--forex {
  color: #9ee6b8;
}

.pair-option span.symbol-market--metals {
  color: #f6d676;
}

.pair-option:hover {
  background: #3a3b41;
}

.pair-empty {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-muted);
}

/* select interval */

.select-wrapper {
  flex: 0 0 110px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.select {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 4px;
  font-size: 14px;
  outline: none;
  color: #111;
}

/* TEST button */

.btn-test {
  flex: 0 0 110px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #111;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 10px 12px;
  box-shadow: var(--shadow-soft);
  transition:
    background var(--transition-fast),
    transform 0.1s ease;
}

.btn-test:hover {
  background: var(--accent-dark);
}

.btn-test:active {
  transform: translateY(1px);
}

.status-label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.initial-signals {
  width: min(680px, 100%);
  margin-top: 14px;
}

.wrap-expanded .initial-signals {
  display: none;
}

.initial-signals__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.initial-signal-card {
  width: 100%;
  min-height: 126px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(22, 23, 27, 0.92);
  color: #fff;
  padding: 12px;
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.initial-signal-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(31, 32, 37, 0.96);
}

.initial-signal-card--green {
  border-color: rgba(69, 210, 111, 0.28);
}

.initial-signal-card--yellow {
  border-color: rgba(255, 211, 74, 0.28);
}

.initial-signal-card--red,
.initial-signal-card--pending {
  border-color: rgba(255, 75, 75, 0.2);
}

.initial-signal-card--loading {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(22, 23, 27, 0.92), rgba(54, 55, 62, 0.72), rgba(22, 23, 27, 0.92));
  background-size: 220% 100%;
  animation: initialSignalLoading 1.2s infinite linear;
}

@keyframes initialSignalLoading {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

.initial-signal-card__top,
.initial-signal-card__middle,
.initial-signal-card__stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.initial-signal-card__pair {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.initial-signal-card__name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.initial-signal-card__meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.initial-signal-card__side,
.initial-signal-card__interval {
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.initial-signal-card__side--long {
  color: #45d26f;
  border-color: rgba(69, 210, 111, 0.28);
}

.initial-signal-card__side--short {
  color: #ff7070;
  border-color: rgba(255, 75, 75, 0.3);
}

.initial-signal-card__interval {
  color: #d8dce6;
}

.initial-signal-card__market--crypto { color: #8dd7ff; }
.initial-signal-card__market--forex { color: #9ee6b8; }
.initial-signal-card__market--metals { color: #f6d676; }

.initial-signal-card__middle {
  margin-top: 14px;
}

.initial-signal-card__signal {
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.initial-signal-card--green .initial-signal-card__signal { color: #45d26f; }
.initial-signal-card--yellow .initial-signal-card__signal { color: #ffd34a; }
.initial-signal-card--red .initial-signal-card__signal { color: #ff4b4b; }
.initial-signal-card--pending .initial-signal-card__signal { color: var(--text-muted); }

.initial-signal-card__score {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.initial-signal-card__stars {
  margin-top: 11px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.initial-signal-card__star {
  color: rgba(255, 255, 255, 0.18);
  font-size: 13px;
  line-height: 1;
}

.initial-signal-card__star--neutral {
  color: #ffd34a;
}

.initial-signal-card__star--good {
  color: #45d26f;
}

.initial-signal-card__stats {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.initial-signal-card__stats span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.initial-signal-card__stats b {
  max-width: 100%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.initial-signal-card__stats em {
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1;
  text-transform: uppercase;
}

/* ----- MAIN PANEL ----- */

.main-panel {
  width: 100%;
  max-width: 98vw;
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1.7fr);
  grid-auto-rows: auto;
  gap: 14px;
}

/* cards */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 12px 14px 16px;
  box-shadow: var(--shadow-soft);
}

.card-price {
  min-height: 100px;
}

.card-rsi,
.card-ema {
  min-height: 35px;
}
.card-macd {
  min-height: 160px;
}

#price-chart {
  height: 280px !important;
  min-height: 280px;
  max-height: 280px;
}

#rsi-chart,
#ema-chart {
  height: 120px !important;
  min-height: 120px;
  max-height: 120px;
}

#macd-chart {
  width: 100%;
  height: 130px !important;
  min-height: 130px;
  max-height: 130px;
}


.card-title {
  font-size: 13px;
  text-transform: lowercase;
  color: var(--text-muted);
}

/* card header with mode toggle */

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* mode toggle */

.price-mode-toggle {
  display: inline-flex;
  background: #16171b;
  border-radius: 999px;
  padding: 2px;
}

.mode-btn {
  border: none;
  background: transparent;
  color: #c7c7cf;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  min-width: 50px;
}

.mode-btn.active {
  background: #2b2c32;
  color: #fff;
}

.chart-range-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.range-btn {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #d7d9df;
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  min-width: 44px;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.range-btn:hover,
.range-btn.active {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.42);
  color: #f8fbff;
}

.range-btn--ghost {
  background: transparent;
  color: var(--text-muted);
}

/* charts column */

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

/* side column */

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

.side-card {
  background: var(--bg-card-soft);
}

.top-side-card {
  padding: 10px 10px 12px;
}

.bottom-side-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px 5px 5px;
}

/* traffic light */

.light-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.light-row {
  display: flex;
  gap: 8px;
  background: #111215;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
}

.light {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #3b3c42;
  box-shadow: inset 0 0 0 2px #202126;
  opacity: 0.35;
  transition:
    background var(--transition-fast),
    opacity var(--transition-fast),
    box-shadow var(--transition-fast);
}

#light-green.on {
  background: #45d26f;
  opacity: 1;
  box-shadow: 0 0 14px rgba(69, 210, 111, 0.7);
}

#light-yellow.on {
  background: #ffd34a;
  opacity: 1;
  box-shadow: 0 0 14px rgba(255, 211, 74, 0.7);
}

#light-red.on {
  background: #ff4b4b;
  opacity: 1;
  box-shadow: 0 0 14px rgba(255, 75, 75, 0.7);
}

.score-block {
  margin-top: 6px;
  text-align: center;
}

.score-main {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #ffd34a; /* дефолт – нейтральний */
}

.score-stars {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.score-star {
  font-size: 15px;
  color: #444;              /* неактивна (сіра) */
  text-shadow: none;
  transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.15s ease;
}

.score-star--active-neutral {
  color: #ffb300;           /* золото */
  text-shadow: 0 0 8px rgba(255, 179, 0, 0.7);
  transform: translateY(-1px);
}

.score-star--active-good {
  color: #45d26f;           /* зелена “good” */
  text-shadow: 0 0 10px rgba(69, 210, 111, 0.9);
  transform: translateY(-1px);
}


/* indicators + reasons */

.side-section {
  background: #202127;
  border-radius: 12px;
  padding: 8px 10px;
}

.side-title {
  margin: 0 0 4px;
  font-size: 15px;
  text-transform: lowercase;
  color: var(--text-muted);
}

.indicators {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.indicator-box {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.indicator-label {
  color: var(--text-muted);
}

.indicator-value {
  font-weight: 600;
}

.reasons-section {
  /* max-height: 180px; */
  overflow-y: auto;
}

.reasons-list {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 15px;
  line-height: 1.4;
  color: #d6d7df;
}

/* ----- RESPONSIVE ----- */

@media (max-width: 900px) {
  /* замість grid робимо колону, щоб можна було міняти порядок */
  .main-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
  }

  /* SIDE зверху, CHARTS знизу */
  .side-column {
    order: 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
  }

  .charts-column {
    order: 1;
  }

  /* карточки справа стають більш широкими/адаптивними */
  .side-card {
    /* flex: 1 1 260px; */
  }

  .card-price {
    min-height: 220px;
  }

  .chart-toolbar {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding-inline: 10px;
  }

  /* control-strip стає колонкою на всю ширину */
  .control-strip {
    border-radius: 18px;
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
  }

  .pair-input-wrapper,
  .select-wrapper,
  .btn-test {
    flex: 1 1 auto;
    width: 100%;
  }

  .btn-test {
    text-align: center;
  }

  .status-label {
    text-align: center;
  }

  .initial-signals__grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding: 0 2px 4px;
    scrollbar-width: none;
  }

  .initial-signals__grid::-webkit-scrollbar {
    display: none;
  }

  .initial-signal-card {
    flex: 0 0 min(168px, 44vw);
    min-height: 0;
    border-radius: 10px;
    padding: 9px;
    scroll-snap-align: start;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.36);
  }

  .initial-signal-card__top {
    gap: 6px;
  }

  .initial-signal-card__name {
    font-size: 13px;
  }

  .initial-signal-card__meta {
    gap: 4px;
  }

  .initial-signal-card__side,
  .initial-signal-card__interval {
    padding: 3px 5px;
    font-size: 8px;
  }

  .initial-signal-card__middle {
    margin-top: 9px;
    gap: 6px;
  }

  .initial-signal-card__signal {
    font-size: 12px;
  }

  .initial-signal-card__score {
    font-size: 8px;
  }

  .initial-signal-card__stars {
    margin-top: 8px;
  }

  .initial-signal-card__star {
    font-size: 10px;
  }

  .initial-signal-card__stats {
    margin-top: 9px;
    gap: 4px;
  }

  .initial-signal-card__stats b {
    font-size: 10px;
  }

  .initial-signal-card__stats em {
    font-size: 8px;
  }

  /* графіки трохи нижчі на телефоні/малому планшеті */
  .card-price canvas {
    height: 215px !important;
  }

  .card-rsi canvas,
  .card-ema canvas {
    height: 92px !important;
  }

  .card-macd canvas {
    height: 98px !important;
  }

  .card-price {
    min-height: 220px;
  }
}

@media (min-width: 641px) and (max-width: 760px) {
  .initial-signals__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .initial-signal-card:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .main-panel {
    margin-top: 12px;
  }

  .card {
    padding: 10px 8px 12px;
  }

  .card-price canvas {
    height: 185px !important;
  }

  .card-rsi canvas,
  .card-ema canvas {
    height: 78px !important;
  }

  .card-macd canvas {
    height: 84px !important;
  }

  /* .reasons-section {
    max-height: 150px;
  } */

  .light-row {
    padding: 5px 8px;
  }

  .light {
    width: 34px;
    height: 34px;
  }

  .score-text {
    font-size: 12px;
  }
}

@media (max-width: 430px) {
  .initial-signals {
    margin-top: 10px;
  }

  .initial-signal-card {
    flex-basis: min(150px, 43vw);
    padding: 8px;
  }

  .initial-signal-card__top {
    align-items: flex-start;
  }

  .initial-signal-card__middle {
    margin-top: 8px;
  }

  .initial-signal-card__signal {
    font-size: 11px;
  }

  .initial-signal-card__stats {
    gap: 3px;
  }
}

@media (max-width: 360px) {
  .initial-signal-card {
    flex-basis: 136px;
  }

  .initial-signal-card__interval {
    display: none;
  }

  .initial-signal-card__stats em {
    display: none;
  }
}


/* --- select інтервалів: зробити схожим на поле монет --- */

.select-wrapper {
  position: relative;
  flex: 0 0 110px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  padding: 0 8px;
  box-shadow: var(--shadow-soft); /* як у control-strip */
}

/* сам select всередині */
.select {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  color: #000;
  cursor: pointer;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* стрілочка, як у монет */
.select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #444;
  pointer-events: none;
}

.select option {
  background: #2a2b30;    /* як .pair-suggestions */
  color: #f5f5f5;
}

.select option:checked {
  background: #3a3b41;    /* як hover в .pair-option */
}


/* --- Mobile: input + interval в один рядок --- */
@media (max-width: 640px) {

  /* control strip стає колонкою, але 1-й ряд робимо flex */
  .control-strip {
    flex-direction: column;
    align-items: stretch;
  }

  /* контейнер з інпутом і select у один рядок */
  .mobile-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
  }

  .mobile-row .pair-input-wrapper,
  .mobile-row .select-wrapper {
    flex: 1 1 0;
    width: 100%;
  }

  /* TEST окремо, широка кнопка */
  .btn-test {
    margin-top: 6px;
    width: 100%;
  }
  .premium-inner {
    flex-direction: row;
    align-items: flex-start;
  }

  /* міняємо видимість блоків */
  .premium-card--desktop {
    display: none;
  }

  .premium-card--mobile {
    display: block;
    margin-top: 18px;
    margin-inline: 10px;
  }
}



/* ---------- PREMIUM CARD ---------- */

.premium-card {
  background: radial-gradient(circle at 0 0, rgba(255,179,0,0.16), transparent 55%),
              linear-gradient(135deg, #1c1d22 0%, #14151b 50%, #111015 100%);
  border-radius: var(--radius-xl);
  /* border: 1px solid rgba(255, 179, 0, 0.18); */
  position: relative;
  overflow: hidden;
}

.premium-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), transparent 40%);
  pointer-events: none;
}

.premium-inner {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.premium-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.premium-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0,0,0,0.7));
  opacity: 0.9;
}

.premium-content {
  flex: 1 1 auto;
}

.premium-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(255, 179, 0, 0.09);
  color: rgba(255, 179, 0, 0.9);
  margin-bottom: 4px;
}

.premium-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.premium-text {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.premium-list {
  margin: 0 0 10px 16px;
  padding: 0;
  font-size: 13px;
  color: #e3e4ec;
  line-height: 1.35;
}

.premium-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: var(--accent);
  color: #111;
  box-shadow: 0 8px 20px rgba(255, 179, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.premium-link:hover {
  background: var(--accent-dark);
  box-shadow: 0 10px 26px rgba(255, 179, 0, 0.45);
  transform: translateY(-1px);
}

.premium-link:active {
  transform: translateY(0);
  box-shadow: 0 5px 14px rgba(255, 179, 0, 0.35);
}

/* за замовчуванням – тільки desktop-версія */
.premium-card--desktop {
  display: block;
}

.premium-card--mobile {
  display: none;
}


/* --- LONG / SHORT toggle --- */

.side-toggle {
  display: flex;
  gap: 8px;
  /* margin-top: 12px; */
  flex-wrap: wrap;
  justify-content: flex-start;
}

.side-btn {
  position: relative;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.08s ease;
  background: #161921;
  color: #c5c9d6;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* Long button базовий колір */
.side-btn--long {
  /* легкий натяк на зелений */
  box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.25);
}

/* Short button базовий колір */
.side-btn--short {
  /* легкий натяк на червоний */
  box-shadow: 0 0 0 1px rgba(231, 76, 60, 0.25);
}

/* Активна кнопка (обрана сторона) */
.side-btn--active {
  color: #05060a;
  background: linear-gradient(135deg, #ffb347, #ff5f6d);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(0, 0, 0, 0.45);
  transform: translateY(-1px);
}

/* Hover ефект */
.side-btn:hover {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 6px 16px rgba(0, 0, 0, 0.4);
}

/* active / click */
.side-btn:active {
  transform: translateY(0);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 3px 8px rgba(0, 0, 0, 0.3);
}

/* Мобільна адаптація, щоб кнопки не ламались */
@media (max-width: 640px) {
  .side-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .side-btn {
    flex: 1 1 48%;
    text-align: center;
  }
}
/* ---------- FIBONACCI BLOCK ---------- */

.fibo-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #202127;
  border-radius: 12px;
  padding: 14px 16px 16px;
}

/* верхній рядок: назва + напрям тренду */
.fibo-header {
  display: flex;
  justify-content: space-between;
  /* align-items: flex-end; */
  margin-bottom: -4px;
}

.fibo-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-transform: lowercase;
  color: var(--text-muted);
}

.fibo-direction {
  font-size: 12px;
  color: #cbd5f5;
  text-align: right;
  /* max-width: 160px; */
  line-height: 1.25;
}

/* рядок руху */
.fibo-range {
  margin: 10px 0 6px;
  font-size: 12px;
  color: #9ca3af;
}

/* таблиця рівнів */
.fibo-levels {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fibo-level-row {
  display: grid;
  grid-template-columns: 48px 80px 1fr;
  gap: 8px;
  font-size: 12px;
  align-items: center;
}

.fibo-level-label {
  color: #facc15;
  font-weight: 700;
  text-align: left;
}

.fibo-level-price {
  color: #e5e7eb;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.fibo-level-desc {
  color: #9ca3af;
  white-space: nowrap;
}

/* нижній коментар */
.fibo-status {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #cbd5f5;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 10px;
  margin-bottom: 0px;
}


/* трішки компактніше на дуже малих екранах */
@media (max-width: 640px) {
  .fibo-section {
    padding: 8px 10px 10px;
  }

  .fibo-level-row {
    grid-template-columns: 48px 72px 1fr;
    font-size: 11px;
  }

  .fibo-status {
    font-size: 11px;
  }
}


body.tl-body {
  min-height: 100vh;
}

.wrap {
  min-height: auto;   /* або просто забрати цей рядок */
}

@media (max-width: 900px) {
  /* main-panel вже flex-колонка — це ок */
  .main-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
  }

  /* робимо side-column "прозорим" контейнером */
  .side-column {
    display: contents;   /* <-- ключовий момент */
  }

  /* порядок:
     0 — весь sidebar (крім fibo)
     1 — графіки
     2 — fibo під графіками
  */

  .top-side-card,
  .bottom-side-card,
  .premium-card--desktop {
    order: 0;            /* sidebar залишається як є, зверху */
  }

  .charts-column {
    order: 1;            /* графіки відразу після sidebar */
  }

  #fibo-box {
    order: 2;            /* fibo переноситься ПІД графіки */
    width: 100%;
    margin-top: 8px;
  }
}

#status .status {
  display: inline-block;
  color: #9698a2;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  padding-top: 2px;
}



/* AI overview: quiet surfaces and two actionable reading cues. */
.ai-card {
  padding: 17px 18px 13px;
  border-radius: 14px;
  background: #222329;
  border: 1px solid rgba(255,255,255,.08);
  min-width: 0;
}
.ai-card__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 13px; }
.ai-title { display: flex; align-items: center; gap: 8px; color: #e1e1e8; font-size: 14px; font-weight: 600; }
.ai-mark { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: rgba(184,160,217,.1); color: #b8a0d9; font-size: 17px; }
.ai-quota { display: flex; align-items: center; gap: 6px; color: #898994; font-size: 11px; }
.ai-quota__badge { min-width: 23px; padding: 3px 6px; border-radius: 6px; background: #2d2e36; color: #bcbcc8; text-align: center; font-variant-numeric: tabular-nums; }
.ai-body { color: #c8c8d2; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.ai-summary { margin: 0 0 14px; max-width: 85ch; white-space: pre-line; }
.ai-insights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ai-insight { padding: 11px 12px; border: 1px solid rgba(255,255,255,.06); border-radius: 10px; background: #26272e; }
.ai-insight-label { display: flex; align-items: center; gap: 7px; color: #b7b7c4; font-size: 11px; font-weight: 500; }
.ai-insight-label::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #86b8ac; flex-shrink: 0; }
.ai-insight--risk .ai-insight-label::before { background: #d0bd81; }
.ai-insight p { margin: 5px 0 0; font-size: 12px; color: #b1b1bf; line-height: 1.55; }
.ai-meta { margin-top: 11px; color: #80808e; font-size: 10px; line-height: 1.5; }
.ai-empty { margin: 0; color: #a2a2af; }
.ai-skel { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.ai-skel .line { height: 10px; border-radius: 5px; background: rgba(255,255,255,.06); animation: aiPulse 1.4s ease-in-out infinite alternate; }
.ai-skel .w92 { width: 92%; } .ai-skel .w80 { width: 80%; } .ai-skel .w70 { width: 70%; }
@keyframes aiPulse { to { opacity: .4; } }
@media (max-width: 600px) {
  .ai-card { padding: 14px; }
  .ai-insights { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .ai-skel .line { animation: none; } }

.tl-bubbles{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height: 22px; /* щоб блок не скакав */
}

.tl-bubbles .b{
  width: 12px;      /* великі кружочки */
  height: 12px;
  border-radius: 999px;
  background: rgba(229,231,235,0.95); /* світлий */
  transform: scale(0.6);
  opacity: 0.35;
  animation: tlBubblePulse 0.9s infinite ease-in-out;
}

.tl-bubbles .b:nth-child(1){ animation-delay: 0s; }
.tl-bubbles .b:nth-child(2){ animation-delay: 0.15s; }
.tl-bubbles .b:nth-child(3){ animation-delay: 0.30s; }

@keyframes tlBubblePulse{
  0%, 100% { transform: scale(0.6); opacity: 0.35; }
  50%      { transform: scale(1.25); opacity: 1; }
}



/* =========================
   PLAN PILL (1:1 like screenshots)
   ========================= */

.top-header{
  width: 100%;
  display: flex;
  justify-content: center; /* title centered */
  align-items: center;
  margin-bottom: 6px;
  position: relative;
}

/* container on the right */
.plan-ui{
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px; /* spacing between main pill and dropdown pill */
  z-index: 50;
}

/* base pill */
.plan-pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 0px;
  background: rgba(34,35,39,0.92); /* like your screenshot dark pill */
  /* box-shadow: 0 10px 22px rgba(0,0,0,0.45); */
  color: rgba(255,255,255,0.92);
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  /* margin-top: -36px; */
}

@media screen and (max-width: 640px){

  .plan-pill{
    margin-top: -10px;
  }
  
}

.plan-pill:hover{
  border-color: rgba(255,255,255,0.14);
  background: rgba(34,35,39,0.98);
}

.plan-label{
  opacity: .92;
}

.plan-value{
  font-weight: 800;
  letter-spacing: .2px;
}

/* FREE green */
.plan-value--free{
  color: #4ade80;
}

/* Premium gold */
.plan-value--premium{
  color: var(--accent);
}

.plan-sep{
  opacity: .75;
}

.plan-cta{
  opacity: .92;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Dropdown wrapper positioned under the premium pill (NO overlay dim) */
.plan-dropdown{
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.plan-dropdown.is-open{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.plan-pill--dropdown{
  padding: 6px 10px;         /* same compact feel */
  border-radius: 8px;
}

.plan-date{
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.plan-continue{
  color: rgba(255,255,255,0.92);
  text-decoration: none;
}

.plan-continue:hover{
  text-decoration: underline;
  text-underline-offset: 2px;
}

.payment-pending-banner {
  width: 100%;
  max-width: 860px;
  margin: 6px auto 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 179, 0, 0.28);
  background: rgba(255, 179, 0, 0.1);
  color: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  line-height: 1.35;
}

.payment-pending-banner[hidden] {
  display: none;
}

.payment-pending-banner strong {
  display: block;
  color: var(--accent);
  margin-bottom: 2px;
}

.payment-pending-banner button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--accent);
  color: #111;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 640px) {
  .payment-pending-banner {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Make premium pill look like clickable button (still identical visually) */
#plan-pill-premium{
  border-color: rgba(255,179,0,0.16);
}

/* ===== Mobile: avoid overlap with centered title ===== */
@media (max-width: 640px){
  .top-header{
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
  }

  .plan-ui{
    position: static;
    transform: none;
    align-items: center;   /* looks clean on phone */
  }

  .plan-dropdown{
    position: static;      /* dropdown goes right under pill, centered */
    transform: translateY(-6px);
  }

  .plan-dropdown.is-open{
    transform: translateY(0);
  }
}



/* ===== Header layout: left / center / right ===== */
.top-header{
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  position: relative;
  margin-bottom: 6px;
}

.title-block{
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.title{
  margin: 0;
}

.market-strip{
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.lang-menu{
  grid-column: 1;
  justify-self: start;
  position: relative;
  z-index: 80;
}

.top-actions{
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}


@media (max-width: 640px){
  .top-header{
    /* grid-template-columns: auto 1fr auto; */
    gap: 8px;
    margin-bottom: 10px;
  }

  .lang-menu{ grid-column: 1; }
  .title-block{ grid-column: 2; }

  /* plan/ui стає другою стрічкою (по центру) */
  .top-actions{
    grid-column: 1 / -1;
    justify-self: center;
    margin-top: 6px;
  }

  .plan-ui{
    position: static !important;
    transform: none !important;
    align-items: center;
  }

  .plan-dropdown{
    position: static;
  }
}

/* ===== Language dropdown (like screenshot) ===== */
.lang-trigger{
  height: 25px;
  padding: 0 10px 0 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(18,18,18,0.72);
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  backdrop-filter: blur(10px);
  font-size: 10px;
}

.lang-current{
  font-weight: 800;
  letter-spacing: .06em;
}

.lang-caret{
  opacity: .75;
  font-size: 10px;
  transform: translateY(-1px);
}

.lang-panel{
  position: absolute;
  left: 0; /* dropdown під кнопкою */
  top: calc(100% + 8px);
  min-width: 92px;
  padding: 10px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(12,12,12,0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.55);

  display: none;
}

.lang-panel.open{ display: block; }

.lang-item{
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.88);
  font-weight: 700;
  letter-spacing: .06em;
  padding: 10px 8px;
  border-radius: 12px;
  cursor: pointer;
}

.lang-item:hover{
  background: rgba(255,255,255,0.06);
}

.lang-item.active{
  color: var(--accent);
}





/* === Burger menu === */
.burger-menu-wrap {
  position: relative;
}

.burger-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}

.burger-btn span {
  width: 22px;
  height: 2px;
  background: #fff;
  display: block;
}

.burger-panel {
  position: absolute;
  left: 0;
  top: 42px;
  background: #0b0b0b;
  border: 1px solid #1f1f1f;
  border-radius: 10px;
  min-width: 220px;
  padding: 12px;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}

.burger-panel.hidden {
  display: none;
}

.burger-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.burger-title {
  font-size: 12px;
  opacity: 0.6;
  margin-bottom: 4px;
}

.burger-item {
  background: none;
  border: none;
  color: #fff;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.burger-item:hover {
  background: #1a1a1a;
}

.burger-item.danger {
  color: #ff5c5c;
}

.burger-item.logout {
  color: #ff9f43;
}
.burger-item.login {
  color: #43ff72;
}

.burger-sep {
  height: 1px;
  background: #222;
  margin: 8px 0;
}

/* Custom timeframe menu, including touch devices. */
.select-wrapper.custom-timeframe { background: #1a1b1f; border: 1px solid #ffffff14; }
.select-wrapper.custom-timeframe::after { color: #92929d; }
.timeframe-trigger { width: 100%; padding: 9px 20px 9px 10px; border: 0; background: transparent; color: #d7d7df; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.timeframe-options { position: fixed; z-index: 200; overflow-y: auto; padding: 5px; border: 1px solid #ffffff14; border-radius: 12px; background: #1a1b1f; box-shadow: 0 12px 30px #0006; }
.timeframe-options[hidden], .timeframe-options button[hidden] { display: none; }
.timeframe-options button { display: block; width: 100%; min-height: 34px; padding: 8px 12px; border: 0; border-radius: 7px; background: transparent; color: #a5a6ad; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.timeframe-options button:hover, .timeframe-options button:focus-visible { background: #2b2c32; color: #fff; }
.timeframe-options button[aria-selected="true"] { background: #ffb30014; color: #ffcf70; }
.timeframe-trigger:focus-visible, .timeframe-options button:focus-visible { outline: 1px solid #a5a6ad; outline-offset: -1px; }
