/* ============ шрифты (локально, без внешних запросов) ============ */
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/serif.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/serif-italic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-cyr.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("/fonts/mono-cyr.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("/fonts/mono-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ============ токены ============ */
@property --a1 { syntax: "<color>"; inherits: true; initial-value: #2b2415; }
@property --a2 { syntax: "<color>"; inherits: true; initial-value: #162330; }
@property --c1 { syntax: "<color>"; inherits: true; initial-value: #3a3a44; }
@property --c2 { syntax: "<color>"; inherits: true; initial-value: #121216; }
@property --c3 { syntax: "<color>"; inherits: true; initial-value: #777777; }
@property --mx { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
@property --my { syntax: "<percentage>"; inherits: true; initial-value: 50%; }

:root {
  --bg: #07080b;
  --ink: #f4f3f0;
  --ink-dim: rgba(244, 243, 240, 0.66);
  --ink-faint: rgba(244, 243, 240, 0.55);
  color-scheme: dark;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --gold: #d8b878;
  --gold-hi: #f3dfae;
  --gold-lo: #8c6b33;
  --gold-grad: linear-gradient(115deg, #a98547 0%, #f3dfae 38%, #d8b878 55%, #8c6b33 100%);
  --gold-rgb: 216, 184, 120;
  --on-gold: #1b1405;
  --up: #6ee7a8;
  --up-rgb: 110, 231, 168;
  --down: #ff7b7b;
  --down-rgb: 255, 123, 123;
  --option-bg: #1a1a20;
  --deal: #f5c76a;
  --accent: var(--gold);
  --r-sm: 12px;
  --r-md: 22px;
  --r-lg: 34px;
  --gap: 20px;
  --blur: blur(28px) saturate(160%);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sans: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans); min-height: 100dvh;
  overflow-x: hidden; -webkit-font-smoothing: antialiased; line-height: 1.4;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--gold); color: var(--on-gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
a { color: inherit; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.4s var(--ease); }
a:hover { background-size: 100% 1px; }

/* плёночное зерно поверх всего */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ фон ============ */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: var(--bg); }
.aurora i { position: absolute; border-radius: 50%; opacity: 0.9; will-change: transform; transition: --a1 1.2s, --a2 1.2s; }
.aurora .b1 { width: 60vw; height: 60vw; left: -15vw; top: -25vw; background: radial-gradient(circle, var(--a1), transparent 70%); animation: drift1 26s ease-in-out infinite alternate; }
.aurora .b2 { width: 55vw; height: 55vw; right: -18vw; top: -8vw; background: radial-gradient(circle, var(--a2), transparent 70%); animation: drift2 32s ease-in-out infinite alternate; }
.aurora .b3 { width: 50vw; height: 50vw; left: 25vw; bottom: -30vw; background: radial-gradient(circle, var(--a1), transparent 70%); opacity: 0.5; animation: drift3 38s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(12vw, 10vw) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-14vw, 14vw) scale(0.9); } }
@keyframes drift3 { to { transform: translate(-18vw, -8vw) scale(1.2); } }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }

/* ============ каркас ============ */
.container { max-width: 1280px; margin: 0 auto; padding: 8px 24px 100px; display: grid; gap: var(--gap); }
.glass {
  background: var(--glass); border: 0; border-radius: var(--r-lg);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
/* тонкий градиентный кант: светлый сверху, тёмный снизу, золотой отблеск справа */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 6;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.04) 38%, rgba(255, 255, 255, 0.05) 62%, rgba(var(--gold-rgb), 0.28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.stats, .hero, .tabs, .chart, .search, .sort { position: relative; }
/* «фонарик» за курсором на стеклянных панелях */
.stats::after, .hero::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(520px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.09), transparent 45%);
  transition: opacity 0.4s; z-index: 5;
}
.stats:hover::after, .hero:hover::after { opacity: 1; }

/* вход при загрузке */
/* «Продать»/«Рынок»: короткий подъём без blur, внутри — каскад (--db также сдвигает цифры .dg) */
.sell-box.rv { animation: lift 0.65s var(--ease) backwards; animation-delay: var(--d, 0s); }
@keyframes lift { from { opacity: 0; transform: translateY(20px); } }
.scns > :nth-child(2) { --i: 1; } .scns > :nth-child(3) { --i: 2; } .scns > :nth-child(4) { --i: 3; }
.sell-box.rv .scn, .sell-box.rv .pk { --db: calc(var(--d, 0s) + 200ms + var(--i, 0) * 70ms); animation: lift 0.6s var(--ease) backwards; animation-delay: var(--db); }
.sell-box.rv .pass-r { --db: calc(var(--d, 0s) + 350ms); }
.flash { animation: flash 0.9s var(--ease); }
@keyframes flash { from { text-shadow: 0 0 18px currentColor; } to { text-shadow: 0 0 0 transparent; } }
.dg { display: inline-block; animation: dgIn 0.55s var(--ease) backwards; }
@keyframes dgIn { from { opacity: 0; transform: translateY(0.4em) scale(0.92); filter: blur(6px); } }
.rv { animation: rise 1s var(--ease) backwards; animation-delay: var(--d, 0s); }
@keyframes rise { from { opacity: 0; transform: translateY(34px) scale(0.985); filter: blur(12px); } }

/* ============ шапка ============ */
.top { position: sticky; top: 0; z-index: 50; transition: background 0.4s, border-color 0.4s, backdrop-filter 0.4s; border-bottom: 1px solid transparent; }
.top.scrolled { background: rgba(7, 8, 11, 0.72); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); border-bottom-color: var(--line); }
.top-in { max-width: 1280px; margin: 0 auto; padding: 22px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; transition: padding 0.4s var(--ease); animation: rise 1s var(--ease) backwards; }
.top.scrolled .top-in { padding-block: 11px; }
.top-right { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 13px; font-weight: 400; }
.brand-gem {
  position: relative; width: 14px; height: 14px; transform: rotate(45deg); border-radius: 3px; background: var(--gold-grad);
  box-shadow: 0 0 18px rgba(var(--gold-rgb), 0.55); animation: gemIn 1.2s var(--spring) backwards;
}
.brand-gem::after { content: ""; position: absolute; inset: 0; border-radius: 3px; border: 1px solid var(--gold); animation: ping 2.8s ease-out infinite; }
@keyframes gemIn { from { transform: rotate(-135deg) scale(0); opacity: 0; } }
@keyframes ping { to { transform: scale(2.8); opacity: 0; } }
.brand-name {
  font-family: var(--serif); font-size: 29px; letter-spacing: 0.01em; line-height: 1;
  background: linear-gradient(100deg, var(--ink) 30%, var(--gold-hi) 48%, var(--gold) 52%, var(--ink) 70%) 0 0 / 260% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: reveal 1.4s 0.15s var(--ease) backwards, shimmerText 9s linear 1.5s infinite;
}
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } }
@keyframes shimmerText { to { background-position: -260% 0; } }
.live { display: flex; align-items: center; gap: 8px; color: var(--ink-faint); font-size: 12px; font-family: var(--mono); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 10px var(--up); animation: blink 2s ease-in-out infinite; }
.live.off i { background: var(--down); box-shadow: 0 0 10px var(--down); animation: none; }
@keyframes blink { 50% { opacity: 0.35; } }

