/* Курс и топливо. Направление: газетная бумага + стела АЗС (янтарные цифры на тёмном). */
:root {
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --card: #fbf9f4;
  --ink: #17150f;
  --ink-2: #4a463c;
  --ink-3: #7a7466;
  --line: #d9d1c0;
  --stella: #16140f;
  --stella-2: #221f18;
  --stella-line: #34302566;
  --led: #f5a524;
  --led-dim: #8a6a2c;
  --up: #b4361b;
  --up-bg: #f6e1d9;
  --down: #1d7a45;
  --down-bg: #dcefe2;
  --flat: #6b6455;
  --flat-bg: #e9e4d8;
  --focus: #2457d6;

  --font-ui: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --text-s: 0.8125rem;
  --text-m: 1rem;
  --text-l: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --text-xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --text-hero: clamp(2.5rem, 1.6rem + 4vw, 4.25rem);

  --r-s: 6px;
  --r-m: 12px;
  --r-l: 20px;
  --shadow: 0 1px 0 #fff8 inset, 0 1px 2px #17150f14, 0 8px 24px -12px #17150f2e;
  --dur: 180ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #14130f; --paper-2: #1b1a15; --card: #1e1c17; --ink: #f1ece0; --ink-2: #c9c2b2; --ink-3: #958d7c;
    --line: #34302a; --stella: #0c0b08; --stella-2: #171510; --up: #ff8a66; --up-bg: #3a1f16; --down: #5fd18d;
    --down-bg: #15301f; --flat: #b3ab99; --flat-bg: #2a2720; --focus: #8fb0ff;
    --shadow: 0 1px 0 #fff1 inset, 0 10px 30px -14px #000c;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #14130f; --paper-2: #1b1a15; --card: #1e1c17; --ink: #f1ece0; --ink-2: #c9c2b2; --ink-3: #958d7c;
  --line: #34302a; --stella: #0c0b08; --stella-2: #171510; --up: #ff8a66; --up-bg: #3a1f16; --down: #5fd18d;
  --down-bg: #15301f; --flat: #b3ab99; --flat-bg: #2a2720; --focus: #8fb0ff;
  --shadow: 0 1px 0 #fff1 inset, 0 10px 30px -14px #000c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--text-m)/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(#17150f08 1px, transparent 1px);
  background-size: 4px 4px;
}
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.muted { color: var(--ink-3); }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: var(--r-s); z-index: 10; }
.skip:focus { left: 16px; }

/* ---------- шапка ---------- */
.top { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 88%, transparent); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.top__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand__mark { font-family: var(--font-num); font-weight: 700; background: var(--stella); color: var(--led); padding: 2px 7px; border-radius: var(--r-s); font-size: var(--text-s); align-self: center; }
.brand__name { font-weight: 700; font-size: 1.125rem; }
.brand__region { color: var(--ink-3); font-size: var(--text-s); }
.sources { display: flex; gap: 6px; flex-wrap: wrap; }
.src { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--ink-2); padding: 3px 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); }
.src::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--down); }
.src--bad { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, var(--line)); }
.src--bad::before { background: var(--up); }
.src--wait::before { background: var(--ink-3); }

/* ---------- общие блоки ---------- */
main { padding-block: 28px 64px; display: grid; gap: clamp(40px, 6vw, 72px); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); }
.block { display: grid; gap: 18px; }
.block__head { display: grid; gap: 4px; border-top: 2px solid var(--ink); padding-top: 12px; }
.block__head h2 { font-size: var(--text-xl); }
.block__head--row { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: var(--text-s); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; }
.btn { border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 99px; padding: 10px 18px; cursor: pointer; font-weight: 600; transition: transform var(--dur) var(--ease), background var(--dur); min-height: 44px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--paper-2); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.badge--up { background: var(--up-bg); color: var(--up); }
.badge--down { background: var(--down-bg); color: var(--down); }
.badge--flat { background: var(--flat-bg); color: var(--flat); }
.delta--up { color: var(--up); }
.delta--down { color: var(--down); }
.delta--flat { color: var(--ink-3); }

