/* Тёмная тема брокерского приложения. Мобильная вёрстка: крупные строки,
   тап-зоны от 48px, никаких эмодзи — только векторные иконки. */

:root {
  --bg: #08080a;
  --bg-2: #101013;
  --card: #141417;
  --card-2: #1b1b1f;
  --line: rgba(255, 255, 255, 0.07);
  --fg: #ffffff;
  --fg-2: #8d8d96;
  --fg-3: #5c5c66;
  --accent: #ffd60a;
  --green: #32d778;
  --green-dim: rgba(50, 215, 120, 0.14);
  --red: #ff453a;
  --red-dim: rgba(255, 69, 58, 0.14);
  --orange: #e9a33e;
  /* кривые как в iOS: плавный выход и лёгкая пружина */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.42, 0.64, 1);
  --tab-h: 66px;
  --pad: 16px;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }

#app { height: 100%; }

.screen {
  position: absolute;
  inset: 0;
  bottom: var(--tab-h);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  opacity: 0;
  visibility: hidden;
  transform: translateX(calc(var(--dir, 1) * 18px)) scale(0.99);
  transition: opacity 0.2s ease, transform 0.34s var(--ease);
}
.screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--pad) 34px;
}

/* ---------- шапка счёта ---------- */

.acc {
  padding: 20px var(--pad) 4px;
  background: radial-gradient(120% 90% at 50% -20%, rgba(255, 214, 10, 0.09), transparent 62%);
}
.acc-row { display: flex; align-items: flex-start; gap: 12px; }
.acc-main { flex: 1; min-width: 0; }
.acc-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.acc-label { color: var(--fg-2); font-size: 15px; margin-top: 3px; }
.acc-chip {
  flex-shrink: 0;
  max-width: 52%;
  margin-top: 5px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: var(--green-dim);
  color: var(--green);
}
.acc-chip .sep { opacity: 0.55; margin: 0 5px; }
.acc.is-down .acc-chip { background: var(--red-dim); color: var(--red); }

.acc-spark { width: 100%; height: 54px; display: block; margin: 10px 0 2px; }

/* ---------- переключатели периодов ---------- */

.periods { display: flex; gap: 6px; padding: 6px 0 2px; }
.period {
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--fg-2);
  background: transparent;
}
.period.is-active { background: var(--card-2); color: var(--fg); font-weight: 600; }

.range { display: flex; gap: 6px; padding: 8px 0 14px; }
.range-wide { padding: 0 var(--pad) 12px; }
.range-btn {
  flex: 1;
  padding: 10px 4px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--fg-2);
  background: var(--card);
  border: 1px solid transparent;
}
.range-btn { transition: background 0.22s var(--ease), color 0.2s ease, transform 0.16s var(--ease); }
.range-btn:active { transform: scale(0.96); }
.range-btn.is-active { background: var(--card-2); color: var(--fg); border-color: var(--line); }

.segments { display: flex; gap: 22px; padding: 14px 0 0; overflow-x: auto; scrollbar-width: none; }
.segments::-webkit-scrollbar { display: none; }
.seg {
  position: relative;
  padding: 4px 0 12px;
  color: var(--fg-2);
  font-size: 16px;
  white-space: nowrap;
}
.seg.is-active { color: var(--fg); }
.seg.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--fg);
}

.head { padding: 20px var(--pad) 12px; }
.head h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.8px; }
.head-sub { color: var(--fg-2); font-size: 14px; margin-top: 4px; }