/* ============ кнопки ============ */
.btn {
  position: relative; overflow: hidden; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 999px;
  padding: 11px 20px; translate: var(--bx, 0px) var(--by, 0px);
  transition: background 0.25s, transform 0.35s var(--spring), border-color 0.25s, box-shadow 0.3s, translate 0.25s var(--ease);
}
.btn::before { /* блик по диагонали при наведении */
  content: ""; position: absolute; inset: 0; transform: translateX(-120%) skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent); transition: transform 0.7s var(--ease);
}
.btn:hover { background: rgba(255, 255, 255, 0.15); transform: translateY(-2px); border-color: rgba(var(--gold-rgb), 0.55); }
.btn:hover::before { transform: translateX(120%) skewX(-20deg); }
.btn:active { transform: translateY(0) scale(0.96); }
.btn .plus { display: inline-block; transition: transform 0.5s var(--spring); color: var(--gold); }
.btn:hover .plus { transform: rotate(180deg) scale(1.2); }
.btn.ghost { background: transparent; }
.btn.primary {
  background: var(--gold-grad) 0 0 / 220% 100%; color: var(--on-gold); border-color: transparent; font-weight: 600;
  box-shadow: 0 10px 34px -10px rgba(var(--gold-rgb), 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: background-position 0.6s var(--ease), transform 0.35s var(--spring), box-shadow 0.3s, translate 0.25s var(--ease);
}
.btn.primary:hover { background-position: 100% 0; box-shadow: 0 14px 44px -8px rgba(var(--gold-rgb), 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5); border-color: transparent; }
.btn.danger { color: var(--down); }
.btn.danger:hover { background: rgba(var(--down-rgb), 0.14); border-color: rgba(var(--down-rgb), 0.4); }
.btn.primary.danger-fill { background: var(--down); color: #1a0808; box-shadow: 0 8px 30px -8px var(--down); }
.btn.primary.danger-fill:hover { background: #ff9a9a; }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, 0.4); transform: scale(0); animation: ripple 0.7s var(--ease) forwards; }
.btn.primary .ripple { background: rgba(0, 0, 0, 0.18); }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* ============ статистика ============ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px; }
.stat { position: relative; padding: 22px 26px; border-radius: var(--r-md); transition: background 0.3s; }
.stat:hover { background: rgba(255, 255, 255, 0.035); }
.stat + .stat::before { content: ""; position: absolute; left: -3px; top: 20px; bottom: 20px; width: 1px; background: linear-gradient(transparent, var(--line), transparent); }
.stat small { display: block; color: var(--gold); opacity: 0.9; font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; }
.sv { display: block; margin-top: 12px; font-size: 36px; font-weight: 600; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; line-height: 1.1; transition: color 0.4s; }
.ss { color: var(--ink-dim); font-size: 13px; }
.sp { width: 100%; max-width: 150px; height: 30px; margin-top: 12px; }
.spark { width: 100%; height: 100%; overflow: visible; }
.spark .line { fill: none; stroke: var(--up); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s 0.3s var(--ease) forwards; filter: drop-shadow(0 0 6px var(--up)); }
.spark .line.neg { stroke: var(--down); filter: drop-shadow(0 0 6px var(--down)); }
.spark .area { opacity: 0; animation: fadeIn 1s 1s forwards; }
.spark .flat { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 3 5; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
.up { color: var(--up); }
.down { color: var(--down); }

/* ============ hero ============ */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden; min-height: 560px; }
.stage {
  position: relative; display: grid; place-items: center; overflow: hidden; perspective: 900px;
  background: radial-gradient(circle at 50% 42%, var(--c1), var(--c2));
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.4);
  transition: --c1 0.8s, --c2 0.8s, --c3 0.8s;
}
.halo { position: absolute; width: 80%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--c3), transparent 65%); opacity: 0.35; animation: breathe 7s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.18); opacity: 0.5; } }
.ring {
  position: absolute; border-radius: 50%; aspect-ratio: 1; pointer-events: none; will-change: transform;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}
.ring.r1 { width: 66%; background: conic-gradient(transparent 0 25%, var(--c3) 45%, rgba(255, 255, 255, 0.8) 55%, transparent 70%); opacity: 0.75; animation: spin 10s linear infinite; }
.ring.r2 { width: 84%; background: conic-gradient(transparent 0 55%, rgba(255, 255, 255, 0.4) 75%, transparent 90%); opacity: 0.5; animation: spin 22s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.fx-stage { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.gift-wrap {
  position: relative; width: min(70%, 380px); aspect-ratio: 1; transform-style: preserve-3d; margin-top: -4%;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 0.35s var(--ease);
}
.gift-in { width: 100%; height: 100%; transform: translateZ(70px); }
.hero.enter .gift-in { animation: giftIn 1.2s var(--spring) backwards; }
@keyframes giftIn { from { opacity: 0; transform: translateZ(70px) scale(0.5) rotate(-14deg) translateY(60px); filter: blur(14px); } }
.gift {
  width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 34px 40px rgba(0, 0, 0, 0.55)); animation: float 6s ease-in-out infinite; user-select: none; -webkit-user-drag: none;
  -webkit-box-reflect: below -2% linear-gradient(transparent 62%, rgba(255, 255, 255, 0.2)); /* отражение на «стекле», только Chromium */
}
@keyframes float { 50% { transform: translateY(-14px) rotate(1.2deg); } }
.floor { position: absolute; left: 50%; bottom: 6%; width: 40%; height: 22px; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent); animation: floorPulse 6s ease-in-out infinite; }
@keyframes floorPulse { 50% { transform: translateX(-50%) scale(0.78); opacity: 0.6; } }
.shine {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: overlay;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.5) 50%, transparent 62%) -150% 0 / 250% 100% no-repeat;
  animation: sweep 8s ease-in-out infinite 1.5s;
}
@keyframes sweep { 0%, 60% { background-position: 160% 0; } 100% { background-position: -150% 0; } }
.no-img { width: 40%; color: var(--ink-faint); animation: float 6s ease-in-out infinite; }

