@font-face {
  font-family: "Manrope";
  src: url("assets/Manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #0b0908;
  --bg2: #14100d;
  --surface: #16120f;
  --surface2: #221b15;
  --line: rgba(255, 255, 255, .09);
  --text: #f6f1e6;
  --muted: #a99f92;
  --red: #e5252d;
  --red-hi: #ff4a50;
  --gold: #ffd200;
  --orange: #ff8a00;
  --gold-ink: #17120a;
  --glass: rgba(11, 9, 8, .8);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .9);
  --quote-bg: #1d1710;
  --chamfer: 18px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="light"] {
  --bg: #eceef4;
  --bg2: #e3e6ee;
  --surface: #ffffff;
  --surface2: #f3f4f8;
  --line: rgba(14, 18, 32, .11);
  --text: #121626;
  --muted: #566078;
  --red: #c9141c;
  --red-hi: #e02a32;
  --glass: rgba(236, 238, 244, .86);
  --shadow: 0 14px 30px -18px rgba(20, 28, 60, .45);
  --quote-bg: #fff6df;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}
/* фон: тонкая диагональная штриховка и красное свечение сверху */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 380px at 12% -8%, rgba(229, 37, 45, .20), transparent 70%),
    repeating-linear-gradient(115deg, transparent 0 22px, rgba(255, 255, 255, .018) 22px 23px);
}
:root[data-theme="light"] body::before {
  background:
    radial-gradient(900px 380px at 12% -8%, rgba(229, 37, 45, .10), transparent 70%),
    repeating-linear-gradient(115deg, transparent 0 22px, rgba(14, 18, 32, .028) 22px 23px);
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, .card:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.bar, .search, .tabs, .quick { max-width: 1080px; margin-inline: auto; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 6px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(229, 37, 45, .45)); }
.word { font-size: 21px; font-weight: 500; letter-spacing: -.02em; }
.word b { font-weight: 800; color: var(--gold); letter-spacing: -.03em; }
:root[data-theme="light"] .word b { color: var(--red); }
.actions { display: flex; gap: 4px; }
.ib {
  position: relative; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; color: var(--muted);
  transition: color .2s, background .2s, transform .15s var(--ease);
}
.ib:active { transform: scale(.9); }
.ib[aria-pressed="true"], .ib[aria-expanded="true"] { color: var(--gold-ink); background: var(--gold); }
.ib[aria-pressed="true"] svg { fill: currentColor; }
.cnt {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff; font: 800 11px/17px "Manrope"; font-style: normal; text-align: center;
}

