:root {
  color-scheme: dark;
  --bg: #000;
  --glow: rgba(10, 132, 255, .16);
  --card: rgba(30, 30, 32, .72);
  --line: rgba(255, 255, 255, .09);
  --text: #f5f5f7;
  --sub: #9a9aa1;
  --green: #30d158;
  --red: #ff453a;
  --amber: #ffd60a;
  --accent: #0a84ff;
  --field: rgba(255, 255, 255, .08);
  --bar: rgba(22, 22, 24, .78);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f2f2f7;
    --glow: rgba(10, 132, 255, .10);
    --card: rgba(255, 255, 255, .82);
    --line: rgba(0, 0, 0, .08);
    --text: #111113;
    --sub: #6c6c72;
    --green: #1d8a3b;
    --red: #d70015;
    --amber: #a86a00;
    --accent: #0066d6;
    --field: rgba(0, 0, 0, .05);
    --bar: rgba(249, 249, 251, .82);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(90% 420px at 50% -80px, var(--glow), transparent 75%) no-repeat var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h2, p, dl, dd { margin: 0; }
button, input { font: inherit; color: inherit; }

/* ------------------------------------------------ logowanie */
.center { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.sheet { width: 100%; max-width: 360px; display: grid; gap: 14px; animation: rise .35s ease both; }
.sheet h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; text-align: center; margin-bottom: 8px; }
.sheet .muted { text-align: center; }
.logo { border-radius: 15px; margin: 0 auto; display: block; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--sub); }
input {
  width: 100%; height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px;
  background: var(--field); font-size: 16px; color: var(--text); outline: none; transition: border-color .15s;
}
input:focus { border-color: var(--accent); }
.primary {
  height: 50px; border: 0; border-radius: 13px; background: var(--accent); color: #fff; font-weight: 600;
  cursor: pointer; transition: opacity .15s, transform .1s;
}
.primary:active { transform: scale(.985); opacity: .85; }
.primary:disabled { opacity: .5; }
.error { color: var(--red); font-size: 14px; text-align: center; }
.muted { color: var(--sub); font-size: 14px; }
.spinner { width: 26px; height: 26px; border: 2.5px solid var(--line); border-top-color: var(--sub); border-radius: 50%; animation: spin .8s linear infinite; }

/* ------------------------------------------------ układ */
#app {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 92px);
}
.top { display: flex; align-items: center; justify-content: space-between; height: 32px; margin-bottom: 12px; }
.brand { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sub); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sub); transition: background .3s; }
.status.live .dot { background: var(--green); }
.status.late .dot { background: var(--amber); }
.status.off .dot { background: var(--red); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px;
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
}
.hero { padding: 18px 18px 16px; }
.label, dt { font-size: 13px; color: var(--sub); }
.equity { font-size: 38px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-top: 2px; }
.equity small { font-size: 16px; font-weight: 500; color: var(--sub); letter-spacing: 0; }
.day { font-size: 14px; margin-top: 4px; min-height: 20px; color: var(--sub); }
.split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.split dd { font-size: 15px; font-weight: 600; margin-top: 2px; }

h2 { font-size: 20px; font-weight: 700; letter-spacing: -.015em; margin: 24px 2px 10px; display: flex; align-items: center; gap: 8px; }
.count { font-size: 14px; font-weight: 500; color: var(--sub); }
.tab { animation: rise .25s ease both; }
.up { color: var(--green); }
.down { color: var(--red); }

/* ------------------------------------------------ pozycja */
.pos { margin-bottom: 10px; animation: rise .3s ease both; }
.pos-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.coin { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.chip {
  display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: var(--field); color: var(--sub);
}
.chip.short { color: var(--red); }
.chip.long { color: var(--green); }
.result { text-align: right; }
.pct { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; transition: color .2s; }
.usdt { font-size: 14px; font-weight: 500; margin-top: 2px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.facts dd { font-size: 15px; font-weight: 500; margin-top: 1px; overflow-wrap: anywhere; }
.facts .note { display: block; font-size: 12px; font-weight: 400; color: var(--sub); }
.wide { grid-column: 1 / -1; }
.empty { text-align: center; color: var(--sub); padding: 30px 16px; font-size: 15px; }

/* ------------------------------------------------ historia */
.group { margin-bottom: 18px; animation: rise .25s ease both; }
.group-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--sub); margin: 0 4px 6px; }
.group-head strong { font-weight: 600; }
.list { padding: 0; overflow: hidden; }
details + details { border-top: 1px solid var(--line); }
summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.name { font-weight: 600; }
.when { font-size: 13px; color: var(--sub); margin-top: 1px; }
.res { text-align: right; font-weight: 600; }
.res small { display: block; font-size: 13px; font-weight: 500; margin-top: 1px; }
details .facts { margin: 0 16px; padding: 12px 0 14px; border-top: 1px solid var(--line); }