.badge {
  position: absolute; top: 20px; left: 20px; z-index: 3; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 12px;
  border-radius: 999px; font-size: 12px; background: rgba(0, 0, 0, 0.42); border: 1px solid var(--line);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.badge.deal { color: var(--deal); }
.badge.deal::before { animation: blink 1.2s ease-in-out infinite; }
.badge.sold { color: var(--up); }
.badge.owned { color: var(--ink); }

/* уровни редкости */
.tier { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.tier::before { content: ""; width: 6px; height: 6px; border-radius: 1px; transform: rotate(45deg); background: currentColor; box-shadow: 0 0 10px currentColor; }
.tier.legendary { color: var(--gold-hi); }
.tier.epic { color: #c9a2ff; }
.tier.rare { color: #7bb8ff; }

.info { padding: 44px 48px; display: grid; align-content: center; gap: 26px; position: relative; z-index: 2; }
.info h2 { font-family: var(--serif); font-size: 60px; font-weight: 400; letter-spacing: -0.015em; line-height: 1; }
.info h2 span { color: var(--gold); font-style: italic; }
.pass { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 16px; }
.chip { padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--ink-dim); background: var(--glass); border: 1px solid var(--line); }
.sub { color: var(--ink-dim); margin-top: 12px; font-size: 13px; font-family: var(--mono); }
.pnl { font-size: 64px; letter-spacing: -0.045em; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1; transition: color 0.4s; }
.pnl small { font-size: 12px; font-weight: 600; color: var(--gold); margin-left: 12px; letter-spacing: 0.2em; }
.pl { margin-top: 12px; font-family: var(--sans); font-size: 14px; }
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.field {
  position: relative; background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px 15px; min-width: 0;
  transition: border-color 0.3s, background 0.3s, opacity 0.4s, transform 0.4s var(--spring), box-shadow 0.3s;
}
.field:hover { background: rgba(255, 255, 255, 0.07); }
.field label { display: block; font-size: 10.5px; color: var(--ink-faint); letter-spacing: 0.14em; text-transform: uppercase; transition: color 0.3s; }
.field input {
  width: 100%; margin-top: 6px; background: none; border: 0; outline: 0; font-size: 24px; font-weight: 500; letter-spacing: -0.02em;
  -moz-appearance: textfield; appearance: textfield; font-variant-numeric: tabular-nums;
}
.field input::-webkit-inner-spin-button, .field input::-webkit-outer-spin-button, .dlg input::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; }
.field input:disabled { cursor: not-allowed; }
.field:focus-within { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 10px 34px -12px rgba(var(--gold-rgb), 0.7); }
.field:focus-within label { color: var(--gold); }
.field.off { opacity: 0.38; }
.field.saved { animation: saved 0.9s var(--ease); }
@keyframes saved { 30% { border-color: var(--up); box-shadow: 0 0 0 4px rgba(var(--up-rgb), 0.22); } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; min-height: 44px; }
.actions .btn { animation: pop 0.6s var(--spring) backwards; }
.actions .btn:nth-child(2) { animation-delay: 0.07s; }
.actions .btn:nth-child(3) { animation-delay: 0.14s; }
@keyframes pop { from { opacity: 0; transform: scale(0.7) translateY(10px); } }

/* появление блоков hero при смене подарка */
.hero.enter .info .rv { animation: rise 0.9s var(--ease) backwards; }
.hero.enter .info .rv:nth-child(1) { animation-delay: 0.05s; }
.hero.enter .info .rv:nth-child(2) { animation-delay: 0.15s; }
.hero.enter .info .rv:nth-child(3) { animation-delay: 0.25s; }
.hero.enter .info .rv:nth-child(4) { animation-delay: 0.35s; }
.hero .info .rv { animation: none; }
.hero.enter .badge { animation: pop 0.8s 0.3s var(--spring) backwards; }

/* ============ график прибыли ============ */
.chart { padding: 28px 32px 30px; overflow-x: clip; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.chart-head h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; letter-spacing: -0.01em; }
.chart-head b { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.chart-plot { position: relative; height: 190px; margin: 22px 0 0 44px; }
.chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-plot .gl { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 2 6; }
.chart-plot .zero { stroke: rgba(255, 255, 255, 0.28); stroke-dasharray: none; }
.chart-plot .cl { fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 8px rgba(var(--gold-rgb), 0.6)); }
.chart-plot svg { animation: wipe 1.6s 0.2s var(--ease) backwards; }
@keyframes wipe { from { clip-path: inset(-20px 100% -20px 0); } }
.chart-plot .ca { opacity: 0; animation: fadeIn 1.2s 0.9s forwards; }
.chart-plot .ya { position: absolute; left: -44px; width: 36px; text-align: right; font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); transform: translateY(-50%); }
.cdot {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--bg); border: 2px solid var(--gold);
  box-shadow: 0 0 12px rgba(var(--gold-rgb), 0.7); cursor: default; opacity: 0; animation: fadeIn 0.5s 1.4s forwards; transition: transform 0.3s var(--spring);
}
.cdot::before { content: ""; position: absolute; inset: -10px; }
.cdot:hover { transform: scale(1.5); z-index: 3; }
.cdot::after {
  content: attr(data-t); position: absolute; left: 50%; bottom: 20px; transform: translate(-50%, 6px); white-space: nowrap; pointer-events: none;
  padding: 6px 12px; border-radius: 10px; font-size: 12px; background: rgba(20, 20, 26, 0.92); border: 1px solid var(--line); opacity: 0; transition: opacity 0.25s, transform 0.3s var(--ease);
}
.cdot:hover::after { opacity: 1; transform: translate(-50%, 0); }
.cdot.r::after { left: auto; right: -6px; transform: translate(0, 6px); }
.cdot.r:hover::after { transform: translate(0, 0); }
.chart-empty { padding: 26px 0 6px; color: var(--ink-dim); font-size: 14px; }
.chart[hidden] { display: none; }

/* ============ вкладки, поиск, сортировка ============ */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.tabs { display: inline-flex; padding: 5px; border-radius: 999px; box-shadow: none; }
.tab-ind {
  position: absolute; top: 5px; bottom: 5px; left: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -2px 0 var(--gold), 0 6px 20px -6px rgba(0, 0, 0, 0.5);
  transition: transform 0.55s var(--spring), width 0.55s var(--spring);
}
.tab { position: relative; z-index: 1; background: none; border: 0; border-radius: 999px; padding: 10px 22px; color: var(--ink-dim); font-size: 15px; transition: color 0.3s; }
.tab:hover, .tab.on { color: var(--ink); }
.tab b { margin-left: 8px; font-weight: 500; font-size: 13px; color: var(--ink-faint); display: inline-block; font-variant-numeric: tabular-nums; }
.tab.on b { color: var(--gold); }
.tab b.bump { animation: bump 0.5s var(--spring); }
@keyframes bump { 40% { transform: scale(1.6); color: var(--gold); } }
.tools { display: flex; gap: 10px; align-items: center; }
.search, .sort { display: flex; align-items: center; height: 52px; border-radius: 999px; box-shadow: none; transition: box-shadow 0.3s; }
.search { gap: 9px; padding: 0 18px; color: var(--ink-faint); }
.search svg { width: 16px; flex: none; }
.search input { width: 130px; background: none; border: 0; outline: 0; font-size: 14px; color: var(--ink); transition: width 0.4s var(--ease); }
.search input::placeholder { color: var(--ink-faint); }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(0.5); }
.search:focus-within { color: var(--gold); box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.6), 0 10px 30px -12px rgba(var(--gold-rgb), 0.6); }
.search:focus-within input { width: 200px; }
.sort select {
  height: 100%; padding: 0 40px 0 20px; background: none; border: 0; outline: 0; border-radius: 999px; font-size: 14px; cursor: pointer;
  -webkit-appearance: none; appearance: none; color: var(--ink-dim);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23d8b878' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 17px center;
}
.sort select option { background: var(--option-bg); color: var(--ink); }
.sort:focus-within { box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.6); }

/* ============ сетка и карточки ============ */
.section-title { display: flex; align-items: center; gap: 14px; color: var(--gold); opacity: 0.9; font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; margin: 18px 4px 14px; animation: rise 0.8s var(--ease) backwards; }
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(var(--gold-rgb), 0.4), transparent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: var(--gap); perspective: 1200px; }