/* ---------- карточки и строки ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 12px;
}
.card-title {
  padding: 15px 16px 8px;
  color: var(--fg-2);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  min-height: 70px;
  position: relative;
  width: 100%;
  text-align: left;
}
.row + .row::before {
  content: '';
  position: absolute;
  left: 72px; right: 0; top: 0;
  height: 1px;
  background: var(--line);
}
.row { transition: background 0.18s ease, transform 0.18s var(--ease); }
.row:active { background: var(--card-2); transform: scale(0.988); }

.screen.is-active .card .row { animation: row-in 0.32s var(--ease) backwards; }
.card .row:nth-child(2) { animation-delay: 0.02s; }
.card .row:nth-child(3) { animation-delay: 0.04s; }
.card .row:nth-child(4) { animation-delay: 0.06s; }
.card .row:nth-child(5) { animation-delay: 0.08s; }
.card .row:nth-child(6) { animation-delay: 0.1s; }
.card .row:nth-child(7) { animation-delay: 0.12s; }
.card .row:nth-child(n + 8) { animation-delay: 0.14s; }
@keyframes row-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.row[disabled] { opacity: 0.42; }
.row[disabled]:active { background: none; }

.ava {
  width: 46px; height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
}
.ava::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 55%);
  pointer-events: none;
}
.ava svg { width: 74%; height: 74%; display: block; }
.ava svg.full { width: 100%; height: 100%; }

.row-main { flex: 1; min-width: 0; }
/* названия у бумаг длинные — показываем целиком, с переносом, без многоточия */
.row-name {
  font-size: 15.5px;
  line-height: 1.22;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.row-sub { font-size: 13px; color: var(--orange); margin-top: 4px; line-height: 1.35; overflow-wrap: anywhere; }
.row-sub.muted { color: var(--fg-2); }

.row-right { text-align: right; flex-shrink: 0; max-width: 42%; font-variant-numeric: tabular-nums; }
.row-val { font-size: 16.5px; white-space: nowrap; }
.row-chg { font-size: 13px; margin-top: 3px; white-space: nowrap; }

.spark { width: 42px; height: 26px; flex-shrink: 0; opacity: 0.9; }

.up { color: var(--green); }
.down { color: var(--red); }
.dim { color: var(--fg-2); }

.empty { padding: 32px 22px; color: var(--fg-2); font-size: 15px; text-align: center; line-height: 1.5; }

.rank-no {
  width: 46px; height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
  background: var(--card-2);
  color: var(--fg-2);
}
.rank-no.gold { background: rgba(255, 214, 10, 0.16); color: var(--accent); }

/* ---------- плитки ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}
.tile-l { color: var(--fg-2); font-size: 12.5px; }
.tile-v { font-size: 20px; font-weight: 600; margin-top: 5px; font-variant-numeric: tabular-nums; }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tiles-3 .tile { padding: 13px 8px; text-align: center; }
.tiles-3 .tile-v { font-size: 17px; }

/* ---------- кнопки ---------- */

.btn {
  display: block;
  width: 100%;
  padding: 17px;
  border-radius: 17px;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  background: var(--card-2);
  border: 1px solid var(--line);
}
.btn { transition: transform 0.18s var(--ease), opacity 0.18s ease; }
.btn:active { opacity: 0.8; transform: scale(0.975); }
.btn-green { background: var(--green); border-color: transparent; color: #04240f; }
.btn-red { background: var(--red); border-color: transparent; color: #2b0402; }
.btn[disabled] { opacity: 0.4; }
.btn + .btn { margin-top: 10px; }

.pills { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px; gap: 4px; margin: 16px 0 14px; }
.pill { flex: 1; padding: 12px 6px; border-radius: 12px; text-align: center; font-size: 15px; color: var(--fg-2); }
.pill { transition: background 0.24s var(--ease), color 0.2s ease; }
.pill.is-active { background: var(--card-2); color: var(--fg); font-weight: 600; }
.pill.is-active[data-side='long'] { background: var(--green); color: #04240f; }
.pill.is-active[data-side='short'] { background: var(--red); color: #2b0402; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  flex: 1;
  min-width: 54px;
  padding: 11px 8px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--fg-2);
  font-size: 14.5px;
  text-align: center;
}
.chip { transition: background 0.2s ease, color 0.2s ease, transform 0.18s var(--ease); }
.chip:active { transform: scale(0.95); }
.chip.is-active { background: var(--accent); border-color: transparent; color: #191500; font-weight: 700; }

/* ---------- поля и ползунки ---------- */

.field { margin-bottom: 16px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 9px; }
.field-label { font-size: 13.5px; color: var(--fg-2); }
.field-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.input {
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}
.input:focus { outline: none; border-color: rgba(255, 214, 10, 0.55); }

.slider { position: relative; height: 34px; display: flex; align-items: center; --track: var(--accent); --fill: 50%; }
.slider input[type='range'] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 34px;
  margin: 0;
}
.slider input[type='range']::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--track) 0 var(--fill), rgba(255, 255, 255, 0.12) var(--fill) 100%);
}
.slider input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px; height: 28px;
  margin-top: -10px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--track);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
}
.slider input[type='range']::-moz-range-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); }
.slider input[type='range']::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--track); }
.slider input[type='range']::-moz-range-thumb { width: 22px; height: 22px; border: 3px solid var(--track); border-radius: 50%; background: #fff; }
.slider.green { --track: var(--green); }
.slider.red { --track: var(--red); }

.summary { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 2px 15px; margin-bottom: 14px; }
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.summary-row + .summary-row { border-top: 1px solid var(--line); }
.summary-row > span { color: var(--fg-2); }

/* ---------- кликер ---------- */

.clicker-top { text-align: center; padding: 20px 0 2px; }
.clicker-balance { font-size: 40px; font-weight: 700; letter-spacing: -1.2px; font-variant-numeric: tabular-nums; }
.clicker-hint { color: var(--fg-2); font-size: 13.5px; margin-top: 6px; }

.coin {
  position: relative;
  width: min(60vw, 240px);
  aspect-ratio: 1;
  margin: 22px auto 6px;
  border-radius: 50%;
  user-select: none;
  filter: drop-shadow(0 18px 40px rgba(255, 200, 40, 0.24));
  transition: transform 0.07s ease;
}
.coin svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.coin.is-tapped { transform: scale(0.94); }
.coin.is-dead { filter: grayscale(1) brightness(0.45); }

.pop {
  position: absolute;
  pointer-events: none;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
  animation: pop 0.85s ease-out forwards;
}
@keyframes pop {
  0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -78px) scale(1.3); }
}

