:root {
  --bg: #06100c;
  --text: #f3fff8;
  --muted: #82988f;
  --line: rgba(255,255,255,.07);
  --green: #43e794;
  --red: #ff6655;
  --amber: #ffcf66;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% -5%, #163b2b 0%, var(--bg) 38%, #030705 100%);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}

body { min-height: 100vh; }

.app {
  width: min(100%, 440px);
  min-height: 100vh;
  margin: 0 auto;
  padding:
    max(14px, env(safe-area-inset-top))
    12px
    max(24px, env(safe-area-inset-bottom));
}

.hidden { display: none !important; }

.header,
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.eyebrow {
  color: var(--green);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .15em;
}

h1 {
  margin: 3px 0 0;
  font-size: clamp(16px, 4.8vw, 24px);
  letter-spacing: -.045em;
  white-space: nowrap;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 999px;
  border: 1px solid rgba(67,231,148,.17);
  background: rgba(67,231,148,.07);
  color: #cffff0;
  font-size: 10px;
  font-weight: 800;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.demo-note {
  margin-top: 13px;
  padding: 10px 11px;
  border: 1px solid rgba(255,255,255,.065);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.42;
}

.section-head {
  margin: 18px 2px 10px;
}

.section-title {
  font-size: 15px;
  font-weight: 800;
}

.section-sub {
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
}

.signals {
  display: grid;
  gap: 9px;
}

.signal-card {
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(19,43,33,.98), rgba(8,18,14,.98));
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  overflow: hidden;
}

.signal-main {
  display: block;
  width: 100%;
  border: 0;
  padding: 13px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.signal-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 10px 9px;
}

.delete-signal {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  padding: 0;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  cursor: pointer;
}

.delete-signal svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.delete-signal:hover {
  color: var(--red);
  border-color: rgba(255,102,85,.2);
  background: rgba(255,102,85,.07);
}


.card-result-points {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

.card-countdown.win .card-result-points {
  color: rgba(67,231,148,.72);
}

.card-countdown.lose .card-result-points {
  color: rgba(255,102,85,.72);
}


.signal-top,
.signal-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.signal-pair {
  font-size: 16px;
  font-weight: 850;
  letter-spacing: -.025em;
}

.signal-time {
  color: var(--muted);
  font-size: 10px;
}

.signal-bottom {
  margin-top: 11px;
}

.direction {
  min-width: 54px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 900;
}

.direction.buy {
  color: #baffd8;
  background: rgba(67,231,148,.12);
  border: 1px solid rgba(67,231,148,.17);
}

.direction.sell {
  color: #ffd0c9;
  background: rgba(255,102,85,.12);
  border: 1px solid rgba(255,102,85,.17);
}

.signal-meta {
  display: flex;
  gap: 15px;
  color: var(--muted);
  font-size: 10px;
}

.signal-meta b {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 13px;
}

.card-countdown {
  min-width: 78px;
  text-align: right;
}

.card-countdown-label {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.card-countdown-value {
  margin-top: 2px;
  color: var(--amber);
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.card-countdown.active .card-countdown-value {
  color: var(--green);
}

.empty {
  padding: 30px 15px;
  text-align: center;
  border: 1px dashed rgba(255,255,255,.1);
  border-radius: 18px;
  color: var(--muted);
  font-size: 12px;
}

.detail-header {
  justify-content: flex-start;
}

.back-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: 21px;
  cursor: pointer;
}

.detail-title-wrap { flex: 1; }

.detail-pair {
  font-size: 18px;
  font-weight: 850;
}

.detail-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.signal-timer {
  margin-top: 14px;
  padding: 13px 14px 12px;
  border-radius: 18px;
  text-align: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  transition: .2s ease;
}

.signal-timer.waiting {
  border-color: rgba(255,207,102,.15);
  background: rgba(255,207,102,.045);
}

.signal-timer.active {
  border-color: rgba(67,231,148,.16);
  background: rgba(67,231,148,.05);
}

.signal-timer.win {
  border-color: rgba(67,231,148,.25);
  background: rgba(67,231,148,.09);
}

.signal-timer.lose {
  border-color: rgba(255,102,85,.25);
  background: rgba(255,102,85,.09);
}

.timer-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .09em;
}

.timer-value {
  margin-top: 2px;
  font-size: 31px;
  line-height: 1.1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
}

.signal-timer.win .timer-value {
  color: var(--green);
}

.signal-timer.lose .timer-value {
  color: var(--red);
}

.timer-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.signal-summary {
  margin-top: 9px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.signal-summary > div {
  padding: 11px 9px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
}

.summary-label {
  color: var(--muted);
  font-size: 9px;
}

.summary-value {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 850;
}

.summary-value.small {
  font-size: 13px;
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}

.chart-card {
  margin-top: 10px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(6,16,12,.78);
}

.chart {
  height: clamp(330px, 48vh, 420px);
  width: 100%;
}

.analysis-card {
  margin-top: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(14,31,24,.9);
}

.analysis-title {
  font-size: 13px;
  font-weight: 850;
}

.analysis-text {
  white-space: pre-line;
  margin-top: 7px;
  color: #a8bbb3;
  font-size: 11px;
  line-height: 1.55;
}

@media (max-height: 720px) {
  .chart { height: 300px; }
  .timer-value { font-size: 27px; }
}


.card-countdown.win .card-countdown-value {
  color: var(--green);
}

.card-countdown.lose .card-countdown-value {
  color: var(--red);
}


.card-countdown.win .card-countdown-value {
  color: var(--green);
}

.card-countdown.lose .card-countdown-value {
  color: var(--red);
}


.signal-pair-wrap {
  min-width: 0;
}

.signal-pair-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.signal-top-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.copy-pair,
.delete-signal {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 0;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
}

.copy-pair svg,
.delete-signal svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.copy-pair:hover,
.copy-pair.copied {
  color: var(--green);
  border-color: rgba(67,231,148,.2);
  background: rgba(67,231,148,.07);
}

.delete-signal:hover {
  color: var(--red);
  border-color: rgba(255,102,85,.2);
  background: rgba(255,102,85,.07);
}

.signal-actions {
  display: none;
}

.card-result-points {
  display: none;
}

.card-countdown.win .card-countdown-value {
  color: var(--green);
}

.card-countdown.lose .card-countdown-value {
  color: var(--red);
}

.detail-pair {
  cursor: pointer;
  transition: opacity .15s ease, color .15s ease;
}

.detail-pair:hover {
  opacity: .9;
}

.detail-pair.copied {
  color: var(--green);
}


/* Card layout fix: actions must not break the signal card geometry. */
.signal-card {
  position: relative;
}

.signal-main {
  width: 100%;
  display: block;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.signal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.signal-pair-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.signal-pair-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.signal-pair {
  min-width: 0;
  white-space: nowrap;
}

.signal-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex: 0 0 auto;
}

.signal-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.signal-meta {
  display: flex;
  align-items: flex-end;
  gap: 18px;
}

.card-countdown {
  margin-left: auto;
  text-align: right;
  flex: 0 0 auto;
}

.copy-pair,
.delete-signal {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
}

/* Animated top notification after copying a pair. */
.copy-toast {
  position: fixed;
  z-index: 9999;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100vw - 32px);
  padding: 11px 15px;
  border: 1px solid rgba(74, 235, 157, .18);
  border-radius: 13px;
  background: rgba(12, 39, 29, .96);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .32);
  color: #f2fff8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -150%);
  transition:
    transform .28s cubic-bezier(.2,.8,.2,1),
    opacity .22s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.copy-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.copy-toast-icon {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(74, 235, 157, .14);
  color: var(--green);
  font-size: 12px;
}

@media (max-width: 380px) {
  .signal-bottom {
    gap: 8px;
  }

  .signal-meta {
    gap: 12px;
  }

  .copy-toast {
    font-size: 11px;
  }
}


.pagination {
  margin: 14px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.page-btn {
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.045);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  transition:
    opacity .15s ease,
    transform .15s ease,
    background .15s ease;
}

.page-btn:active:not(:disabled) {
  transform: scale(.96);
}

.page-btn:disabled {
  opacity: .28;
  cursor: default;
}

.page-info {
  min-width: 58px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.pagination.hidden {
  display: none;
}


/* Smooth screen transitions */
.screen {
  transition: opacity .25s ease, transform .35s ease;
}

.screen-enter {
  animation: screenEnter .45s cubic-bezier(.22,1,.36,1);
}

.screen-leave {
  animation: screenLeave .12s ease forwards;
}

.signal-card {
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.signal-card:active {
  transform: scale(.97);
}

@keyframes screenEnter {
  from {
    opacity: 0;
    transform: translateX(45px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes screenLeave {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-20px);
  }
}


/* New messenger-like page transition */
.page-slide-in {
  animation: pageSlideIn .5s cubic-bezier(.16,1,.3,1);
}

.page-slide-out {
  animation: pageSlideOut .26s ease forwards;
}

@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%) scale(.96);
    border-radius: 30px;
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
    border-radius: 0;
  }
}

@keyframes pageSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-25%);
  }
}