.card {
  position: relative; border-radius: var(--r-md); overflow: hidden; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.14); isolation: isolate;
  aspect-ratio: 4 / 5; background: radial-gradient(circle at 50% 38%, var(--c1), var(--c2)); display: grid; grid-template-rows: 1fr auto;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px)) scale(var(--sc, 1));
  transition: transform 0.4s var(--ease), box-shadow 0.4s, border-color 0.3s;
}
.card.enter { animation: cardIn 0.9s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes cardIn { from { opacity: 0; transform: translateY(50px) scale(0.9) rotateX(14deg); filter: blur(10px); } }
.card.leaving { animation: cardOut 0.35s ease-in forwards; pointer-events: none; }
@keyframes cardOut { to { opacity: 0; transform: scale(0.8) translateY(20px); filter: blur(8px); } }
.card:hover, .card:focus-visible { --ty: -8px; --sc: 1.02; box-shadow: 0 30px 60px -20px var(--c3), 0 20px 50px rgba(0, 0, 0, 0.5); border-color: rgba(255, 255, 255, 0.3); }
.card:active { --sc: 0.98; }
.card::before { /* голографическая фольга, следует за курсором */
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.35s; mix-blend-mode: color-dodge;
  background: repeating-linear-gradient(115deg, #ff7bd5 0%, #ffe27b 8%, #7bffd0 16%, #7bb8ff 24%, #c47bff 32%, #ff7bd5 40%) var(--mx) var(--my) / 260% 260%;
  -webkit-mask: radial-gradient(circle 190px at var(--mx) var(--my), #000, transparent); mask: radial-gradient(circle 190px at var(--mx) var(--my), #000, transparent);
}
.card:hover::before { opacity: 0.42; }
.card::after { /* мягкий блик за курсором */
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.28), transparent 60%); mix-blend-mode: soft-light;
}
.card:hover::after { opacity: 1; }
.card.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 18px 54px -12px var(--c3), inset 0 0 0 1px rgba(var(--gold-rgb), 0.35); }
.card > img { width: 78%; margin: 16% auto 0; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.5)); transition: transform 0.5s var(--ease); }
.card:hover > img { transform: translateY(-4px) scale(1.08); }
.card .badge { top: 12px; left: 12px; font-size: 11px; padding: 4px 10px 4px 9px; }
.card .rar { position: absolute; top: 12px; right: 12px; z-index: 3; padding: 4px 9px; border-radius: 999px; background: rgba(0, 0, 0, 0.42); border: 1px solid var(--line); }
.card .rar.tier { font-size: 10px; gap: 6px; }
.card .meta { position: relative; z-index: 3; padding: 13px 16px 14px; background: rgba(0, 0, 0, 0.5); display: grid; gap: 5px; }
.card .name { font-family: var(--serif); font-size: 21px; line-height: 1.1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .name i { color: var(--gold); font-style: italic; }
.card .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* пустые состояния / скелетоны / ошибка */
.empty { display: grid; justify-items: center; gap: 14px; padding: 70px 24px; text-align: center; color: var(--ink-dim); grid-column: 1 / -1; }
.empty svg { width: 88px; color: var(--gold); opacity: 0.7; animation: float 5s ease-in-out infinite; }
.empty b { color: var(--ink); font-family: var(--serif); font-size: 28px; font-weight: 400; }
.skel { position: relative; overflow: hidden; background: rgba(255, 255, 255, 0.05); border-radius: var(--r-sm); }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.09), transparent); animation: skel 1.4s infinite; }
@keyframes skel { to { transform: translateX(100%); } }
.skel-stage { background: rgba(255, 255, 255, 0.03); }
.skel-stage .skel { position: absolute; inset: 14%; border-radius: 50%; }
.skel.line { height: 20px; } .skel.w60 { width: 60%; } .skel.w40 { width: 40%; } .skel.w80 { width: 80%; } .skel.block { height: 110px; }
.card-skel { aspect-ratio: 4 / 5; border-radius: var(--r-md); }

/* ============ диалоги ============ */
.dlg {
  color: var(--ink); padding: 30px; width: min(440px, calc(100vw - 32px)); background: rgba(22, 22, 30, 0.86); margin: auto;
  opacity: 0; transform: translateY(30px) scale(0.94); filter: blur(10px);
  transition: opacity 0.35s var(--ease), transform 0.45s var(--spring), filter 0.35s, overlay 0.35s allow-discrete, display 0.35s allow-discrete;
}
.dlg[open] { opacity: 1; transform: none; filter: none; }
@starting-style { .dlg[open] { opacity: 0; transform: translateY(30px) scale(0.94); filter: blur(10px); } }
.dlg.closing { opacity: 0; transform: translateY(20px) scale(0.96); filter: blur(8px); transition-duration: 0.2s; }
.dlg::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); opacity: 0; transition: opacity 0.35s, overlay 0.35s allow-discrete, display 0.35s allow-discrete; }
.dlg[open]::backdrop { opacity: 1; }
@starting-style { .dlg[open]::backdrop { opacity: 0; } }
.dlg.closing::backdrop { opacity: 0; transition-duration: 0.2s; }
.dlg h3 { margin-bottom: 18px; font-family: var(--serif); font-weight: 400; font-size: 32px; letter-spacing: -0.01em; line-height: 1; }
.dlg p { color: var(--ink-dim); margin-bottom: 8px; }
.dlg.small { width: min(380px, calc(100vw - 32px)); }
.dlg label { display: grid; gap: 6px; margin-bottom: 14px; font-size: 11px; color: var(--ink-faint); letter-spacing: 0.14em; text-transform: uppercase; transition: color 0.3s; }
.dlg label:focus-within { color: var(--gold); }
.dlg select, .dlg input {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 13px; font-size: 15px; text-transform: none;
  letter-spacing: 0; outline: 0; transition: border-color 0.3s, box-shadow 0.3s, background 0.3s; width: 100%; -moz-appearance: textfield; appearance: textfield;
}
.dlg select {
  -webkit-appearance: none; appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23d8b878' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.dlg select:focus, .dlg input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(var(--gold-rgb), 0.16); background-color: rgba(255, 255, 255, 0.07); }
.dlg select option { background: var(--option-bg); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.pv-box {
  position: relative; height: 150px; margin-bottom: 18px; border-radius: var(--r-md); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 40%, var(--c1), var(--c2)); transition: --c1 0.5s, --c2 0.5s;
}
.pv-box img { height: 86%; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.5)); animation: float 5s ease-in-out infinite; }
.pv-box img.swap { animation: swapIn 0.5s var(--spring), float 5s 0.5s ease-in-out infinite; }
.pv-rar { position: absolute; left: 12px; bottom: 10px; }
@keyframes swapIn { from { opacity: 0; transform: scale(0.6) rotate(-10deg); } }

/* ============ тосты ============ */
.toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100; display: grid; gap: 10px; justify-items: center; pointer-events: none; }
.toast {
  position: relative; overflow: hidden; background: rgba(30, 30, 38, 0.84); border: 1px solid var(--line); backdrop-filter: var(--blur);
  padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; transform: translateY(24px) scale(0.9); transition: opacity 0.4s, transform 0.5s var(--spring);
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(-10px) scale(0.95); }
.toast.err { border-color: rgba(var(--down-rgb), 0.5); }
.toast.ok { border-color: rgba(var(--up-rgb), 0.5); }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--gold); transform-origin: left; animation: toastBar 2.6s linear forwards; }
.toast.err::after { background: var(--down); } .toast.ok::after { background: var(--up); }
@keyframes toastBar { to { transform: scaleX(0); } }