.energy { display: flex; align-items: center; gap: 10px; margin: 16px 0 14px; font-size: 13.5px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.energy .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }
.energy .ico svg { width: 100%; height: 100%; display: block; }
.energy-bar { flex: 1; height: 9px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.energy-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #f0b90b, #ffe873); transition: width 0.2s linear; }

/* ---------- нижнее меню ---------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(14, 14, 17, 0.92);
  backdrop-filter: blur(24px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tab-glow {
  position: absolute;
  top: 6px;
  left: 0;
  width: 25%;
  height: calc(var(--tab-h) - 12px);
  padding: 0 12px;
  transition: transform 0.42s var(--spring);
  pointer-events: none;
}
.tab-glow::before {
  content: '';
  display: block;
  height: 100%;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 214, 10, 0.18), rgba(255, 214, 10, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255, 214, 10, 0.22);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--fg-3);
  font-size: 10.5px;
  position: relative;
  z-index: 1;
  transition: color 0.2s;
}
.tab i { display: block; width: 25px; height: 25px; }
.tab svg {
  width: 100%; height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab i { transition: transform 0.34s var(--spring); }
.tab.is-active { color: var(--accent); }
.tab.is-active i { transform: translateY(-2px) scale(1.08); }
.tab.is-active span { font-weight: 600; }

/* ---------- карточка бумаги ---------- */

.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.sheet-wrap.is-hidden { display: none; }
.sheet-back { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.68); animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: relative;
  width: 100%;
  max-height: 94vh;
  background: var(--bg-2);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  flex-direction: column;
  animation: rise 0.42s var(--ease);
  touch-action: none;
}
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet.is-dragging { animation: none; transition: none; }
.sheet.is-settling { animation: none; transition: transform 0.4s var(--ease); }

.sheet-grab { padding: 11px 0 5px; display: flex; justify-content: center; flex-shrink: 0; }
.sheet-grab::before { content: ''; width: 42px; height: 4px; border-radius: 2px; background: #46464c; }
.sheet-body { padding: 6px 16px calc(26px + env(safe-area-inset-bottom)); overflow-y: auto; }

.sheet-head { display: flex; align-items: center; gap: 13px; }
.sheet-name { font-size: 18px; line-height: 1.25; }
.sheet-tick { font-size: 13px; color: var(--fg-2); margin-top: 3px; }
.sheet-price { font-size: 34px; font-weight: 700; letter-spacing: -1px; margin-top: 14px; font-variant-numeric: tabular-nums; }
.sheet-chg { font-size: 14px; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* шесть таймфреймов полными словами не влезают в строку — раскладываем в две по три */
.tf { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 8px; }
.tf-btn {
  flex: 1 1 calc(33.333% - 4px);
  padding: 9px 6px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-2);
  background: var(--card);
  border: 1px solid transparent;
  white-space: nowrap;
}
.tf-btn.is-active { background: var(--card-2); color: var(--accent); border-color: rgba(255, 214, 10, 0.28); }

.chart-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px 6px 4px;
  margin-bottom: 12px;
}
.chart { width: 100%; height: 210px; display: block; }
.chart-foot { display: flex; justify-content: space-between; padding: 7px 10px 2px; font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }

