/* Графики криптовалют в одном окне — тёмная тема по умолчанию, светлая — класс .light на <html> */
:root {
  --bg: #0b0f17; --panel: #121826; --panel-2: #182032; --line: #242e44; --text: #e6ebf5; --muted: #8b96ad;
  --accent: #3b82f6; --accent-2: #60a5fa; --up: #22c55e; --down: #ef4444;
  --bar-h: 56px; --foot-h: 0px; --gap: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
:root.light {
  --bg: #eef1f6; --panel: #ffffff; --panel-2: #f4f6fa; --line: #dbe1ea; --text: #131a26; --muted: #66708a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--accent-2); }
button, select, input { font: inherit; color: inherit; }

/* Верхняя панель */
.bar { height: var(--bar-h); display: flex; align-items: center; gap: 14px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-size: 17px; white-space: nowrap; }
.logo svg { width: 30px; height: 30px; flex: none; }
.logo b { color: var(--accent-2); }
.ctl { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.ctl::-webkit-scrollbar { display: none; }
.sel { display: flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 0 4px 0 10px; height: 36px; }
.sel span { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.sel select { background: transparent; border: 0; height: 34px; outline: none; cursor: pointer; padding-right: 4px; }
.sel select option { background: var(--panel); color: var(--text); }
.btn { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Сетка графиков */
.grid { height: calc(100vh - var(--bar-h) - var(--foot-h)); height: calc(100dvh - var(--bar-h) - var(--foot-h)); display: grid; gap: var(--gap); padding: var(--gap); }
.g1 { grid-template: 1fr / 1fr; }
.g2 { grid-template: 1fr / repeat(2, 1fr); }
.g3 { grid-template: 1fr / repeat(3, 1fr); }
.g4 { grid-template: repeat(2, 1fr) / repeat(2, 1fr); }
.g6 { grid-template: repeat(2, 1fr) / repeat(3, 1fr); }
.g8 { grid-template: repeat(2, 1fr) / repeat(4, 1fr); }
.g9 { grid-template: repeat(3, 1fr) / repeat(3, 1fr); }
.cell { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cell__bar { height: 32px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 8px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.cell__sym { background: none; border: 0; cursor: pointer; font-weight: 700; padding: 4px; border-radius: 6px; }
.cell__sym small { color: var(--muted); font-weight: 400; font-size: 11px; }
.cell__sym:hover { background: var(--panel); }
.cell__acts button { width: 28px; height: 26px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; }
.cell__acts button:hover { background: var(--panel); color: var(--text); }
.cell__chart { flex: 1; min-height: 0; }
.cell__chart > div, .cell__chart iframe { width: 100% !important; height: 100% !important; }
.cell__load { height: 100%; display: grid; place-items: center; color: var(--muted); padding: 12px; text-align: center; }
.cell--empty { border-style: dashed; }
.cell__add { flex: 1; display: grid; place-content: center; gap: 6px; background: none; border: 0; color: var(--muted); cursor: pointer; }
.cell__add b { font-size: 34px; line-height: 1; color: var(--accent-2); }
.cell__add:hover { color: var(--text); background: var(--panel-2); }
.grid.has-solo { grid-template: 1fr / 1fr; }
.grid.has-solo .cell:not(.is-solo) { display: none; }

/* Подвал */
.foot { height: var(--foot-h); display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 10px; color: var(--muted); font-size: 11.5px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Боковые панели и окна */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 50; padding: 14px 16px; overflow-y: auto; box-shadow: -10px 0 40px rgba(0, 0, 0, .3); }
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.drawer h2 { font-size: 18px; margin: 0; }
.drawer h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0; }
.small { font-size: 12px; }
.muted { color: var(--muted); padding: 10px 0; }
.tabs { display: flex; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tab { flex: 1; height: 32px; border: 0; background: none; border-radius: 7px; cursor: pointer; color: var(--muted); font-size: 13px; }
.tab.is-on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.movers { list-style: none; margin: 0; padding: 0; counter-reset: m; }
.movers li { counter-increment: m; }
.movers button { width: 100%; display: grid; grid-template-columns: 26px 1fr auto 76px; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; }
.movers button::before { content: counter(m); grid-row: 1 / 3; color: var(--muted); font-size: 12px; }
.movers button:hover { background: var(--panel-2); }
.movers b { font-size: 15px; }
.movers .price { grid-column: 2; font-size: 12px; color: var(--muted); }
.movers .chg { grid-column: 4; grid-row: 1; text-align: right; font-weight: 700; }
.movers .vol { grid-column: 4; grid-row: 2; text-align: right; font-size: 11.5px; color: var(--muted); }
.up { color: var(--up); } .down { color: var(--down); }
.save { display: flex; gap: 8px; }
.save input, #q { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); outline: none; }
.save input:focus, #q:focus { border-color: var(--accent); }
.sets { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sets li { display: flex; gap: 6px; }
.set { flex: 1; text-align: left; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; display: grid; gap: 2px; }
.set:hover { border-color: var(--accent); }
.set span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.del { width: 36px; border-radius: 9px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; }
.del:hover { color: var(--down); border-color: var(--down); }
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 14px 14px; pointer-events: none; }
.modal__box { pointer-events: auto; width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
#q { width: 100%; height: 44px; font-size: 16px; }
.results { list-style: none; margin: 10px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.results button { width: 100%; display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; }
.results button span { color: var(--muted); font-size: 12.5px; }
.results button:hover, .results button.is-first { background: var(--panel-2); }
.toast { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }

/* Телефон и узкие экраны: графики друг под другом, страница прокручивается */
@media (max-width: 900px) {
  .btn span, .sel span { display: none; }
  .sel { padding-left: 4px; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .bar { position: sticky; top: 0; z-index: 30; height: auto; min-height: var(--bar-h); flex-wrap: wrap; padding: 8px 10px; gap: 8px; }
  .logo span { display: none; }
  .ctl { margin-left: 0; flex: 1; }
  .grid, .grid[class] { height: auto; display: flex; flex-direction: column; }
  .cell { height: 70vh; height: 70dvh; flex: none; }
  .grid.g1 .cell { height: calc(100dvh - 120px); }
  .grid.has-solo .cell.is-solo { height: calc(100dvh - 120px); }
  .foot { height: auto; white-space: normal; padding: 10px; }
}

/* ===== Контентные страницы (монеты, движения, наборы, статьи) ===== */
.logo-wrap { margin: 0; font: inherit; font-weight: 400; }
.bar--site { position: sticky; top: 0; z-index: 30; }
.site-nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 8px 11px; border-radius: 8px; white-space: nowrap; }
.site-nav a:hover { color: var(--text); background: var(--panel-2); }
.site-nav a[aria-current] { color: var(--text); background: var(--panel-2); }
.page-in { max-width: 860px; margin: 0 auto; padding: 18px 16px 40px; line-height: 1.6; font-size: 15.5px; }
.page-in--wide { max-width: 1200px; }
.page-in h1 { font-size: 28px; line-height: 1.25; margin: 6px 0 12px; }
.page-in h2 { font-size: 21px; line-height: 1.3; margin: 28px 0 10px; }
.page-in .muted:not(td) { padding: 0; }   /* в ячейках таблиц muted — только цвет, отступы как у остальных ячеек */
.page-in .btn { text-decoration: none; color: var(--text); }
.page-in .btn.accent { color: #fff; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.stats { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr) 1.4fr; gap: 8px; margin: 14px 0 6px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat b { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat--main b { font-size: 26px; }
.stat em { font-style: normal; font-weight: 700; }
.stat--range i { position: relative; display: block; height: 6px; margin-top: 12px; border-radius: 3px; background: linear-gradient(90deg, var(--down), var(--line), var(--up)); }
.stat--range s { position: absolute; top: -4px; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; background: var(--text); }
.charts-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 8px; }
.grid.charts { height: auto; padding: 0; }
.grid.charts.g1 { height: 70vh; min-height: 420px; }
.grid.charts:not(.g1) { grid-auto-rows: 380px; grid-template-rows: none; }
.cols { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }
.rel { list-style: none; padding: 0; margin: 0; }
.rel li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rel a { text-decoration: none; color: var(--text); }
.faq details { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; margin-bottom: 8px; padding: 0 14px; }
.faq summary { cursor: pointer; padding: 11px 0; font-weight: 600; }
.faq details p { margin: 0 0 12px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--panel-2); }
.tbl .r { text-align: right; }
.coin-link { color: var(--text); text-decoration: none; }
.coin-link:hover b { color: var(--accent-2); }
.mini-btn { display: inline-grid; place-items: center; width: 28px; height: 26px; border-radius: 7px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); }
.mini-btn:hover { color: var(--text); border-color: var(--accent); }
.tabs-links { display: flex; gap: 4px; flex-wrap: wrap; margin: 14px 0; }
.tabs-links a { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); text-decoration: none; font-size: 14px; }
.tabs-links a[aria-current] { color: #fff; background: var(--accent); border-color: var(--accent); }
.summary { color: var(--muted); }
.summary b { color: var(--text); }
.note { margin-top: 30px; color: var(--muted); }
.note h2 { color: var(--text); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 14px 0; }
.cards--list { grid-template-columns: 1fr; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); text-decoration: none; color: var(--text); line-height: 1.4; }
.card:hover { border-color: var(--accent); }
.card span { color: var(--muted); font-size: 13.5px; }
.coin-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); text-decoration: none; color: var(--text); font-size: 13.5px; }
.chip:hover { border-color: var(--accent); }
.chip span:not(.up):not(.down) { color: var(--muted); }
.chip--more { color: var(--accent-2); }
.article ul { padding-left: 22px; }
.article li { margin: 4px 0; }
.below { border-top: 1px solid var(--line); }
.below__hint { display: block; text-align: center; padding: 8px; font-size: 13px; color: var(--muted); text-decoration: none; }
.site-foot { border-top: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; }
.site-foot__in { max-width: 1200px; margin: 0 auto; padding: 18px 16px; }
.site-foot__nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.site-foot__nav a { color: var(--text); text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat--main, .stat--range { grid-column: 1 / -1; }
  .cols { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 760px) {
  .bar--site { flex-wrap: nowrap; }
  .bar--site .logo span { display: none; }
  .site-nav { margin-left: 0; flex: 1; }
  .page-in h1 { font-size: 23px; }
  .grid.charts.g1 { height: 60vh; min-height: 320px; }
  .grid.charts:not(.g1) .cell { height: 60vh; }
  .hide-sm { display: none; }
  .tbl td, .tbl th { padding: 8px; }
}

/* Переключатель языка (меню position:fixed — чтобы не обрезалось прокручиваемой панелью) */
.langs { position: relative; flex: none; }
.langs > summary { list-style: none; cursor: pointer; font-size: 13px; }
.langs > summary::-webkit-details-marker { display: none; }
.langs__menu { position: fixed; top: calc(var(--bar-h) - 4px); right: 12px; z-index: 60; min-width: 150px; display: grid; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.langs__menu a { padding: 8px 12px; border-radius: 7px; color: var(--text); text-decoration: none; }
.langs__menu a:hover { background: var(--panel-2); }
.langs__menu a[aria-current] { color: var(--accent-2); font-weight: 700; }
.site-foot__langs { display: flex; gap: 14px; }
.site-foot__langs a { color: var(--text); text-decoration: none; }
html[lang^="zh"] .page-in, html[lang="hi"] .page-in { line-height: 1.75; }

/* Биржи */
.stats--3 { grid-template-columns: repeat(3, minmax(0, 220px)); }
.cols--2 { grid-template-columns: 1fr 1fr; gap: 20px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.spread { color: var(--muted); }
@media (max-width: 900px) { .cols--2 { grid-template-columns: 1fr; } .stats--3 { grid-template-columns: repeat(3, 1fr); } .stats--3 .stat { grid-column: auto; } }

/* 20 языков: меню прокручивается; арабский и иврит — справа налево */
.langs__menu { max-height: min(70vh, 640px); overflow-y: auto; grid-template-columns: 1fr 1fr; min-width: 300px; }
.site-foot__langs { flex-wrap: wrap; gap: 6px 14px; }
[dir="rtl"] .langs__menu { right: auto; left: 12px; }
[dir="rtl"] .tbl th, [dir="rtl"] .tbl td { text-align: right; }
[dir="rtl"] .tbl .r { text-align: left; }
[dir="rtl"] .article ul { padding-left: 0; padding-right: 22px; }
[dir="rtl"] .crumbs span:not([aria-current]) { display: inline-block; transform: scaleX(-1); }
[dir="rtl"] .stat--range i { transform: scaleX(-1); }

/* Телефон: таблицы монет помещаются в экран — без полного названия монеты/пары рядом с тикером, отступы меньше */
@media (max-width: 760px) {
  .coin-link .muted, .tbl td > .muted:not(:first-child) { display: none; }
  .tbl { font-size: 13px; }
  .tbl td, .tbl th { padding: 8px 6px; }
}