/* ============ адаптив ============ */
@media (max-width: 1100px) {
  .info { padding: 36px 32px; }
  .info h2 { font-size: 50px; }
  .fields { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .stage { min-height: 400px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3)::before { display: none; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); border-radius: 0; }
}
@media (max-width: 640px) {
  .container { padding: 4px 16px 80px; }
  .top-in { padding: 14px 16px; }
  .brand-name { font-size: 24px; }
  .live { display: none; }
  .info { padding: 26px 22px; }
  .info h2 { font-size: 42px; }
  .pnl { font-size: 48px; }
  .fields { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card .name { font-size: 17px; }
  .sv { font-size: 26px; }
  .stat { padding: 16px; }
  .chart { padding: 22px 18px 24px; }
  .chart-plot { margin-left: 38px; }
  .toolbar { gap: 10px; }
  .tools { width: 100%; }
  .search { flex: 1; }
  .search input, .search:focus-within input { width: 100%; }
  .two { grid-template-columns: 1fr; }
}
@media (hover: none) { .card:hover { --ty: 0px; --sc: 1; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}

/* ============ баланс MRKT и вкладка «Продать» ============ */
.bal { display: flex; align-items: baseline; gap: 7px; padding: 7px 14px; border-radius: 999px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--line); font-family: var(--mono); font-size: 12px; white-space: nowrap; transition: opacity 0.4s; }
.bal[hidden] { display: none; }
.bal-k { color: var(--gold); letter-spacing: 0.16em; font-size: 10.5px; }
.bal b { font-size: 14px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.bal-u { color: var(--ink-faint); font-size: 10.5px; }
.bal.stale { opacity: 0.55; }

.sell-mode #hero, .sell-mode #chart, .sell-mode #grid, .sell-mode .tools { display: none; }
.sell { display: grid; gap: var(--gap); }
.sell[hidden] { display: none; }
.sell-box { position: relative; padding: 34px 38px 38px; }
.sell-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 26px; }
.sell-head h3 { font-family: var(--serif); font-weight: 400; font-size: 38px; letter-spacing: -0.015em; line-height: 1.05; }
.sell-head h3 em { color: var(--gold); font-style: italic; }
.sell-sub { color: var(--ink-dim); font-size: 13px; }
.scns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.scn { position: relative; padding: 22px 24px 24px; border-radius: var(--r-md); background: rgba(255, 255, 255, 0.035); box-shadow: inset 0 0 0 1px var(--line); transition: background 0.3s, transform 0.5s var(--ease); }
.scn:hover { background: rgba(255, 255, 255, 0.06); transform: translateY(-3px); }
.scn.main { box-shadow: inset 0 0 0 1px rgba(var(--gold-rgb), 0.5), 0 20px 50px -24px rgba(var(--gold-rgb), 0.55); }
.scn small { display: block; color: var(--gold); font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; }
.scn-hint { display: block; margin-top: 4px; color: var(--ink-faint); font-size: 12px; min-height: 2.8em; }
.scn-v { display: block; margin-top: 14px; font-family: var(--serif); font-size: 58px; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.scn-v i { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--gold); margin-left: 8px; }
.scn-rows, .res-rows { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; }
.scn-rows div, .res-rows div { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-dim); }
.scn-rows b, .res-rows b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.scn-rows b.up, .res-rows b.up { color: var(--up); }
.scn-rows b.down, .res-rows b.down { color: var(--down); }
.sell-note { margin-top: 18px; color: var(--ink-faint); font-size: 12px; line-height: 1.5; }

.pick { display: flex; gap: 12px; overflow-x: auto; padding: 4px 4px 14px; margin: 0 -4px 18px; scroll-snap-type: x proximity; }
.pk { flex: 0 0 auto; width: 118px; scroll-snap-align: start; padding: 10px 8px 12px; border: 0; border-radius: var(--r-md); text-align: center; background: radial-gradient(circle at 50% 30%, var(--c1), var(--c2)); box-shadow: inset 0 0 0 1px var(--line); opacity: 0.62; transition: opacity 0.3s, transform 0.5s var(--spring), box-shadow 0.3s; }
.pk:hover { opacity: 1; transform: translateY(-3px); }
.pk.on { opacity: 1; box-shadow: inset 0 0 0 2px var(--gold), 0 14px 34px -14px rgba(var(--gold-rgb), 0.8); }
.pk img, .pk .no-img { display: block; width: 72px; height: 72px; margin: 0 auto 6px; object-fit: contain; color: var(--ink-dim); }
.pk b { display: block; font-family: var(--serif); font-weight: 400; font-size: 15px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk span { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* .pass уже занят в hero (чипы) — тут скоупим, иначе перебивает hero */
.sell .pass { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; margin-top: 0; }
.pass-l h4 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.05; letter-spacing: -0.01em; }
.pass-l p { margin-top: 4px; color: var(--ink-dim); font-size: 13px; }
.refs { display: grid; gap: 8px; margin-top: 18px; }
.ref { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border: 0; border-radius: var(--r-sm); background: rgba(255, 255, 255, 0.04); color: var(--ink-dim); font-size: 13px; text-align: left; transition: background 0.3s, color 0.3s; }
.ref:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); color: var(--ink); }
.ref:disabled { cursor: default; opacity: 0.6; }
.ref b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.ref em { font-style: normal; color: var(--ink-faint); font-size: 11px; margin-left: 6px; }
.pass-r .field { margin-bottom: 14px; }
.res-v { font-family: var(--serif); font-size: 64px; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.res-v i { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--gold); margin-left: 8px; }
.res-rows { margin-top: 16px; padding-top: 14px; }
.sell-empty { padding: 40px 10px; text-align: center; color: var(--ink-dim); }
@media (max-width: 900px) {
  .scns, .sell .pass { grid-template-columns: 1fr; }
  .scn-hint { min-height: 0; }
}
@media (max-width: 640px) {
  .sell-box { padding: 24px 18px 26px; }
  .sell-head h3 { font-size: 30px; }
  .scn-v { font-size: 48px; }
  .res-v { font-size: 52px; }
  .pass-l h4 { font-size: 28px; }
  .bal { padding: 6px 11px; }
  .bal-u { display: none; }
  .top-right { gap: 8px; }
  #addBtn { padding-inline: 16px; }
  #addBtn .lbl { display: none; }
  .tabs { max-width: 100%; }
  .tab { padding: 10px 10px; font-size: 13px; white-space: nowrap; }
  .tab b { margin-left: 4px; }
}