.search {
  display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 0 14px 6px;
  animation: drop .28s var(--ease);
}
.search svg { position: absolute; margin-left: 12px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px 0 38px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 500 16px "Manrope", sans-serif;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.clr { color: var(--gold); font-weight: 700; padding: 10px 4px; }
:root[data-theme="light"] .clr { color: var(--red); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

.tabs {
  position: relative; display: flex; gap: 2px; padding: 0 8px; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar, .quick::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative; padding: 11px 12px 13px; font-size: 16px; font-weight: 600; color: var(--muted); white-space: nowrap;
  transition: color .2s;
}
.tabs button.on { color: var(--text); font-weight: 800; }
.ink {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 10px; background: var(--red);
  box-shadow: 0 0 12px var(--red); transform-origin: left; pointer-events: none;
  transition: transform .35s var(--ease), width .35s var(--ease);
}
.ink::before {
  content: ""; position: absolute; left: 0; bottom: 0; width: 9px; height: 9px; background: var(--gold);
}

.quick {
  display: flex; gap: 8px; padding: 10px 14px 12px; overflow-x: auto; scrollbar-width: none;
}
.quick button {
  flex: none; padding: 6px 13px; border-radius: 8px; font-size: 13.5px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  transition: background .2s, color .2s, border-color .2s, transform .15s var(--ease);
}
.quick button:active { transform: scale(.94); }
.quick button.on { background: var(--gold); border-color: var(--gold); color: #000; }

/* ---------- лента ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 14px 14px calc(40px + var(--safe-b)); }
.sampleNote {
  margin: 0 0 12px; padding: 10px 12px; font-size: 13px; color: var(--gold-ink);
  background: var(--gold); border-radius: 8px; font-weight: 600;
}
.head { display: flex; justify-content: space-between; align-items: baseline; margin: 2px 2px 12px; color: var(--muted); font-size: 13.5px; font-weight: 600; min-height: 20px; }
.head b { color: var(--text); font-weight: 800; font-size: 15px; }

.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface); cursor: pointer;
  clip-path: polygon(0 0, calc(100% - var(--chamfer)) 0, 100% var(--chamfer), 100% 100%, 0 100%);
  transition: transform .25s var(--ease), background .25s;
  outline-offset: -3px;
}
.card:hover { transform: translateY(-3px); background: var(--surface2); }
.card:active { transform: scale(.985); }

.media { position: relative; aspect-ratio: 16 / 9; background: radial-gradient(120% 120% at 20% 0%, #3a2210, #0b0908 75%); overflow: hidden; }
.media img.ph-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease), opacity .4s; opacity: 0; }
.media img.ph-img.ok { opacity: 1; }
.card:hover .media img.ph-img { transform: scale(1.05); }
.media::after { content: ""; position: absolute; inset: auto 0 0 0; height: 55%; background: linear-gradient(transparent, rgba(0, 0, 0, .5)); pointer-events: none; }

/* заготовка вместо картинки */
.ph {
  display: grid; place-items: center; width: 100%; height: 100%;
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(229, 37, 45, .35) 46% 48%, transparent 48%),
    repeating-linear-gradient(115deg, transparent 0 14px, rgba(255, 255, 255, .035) 14px 15px),
    radial-gradient(120% 120% at 20% 0%, var(--kc, #3a2210), #0b0908 75%);
}
.ph img { width: 34%; max-width: 150px; opacity: .92; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .6)); }
.k-игры { --kc: #3a2210; } .k-железо { --kc: #3a1a14; } .k-ии { --kc: #45170f; } .k-роботы { --kc: #45170f; } .k-технологии { --kc: #33280d; }

.fav {
  position: absolute; z-index: 3; left: 10px; top: 10px; width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; color: #fff; background: rgba(11, 9, 8, .62);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: transform .2s var(--ease), background .2s, color .2s;
}
.fav svg { width: 19px; height: 19px; }
.fav:active { transform: scale(.85); }
.fav.on { background: var(--gold); color: var(--gold-ink); }
.fav.on svg { fill: currentColor; }
.fav.pop svg { animation: pop .4s var(--ease); }
@keyframes pop { 40% { transform: scale(1.45) rotate(-8deg); } }

.china {
  position: absolute; z-index: 2; right: calc(var(--chamfer) + 2px); top: 12px; padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700; color: #fff; background: rgba(11, 9, 8, .62); border: 1px solid rgba(255, 255, 255, .2);
}

/* фирменная полоска: жёлтый квадрат с чёрным номером и красная линия */
.strip { position: relative; z-index: 2; display: flex; align-items: center; height: 34px; margin: -17px 0 0 14px; }
.strip .num {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--gold); color: #000; font-weight: 800; font-size: 18px; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.strip .line {
  flex: 1; height: 4px; background: linear-gradient(90deg, var(--red), var(--orange)); box-shadow: 0 0 14px rgba(229, 37, 45, .85);
  transform-origin: left; margin-right: 0;
}
.strip .kind {
  flex: none; margin-left: 10px; margin-right: 14px; padding: 3px 9px; font-size: 12.5px; font-weight: 700;
  color: #fff; background: var(--bg); border-radius: 6px;
}
:root[data-theme="light"] .strip .kind { background: #121626; }
.draw .strip .line { animation: draw .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + 150ms); }
@keyframes draw { from { transform: scaleX(0); } }

.body { padding: 10px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.body h3 { margin: 0; font-size: 18px; line-height: 1.24; font-weight: 800; letter-spacing: -.015em; text-wrap: balance; }
.body p {
  margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { margin-top: auto; padding-top: 4px; display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.meta span:first-child { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta span:last-child { flex: none; }

/* первая карточка крупнее */
@media (min-width: 640px) {
  .card.hero { grid-column: 1 / -1; flex-direction: row; }
  .card.hero .media { aspect-ratio: auto; flex: 0 0 58%; min-height: 300px; }
  .card.hero .strip { position: absolute; left: calc(58% - 17px); top: 0; margin: 0; height: auto; width: auto; flex-direction: column; bottom: 0; }
  .card.hero .strip .num { margin-top: 18px; }
  .card.hero .strip .line { width: 4px; height: auto; flex: 1; transform-origin: top; }
  .card.hero .strip .kind { position: absolute; right: 46px; top: 22px; margin: 0; }
  .draw .card.hero .strip .line { animation-name: drawY; }
  .card.hero .media::after { display: none; }
  .card.hero .body { padding: 22px 24px 22px 40px; justify-content: center; }
  .card.hero h3 { font-size: 27px; }
  .card.hero p { -webkit-line-clamp: 4; font-size: 15px; }
  .card.hero .meta { margin-top: 10px; }
}
@keyframes drawY { from { transform: scaleY(0); } }
@media (max-width: 639px) { .card.hero h3 { font-size: 21px; } }

/* скелетоны */
.sk .media, .sk .bar1, .sk .bar2, .sk .bar3 { background: linear-gradient(100deg, var(--surface2) 30%, rgba(255, 255, 255, .09) 50%, var(--surface2) 70%) 0 0 / 220% 100%; animation: sh 1.3s linear infinite; }
:root[data-theme="light"] .sk .media, :root[data-theme="light"] .sk .bar1, :root[data-theme="light"] .sk .bar2, :root[data-theme="light"] .sk .bar3 { background: linear-gradient(100deg, #e6e9f1 30%, #fff 50%, #e6e9f1 70%) 0 0 / 220% 100%; animation: sh 1.3s linear infinite; }
.sk .bar1 { height: 18px; width: 92%; border-radius: 4px; } .sk .bar2 { height: 18px; width: 64%; border-radius: 4px; } .sk .bar3 { height: 12px; width: 40%; border-radius: 4px; margin-top: 6px; }
.sk .strip .line { background: var(--surface2); box-shadow: none; }
.sk { cursor: default; }
.sk:hover { transform: none; background: var(--surface); }
@keyframes sh { to { background-position: -220% 0; } }

/* пусто и ошибка */
.empty { text-align: center; padding: 48px 20px; max-width: 420px; margin: 0 auto; animation: drop .4s var(--ease); }
.empty .sq { width: 64px; height: 64px; margin: 0 auto 18px; display: grid; place-items: center; background: var(--gold); color: #000; font-size: 34px; font-weight: 800; box-shadow: 0 0 0 0 transparent, 80px 0 0 -30px var(--red); }
.empty h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.empty p { margin: 0 0 20px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  font-weight: 800; font-size: 15.5px; color: #fff; background: var(--red); text-decoration: none;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  transition: background .2s, transform .15s var(--ease);
}
.btn:hover { background: var(--red-hi); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface); color: var(--text); border: 0; box-shadow: inset 0 0 0 1px var(--line); clip-path: none; border-radius: 12px; }
.btn.ghost.on { background: var(--gold); color: var(--gold-ink); box-shadow: none; }
.btn.ghost.on svg { fill: currentColor; }
.btn svg { width: 19px; height: 19px; }

/* ---------- экран новости ---------- */
.detail {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  transform: translateX(104%); visibility: hidden;
  transition: transform .38s var(--ease), visibility 0s .38s;
}
.detail.open { transform: none; visibility: visible; transition: transform .38s var(--ease); }
.detail::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(900px 360px at 85% -6%, rgba(229, 37, 45, .17), transparent 70%);
}
.dscroll { position: relative; height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(48px + var(--safe-b)); }
.back {
  position: sticky; top: 10px; z-index: 5; display: flex; align-items: center; gap: 2px; margin: 10px 0 0 10px;
  padding: 8px 14px 8px 8px; border-radius: 12px; font-weight: 700; background: var(--glass);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); width: fit-content; box-shadow: inset 0 0 0 1px var(--line);
}
.tg .back { display: none; }
#article { position: relative; max-width: 720px; margin: -46px auto 0; }
.tg #article { margin-top: 0; }
.dmedia { position: relative; aspect-ratio: 16 / 9; background: radial-gradient(120% 120% at 20% 0%, #3a2210, #0b0908 75%); overflow: hidden; clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 0 100%); }
.dmedia img.ph-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dmedia::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(transparent, rgba(0, 0, 0, .45)); }
.detail .strip { margin: -17px 0 0 18px; }
.detail .strip .kind { margin-right: 18px; }
.dbody { padding: 18px 18px 0; animation: rise .5s .12s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.dbody h1 { margin: 0 0 10px; font-size: 28px; line-height: 1.16; font-weight: 800; letter-spacing: -.025em; text-wrap: balance; }
.dmeta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 20px; }
.dmeta b { color: var(--text); font-weight: 800; }
.dtext p { margin: 0 0 1.05em; font-size: 17px; line-height: 1.65; max-width: 62ch; }
.quote {
  position: relative; margin: 24px 0; padding: 18px 20px 18px 22px; background: var(--quote-bg);
  border-left: 4px solid var(--red); font-size: 18px; line-height: 1.5; font-weight: 600; font-style: italic;
}
.quote::before { content: "\201C"; position: absolute; right: 14px; top: -6px; font: 800 70px/1 "Manrope", serif; color: var(--gold); opacity: .9; font-style: normal; }
.quote p { margin: 0; max-width: 52ch; }
.joke { display: flex; gap: 12px; align-items: flex-start; margin: 22px 0; padding: 14px 16px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 16px; line-height: 1.5; }
.joke .heart { font-size: 22px; line-height: 1.2; }
.joke b { color: var(--gold); font-weight: 800; }
:root[data-theme="light"] .joke b { color: var(--red); }
.dact { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.dact .btn:first-child { flex: 1 1 240px; }
.src { margin-top: 12px; font-size: 13px; color: var(--muted); word-break: break-all; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 60; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 10px; background: var(--gold); color: var(--gold-ink); font-weight: 800; font-size: 14px;
  transition: opacity .25s, transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 900px) {
  .dbody h1 { font-size: 34px; }
  .bar { padding-inline: 20px; } main { padding-inline: 20px; } .quick { padding-inline: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
@media (min-width: 640px) { .card.hero .strip .line { background: linear-gradient(180deg, var(--red), var(--orange)); } }

/* плеер YouTube на экране новости */
.dmedia.yt { aspect-ratio: 16 / 9; background: #000; }
.dmedia.yt iframe { display: block; width: 100%; height: 100%; border: 0; }