/* Bigger BUY / SELL signal badge */


.signal-summary {
  margin-top: 14px;
}

#signalTimer {
  position: relative;
  margin-top: 18px;
  padding-top: 42px;
}

#signalTimer::before {
  content: attr(data-direction);
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  padding: 8px 0;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 950;
  text-align: center;
  letter-spacing: .08em;
  background: rgba(67,231,148,.12);
  color: #baffd8;
  border: 1px solid rgba(67,231,148,.22);
}

.signal-timer.sell::before {
  background: rgba(255,102,85,.12);
  color: #ffd0c9;
  border-color: rgba(255,102,85,.22);
}


/* Signal open transition */
.screen {
  overflow-x: hidden;
}

.page-enter {
  animation: messengerOpen .5s cubic-bezier(.16,1,.3,1);
}

.page-exit {
  animation: messengerClose .22s ease forwards;
}

@keyframes messengerOpen {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes messengerClose {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-20%);
  }
}

.signal-main {
  transition: transform .15s ease, filter .15s ease;
}

.signal-main:active {
  transform: scale(.96);
  filter: brightness(1.15);
}

/* Better direction badge on detail */
.detail-header .direction {
  min-width: 120px;
  padding: 12px 18px;
  font-size: 15px;
  border-radius: 14px;
}