/* ---- вкладка «Рынок» ---- */
.scns.mk-cards { grid-template-columns: repeat(4, 1fr); }
.mk-v { font-size: 46px; }
.mk-d { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--ink-faint); }
.mk-d em { font-style: normal; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.mk-d em.up { color: var(--up); }
.mk-d em.down { color: var(--down); }
.hbars { display: grid; grid-template-columns: repeat(24, 1fr); gap: 4px; align-items: end; height: 150px; }
.hb { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.hb i { display: block; flex: none; width: 100%; min-height: 2px; border-radius: 4px 4px 2px 2px; background: var(--gold-grad); opacity: 0.8; transition: opacity 0.3s, transform 0.5s var(--ease); transform-origin: bottom; }
.hb:hover i { opacity: 1; transform: scaleY(1.04); }
.hb span { font-size: 10px; color: var(--ink-faint); font-variant-numeric: tabular-nums; line-height: 1; }
.mines { display: grid; gap: 10px; }
.mine { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; padding: 14px 18px; border-radius: var(--r-sm); background: rgba(255, 255, 255, 0.04); font-size: 13px; color: var(--ink-dim); }
.mine > b { font-family: var(--serif); font-weight: 400; font-size: 22px; color: var(--ink); }
.mine span b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.mine .mine-r { margin-left: auto; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.mk-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.mb { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.mb li { display: grid; grid-template-columns: minmax(0, 11em) 1fr auto; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-dim); }
.mb-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-n small { color: var(--ink-faint); font-size: 11px; }
.mb-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.mb-bar i { display: block; height: 100%; border-radius: inherit; background: var(--gold-grad); }
.mb b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.mb-top li { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 900px) {
  .scns.mk-cards { grid-template-columns: 1fr 1fr; }
  .mk-cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .scns.mk-cards { gap: 10px; }
  .mk-v { font-size: 34px; }
  .scn.main, .mk-cards .scn { padding: 16px 16px 18px; }
  .hbars { gap: 2px; height: 120px; }
  .hb span { font-size: 8px; }
  .hb:nth-child(2n) span { visibility: hidden; }
  .mine .mine-r { margin-left: 0; }
  .mb li { grid-template-columns: minmax(0, 8em) 1fr auto; gap: 10px; }
  .mb-top li { grid-template-columns: minmax(0, 1fr) auto; }
}

/* ---- «Рынок»: ликвидность по коридорам ---- */
.lqs { display: grid; gap: 22px; }
.lq-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 8px; }
.lq-h b { font-family: var(--serif); font-weight: 400; font-size: 24px; }
.lq-h b i { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--gold); margin-left: 6px; }
.lq-h span { color: var(--ink-faint); font-size: 12px; }
.lq-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.lq-card { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-md); background: rgba(255, 255, 255, 0.035); box-shadow: inset 0 0 0 1px var(--line), 0 14px 30px -14px rgba(0, 0, 0, 0.7); transition: transform 0.5s var(--spring), box-shadow 0.3s; }
.lq-card:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 1px var(--line), 0 22px 40px -14px rgba(0, 0, 0, 0.8); }
.lq-p { position: relative; display: grid; place-items: center; aspect-ratio: 1 / 0.82; background: radial-gradient(circle at 50% 35%, var(--c1), var(--c2)); box-shadow: inset 0 -26px 36px rgba(0, 0, 0, 0.28); }
.lq-p img, .lq-p .no-img { display: block; width: 72%; height: 72%; object-fit: contain; color: var(--ink-dim); filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.5)); animation: none; transition: transform 0.5s var(--spring); }
.lq-card:hover .lq-p img { transform: scale(1.08) rotate(-3deg); }
.lq-i { position: absolute; top: 10px; left: 12px; font-family: var(--serif); font-size: 26px; line-height: 1; color: var(--ink); opacity: 0.85; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.lq-p .lq-tag { position: absolute; top: 10px; right: 10px; backdrop-filter: blur(6px); }
.lq-b { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 16px; min-width: 0; }
.lq-b > b { color: var(--ink); font-weight: 500; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lq-b > small { color: var(--ink-faint); font-size: 11px; }
.lq-big { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; margin: 12px 0 12px; color: var(--ink); }
.lq-big strong { font-weight: 650; font-size: 46px; line-height: 1; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.lq-big span { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.lq-big small { margin-left: auto; font-size: 12px; }
.lq-b em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.lq-b em.up { color: var(--up); }
.lq-b em.down { color: var(--down); }
.lq-st { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lq-st > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--glass); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.lq-st dt, .lq-rg dt { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.lq-st dd { margin: 0; font-weight: 600; font-size: 22px; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.lq-st em { font-size: 11px; }
.lq-rg { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 10px; padding: 0 2px; }
.lq-rg dd { margin: 0; font-size: 13px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.lq-ago { margin-top: 8px; color: var(--ink-faint); font-size: 11px; }
.lq-tag { padding: 2px 8px; border-radius: 99px; font-size: 10px; letter-spacing: 0.06em; background: rgba(0, 0, 0, 0.45); }
.lq-tag.up { color: var(--up); }
.lq-tag.down { color: var(--down); }
.lq-empty { color: var(--ink-faint); grid-column: 1 / -1; }
@media (max-width: 1100px) { .lq-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .lq-h b { font-size: 20px; }
  .lq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .lq-b { padding: 12px; }
  .lq-big strong { font-size: 36px; }
  .lq-st { gap: 6px; }
  .lq-st > div { padding: 8px 9px; }
  .lq-st dd { font-size: 17px; }
  .lq-st dt, .lq-rg dt { font-size: 9px; letter-spacing: 0.04em; }
  .lq-rg { flex-direction: column; gap: 1px; }
}

/* ============ сводка по модели ============ */
.mdl-t { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.mt { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border-radius: var(--r-sm); background: var(--glass); box-shadow: inset 0 0 0 1px var(--line); }
.mt small { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.mt b { font-family: var(--sans); font-weight: 600; font-size: 34px; line-height: 1.1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.mt span { font-size: 14px; color: var(--ink-dim); }
.mt.down b { color: var(--down); }
.mdl-c { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 26px; }
.mdl-c .sell-note { font-size: 13px; }
.mdl-c h4 { margin-bottom: 12px; font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.mdl-c h4 small { margin-left: 8px; font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--ink-faint); }
.ml { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ml li { display: grid; grid-template-columns: 12px auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); font-size: 16px; color: var(--ink-dim); }
.ml li.me { background: rgba(var(--gold-rgb), 0.14); box-shadow: inset 0 0 0 1px rgba(var(--gold-rgb), 0.4); color: var(--ink); }
.ml li.gap { grid-template-columns: 1fr; text-align: center; color: var(--ink-faint); }
.ml a, .ml li > span:nth-child(2) { color: inherit; text-decoration: none; font-family: var(--mono); font-size: 14px; }
.ml a:hover, .ml a:focus-visible { color: var(--gold); }
.ml .ml-b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml .ml-b small { color: var(--ink-faint); font-size: 13px; }
.ml em { margin-left: 8px; font-style: normal; font-size: 13px; color: var(--gold); }
.ml b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--c1), var(--c2)); box-shadow: 0 0 0 1px var(--line); }

.hint { order: -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; border-radius: var(--r-sm); background: rgba(var(--up-rgb), 0.1); box-shadow: inset 0 0 0 1px rgba(var(--up-rgb), 0.4); font-size: 16px; }
.hint[hidden] { display: none; }
.hint b { color: var(--up); font-weight: 600; }
.hint span { flex: 1 1 200px; }
.card .hint-b { position: absolute; top: 44px; left: 12px; z-index: 3; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--up); background: rgba(var(--up-rgb), 0.16); border: 1px solid rgba(var(--up-rgb), 0.5); }

.lq-card { cursor: pointer; }
.msearch { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 18px; }
.msearch[hidden] { display: none; }
.msearch-k { margin-right: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.dlg.wide { width: min(880px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; }
.md-h { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.md-h img { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.5)); }
.md-h h3 { margin: 0; }
.md-h span { color: var(--ink-dim); font-size: 13px; }
.md-h .btn { margin-left: auto; }
@media (max-width: 900px) { .mdl-c { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .ml .ml-b { white-space: normal; } .mt b { font-size: 28px; } .dlg.wide { padding: 20px 16px; } .msearch .sort { flex: 1 1 100%; } }

/* ---- выбор подарка / модели / фона картинками (диалог добавления) ---- */
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dlg:has(.gpk) { width: min(560px, calc(100vw - 32px)); overflow: hidden; }
#addForm { max-height: calc(100dvh - 92px); overflow-y: auto; overflow-x: hidden; padding-right: 6px; scrollbar-width: thin; }
#addForm .dlg-actions { position: sticky; bottom: 0; padding: 10px 0 2px; background: linear-gradient(transparent, rgba(22, 22, 30, 0.96) 40%); }
.gpk { margin-bottom: 14px; }
.gpk-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 11px; color: var(--ink-faint); letter-spacing: 0.14em; text-transform: uppercase; }
.gpk-h b { color: var(--gold); font-weight: 500; letter-spacing: 0.04em; text-transform: none; font-size: 13px; }
.gpk-q { width: 120px; padding: 6px 10px; font-size: 13px; }
.gpk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 190px; overflow-y: auto; padding: 4px; scrollbar-width: thin; }
.gpki { display: grid; grid-template-rows: 64px auto; gap: 4px; justify-items: center; padding: 6px 4px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; background: rgba(255, 255, 255, 0.03); color: var(--ink-dim); font: inherit; font-size: 11px; line-height: 1.2; cursor: pointer; transition: border-color 0.2s, background 0.2s, transform 0.2s var(--spring); }
.gpki[hidden] { display: none; }
.gpki:hover { border-color: rgba(var(--gold-rgb), 0.5); transform: translateY(-2px); }
.gpki:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.gpki.on { border-color: var(--gold); background: rgba(var(--gold-rgb), 0.12); color: var(--ink); box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.16); }
.gpki i { width: 100%; height: 64px; display: grid; place-items: center; border-radius: 9px; }
.gpki i { overflow: hidden; min-height: 0; }
.gpki i img { width: 100%; height: 100%; padding: 4px; box-sizing: border-box; object-fit: contain; animation: none; filter: none; }
#gMdl .gpki i { background: radial-gradient(circle at 50% 40%, var(--c1, #333), var(--c2, #111)); }
.gpki span { overflow-wrap: anywhere; text-align: center; }
.gpk-grid.bd { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.gpk-grid.bd .gpki i { height: 40px; background: radial-gradient(circle at 50% 40%, var(--c1), var(--c2)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.gpk-grid.bd .gpki { grid-template-rows: 40px auto; }
@media (max-width: 640px) { .gpk-q { width: 96px; } .gpk-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); } }

/* ---- окно «Добавить подарок»: крупное, две колонки (слева превью и цена, справа выбор) ---- */
.dlg:has(.gpk) { width: min(1120px, calc(100vw - 48px)); padding: 36px 40px; }
#addForm { display: grid; grid-template-columns: 340px minmax(0, 1fr); column-gap: 40px; align-items: start; max-height: calc(100dvh - 120px); overflow: hidden; padding-right: 0; }
#addForm h3 { grid-column: 1 / -1; margin-bottom: 24px; font-size: 38px; }
#addForm .pv-box { grid-column: 1; grid-row: 2; height: 260px; margin-bottom: 20px; }
#addForm .two { grid-column: 1; grid-row: 3; grid-template-columns: 1fr; gap: 0; }
#addForm .dlg-actions { grid-column: 1; grid-row: 4; position: static; padding: 6px 0 0; background: none; justify-content: stretch; }
#addForm .dlg-actions .btn { flex: 1; }
.gpk-col { grid-column: 2; grid-row: 2 / span 3; display: grid; gap: 22px; max-height: calc(100dvh - 230px); overflow-y: auto; padding-right: 10px; scrollbar-width: thin; align-content: start; }
.gpk { margin-bottom: 0; }
.gpk-q { width: 200px; }
.gpk-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; max-height: 262px; }
.gpki { grid-template-rows: 84px auto; padding: 8px 6px; font-size: 12px; }
.gpki i { height: 84px; }
.gpk-grid.bd { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: 210px; }
.gpk-grid.bd .gpki { grid-template-rows: 50px auto; }
.gpk-grid.bd .gpki i { height: 50px; }
@media (max-width: 900px) {
  .dlg:has(.gpk) { width: min(620px, calc(100vw - 32px)); padding: 26px 20px; }
  #addForm { display: block; overflow-y: auto; overflow-x: hidden; padding-right: 6px; }
  #addForm .pv-box { height: 170px; }
  #addForm .two { grid-template-columns: 1fr 1fr; gap: 12px; }
  #addForm .dlg-actions { position: sticky; bottom: 0; padding: 10px 0 2px; background: linear-gradient(transparent, rgba(22, 22, 30, 0.96) 40%); justify-content: flex-end; }
  #addForm .dlg-actions .btn { flex: 0 0 auto; }
  .gpk-col { max-height: none; overflow: visible; padding-right: 0; margin-bottom: 14px; }
  .gpk-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); max-height: 220px; }
  .gpki, .gpk-grid.bd .gpki { grid-template-rows: 64px auto; } .gpki i { height: 64px; }
  .gpk-grid.bd { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); max-height: 170px; } .gpk-grid.bd .gpki { grid-template-rows: 40px auto; } .gpk-grid.bd .gpki i { height: 40px; }
  .gpk-q { width: 130px; }
}

.gpk-left { grid-column: 1; grid-row: 2; display: grid; gap: 4px; align-content: start; }
#addForm .pv-box, #addForm .two, #addForm .dlg-actions { grid-column: auto; grid-row: auto; }
.gpk-col { grid-row: 2; }
.gpk-h span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gpk-q { flex: 0 0 200px; width: auto; }
@media (max-width: 900px) { .gpk-left { display: block; } .gpk-q { flex-basis: 130px; } }
@media (max-width: 900px) {
  #addForm { display: flex; flex-direction: column; }
  .gpk-left { display: contents; }
  #addForm .dlg-actions { order: 9; }
}
@media (max-width: 900px) { #addForm > *, .gpk-left > * { flex-shrink: 0; } }

/* вкладка «Проданные»: сделки в ожидании подтверждения — отдельно от проданных */
.tab b[data-deal]:not([data-deal=""])::after { content: " +" attr(data-deal); font-size: 11px; opacity: 0.7; }

/* вкладка «Мои лоты» */
.myl-h { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0 0 18px; }
.myl { display: grid; grid-template-columns: 64px minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 8px 22px; align-items: center; padding: 14px 18px; border-radius: var(--r-sm); background: rgba(255, 255, 255, 0.04); }
.myl + .myl { margin-top: 10px; }
.myl-i { width: 64px; height: 64px; border-radius: var(--r-sm); overflow: hidden; }
.myl-i img { width: 100%; height: 100%; object-fit: contain; display: block; }
.myl-n b, .myl-p b { display: block; font-weight: 500; font-variant-numeric: tabular-nums; }
.myl small { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-faint); }
.myl-note { margin: 16px 0 0; font-size: 12px; color: var(--ink-faint); }
@media (max-width: 900px) { .myl { grid-template-columns: 56px 1fr 1fr; } .myl-i { width: 56px; height: 56px; grid-row: span 2; } .myl-n { grid-column: 2 / -1; } }
.myl.off { opacity: 0.8; }

/* алерты */
.al-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; margin-bottom: 6px; }
.al-top .myl-h { margin: 0 auto 0 0; }
.al-cap { display: flex; align-items: flex-end; gap: 8px; }
.al-cap label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-faint); }
.al-cap input { width: 96px; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.05); color: inherit; font: inherit; font-variant-numeric: tabular-nums; }
.al-on { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 14px; color: var(--ink-dim); cursor: pointer; }
.al-on input { width: 18px; height: 18px; accent-color: var(--gold); }
.al-hint { margin: 0 0 16px; }
.al-hint:empty { display: none; }
.al-act { display: grid; justify-items: end; gap: 4px; }
.al-act .btn { white-space: nowrap; }
.al-st { font-size: 13px; font-weight: 500; }
.al-st.ok { color: rgb(var(--up-rgb)); }
.al-act small.al-st.err { color: rgb(var(--down-rgb)); font-weight: 400; text-align: right; }
.al a { color: var(--gold); text-decoration: none; }
@media (max-width: 900px) { .al .al-act { grid-column: 1 / -1; justify-items: stretch; } .al-act small.al-st.err { text-align: left; } }

