/* ===================== MedTikTok — styl ===================== */
:root {
  --bg: #0a0e14;
  --panel: #131c26;
  --text: #eef3f8;
  --muted: #93a6ba;
  --line: #243240;
  --accent: #36c5a8;   /* zielony — plus / lubię (domyślny, nadpisywany per układ) */
  --accent-ink: #04231d;
  --accent-2: #2980b9; /* niebieski */
  --warn: #e0b341;
  --bad: #e06b5b;      /* czerwony — minus */
  --topbar-h: 52px;
  --font-display: "Sora", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, monospace;
  --font-kicker: "Spectral", Georgia, serif;
  --font-num: "Onest", "Inter", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* ---- Tożsamość kolorystyczna układu (każda rolka ma swój akcent) ---- */
.reel[data-system="serce"]      { --accent: #ff5a6a; --accent-ink: #2a0207; }
.reel[data-system="krew"]       { --accent: #ff6a8a; --accent-ink: #2a0410; }
.reel[data-system="krazenie"]   { --accent: #ff7a6b; --accent-ink: #2a0a05; }
.reel[data-system="neuro"]      { --accent: #6ea0ff; --accent-ink: #04102e; }
.reel[data-system="nerki"]      { --accent: #4fc3f7; --accent-ink: #04202e; }
.reel[data-system="oddech"]     { --accent: #2dd4bf; --accent-ink: #042a26; }
.reel[data-system="pokarm"]     { --accent: #f7b53b; --accent-ink: #2a1f02; }
.reel[data-system="endo"]       { --accent: #c98bff; --accent-ink: #1e082e; }
.reel[data-system="miesnie"]    { --accent: #ff9a4d; --accent-ink: #2a1602; }
.reel[data-system="ogolne"]     { --accent: #36c5a8; --accent-ink: #04231d; }
.reel[data-system="smierc_kom"] { --accent: #e26bf0; --accent-ink: #260429; }
.reel[data-system="zapalenie"]  { --accent: #ff9f43; --accent-ink: #2a1702; }
.reel[data-system="adaptacja"]  { --accent: #6fb3ff; --accent-ink: #04162e; }
.reel[data-system="nowotwor"]   { --accent: #ef7df5; --accent-ink: #28042a; }

/* ---- Tożsamość TYPOGRAFICZNA: każdy układ ma własny krój nagłówka ---- */
.reel[data-system="serce"]      { --font-display: "Unbounded", sans-serif; }
.reel[data-system="krew"]       { --font-display: "Syne", sans-serif; }
.reel[data-system="krazenie"]   { --font-display: "Big Shoulders Display", sans-serif; }
.reel[data-system="neuro"]      { --font-display: "Space Grotesk", sans-serif; }
.reel[data-system="nerki"]      { --font-display: "Sora", sans-serif; }
.reel[data-system="oddech"]     { --font-display: "Schibsted Grotesk", sans-serif; }
.reel[data-system="pokarm"]     { --font-display: "Zilla Slab", serif; }
.reel[data-system="endo"]       { --font-display: "Familjen Grotesk", sans-serif; }
.reel[data-system="miesnie"]    { --font-display: "Archivo", sans-serif; }
.reel[data-system="ogolne"]     { --font-display: "Outfit", sans-serif; }
.reel[data-system="smierc_kom"] { --font-display: "Instrument Serif", serif; --font-kicker: "DM Serif Display", serif; }
.reel[data-system="zapalenie"]  { --font-display: "Be Vietnam Pro", sans-serif; }
.reel[data-system="adaptacja"]  { --font-display: "Hanken Grotesk", sans-serif; }
.reel[data-system="nowotwor"]   { --font-display: "DM Serif Display", serif; }
/* przedmiot steruje krojem treści (drobna różnica fizjologia/patologia) */
.reel[data-subject="patologia"] { --font-body: "Manrope", sans-serif; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- Topbar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 30;
  background: linear-gradient(180deg, rgba(13,17,23,0.95), rgba(13,17,23,0));
  pointer-events: none;
}
.topbar .brand, .topbar .topbar-actions { pointer-events: auto; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.5px; }
.brand span { color: var(--accent); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.sync-status {
  font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.08); white-space: nowrap; transition: color .2s, background .2s;
}
.sync-status.ok  { color: var(--accent); }
.sync-status.off { color: var(--muted); }
.sync-status.err { color: var(--bad); background: rgba(224,107,91,0.14); }

.icon-btn {
  background: rgba(255,255,255,0.08); border: none; color: var(--text);
  width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer;
  display: grid; place-items: center; transition: background .15s, transform .1s;
}
.icon-btn:hover { background: rgba(255,255,255,0.16); }
.icon-btn:active { transform: scale(0.92); }

/* ---------- Feed ---------- */
.feed {
  height: 100%; width: 100%;
  overflow-y: scroll; scroll-snap-type: y mandatory;
  scroll-behavior: smooth; scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.reel {
  position: relative;
  height: 100%; width: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--topbar-h) + 18px) 80px 90px 22px;
}
/* delikatne, różne tła per układ */
.reel[data-system="neuro"]   { background: radial-gradient(120% 80% at 20% 10%, #1b2740, var(--bg)); }
.reel[data-system="krew"]    { background: radial-gradient(120% 80% at 20% 10%, #2a1620, var(--bg)); }
.reel[data-system="serce"]   { background: radial-gradient(120% 80% at 20% 10%, #2a1418, var(--bg)); }
.reel[data-system="nerki"]   { background: radial-gradient(120% 80% at 20% 10%, #122433, var(--bg)); }
.reel[data-system="oddech"]  { background: radial-gradient(120% 80% at 20% 10%, #102a2a, var(--bg)); }
.reel[data-system="pokarm"]  { background: radial-gradient(120% 80% at 20% 10%, #2a2410, var(--bg)); }
.reel[data-system="endo"]    { background: radial-gradient(120% 80% at 20% 10%, #221a33, var(--bg)); }
.reel[data-system="miesnie"] { background: radial-gradient(120% 80% at 20% 10%, #2a2018, var(--bg)); }
.reel[data-system="ogolne"]  { background: radial-gradient(120% 80% at 20% 10%, #18222b, var(--bg)); }
.reel[data-system="smierc_kom"] { background: radial-gradient(120% 80% at 20% 10%, #281a26, var(--bg)); }
.reel[data-system="krazenie"]   { background: radial-gradient(120% 80% at 20% 10%, #2a151a, var(--bg)); }
.reel[data-system="zapalenie"]  { background: radial-gradient(120% 80% at 20% 10%, #2b1d12, var(--bg)); }
.reel[data-system="adaptacja"]  { background: radial-gradient(120% 80% at 20% 10%, #1c2630, var(--bg)); }
.reel[data-system="nowotwor"]   { background: radial-gradient(120% 80% at 20% 10%, #261628, var(--bg)); }

/* Redakcyjna brewka zamiast pływających chipów */
.reel-eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.eb-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.eb-sys {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--accent);
  white-space: nowrap; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.eb-rule { flex: 1 1 12px; min-width: 10px; height: 1px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 30%, transparent), transparent); }
.eb-subj {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 1px; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn svg { width: 20px; height: 20px; display: block; }

.reel-emoji { font-size: 46px; line-height: 1; margin-bottom: 10px; }
.reel-hook  {
  font-family: var(--font-display);
  font-size: clamp(25px, 6.6vw, 36px); font-weight: 700; line-height: 1.12;
  margin: 0 0 20px; letter-spacing: -0.9px; text-wrap: balance;
}
.reel-svg   { margin: 2px 0 20px; max-width: 430px; }

/* beaty — karty informacyjne (zamiast gęstego akapitu) */
.reel-beats { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.reel-beat {
  position: relative; padding: 11px 14px 11px 28px;
  font-size: clamp(14.5px, 3.9vw, 17px); line-height: 1.46; color: #d6e0ea;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
}
.reel-beat strong, .reel-beat b { color: #fff; font-weight: 700; }
.reel-beat::before {
  content: ""; position: absolute; left: 13px; top: 19px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.reel-kicker {
  position: relative;
  font-family: var(--font-kicker);
  font-size: clamp(15px, 4vw, 18px); font-weight: 600; line-height: 1.38;
  color: #fff; margin: 0;
  padding: 13px 16px 13px 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent) 5%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 4px 14px 14px 4px;
}
.reel-kicker::before {
  content: "KLUCZ"; position: absolute; top: -8px; left: 14px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--accent-ink); background: var(--accent);
  padding: 2px 7px; border-radius: 5px;
}
.reel-source { margin-top: 16px; font-size: 11px; color: #5b6b7a; }

/* ---------- Akcje +/- z prawej (jak TikTok) ---------- */
.reel-actions {
  position: absolute; right: 14px; bottom: 110px;
  display: flex; flex-direction: column; gap: 18px; align-items: center;
}
.act {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; color: var(--text); cursor: pointer;
}
.act .bubble {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  font-size: 26px; background: rgba(255,255,255,0.10); transition: transform .12s, background .15s;
}
.act:active .bubble { transform: scale(0.88); }
.act .lbl { font-size: 11px; color: var(--muted); }
.act.like.on  .bubble { background: var(--accent); color: #04231d; }
.act.dislike.on .bubble { background: var(--bad); color: #2a0d09; }

/* ---------- Hint przewijania ---------- */
.scroll-hint {
  position: absolute; bottom: 26px; left: 0; right: 0; text-align: center;
  color: var(--muted); font-size: 12px; animation: bob 1.6s infinite; pointer-events: none;
}
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(6px);} }

.feed-empty {
  position: fixed; inset: 0; display: grid; place-content: center; text-align: center;
  padding: 24px; z-index: 5;
}

/* ---------- Sheety (ustawienia / wnioski) ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.sheet-inner {
  width: 100%; max-width: 520px; max-height: 82vh; overflow-y: auto;
  background: var(--panel); border-radius: 18px;
  padding: 18px 20px 24px; border: 1px solid var(--line);
  animation: sheetpop .2s ease;
}
@keyframes sheetpop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { font-size: 20px; margin: 0; }
.sheet-section { padding: 16px 0; border-top: 1px solid var(--line); }
.sheet-section:first-of-type { border-top: none; }
.sheet-section h3 { margin: 0 0 4px; font-size: 16px; }

.subject-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.subject-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  background: rgba(255,255,255,0.04); border-radius: 12px; cursor: pointer;
}
.subject-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.subject-row .s-emoji { font-size: 20px; }
.subject-row .s-label { flex: 1; font-weight: 600; }
.subject-row .s-count { font-size: 12px; color: var(--muted); }
.subject-row.soon { opacity: 0.55; }
.subject-row.soon .s-count { color: var(--warn); }

.row-toggle { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.row-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }

.btn {
  background: var(--accent); color: #04231d; border: none; border-radius: 12px;
  padding: 12px 16px; font-size: 14px; font-weight: 700; cursor: pointer; margin: 4px 0;
}
.btn:active { transform: scale(0.97); }
.btn-ghost { background: rgba(255,255,255,0.10); color: var(--text); }
.btn-danger { background: rgba(224,107,91,0.18); color: var(--bad); width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }

/* ---------- Wnioski ---------- */
.insight-stat { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.insight-stat .v { font-weight: 800; }
.bar-row { margin: 10px 0; }
.bar-row .bl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar { height: 9px; border-radius: 6px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.neg > span { background: var(--bad); }
.tag-pill { display: inline-block; background: rgba(255,255,255,0.08); border-radius: 999px; padding: 5px 11px; margin: 3px; font-size: 13px; }
.tag-pill.up { background: rgba(54,197,168,0.18); color: var(--accent); }
.tag-pill.down { background: rgba(224,107,91,0.16); color: var(--bad); }

/* ===================== EFEKTY / SZATA ===================== */

/* chipy z subtelnym gradientem i obwódką */
.chip {
  background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.07);
}

/* poświata emoji + głębsza puenta */
.reel-emoji { filter: drop-shadow(0 0 16px rgba(54,197,168,0.28)); }
.reel-hook  { text-shadow: 0 2px 18px rgba(0,0,0,0.35); }
.reel-kicker { box-shadow: -10px 0 22px -16px var(--accent); }

/* delikatny, pulsujący vignette aktywnej rolki */
.reel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(70% 50% at 85% 95%, rgba(54,197,168,0.10), transparent 70%);
  transition: opacity .6s;
}
.reel.in-view::before { opacity: 1; animation: glowpulse 6s ease-in-out infinite; }
@keyframes glowpulse { 0%,100% { opacity: .4; } 50% { opacity: .85; } }

/* --- animacje wejścia (tylko gdy JS aktywny) --- */
.js-ready .reel-emoji,
.js-ready .reel-hook,
.js-ready .reel-svg,
.js-ready .reel-beat,
.js-ready .reel-kicker { opacity: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pop  { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }

.reel.in-view .reel-emoji { animation: pop .5s .02s both; }
.reel.in-view .reel-hook  { animation: rise .55s .10s both; }
.reel.in-view .reel-svg   { animation: rise .6s .18s both; }
.reel.in-view .reel-beat  { animation: rise .5s both; animation-delay: calc(.26s + var(--i, 0) * .09s); }
.reel.in-view .reel-kicker{ animation: rise .55s .5s both; }

/* --- efekt „boop" przy ocenie --- */
.act .bubble { position: relative; transition: transform .12s, background .15s, box-shadow .2s; }
.act.like.on .bubble    { box-shadow: 0 0 16px rgba(54,197,168,0.5); }
.act.dislike.on .bubble { box-shadow: 0 0 16px rgba(224,107,91,0.45); }
@keyframes boop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 60% { transform: scale(.9); } 100% { transform: scale(1); } }
.act.boop .bubble { animation: boop .45s ease; }
.act.boop .bubble::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--accent); pointer-events: none; animation: ring .5s ease-out forwards;
}
.act.dislike.boop .bubble::after { border-color: var(--bad); }
@keyframes ring { from { opacity: .6; transform: scale(.7); } to { opacity: 0; transform: scale(1.7); } }

/* szacunek dla osób z ograniczonym ruchem */
@media (prefers-reduced-motion: reduce) {
  .js-ready .reel-emoji, .js-ready .reel-hook, .js-ready .reel-svg,
  .js-ready .reel-beat, .js-ready .reel-kicker { opacity: 1 !important; animation: none !important; }
  .act.boop .bubble, .act.boop .bubble::after, .reel.in-view::before { animation: none !important; }
}

/* ===================== AURORA + GŁĘBOKA SZATA (v2) ===================== */

/* Aurory per system — gradient 400%×400% w animowanym ruchu */
.reel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0; transition: opacity 1.6s ease;
  background-size: 400% 400%;
}
.reel.in-view::after { opacity: 1; animation: auroramove 16s ease-in-out infinite; }
@keyframes auroramove {
  0%,100% { background-position: 0% 40%; }
  33%      { background-position: 100% 0%; }
  66%      { background-position: 50% 100%; }
}

.reel[data-system="serce"]::after    { background: linear-gradient(-45deg,rgba(200,20,30,.22),rgba(80,5,10,0),rgba(180,10,20,.18),rgba(60,0,5,0)); }
.reel[data-system="krew"]::after     { background: linear-gradient(-45deg,rgba(190,10,35,.20),rgba(90,0,15,0),rgba(160,5,30,.16),rgba(50,0,10,0)); }
.reel[data-system="neuro"]::after    { background: linear-gradient(-45deg,rgba(30,70,200,.18),rgba(5,25,80,0),rgba(20,90,180,.15),rgba(3,20,60,0)); }
.reel[data-system="nerki"]::after    { background: linear-gradient(-45deg,rgba(10,90,180,.18),rgba(3,40,80,0),rgba(8,70,150,.14),rgba(2,25,60,0)); }
.reel[data-system="oddech"]::after   { background: linear-gradient(-45deg,rgba(10,140,140,.18),rgba(3,70,70,0),rgba(8,110,110,.14),rgba(2,45,50,0)); }
.reel[data-system="pokarm"]::after   { background: linear-gradient(-45deg,rgba(180,140,15,.16),rgba(100,80,0,0),rgba(200,130,8,.14),rgba(70,50,0,0)); }
.reel[data-system="endo"]::after     { background: linear-gradient(-45deg,rgba(110,30,200,.18),rgba(50,8,110,0),rgba(90,20,170,.14),rgba(35,4,75,0)); }
.reel[data-system="miesnie"]::after  { background: linear-gradient(-45deg,rgba(200,90,15,.18),rgba(110,50,0,0),rgba(170,70,8,.14),rgba(70,35,0,0)); }
.reel[data-system="zapalenie"]::after{ background: linear-gradient(-45deg,rgba(220,120,15,.22),rgba(150,70,0,0),rgba(195,95,8,.18),rgba(90,40,0,0)); }
.reel[data-system="nowotwor"]::after { background: linear-gradient(-45deg,rgba(140,15,175,.18),rgba(70,4,90,0),rgba(115,8,150,.14),rgba(45,0,65,0)); }
.reel[data-system="krazenie"]::after { background: linear-gradient(-45deg,rgba(195,15,35,.22),rgba(100,4,15,0),rgba(155,8,28,.18),rgba(65,0,8,0)); }
.reel[data-system="smierc_kom"]::after{ background: linear-gradient(-45deg,rgba(130,0,155,.18),rgba(60,0,75,0),rgba(95,0,115,.14),rgba(35,0,45,0)); }
.reel[data-system="adaptacja"]::after{ background: linear-gradient(-45deg,rgba(18,90,155,.18),rgba(6,42,72,0),rgba(13,72,130,.14),rgba(4,26,55,0)); }
.reel[data-system="ogolne"]::after   { background: linear-gradient(-45deg,rgba(40,185,155,.14),rgba(15,90,70,0),rgba(30,150,120,.11),rgba(8,55,42,0)); }

/* Treść musi być ponad pseudo-elementami */
.reel::before { z-index: 0; }   /* tło — poniżej treści */
.reel-eyebrow, .reel-hook, .reel-svg, .reel-beats, .reel-kicker,
.vs-split, .proc, .mt-chart, .mt-title { position: relative; z-index: 1; }
.reel-actions, .scroll-hint { z-index: 1; }  /* position:absolute już ustawione */

/* Pasek trudności wzdłuż lewej krawędzi rolki */
.reel[data-difficulty="1"] { border-left: 3px solid rgba(54,197,168,.5); }
.reel[data-difficulty="2"] { border-left: 3px solid rgba(224,179,65,.5); }
.reel[data-difficulty="3"] { border-left: 3px solid rgba(224,107,91,.5); }

/* Gradient tekstu hooka po wejściu w viewport — w kolorze akcentu układu */
.js-ready .reel.in-view .reel-hook {
  background: linear-gradient(118deg, #fff 0%, #eef4fb 38%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}
@media (prefers-reduced-motion: reduce) {
  .js-ready .reel.in-view .reel-hook { -webkit-text-fill-color: var(--text); background: none; }
  .reel.in-view::after { animation: none !important; }
}

/* Pulsujące punkciki przy beatach */
@keyframes bulletglow {
  0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 0%, transparent); }
}
.reel.in-view .reel-beat::before {
  animation: bulletglow 2.8s ease-in-out infinite;
  animation-delay: calc(var(--i,0) * .55s + .9s);
}
.reel-beat { transition: color .18s, border-color .18s, transform .18s; }
.reel-beat:hover {
  color: #fff; border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  transform: translateX(3px);
}
.reel-beat:hover::before { transform: scale(1.5); }

/* Głębszy kicker glow */
.reel.in-view .reel-kicker {
  box-shadow: -3px 0 24px -8px var(--accent), -16px 0 38px -20px var(--accent);
}

/* Hover diagram — subtelne rozjaśnienie */
.reel-svg { transition: filter .25s; }
.reel-svg:hover { filter: brightness(1.13) drop-shadow(0 0 10px rgba(54,197,168,.18)); }

/* ===================== SZABLONY (TEMPLATES) ===================== */
/* Każdy szablon to inna kompozycja DOM, nie tylko inny kolor:
   split · process · metric · stage · statement · default.            */

/* ---- elementy bohaterskie startują niewidoczne (wejście) ---- */
.js-ready .vs-side, .js-ready .vs-bolt,
.js-ready .proc-step, .js-ready .mt-row, .js-ready .mt-title { opacity: 0; }

/* ============ STATEMENT — gigantyczna teza (brak diagramu) ============ */
/* Redakcyjnie: ogromny nagłówek z belką akcentu, fakty jako numerowana
   lista z liniami (NIE karty) — inny rytm wizualny niż pozostałe szablony. */
.reel[data-template="statement"] .reel-hook {
  font-size: clamp(30px, 8vw, 46px); line-height: 1.04; letter-spacing: -1.1px;
  margin: 0 0 24px; padding-left: 16px;
  border-left: 4px solid var(--accent);
}
.reel[data-template="statement"] .reel-beats { counter-reset: st; gap: 0; margin-bottom: 20px; }
.reel[data-template="statement"] .reel-beat {
  counter-increment: st;
  background: none; border: none; border-bottom: 1px solid rgba(255,255,255,.09);
  border-radius: 0; padding: 13px 0 13px 34px;
  font-size: clamp(14px, 3.7vw, 16.5px);
}
.reel[data-template="statement"] .reel-beat::before {
  content: counter(st, decimal-leading-zero);
  position: absolute; left: 0; top: 12px;
  width: auto; height: auto; border-radius: 0; background: none !important;
  box-shadow: none !important; animation: none !important;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--accent); opacity: .85;
}
.reel[data-template="statement"] .reel-beat:hover { transform: none; border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ============ STAGE — diagram na cały kadr ============ */
.reel[data-template="stage"] { padding-top: calc(var(--topbar-h) + 14px); }
.reel[data-template="stage"] .reel-svg {
  margin: 0 0 16px; max-width: 470px; padding: 14px; border-radius: 18px;
  background: radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 72%);
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
}
.reel[data-template="stage"] .reel-hook { font-size: clamp(18px, 4.8vw, 24px); margin-bottom: 12px; }
.reel[data-template="stage"] .reel-beat { padding-top: 9px; padding-bottom: 9px; font-size: clamp(13.5px, 3.6vw, 16px); }
.reel[data-template="stage"].in-view .reel-svg  { animation: rise .55s .04s both; }
.reel[data-template="stage"].in-view .reel-hook { animation-delay: .22s; }

/* ============ SPLIT — pełnoekranowe zestawienie dwóch stron ============ */
.reel[data-template="split"] .reel-hook { font-size: clamp(18px, 4.6vw, 23px); margin-bottom: 14px; }
.reel[data-template="split"] .reel-beats { gap: 7px; margin-bottom: 14px; }
.reel[data-template="split"] .reel-beat { padding: 9px 13px 9px 26px; font-size: clamp(12.5px, 3.3vw, 14px); }
.vs-split { position: relative; display: flex; gap: 12px; align-items: center; margin: 0 0 14px; }
.vs-side {
  flex: 1 1 0; min-width: 0; align-self: stretch; border-radius: 14px; padding: 14px 12px 13px;
  display: flex; flex-direction: column; gap: 5px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--vc) 18%, transparent), color-mix(in srgb, var(--vc) 6%, transparent));
  border: 1px solid color-mix(in srgb, var(--vc) 38%, transparent);
  border-top: 3px solid var(--vc);
}
.vs-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(14px, 3.7vw, 18px); letter-spacing: -.3px; color: var(--vc);
}
.vs-note { font-size: clamp(12px, 3.2vw, 13.5px); color: #d6e0ea; line-height: 1.38; }
.vs-note2 { color: var(--muted); }
.vs-bolt {
  flex: 0 0 auto; align-self: center;
  width: 34px; height: 34px; border-radius: 50%; z-index: 2;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 12px; letter-spacing: .5px; color: #0a0e14;
  background: #eef3f8; box-shadow: 0 4px 16px rgba(0,0,0,.55);
}
.reel[data-template="split"].in-view .vs-side  { animation: rise .5s both; }
.reel[data-template="split"].in-view .vs-l     { animation-delay: .14s; }
.reel[data-template="split"].in-view .vs-r     { animation-delay: .24s; }
.reel[data-template="split"].in-view .vs-bolt  { animation: pop .5s .42s both; }

/* ============ PROCESS — wielkie ponumerowane kroki ============ */
.reel[data-template="process"] .reel-emoji { font-size: 30px; margin-bottom: 6px; }
.reel[data-template="process"] .reel-hook  { font-size: clamp(19px, 5vw, 26px); margin-bottom: 16px; }
.proc { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.proc-step { position: relative; display: grid; grid-template-columns: 42px 1fr; gap: 13px; align-items: start; }
.proc-step:not(:last-child)::before {
  content: ""; position: absolute; left: 20px; top: 38px; bottom: -11px; width: 2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--sc, var(--accent)) 50%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
}
.proc-n {
  font-family: var(--font-num); font-weight: 800; font-size: 21px; line-height: 40px;
  width: 40px; height: 40px; text-align: center; border-radius: 13px; z-index: 1;
  color: var(--sc, var(--accent));
  background: color-mix(in srgb, var(--sc, var(--accent)) 15%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--sc, var(--accent)) 60%, transparent);
}
.proc-body { display: flex; flex-direction: column; gap: 2px; padding-top: 1px; }
.proc-head { font-family: var(--font-display); font-weight: 700; color: #fff; font-size: clamp(14px, 3.9vw, 17px); }
.proc-detail { font-size: clamp(12.5px, 3.4vw, 15px); color: #c7d3de; line-height: 1.4; }
.reel[data-template="process"].in-view .proc-step { animation: rise .5s both; animation-delay: calc(.2s + var(--i,0) * .1s); }

/* ============ METRIC — poziome paski z dużymi liczbami ============ */
.reel[data-template="metric"] .reel-hook { font-size: clamp(20px, 5.2vw, 27px); margin-bottom: 14px; }
.mt-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.mt-chart { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.mt-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label val" "track track"; gap: 4px 10px; align-items: baseline; }
.mt-label { grid-area: label; font-size: clamp(13px, 3.5vw, 15px); color: #d6e0ea; }
.mt-val { grid-area: val; font-family: var(--font-num); font-weight: 800; font-size: clamp(17px, 4.6vw, 22px); color: var(--mc); }
.mt-track { grid-area: track; height: 13px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.mt-fill {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--mc) 55%, transparent), var(--mc));
}
.reel[data-template="metric"].in-view .mt-fill { animation: mtgrow .9s cubic-bezier(.2,.8,.25,1) forwards; animation-delay: calc(.3s + var(--i,0) * .12s); }
@keyframes mtgrow { from { width: 0; } to { width: var(--w); } }
.reel[data-template="metric"].in-view .mt-row, .reel[data-template="metric"].in-view .mt-title { animation: rise .5s both; }
.reel[data-template="metric"].in-view .mt-row { animation-delay: calc(.18s + var(--i,0) * .1s); }

/* ===================== DOPRACOWANIE GLOBALNE ===================== */

/* Akcje +/- przejmują kolor akcentu układu */
.act .bubble { border: 1px solid rgba(255,255,255,.08); }
.act.like.on .bubble    { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent); }

/* Topbar z mocniejszym brandingiem */
.brand { font-family: "Epilogue", sans-serif; font-weight: 800; }

/* Subtelne winietowanie krawędzi feedu dla głębi */
.feed::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 20;
  box-shadow: inset 0 0 120px 10px rgba(0,0,0,.35);
}

@media (prefers-reduced-motion: reduce) {
  .js-ready .vs-side, .js-ready .vs-bolt, .js-ready .proc-step,
  .js-ready .mt-row, .js-ready .mt-title { opacity: 1 !important; animation: none !important; }
  .reel[data-template="metric"] .mt-fill { width: var(--w) !important; animation: none !important; }
}

/* ===================== TŁO v4 — ciemne, dopracowane, redakcyjne ===================== */
/* Profesjonalizm = wstrzemięźliwość: prawie-czarna baza, JEDNA wyraźna
   poświata akcentu u góry, hairline-grid jako tekstura, miękka orbita
   dryfująca z boku. Bez gimmicków. Jedna reguła sterowana --accent.        */
.reel[data-system] {
  background:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px) 0 -1px / 100% 46px,
    radial-gradient(115% 80% at 50% -22%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 55%),
    radial-gradient(90% 70% at 108% 8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 50%),
    #07090d;
}

/* Miękka, duża orbita światła — dryfuje powoli, daje głębię i ruch */
.reel::before {
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent 75%);
  width: 70%; height: 55%; inset: auto auto -8% -18%;
  border-radius: 50%; filter: blur(8px);
}
.reel.in-view::before { animation: drift 14s ease-in-out infinite; }
@keyframes drift {
  0%,100% { transform: translate(0,0) scale(1);   opacity: .55; }
  50%     { transform: translate(26px,-22px) scale(1.12); opacity: .85; }
}

/* Aurora — bardzo delikatna, animowana wstęga (subtelny ruch, nie dyskoteka) */
.reel[data-system]::after {
  background:
    linear-gradient(-42deg,
      color-mix(in srgb, var(--accent) 14%, transparent) 0%,
      transparent 42%,
      color-mix(in srgb, var(--accent) 10%, transparent) 70%,
      transparent 95%);
  background-size: 320% 320%;
  mix-blend-mode: screen;
}

@media (prefers-reduced-motion: reduce) {
  .reel[data-system]::after { animation: none !important; }
  .reel.in-view::before { animation: none !important; }
}

/* ===================== TŁO v5 — generowana grafika SVG na rolkę ===================== */
/* Każda rolka ma własną, unikalną grafikę (js/bg.js). CSS-owe pseudo-tła
   wyłączone — SVG je zastępuje. Baza pod spodem dla pewnej czytelności.    */
.reel[data-system] { background: #07090d; }
.reel[data-system]::before, .reel[data-system]::after { display: none !important; }
.reel-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.reel-bg svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
@media (prefers-reduced-motion: reduce) {
  .reel-bg svg * { animation: none !important; }
}

/* ===================== PERSONALIZACJA + DOPASOWANIE EKRANU ===================== */

/* Treść wyśrodkowana i ograniczona szerokością (czytelnie też na szerokim ekranie) */
.reel { align-items: center; padding: calc(var(--topbar-h) + 18px) 22px 92px; }
.reel > .reel-eyebrow, .reel > .reel-hook, .reel > .reel-beats,
.reel > .reel-kicker, .reel > .vs-split, .reel > .proc,
.reel > .mt-chart, .reel > .mt-title { width: 100%; max-width: 620px; }

/* Dyskretna kontrola „więcej / mniej takich" (prawy dół) */
.reel-pref {
  position: absolute; right: 14px; bottom: 22px; z-index: 2;
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.pref {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; color: var(--muted);
}
.pref svg {
  width: 24px; height: 24px; padding: 8px; box-sizing: content-box;
  border-radius: 50%; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  transition: background .15s, color .15s, box-shadow .2s, transform .1s;
}
.pref:active svg { transform: scale(.9); }
.pref:hover svg { background: rgba(255,255,255,.15); }
.pref-lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: .6px; text-transform: uppercase; }
.pref-up.on svg { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 55%, transparent); }
.pref-down.on svg { background: var(--bad); color: #240a06; border-color: var(--bad); }
.pref.on .pref-lbl { color: #fff; }

/* Toast potwierdzenia oceny */
.reel-toast {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 3; max-width: 78%; text-align: center; white-space: nowrap;
  background: rgba(7,9,13,.92); border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  color: #fff; font-family: var(--font-mono); font-size: 12px; letter-spacing: .3px;
  padding: 8px 14px; border-radius: 999px;
  animation: toastin .22s ease, toastout .3s ease 1.2s forwards;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastout { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sheet-inner, .reel-toast { animation: none !important; }
}

/* ===================== FISZKA (interaktywna, animowane odsłonięcie) ===================== */
.reel[data-template="flashcard"] { text-align: center; }
.reel > .fc-a { width: 100%; max-width: 620px; }
.fc-badge {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: 2px;
  color: var(--accent-ink); background: var(--accent);
  padding: 4px 11px; border-radius: 6px; margin-bottom: 16px;
}
.reel[data-template="flashcard"] .reel-hook { font-size: clamp(24px, 6.6vw, 36px); line-height: 1.14; margin-bottom: 20px; }
.fc-reveal {
  font-family: var(--font-display); font-weight: 700; font-size: 15px; cursor: pointer;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 12px;
  padding: 12px 20px; transition: background .15s, transform .1s;
}
.fc-reveal:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.fc-reveal:active { transform: scale(.97); }
.fc-a { max-height: 0; opacity: 0; overflow: hidden; transition: max-height .5s ease, opacity .4s ease, margin-top .4s ease; }
.reel.fc-open .fc-a { max-height: 70vh; opacity: 1; margin-top: 14px; }
.reel.fc-open .fc-reveal { display: none; }
.fc-a p {
  margin: 0; text-align: left; font-size: clamp(15px, 4vw, 18px); line-height: 1.5; color: #eaf1f8;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent) 4%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-left: 3px solid var(--accent); border-radius: 4px 14px 14px 4px; padding: 16px 18px;
}