.signal-timer {
  margin-top: 24px;
}


/* BUY / SELL signal badge */
.detail-header .direction {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 130px;
  height: 42px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: .08em;
  transition: .25s ease;
}

.detail-header .direction.buy {
  color: #baffd8;
  background: rgba(67,231,148,.16);
  border: 1px solid rgba(67,231,148,.35);
  box-shadow: 0 0 20px rgba(67,231,148,.12);
}

.detail-header .direction.sell {
  color: #ffd0c9;
  background: rgba(255,102,85,.16);
  border: 1px solid rgba(255,102,85,.35);
  box-shadow: 0 0 20px rgba(255,102,85,.12);
}

.detail-header {
  margin-bottom: 14px;
}

/* Final signal layout */
#signalTimer::before {
  display: none !important;
}

#signalTimer {
  margin-top: 18px;
  padding: 14px;
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#signalTimer .direction {
  order: -1;
  width: 100%;
  height: 38px;
  margin-bottom: 8px;
}

#signalTimer.waiting {
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.07);
}

#signalTimer .timer-label {
  color: var(--muted);
}

#signalTimer .timer-value {
  color: var(--text);
}


/* Direction moved above timer */
#detailDirection {
  margin: 14px 0 10px;
  width: 100%;
  height: 48px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:16px;
  font-size:17px;
  font-weight:950;
  letter-spacing:.12em;
}