/* ============ мобила / Telegram Mini App (<=640px) ============
   Первопричина горизонтального скролла: .container = grid с одной неявной колонкой `auto`
   (min-width:auto у ребёнка). Нижняя граница колонки = min-content самого широкого ребёнка,
   а у .toolbar/.tabs это сумма 5 nowrap-кнопок (~476px) -> колонка раздувалась, и stats/hero
   растягивались до 476+16px. Лечится minmax(0,1fr) на контейнере (+ вкладки уходят из потока). */
.container { grid-template-columns: minmax(0, 1fr); }
/* та же причина на «Продать»/«Мои лоты»/«Рынок»: .sell = grid с колонкой auto, а .pick (flex, overflow-x:auto)
   со всеми .pk даёт огромный min-content и раздувает колонку. Нулевой минимум колонки + min-width:0 у ячеек. */
.sell { grid-template-columns: minmax(0, 1fr); }
.sell > *, .sell-box { min-width: 0; }

@media (max-width: 640px) {
  :root { --nav-h: 58px; --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px)); }

  /* единицы 1fr в раскладках, которые схлопываются на мобиле, -> minmax(0,1fr) */
  .stats, .hero { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields, .two, .scns, .sell .pass, .mk-cols, .mdl-c { grid-template-columns: minmax(0, 1fr); }
  .scns.mk-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .myl { grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr); }
  .hbars { grid-template-columns: repeat(24, minmax(0, 1fr)); }
  .info h2, .pnl, .scn-v, .res-v, .sv, .mk-v { overflow-wrap: anywhere; }

  .container { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 28px); }

  /* .toolbar остаётся в потоке только ради .tools; сам nav выпадает из потока */
  .toolbar { display: contents; }
  .tools { min-width: 0; }

  /* --- нижняя навигация --- */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; width: 100%;
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; align-items: stretch;
    padding: 6px 6px calc(2px + var(--safe-b));
    border-radius: var(--r-md) var(--r-md) 0 0;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  .tab-ind { display: none; }
  .tab {
    position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 52px;
    padding: 6px 2px; font-size: 12px; line-height: 1.15; text-align: center; white-space: normal; overflow-wrap: break-word;
    border-radius: var(--r-sm); -webkit-tap-highlight-color: transparent; transition: color 0.3s, background 0.3s, box-shadow 0.3s;
  }
  .tab.on { background: rgba(255, 255, 255, 0.11); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -2px 0 var(--gold); }
  .tab b {
    position: absolute; top: 3px; right: 4px; margin: 0; min-width: 18px; padding: 1px 5px; border-radius: 999px;
    font-size: 10.5px; line-height: 1.3; text-align: center; white-space: nowrap;
    background: var(--glass-strong); color: var(--ink-dim);
  }
  .tab.on b { background: rgba(var(--gold-rgb), 0.18); color: var(--gold); }
  .tab b[data-deal]:not([data-deal=""])::after { font-size: 10px; }

  .toasts { bottom: calc(var(--nav-h) + var(--safe-b) + 14px); max-width: calc(100vw - 24px); }
  .toast { max-width: 100%; }

  /* --- шапка в Telegram: под системные кнопки/вырез --- */
  .tg .top { padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }

  /* --- тач-цели и 16px в полях (иначе iOS зумит при фокусе) --- */
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  #addBtn { min-width: 44px; }
  .ref { min-height: 44px; }
  .search input, .sort select, .field input, .dlg input, .dlg select, .dlg .gpk-q { font-size: 16px; }
  .dlg .gpk-q { min-height: 40px; }
  .dlg input, .dlg select { min-height: 44px; }

  /* --- диалоги: bottom-sheet --- */
  .dlg, .dlg.small, .dlg.wide, .dlg:has(.gpk) {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92dvh; overflow-x: hidden; overflow-y: auto;
    padding: 20px 16px calc(16px + var(--safe-b)); border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .dlg:has(.gpk) { overflow: hidden; }
  .dlg h3, #addForm h3 { font-size: 28px; margin-bottom: 14px; }
  #addForm { max-height: calc(92dvh - 36px - var(--safe-b)); }
  #addForm .two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  #addForm .dlg-actions .btn, .dlg-actions .btn { flex: 1 1 0; }
  .gpk-h { flex-wrap: wrap; }
  .gpk-h span { flex: 1 1 100%; white-space: normal; }
  .dlg .gpk-q { flex: 1 1 100%; width: 100%; }
  .gpk-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); max-height: 200px; }
  .gpk-grid.bd { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .md-h { flex-wrap: wrap; gap: 12px; }
  .md-h .btn { margin-left: 0; }
}