/* ---------- конвертер ---------- */
.hero { display: grid; gap: 20px; }
@media (min-width: 920px) { .hero { grid-template-columns: 1.35fr 1fr; align-items: stretch; } }
.conv { padding: clamp(20px, 3vw, 32px); display: grid; gap: 18px; }
.conv__title { font-size: var(--text-l); }
.seg { justify-self: start; display: inline-flex; padding: 3px; gap: 2px; background: var(--paper-2); border-radius: 99px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 99px; cursor: pointer; font-size: var(--text-s); font-weight: 600; color: var(--ink-2); min-height: 36px; transition: background var(--dur), color var(--dur); }
.seg button[aria-pressed='true'] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px #17150f26; }
.conv__row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
@media (max-width: 560px) { .conv__row { grid-template-columns: 1fr; } .swap { justify-self: center; transform: rotate(90deg); } }
.field { display: grid; gap: 6px; }
.field label { font-size: var(--text-s); color: var(--ink-3); font-weight: 500; }
.field__box { display: flex; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper); overflow: hidden; transition: border-color var(--dur); }
.field__box:focus-within { border-color: var(--ink); }
.field input { border: 0; background: transparent; padding: 12px 14px; width: 100%; min-width: 0; font-family: var(--font-num); font-size: 1.25rem; outline: none; }
.field select { border: 0; border-left: 1px solid var(--line); background: var(--paper-2); padding: 0 10px; font-weight: 600; cursor: pointer; outline: none; }
.swap { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 1.1rem; transition: transform var(--dur) var(--ease); }
.swap:hover { transform: rotate(180deg); }
.conv__result { display: grid; gap: 4px; padding-top: 16px; border-top: 1px dashed var(--line); }
.conv__big { font-family: var(--font-num); font-size: var(--text-hero); font-weight: 700; line-height: 1; letter-spacing: -0.04em; overflow-wrap: anywhere; }
.conv__big small { font-size: 0.4em; color: var(--ink-3); font-weight: 500; letter-spacing: 0; margin-left: 6px; }
.conv__rate { font-size: var(--text-s); color: var(--ink-2); }