/* ---------- лента ---------- */

.note { padding: 13px 15px; font-size: 14.5px; line-height: 1.42; position: relative; display: flex; gap: 10px; }
.note + .note::before {
  content: '';
  position: absolute;
  left: 15px; right: 0; top: 0;
  height: 1px;
  background: var(--line);
}
.note-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--fg-3); }
.note-dot.pump, .note-dot.win, .note-dot.div { background: var(--green); }
.note-dot.dump, .note-dot.loss, .note-dot.liq { background: var(--red); }
.note-dot.star { background: var(--accent); }
.note-time { color: var(--fg-3); font-size: 12.5px; margin-top: 4px; }

/* ---------- уведомления ---------- */

.toast-wrap {
  position: fixed;
  left: 10px; right: 10px;
  top: calc(10px + env(safe-area-inset-top));
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  background: rgba(32, 32, 36, 0.97);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 15px;
  font-size: 14.5px;
  line-height: 1.35;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
  animation: toast-in 0.42s var(--spring);
}
.toast .bar { width: 3px; align-self: stretch; border-radius: 2px; background: var(--fg-3); flex-shrink: 0; }
.toast.ok .bar { background: var(--green); }
.toast.err .bar { background: var(--red); }
.toast.warn .bar { background: var(--accent); }
.toast b { display: block; font-size: 13px; margin-bottom: 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

.disclaimer { color: var(--fg-3); font-size: 12.5px; line-height: 1.5; text-align: center; padding: 12px 10px 0; }

/* ---------- подсветка изменения цены ---------- */

@keyframes flash-up { from { color: var(--green); } to { color: var(--fg); } }
@keyframes flash-down { from { color: var(--red); } to { color: var(--fg); } }
.flash-up { animation: flash-up 0.75s ease-out; }
.flash-down { animation: flash-down 0.75s ease-out; }

/* ---------- ежедневная награда и приглашения ---------- */

.card-pad { padding: 0 14px 14px; }

.dots { display: flex; gap: 6px; margin: 2px 0 12px; }
.dot {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
}
.dot.is-done { background: var(--accent); }
.dot.is-next { background: rgba(255, 214, 10, 0.4); }

.row-chg .sep { opacity: 0.5; margin: 0 4px; }

/* ---------- перевод денег и золотой статус ---------- */

.gold-banner { border-color: rgba(255, 214, 10, 0.32); background: linear-gradient(180deg, rgba(255, 214, 10, 0.08), var(--card) 60%); }
.btn-gold { background: var(--accent); border-color: transparent; color: #191500; }

.mini {
  margin-top: 6px;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--fg-2);
  background: var(--card-2);
  border: 1px solid var(--line);
}
.mini:active { opacity: 0.7; }

/* шесть вкладок: подписи чуть мельче */
.tabbar .tab { font-size: 9.5px; }
.tabbar .tab i { width: 23px; height: 23px; }
.tab-glow { padding: 0 6px; }

/* подсказка-ссылка внутри карточки бумаги */
.hint-row {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border-radius: 15px;
  background: var(--card);
  border: 1px dashed rgba(255, 214, 10, 0.3);
  color: var(--fg-2);
  font-size: 13.5px;
  line-height: 1.4;
  text-align: center;
}
.hint-row:active { opacity: 0.7; }

/* монета кликера пружинит */
.coin { transition: transform 0.34s var(--spring); }
.coin.is-tapped { transform: scale(0.93); transition: transform 0.07s ease; }

/* карточка бумаги подъезжает мягко */
.sheet-back { transition: opacity 0.3s ease; }

/* если в системе выключены анимации — уважаем настройку */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