#detailDirection.buy {
 color:#baffd8;
 background:rgba(67,231,148,.12);
 border:1px solid rgba(67,231,148,.3);
}

#detailDirection.sell {
 color:#ffd0c9;
 background:rgba(255,102,85,.12);
 border:1px solid rgba(255,102,85,.3);
}

.signal-timer {
 background:rgba(255,255,255,.035);
 border-color:var(--line);
}

.signal-timer.waiting {
 background:rgba(255,207,102,.045);
 border-color:rgba(255,207,102,.18);
}

.signal-timer.active {
 background:rgba(255,255,255,.035);
 border-color:var(--line);
}

.page-back {
 animation: pageBack .25s ease forwards;
}

.page-return {
 animation: pageReturn .5s cubic-bezier(.16,1,.3,1);
}

@keyframes pageBack {
 from {opacity:1; transform:translateX(0);}
 to {opacity:0; transform:translateX(100%);}
}

@keyframes pageReturn {
 from {opacity:0; transform:translateX(-25%);}
 to {opacity:1; transform:translateX(0);}
}

/* result colors */
.signal-timer.win + * {}



/* Signal timer card states */
.signal-timer.waiting {
  border-color: rgba(255, 207, 102, .22);
  background: rgba(255, 207, 102, .055);
}

.signal-timer.waiting .timer-label,
.signal-timer.waiting .timer-hint {
  color: rgba(255, 240, 190, .75);
}

.signal-timer.waiting .timer-value {
  color: #ffcf66;
}

/* When trade is active */
.signal-timer.active {
  border-color: rgba(255, 207, 102, .18);
  background: rgba(255, 207, 102, .045);
}

.signal-timer.active .timer-value {
  color: #ffcf66;
}

/* Win */
.signal-timer.win {
  border-color: rgba(67, 231, 148, .28);
  background: rgba(67, 231, 148, .075);
}

.signal-timer.win .timer-value {
  color: #43e794;
}

/* Lose */
.signal-timer.lose {
  border-color: rgba(255, 102, 85, .28);
  background: rgba(255, 102, 85, .075);
}

.signal-timer.lose .timer-value {
  color: #ff6655;
}


/* Final timer card colors: only background changes, text stays neutral */
.signal-timer.waiting,
.signal-timer.active {
  border-color: rgba(255, 207, 102, .22);
  background: rgba(255, 207, 102, .08);
}

.signal-timer.waiting .timer-label,
.signal-timer.active .timer-label,
.signal-timer.waiting .timer-hint,
.signal-timer.active .timer-hint {
  color: var(--muted);
}

.signal-timer.waiting .timer-value,
.signal-timer.active .timer-value {
  color: var(--text);
}

/* WIN */
.signal-timer.win {
  border-color: rgba(67, 231, 148, .28);
  background: rgba(67, 231, 148, .09);
}

.signal-timer.win .timer-label,
.signal-timer.win .timer-hint {
  color: var(--muted);
}

.signal-timer.win .timer-value {
  color: var(--text);
}

/* LOSE */
.signal-timer.lose {
  border-color: rgba(255, 102, 85, .28);
  background: rgba(255, 102, 85, .09);
}

.signal-timer.lose .timer-label,
.signal-timer.lose .timer-hint {
  color: var(--muted);
}

.signal-timer.lose .timer-value {
  color: var(--text);
}


/* Fix lose result card color */
.signal-timer.lose {
  border-color: rgba(255, 102, 85, .45) !important;
  background: rgba(255, 102, 85, .14) !important;
  box-shadow: 0 0 30px rgba(255, 102, 85, .08);
}

.signal-timer.win {
  border-color: rgba(67, 231, 148, .45) !important;
  background: rgba(67, 231, 148, .14) !important;
  box-shadow: 0 0 30px rgba(67, 231, 148, .08);
}