.pulse { padding: clamp(20px, 3vw, 28px); display: grid; gap: 14px; align-content: start; background: var(--stella); color: #efe7d4; border-color: var(--stella); }
.pulse .eyebrow { color: var(--led-dim); }
.pulse__item { display: grid; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid #ffffff14; }
.pulse__item:last-child { border-bottom: 0; padding-bottom: 0; }
.pulse__label { font-size: var(--text-s); color: #b9b09c; }
.pulse__value { font-family: var(--font-num); font-size: 1.75rem; font-weight: 700; color: var(--led); text-shadow: 0 0 18px #f5a52440; }
.pulse__text { font-size: var(--text-s); color: #d8cfbb; }

/* ---------- топливо: стела ---------- */
.fuel-grid { display: grid; gap: 20px; }
@media (min-width: 920px) { .fuel-grid { grid-template-columns: 1fr 1fr; } }
.fuel { display: grid; gap: 0; border-radius: var(--r-l); overflow: hidden; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); align-content: start; }
.stella { background: linear-gradient(180deg, var(--stella-2), var(--stella)); color: #efe7d4; padding: 20px clamp(16px, 3vw, 24px) 18px; display: grid; gap: 14px; }
.stella__head { display: flex; justify-content: space-between; align-items: start; gap: 12px; flex-wrap: wrap; }
.stella__brand { font-weight: 700; font-size: var(--text-l); }
.stella__sub { font-size: var(--text-s); color: #a89f8b; }
.stella__tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; padding: 2px 4px; }
.stella__tabs button { flex: none; border: 1px solid #ffffff1f; background: transparent; color: #cfc6b2; border-radius: 99px; padding: 6px 12px; font-size: 0.75rem; cursor: pointer; min-height: 32px; }
.stella__tabs button[aria-pressed='true'] { background: var(--led); color: var(--stella); border-color: var(--led); font-weight: 700; }
.led-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.led-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 8px 12px; background: #00000059; border: 1px solid #ffffff0d; border-radius: var(--r-s); }
.led-row__name { font-weight: 600; font-size: 0.9375rem; }
.led-row__meta { font-size: 0.75rem; color: #9d947f; }
.led { font-family: var(--font-num); font-weight: 700; font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.2rem); color: var(--led); text-shadow: 0 0 14px #f5a52466; line-height: 1; text-align: right; }
.led small { font-size: 0.42em; color: var(--led-dim); text-shadow: none; margin-left: 4px; font-weight: 500; }

.explain { padding: 18px clamp(16px, 3vw, 24px) 22px; display: grid; gap: 14px; }
.explain__part { display: grid; gap: 6px; }
.explain__part h3 { font-size: var(--text-s); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.explain__part p { color: var(--ink-2); font-size: 0.9375rem; }
.explain__title { font-weight: 600; color: var(--ink) !important; }

.breakdown { display: grid; gap: 6px; }
.breakdown__bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--paper-2); }
.breakdown__bar span { display: block; height: 100%; }
.breakdown__legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.75rem; color: var(--ink-2); }
.breakdown__legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.c-plcv { background: #e38b12; } .c-ac { background: #6b5a3a; } .c-mc { background: #a8987a; } .c-tva { background: #d3c6a8; }

.spark { width: 100%; height: 44px; display: block; }
.spark path.line { fill: none; stroke: var(--led); stroke-width: 2; }
.spark path.area { fill: #f5a52422; }

/* ---------- нефть ---------- */
.oil { padding: clamp(18px, 3vw, 28px); display: grid; gap: 18px; }
.oil__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.stat { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-m); background: var(--paper); border: 1px solid var(--line); }
.stat--main { background: var(--stella); border-color: var(--stella); color: #efe7d4; }
.stat__label { font-size: 0.75rem; color: var(--ink-3); }
.stat--main .stat__label { color: #a89f8b; }
.stat__value { font-family: var(--font-num); font-size: 1.5rem; font-weight: 700; }
.stat--main .stat__value { color: var(--led); }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--ink-3); font: 500 11px var(--font-num); }
.chart .price { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: url(#oilfill); }
.chart .avg { fill: none; stroke: #e38b12; stroke-width: 2; stroke-dasharray: 5 4; }
.chart .cross line { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.chart .cross circle { fill: var(--card); stroke: var(--ink); stroke-width: 2; }
.chart__tip { position: absolute; top: 0; pointer-events: none; background: var(--ink); color: var(--paper); font: 600 0.75rem var(--font-num); padding: 5px 8px; border-radius: var(--r-s); transform: translateX(-50%); white-space: nowrap; opacity: 0; transition: opacity var(--dur); }
.chart__legend { display: flex; gap: 16px; font-size: 0.75rem; color: var(--ink-2); flex-wrap: wrap; }
.chart__legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--ink); margin-right: 6px; vertical-align: 3px; }
.chart__legend i.dash { border-top: 2px dashed #e38b12; }

/* ---------- курсы ---------- */
.fx-grid { display: grid; gap: 20px; }
@media (min-width: 920px) { .fx-grid { grid-template-columns: 1.15fr 1fr 1fr; } }
.fx-card { padding: 18px 20px 20px; display: grid; gap: 12px; align-content: start; }
.fx-card h3 { font-size: 1.0625rem; }
.fx-card__date { font-size: 0.75rem; color: var(--ink-3); }
.fx-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.fx-table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 0.75rem; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fx-table th:not(:first-child), .fx-table td:not(:first-child) { text-align: right; }
.fx-table td { padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.fx-table tr:last-child td { border-bottom: 0; }
.fx-table .code { font-weight: 700; font-family: var(--font-num); }
.fx-table .name { color: var(--ink-3); font-size: 0.8125rem; margin-left: 6px; }
.fx-note { font-size: var(--text-s); color: var(--ink-2); background: var(--paper); border-left: 3px solid #e38b12; padding: 8px 12px; border-radius: 0 var(--r-s) var(--r-s) 0; }

/* ---------- лента ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 14px; cursor: pointer; font-size: var(--text-s); font-weight: 600; color: var(--ink-2); min-height: 36px; }
.chips button[aria-pressed='true'] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-left: 2px solid var(--line); margin-left: 6px; }
.ev { position: relative; padding: 4px 0 22px 22px; display: grid; gap: 6px; }
.ev::before { content: ''; position: absolute; left: -7px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink-3); }
.ev--up::before { border-color: var(--up); background: var(--up-bg); }
.ev--down::before { border-color: var(--down); background: var(--down-bg); }
.ev--new { animation: ev-in 600ms var(--ease); }
@keyframes ev-in { from { opacity: 0; transform: translateY(-6px); } }
.ev__meta { display: flex; gap: 8px; align-items: center; font-size: 0.75rem; color: var(--ink-3); flex-wrap: wrap; }
.ev__title { font-weight: 600; font-size: 1.0625rem; line-height: 1.35; }
.ev__reason { color: var(--ink-2); font-size: 0.9375rem; max-width: 75ch; }
.ev__forecast { font-size: 0.875rem; color: var(--ink-2); max-width: 75ch; display: flex; gap: 8px; align-items: baseline; }
.empty { padding: 20px; border: 1px dashed var(--line); border-radius: var(--r-m); color: var(--ink-3); }

/* ---------- подвал и тост ---------- */
.foot { border-top: 1px solid var(--line); padding-block: 24px 40px; font-size: var(--text-s); color: var(--ink-2); }
.foot__grid { display: grid; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: min(520px, calc(100% - 32px)); background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: var(--r-m); box-shadow: 0 10px 30px -10px #000a; font-size: 0.9375rem; z-index: 20; animation: ev-in 300ms var(--ease); }

.skeleton { color: transparent !important; background: linear-gradient(90deg, var(--paper-2), var(--card), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-s); }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- узкие экраны ---------- */
@media (max-width: 600px) {
  .top { position: static; }
  .seg { display: grid; grid-template-columns: repeat(3, 1fr); border-radius: var(--r-m); justify-self: stretch; }
  .seg button { border-radius: 9px; padding: 8px 6px; font-size: 0.75rem; line-height: 1.2; }
}

/* ---------- карта заправок ---------- */
.map-wrap { padding: clamp(14px, 2.4vw, 22px); display: grid; gap: 14px; }
@media (min-width: 980px) {
  .map-wrap { grid-template-columns: 1.6fr 1fr; grid-template-areas: 'ctl ctl' 'map side' 'note note'; align-items: start; }
  .map-controls { grid-area: ctl; } .map { grid-area: map; } .map-side { grid-area: side; } .map-note { grid-area: note; }
  .map-side { max-height: 520px; overflow-y: auto; padding-right: 4px; }
}
.map-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.map-controls .btn { margin-left: auto; }
@media (max-width: 600px) { .map-controls .btn { margin-left: 0; width: 100%; } }
.map { height: clamp(340px, 55vh, 520px); border-radius: var(--r-m); border: 1px solid var(--line); overflow: hidden; z-index: 0; }
.map-side { display: grid; gap: 10px; align-content: start; }
.map-note { font-size: 0.8125rem; }
.st { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper); }
.leaflet-popup-content .st { border: 0; padding: 0; background: transparent; }
.st__head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.st__brand { font-weight: 700; }
.st__km { margin-left: auto; font-family: var(--font-num); font-size: 0.8125rem; color: var(--ink-3); }
.st__addr, .st__hours { font-size: 0.8125rem; color: var(--ink-3); }
.st__prices { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 0.875rem; color: var(--ink-2); }
.st__price b { font-family: var(--font-num); }
.st__price--on b { color: var(--ink); background: #f5a52433; padding: 0 4px; border-radius: 4px; }
.st__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.btn--small { padding: 6px 12px; min-height: 36px; font-size: 0.8125rem; text-decoration: none; display: inline-flex; align-items: center; }
.leaflet-container { font: inherit; background: var(--paper-2); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-content a.btn { color: var(--paper); }
.leaflet-popup-content a.btn--ghost { color: var(--ink); }
