:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --page: #171217;
  --panel: #241c24;
  --line: #3b303b;
  --text: #fcf9ff;
  --muted: #b3aabb;
  --acid: #ddfc8f;
  --pink: #ff9caa;
  --violet: #d5baff;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font-size: 1rem; line-height: 1.45; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }
button:disabled { cursor: default; opacity: .44; }
button:not(:disabled), summary { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap { width: min(1200px, 100% - 64px); margin-inline: auto; }
.top { border-bottom: 1px solid #2f2b35; }
.top-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark { display: flex; align-items: center; gap: 11px; font-size: .96rem; letter-spacing: .08em; white-space: nowrap; }
.wordmark strong span { color: #ff7886; }
.brand-icon { display: grid; place-content: center; width: 35px; height: 35px; border-radius: 10px; background: #ff626d; transform: rotate(-6deg); }
.brand-icon i { width: 16px; height: 4px; background: #23251c; transform: skewX(-24deg); }
.brand-icon i + i { margin: 3px 0 0 3px; }
.top-source { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; color: var(--muted); font-size: .875rem; text-decoration: none; }
.top-source:hover { color: var(--text); }
.source-dot { background: var(--acid); border-radius: 50%; width: 7px; height: 7px; box-shadow: 0 0 11px #defe7870; }

.top-status { display: flex; align-items: center; gap: 14px; }
.online-badge { display: inline-flex; align-items: center; gap: 7px; min-height: 31px; padding: 3px 9px; border: 1px solid #48523b; border-radius: 9px; background: #262a22; color: #e1f1c8; white-space: nowrap; font-size: .83rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.online-badge .source-dot { flex: none; }

.hero { position: relative; overflow: hidden; margin-block: 28px 30px; min-height: 246px; display: grid; align-items: center; border-radius: 23px; border: 1px solid #663540; background: radial-gradient(ellipse at 80% 34%, #621f2d 0%, #391d28 42%, #251a23 78%); isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .33; background-image: radial-gradient(circle at 1px 1px, #ef839670 1px, transparent 1.6px); background-size: 14px 14px; mask-image: linear-gradient(115deg, transparent 33%, black 90%); }
.hero-content { padding: 38px 40px 41px; position: relative; z-index: 1; }
.eyebrow { margin: 0; font-size: .82rem; font-weight: 750; letter-spacing: .13em; }
.hero .eyebrow { color: #ffb6c0; }
h1, h2, h3, p { margin: 0; }
h1 { margin-block: 9px 11px; font-size: clamp(2.55rem, 5.6vw, 4.25rem); line-height: .99; font-weight: 850; letter-spacing: -.063em; }
h1 span { color: #ff7584; }
.hero-note { max-width: 44ch; font-size: 1.06rem; color: #f5dee6; }
.hero-character { position: absolute; right: 39px; bottom: -63px; width: 360px; height: auto; z-index: -1; filter: drop-shadow(0 0 24px #f42a4d38); pointer-events: none; }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(288px, .45fr); gap: 23px; align-items: start; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 45px; margin-bottom: 12px; }
.section-heading h2 { font-size: 1.53rem; line-height: 1.1; letter-spacing: -.036em; }
.tools { display: flex; gap: 5px; }
.quiet { display: inline-flex; align-items: center; justify-content: center; gap: .36em; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 7px 10px; min-height: 44px; font-size: .875rem; line-height: 1.25; font-weight: 680; }
.quiet:not(:disabled):hover { background: #292535; color: var(--text); }
.quiet span { font-size: 1.15em; line-height: 1; }
.offers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.offer { --accent: var(--pink); --tint: #412c39; display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); min-width: 0; }
.getting { --accent: var(--acid); --tint: #343e2a; }
.offer-header { display: flex; gap: 12px; align-items: center; margin-bottom: 15px; }
.offer-icon { display: grid; place-items: center; width: 43px; height: 43px; flex: none; border-radius: 12px; color: var(--accent); font-size: 1.4rem; font-weight: 700; background: var(--tint); }
.offer-header h3 { font-size: 1.16rem; letter-spacing: -.02em; }
.offer-header p { font-size: .875rem; color: var(--muted); }
.add { margin-top: auto; display: flex; justify-content: center; align-items: center; gap: 7px; border: 1px dashed #61576c; border-radius: 11px; padding: 8px; color: var(--accent); background: #19171f; min-height: 48px; width: 100%; font-size: .91rem; line-height: 1.25; font-weight: 700; }
.add span { font-size: 1.35rem; line-height: 1; }
.add:not(:disabled):hover { background: var(--tint); border-color: var(--accent); }
.offer-total { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.offer-total span { font-size: .875rem; color: var(--muted); }
.offer-total strong { text-align: right; color: var(--accent); font-size: 1.55rem; line-height: 1.12; font-variant-numeric: tabular-nums; }
.offer-total .partial { font-size: 1rem; }
.example { margin-top: 8px; margin-left: -7px; }
.items:empty { display: none; }
.items { display: grid; gap: 6px; margin-bottom: 10px; }
.trade-row, .picker-item { min-width: 0; display: flex; align-items: center; gap: 9px; border: 1px solid #3b3547; border-radius: 10px; background: #1a1821; }
.trade-row { padding: 4px 5px 4px 7px; }
.item-icon { display: grid; place-items: center; flex: none; width: 29px; height: 29px; border-radius: 8px; color: var(--icon, #d9c9f4); background: var(--icon-bg, #3a304c); font: 750 .66rem/1 system-ui, sans-serif; position: relative; overflow: hidden; }
.item-icon img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 2px; object-fit: contain; opacity: 0; }
.item-icon.has-thumbnail { color: transparent; }
.item-icon.has-thumbnail img { opacity: 1; }
.item-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
.item-name { overflow-wrap: anywhere; color: var(--text); font-weight: 700; font-size: .875rem; line-height: 1.2; text-decoration: none; }
a.item-name:hover { text-decoration: underline; }
.item-meta { color: var(--muted); font-size: .79rem; line-height: 1.25; }
.item-demand { color: #c6b9cc; font-size: .76rem; line-height: 1.3; }
.item-demand[data-level="средний"] { color: #eed29c; }
.item-demand[data-level="высокий"] { color: #d8efad; }
.quantity { display: flex; align-items: center; flex: none; font-size: .8rem; }
.quantity span { text-align: center; min-width: 14px; color: var(--text); }
.quantity button, .close { border: none; padding: 0; border-radius: 8px; background: transparent; color: var(--muted); min-width: 34px; min-height: 44px; font-size: 1.23rem; }
.quantity button:hover, .close:hover { background: #3e354b; color: var(--text); }

.result { --active: var(--violet); padding: 19px 19px 13px; border: 1px solid #4c405d; border-radius: 17px; background: linear-gradient(150deg, #302439, #241e2e 61%); }
.result[data-tone="win"] { --active: var(--acid); }
.result[data-tone="loss"] { --active: var(--pink); }
.result[data-tone="fair"] { --active: #e7cbff; }
.result-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--active); min-height: 34px; }
.result-icon { border: 1px solid #665476; background: #4b395866; border-radius: 9px; width: 34px; height: 34px; display: grid; place-items: center; font-size: 1.23rem; }
.result h2 { font-size: clamp(1.56rem, 2.5vw, 2.35rem); line-height: 1.05; font-weight: 810; letter-spacing: -.045em; margin-top: 9px; }
.result p { margin-top: 8px; color: #d6cbde; font-size: .875rem; }
.difference { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block: 21px 10px; }
.difference > span { color: #d6cbde; font-size: .875rem; }
.result .trade-tip { margin: 0 0 12px; padding: 9px 10px; border-left: 2px solid var(--pink); border-radius: 0 8px 8px 0; background: #533047; color: #ffe5ee; }
.difference div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; justify-content: flex-end; text-align: right; color: var(--active); font-variant-numeric: tabular-nums; }
.difference strong { font-size: 1.33rem; line-height: 1; }
.difference small { color: #d6cbde; }
.meter { position: relative; height: 8px; margin-inline: 4px; }
.meter-fill { height: 100%; border-radius: 10px; background: linear-gradient(to right, #f191b6, #c8a9ee 46%, #c8a9ee 54%, #d9f877); }
.meter i { position: absolute; width: 13px; height: 13px; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #ffffff; border: 2px solid #30243c; border-radius: 50%; transition: left .18s ease; }
.meter-labels { display: flex; justify-content: space-between; margin-block: 7px 11px; color: var(--muted); font-size: .78rem; }
details { border-top: 1px solid #473a54; }
summary { color: #dbcbe7; min-height: 39px; padding-block: 9px 4px; font-size: .875rem; }
details p { margin-bottom: 8px; }

.data { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-block: 26px 36px; padding: 12px 14px; color: var(--muted); border-top: 1px solid var(--line); }
.data p { font-size: .875rem; }
.data p + p { margin-top: 3px; }
.data a { color: var(--text); font-weight: 680; text-underline-offset: 3px; }
.data-separator { padding-inline: 4px; }
.refresh { border-color: var(--line); flex: none; }

dialog { color: var(--text); background: #211c2a; border: 1px solid #514462; padding: 0; border-radius: 19px; width: min(560px, 100% - 24px); height: min(622px, 100dvh - 24px); max-width: 100%; max-height: none; overflow: hidden; box-shadow: 0 22px 90px #0009; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #0c0912b8; backdrop-filter: blur(4px); }
body:has(dialog[open]) { overflow: hidden; }
.picker-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 20px 19px 13px; }
.picker-top .eyebrow { color: var(--acid); margin-bottom: 3px; }
.picker-top h2 { font-size: 1.52rem; letter-spacing: -.04em; }
.close { min-width: 44px; background: #342c42; font-size: 1.65rem; line-height: 1; }
.picker-controls { display: grid; grid-template-columns: minmax(0, 1fr) 125px; gap: 8px; padding-inline: 19px; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field span { position: absolute; left: 13px; font-size: 1.3rem; color: var(--muted); pointer-events: none; }
.search-field input, select { width: 100%; min-width: 0; height: 46px; background: #15121d; color: var(--text); border: 1px solid #514462; border-radius: 8px; }
.search-field input { padding: 0 8px 0 36px; }
.search-field input::placeholder { color: #b5a9c1; }
select { appearance: none; padding-inline: 9px 22px; }
.filter-field { position: relative; }
.filter-field::after { content: ""; position: absolute; top: 17px; right: 10px; width: 6px; height: 6px; border: 2px solid var(--muted); border-top: 0; border-left: 0; transform: rotate(45deg); pointer-events: none; }
.picker-meta { min-height: 32px; padding: 7px 19px 4px; color: var(--muted); font-size: .875rem; }
.picker-items { display: grid; align-content: start; flex: 1; overflow: auto; overscroll-behavior: contain; gap: 5px; min-height: 0; padding: 1px 19px 12px; scrollbar-color: #645478 #241e2e; }
.picker-item { text-align: left; min-height: 54px; padding: 7px 8px; color: var(--text); }
.picker-item .item-icon { width: 44px; height: 44px; }
.picker-item:hover { border-color: #8873a1; background: #31283c; }
.picker-value { font-size: .92rem; text-align: end; color: var(--acid); }
.picker-value.unknown { color: var(--muted); font-weight: 500; font-size: .79rem; }
.pick-plus { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 7px; color: var(--acid); background: #3d4132; font-size: 1.18rem; }
.more { margin-block: 4px; }
.picker-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 19px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid #41364c; background: #241e2e; }
.picker-footer span { color: var(--muted); font-size: .875rem; }
.done { flex: none; min-height: 44px; border: 0; border-radius: 9px; padding: 8px 24px; background: var(--acid); color: #24281c; font-weight: 800; }
.done:hover { background: #edffa9; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

@media (max-width: 970px) {
  .wrap { width: calc(100% - 46px); }
  .workbench { grid-template-columns: minmax(0, 1fr) minmax(248px, .43fr); gap: 15px; }
  .offers { gap: 10px; }
  .offer { padding: 13px; }
  .hero-character { right: 4px; width: 303px; bottom: -32px; }
}
@media (max-width: 760px) {
  .wrap { width: calc(100% - 32px); }
  .top-inner { min-height: 58px; }
  .hero { margin-block: 17px 14px; min-height: 0; border-radius: 16px; }
  .hero-content { padding: 23px 19px 26px; }
  h1 { font-size: clamp(2.3rem, 8vw, 3.25rem); }
  .hero-note { max-width: min(34ch, 62%); font-size: .95rem; }
  .hero-character { width: min(36vw, 235px); right: -8px; bottom: -3px; }
  .workbench { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .section-heading { margin-bottom: 9px; }
  .section-heading h2 { font-size: 1.36rem; }
  .offer-header { gap: 8px; margin-bottom: 11px; }
  .tools .quiet { padding-inline: 6px; font-size: .82rem; }
  .offer-icon { width: 33px; height: 33px; font-size: 1.12rem; border-radius: 9px; }
  .offer-header h3 { font-size: 1rem; }
  .offer-header p { font-size: .79rem; }
  .offer-total { margin-top: 10px; padding-top: 9px; }
  .offer-total strong { font-size: 1.35rem; }
  .add { font-size: .84rem; padding-inline: 5px; gap: 4px; }
  .data { align-items: flex-start; flex-direction: column; padding-inline: 0; margin-top: 18px; }
}
@media (max-width: 510px) {
  .top-inner { gap: 8px; }
  .wordmark { gap: 8px; font-size: .84rem; }
  .brand-icon { width: 30px; height: 30px; }
  .top-status:has(.online-badge:not([hidden])) .top-source { display: none; }
  h1 { max-width: 8ch; }
  .hero-content { padding: 19px 14px 22px; }
  .hero-character { right: -8px; width: 39vw; }
  .picker-controls { grid-template-columns: minmax(0, 1fr) 108px; }
  .offer-header { align-items: flex-start; min-height: 57px; }
  dialog { margin: auto auto 0; width: 100%; height: min(640px, 93dvh); border-radius: 17px 17px 0 0; }
  .trade-row { flex-wrap: wrap; gap: 5px; }
  .trade-row .item-copy { flex-basis: calc(100% - 34px); }
  .quantity { margin-left: auto; }
  .quantity button { min-width: 44px; }
}
@media (max-width: 365px) {
  .wrap { width: calc(100% - 22px); }
  .hero .eyebrow { font-size: .7rem; }
  h1 { font-size: 2.04rem; }
  .offer { padding: 9px; }
  .offer-icon { display: none; }
  .top-source { font-size: .78rem; }
  .tools { gap: 0; }
  .quiet { padding-inline: 6px; }
  .picker-controls, .picker-top, .picker-items, .picker-footer, .picker-meta { padding-inline: 13px; }
  .picker-controls { grid-template-columns: minmax(0, 1fr) 93px; }
}
@media (prefers-reduced-motion: reduce) { .meter i { transition: none; } }