/* узкие экраны (360): «Проданные» (9 букв, ~5.3em) в колонку ~58px не влезало при 11px.
   Убираем зазоры/паддинги панели -> колонка 59px (360) / 52px (320); шрифт 10.5 / 9.5px.
   Верхний паддинг резервирует место под бейдж-счётчик, чтобы он не наезжал на подпись. */
@media (max-width: 400px) {
  .tabs { padding-inline: 3px; gap: 0; }
  .tab { padding: 17px 0 5px; font-size: 10.5px; letter-spacing: -0.02em; }
  .tab b { right: 2px; }
}
@media (max-width: 340px) {
  .tab { font-size: 9.5px; }
}

/* карточка алерта на мобиле: строка 1 — картинка + название; строка 2 — цена·флор слева, время·ссылка справа;
   строка 3 — кнопка на всю ширину. Короткие фразы не переносятся, длинное название переносится в своей ячейке. */
@media (max-width: 640px) {
  .myl.al { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px; align-items: start; }
  .myl.al .myl-i { grid-row: auto; }
  .myl.al .myl-n { grid-column: 2 / -1; min-width: 0; overflow-wrap: anywhere; }
  .myl.al > :nth-child(3) { grid-column: 1 / 3; }
  .myl.al > :nth-child(4) { grid-column: 3; text-align: right; }
  .myl.al .myl-p b, .myl.al .myl-p small { white-space: nowrap; }
  .myl.al .myl-p small { overflow-wrap: normal; }
  .myl.al .al-act { grid-column: 1 / -1; }
  .myl.al .al-act small.al-st.err { white-space: normal; overflow-wrap: anywhere; }
}