/* ------------------------------------------------ sygnały */
.brand small { font-size: 13px; font-weight: 500; color: var(--sub); margin-left: 4px; }
.filters { display: grid; gap: 10px; margin-bottom: 12px; }
.seg {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 3px; border-radius: 12px;
  background: var(--field); border: 1px solid var(--line);
}
.seg button {
  min-height: 34px; border: 0; border-radius: 9px; background: none; color: var(--sub); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s; padding: 0 2px;
}
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.selects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick { gap: 4px; }
.pick span { padding-left: 2px; }
select {
  width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--field);
  color: var(--text); font: inherit; font-size: 15px; outline: none; -webkit-appearance: none; appearance: none;
}
select:focus { border-color: var(--accent); }
.summary { padding: 14px 16px; margin-bottom: 16px; }
.split.four { grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; border: 0; }
.split dd .note, .split .note { display: block; font-size: 12px; font-weight: 400; color: var(--sub); }
.sig summary { align-items: flex-start; }
.sig-l { min-width: 0; }
.sig .name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 17px; }
.sig .name .chip { margin-top: 0; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.tags .chip { margin-top: 0; }
.chip.type { color: var(--text); }
.chip.live { color: #fff; background: var(--accent); }
.sig .res { font-size: 18px; white-space: nowrap; }
.sig .res small { font-size: 11px; color: var(--sub); font-weight: 500; }
.sig .when { margin-top: 5px; }
.sig[open] summary { background: rgba(127, 127, 127, .06); }
.facts dd b { font-weight: 600; }
.chip.st-stop { color: #fff; background: var(--red); }
.chip.st-open { color: var(--amber); }

/* kolumny typów: na telefonie przesuwane palcem w bok, na komputerze obok siebie */
.jump { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 10px; padding: 0 16px 2px; scrollbar-width: none; }
.jump::-webkit-scrollbar { display: none; }
.jump button {
  flex: 0 0 auto; height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 16px; background: var(--card);
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.jump button span { color: var(--sub); font-weight: 500; margin-left: 2px; }
.board {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  margin: 0 -16px; padding: 0 16px 12px; scroll-padding: 0 16px;
}
.col { flex: 0 0 min(88vw, 380px); scroll-snap-align: start; min-width: 0; }
.col-head { padding: 2px 4px 8px; }
.col-top { display: flex; align-items: center; gap: 8px; }
.col-top .chip { margin-top: 0; }
.col-name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.col-sum { margin-left: auto; font-weight: 700; font-size: 16px; }
.col-stats { font-size: 13px; color: var(--sub); margin-top: 3px; }
.col-stats b { font-weight: 600; }
.col .list { padding: 0; }
@media (min-width: 900px) {
  #app { max-width: 1480px; }
  .filters, .summary { max-width: 720px; }
  .jump { display: none; }
  .board { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; scroll-snap-type: none; }
  .col { flex: 1 1 340px; max-width: 460px; }
}
@media (max-width: 380px) {
  .seg button { font-size: 12px; }
  .split.four { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ------------------------------------------------ konto */
.rows { padding: 2px 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row strong { font-weight: 500; color: var(--sub); text-align: right; }
.install { margin-top: 12px; display: grid; gap: 8px; }
.plain { width: 100%; height: 50px; margin-top: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); font-weight: 500; cursor: pointer; }
.danger { color: var(--red); }
.foot { margin: 14px 4px 0; font-size: 13px; }

/* ------------------------------------------------ dolna belka */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  padding: 6px 12px calc(env(safe-area-inset-bottom) + 6px);
  background: var(--bar); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
}
.tabs button {
  flex: 1; max-width: 186px; min-height: 48px; border: 0; background: none; color: var(--sub); cursor: pointer;
  display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 500; transition: color .15s;
}
.tabs button.on { color: var(--accent); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
