/* rs-fx.css v1 – Red Shadow: panel pamięci jako ekran CRT + efekty */

/* ---------- ekran ---------- */
.rsfx-crt { position: relative; }
.rsfx-crt #memory-log {
  position: relative;
  box-shadow: inset 0 0 40px rgba(0, 255, 255, .06), 0 0 0 1px rgba(0, 255, 255, .08);
  transform-origin: 50% 50%;
}
#memory-log .feed-entry:not(.inactive) { text-shadow: 0 0 6px rgba(140, 255, 255, .22); }
.rsfx-crt-fx {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2;
}
/* linie skanowania */
.rsfx-crt-fx::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.035) 0, rgba(255,255,255,.035) 1px, transparent 1px, transparent 3px);
  animation: rsfxFlicker 6s infinite steps(1);
}
/* winieta */
.rsfx-crt-fx::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 58%, rgba(0,0,0,.55) 100%);
}
/* połysk szkła */
.rsfx-sheen {
  position: absolute; inset: 0;
  background: linear-gradient(118deg, rgba(150,255,255,.07) 0%, rgba(150,255,255,.02) 22%, transparent 40%);
}
/* przewijający się pas odświeżania */
.rsfx-roll {
  position: absolute; left: 0; right: 0; top: -20%; height: 18%;
  background: linear-gradient(to bottom, transparent, rgba(120,255,255,.05), transparent);
  animation: rsfxRoll 7s linear infinite;
}
@keyframes rsfxRoll { to { top: 110%; } }
@keyframes rsfxFlicker { 0%,100% { opacity: 1 } 47% { opacity: .85 } 48% { opacity: 1 } 83% { opacity: .92 } 84% { opacity: 1 } }

/* włączenie ekranu */
.rsfx-crt.rsfx-boot #memory-log { animation: rsfxBoot .62s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rsfxBoot {
  0%   { transform: scale(.6, .004); filter: brightness(5); }
  35%  { transform: scale(1, .012); filter: brightness(4); }
  60%  { transform: scale(1, 1.03); filter: brightness(1.8) blur(1px); }
  100% { transform: none; filter: none; }
}
/* odświeżenie przy nowej scenie */
.rsfx-crt.rsfx-refresh #memory-log { animation: rsfxRefresh .5s steps(6) both; }
.rsfx-crt.rsfx-refresh .rsfx-roll { animation: rsfxRollFast .5s linear 1; background: linear-gradient(to bottom, transparent, rgba(160,255,255,.16), transparent); }
@keyframes rsfxRefresh { 0% { filter: brightness(1.6) } 30% { filter: brightness(.7) } 50% { filter: brightness(1.25) } 100% { filter: none } }
@keyframes rsfxRollFast { from { top: -20% } to { top: 110% } }
/* błąd: czerwone mignięcie ekranu */
.rsfx-crt.rsfx-err .rsfx-crt-fx { animation: rsfxErr .45s steps(3) 1; }
@keyframes rsfxErr { 0% { background: rgba(255,0,40,.16) } 50% { background: rgba(255,0,40,.05) } 100% { background: transparent } }

/* ---------- odsłanianie tekstu ---------- */
#memory-log .rsfx-h { display: none !important; }
#memory-log .rsfx-in { animation: rsfxIn .34s ease-out both; }
@keyframes rsfxIn {
  0%   { opacity: 0; filter: blur(3px) brightness(2.2); }
  55%  { opacity: 1; filter: blur(.6px) brightness(1.4); }
  100% { opacity: 1; filter: none; }
}
#memory-log p.rsfx-in { animation-name: rsfxInBlock; }
@keyframes rsfxInBlock {
  0%   { opacity: 0; filter: blur(3px) brightness(2.2); transform: translateX(-4px); clip-path: inset(0 100% 0 0); }
  40%  { opacity: 1; clip-path: inset(0 0 0 0); }
  100% { opacity: 1; filter: none; transform: none; clip-path: inset(0 0 0 0); }
}
.rsfx-cur {
  display: inline-block; margin-left: 2px; color: #6ff;
  text-shadow: 0 0 8px rgba(0,255,255,.7);
  animation: rsfxCur .55s steps(2) infinite;
}
@keyframes rsfxCur { 50% { opacity: 0 } }
#memory-log.rsfx-skip-hint, .rsfx-crt:has(.rsfx-revealing) #memory-log { cursor: pointer; }

/* linia "Nadzorca: ..." – myśli */
#memory-log .feed-entry[data-temp="1"] { color: #6ff; animation: rsfxThink 1s steps(2) infinite; }
@keyframes rsfxThink { 50% { opacity: .35 } }
/* wpis gracza */
#memory-log .feed-entry.rsfx-user:not(.inactive) { color: #bfefff; }

/* [Nowy przedmiot: …] */
.loot-tag.rsfx-loot { animation: rsfxTag 1.5s ease-out both; display: inline-block; }
@keyframes rsfxTag {
  0%   { background: rgba(0,229,255,.55); color: #001; box-shadow: 0 0 22px rgba(0,229,255,.9); letter-spacing: .25em; }
  30%  { background: rgba(0,229,255,.25); color: #fff; letter-spacing: .06em; }
  100% { background: transparent; box-shadow: none; color: #00e5ff; letter-spacing: .02em; }
}
.loot-tag.rsfx-loot-static { text-shadow: 0 0 8px rgba(0,229,255,.8); }

/* zły fragment */
#memory-log .feed-entry.rsfx-wrong:not(.inactive) { color: #ff7a7a; text-shadow: 0 0 8px rgba(255,40,60,.45); }
#memory-log .feed-entry.rsfx-glitching { animation: rsfxGlitch .65s steps(1) both; }
@keyframes rsfxGlitch {
  0%   { transform: translateX(-3px) skewX(-6deg); text-shadow: 3px 0 rgba(255,0,60,.8), -3px 0 rgba(0,255,255,.7); clip-path: inset(0 0 55% 0); }
  15%  { transform: translateX(4px); clip-path: inset(40% 0 0 0); }
  30%  { transform: translateX(-2px) skewX(4deg); clip-path: inset(10% 0 30% 0); }
  45%  { transform: translateX(2px); clip-path: inset(0 0 0 0); text-shadow: -2px 0 rgba(255,0,60,.8), 2px 0 rgba(0,255,255,.7); }
  60%  { transform: translateX(-1px); opacity: .6; }
  75%  { transform: none; opacity: 1; }
  100% { transform: none; clip-path: inset(0 0 0 0); }
}

/* ---------- przyciski wyboru zablokowane podczas odsłaniania ---------- */
#choices.rsfx-locked button { opacity: .38; filter: grayscale(.6); cursor: pointer; transition: opacity .3s; }
#choices:not(.rsfx-locked) button:not(.disabled-choice) { transition: opacity .35s, filter .35s; }

/* ---------- przycisk dźwięku ---------- */
.panel-title.rsfx-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#rsfx-mute {
  background: transparent !important; border: 1px solid rgba(0,255,255,.35) !important; color: #6ff;
  border-radius: 6px; font-size: 15px; line-height: 1; padding: 4px 7px !important; width: auto !important;
  cursor: pointer; opacity: .75; flex: 0 0 auto; margin: 0; box-shadow: none;
}
#rsfx-mute:hover, #rsfx-mute:focus-visible { opacity: 1; box-shadow: 0 0 10px rgba(0,255,255,.35); }

/* ---------- karty ODZYSKANE DANE ---------- */
#inventory { position: relative; }
#inventory .inventory-item.rsfx-wait { opacity: 0; }
.rsfx-card { position: absolute; pointer-events: none; z-index: 3; }
.rsfx-card .rsfx-q { display: block; width: 100%; height: auto; }
.rsfx-card .rsfx-glyph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 700 18px/1 monospace; color: #6ff; text-shadow: 0 0 8px #0ff; letter-spacing: 1px;
}
.rsfx-card .rsfx-bar {
  position: absolute; left: -4%; right: -4%; height: 3px; top: 0; opacity: 0;
  background: #bff; box-shadow: 0 0 10px 2px rgba(0,255,255,.9);
}
.rsfx-card.rsfx-card-go { animation: rsfxFrame .5s steps(2) both; }
.rsfx-card.rsfx-card-go .rsfx-q { animation: rsfxQOut .52s steps(7) both; }
.rsfx-card.rsfx-card-go .rsfx-bar { animation: rsfxBar .85s linear .43s both; }
@keyframes rsfxFrame { 0% { filter: drop-shadow(0 0 0 #0ff) brightness(1) } 30% { filter: drop-shadow(0 0 10px #0ff) brightness(2.4) } 60% { filter: drop-shadow(0 0 4px #0ff) brightness(1.3) } 100% { filter: none } }
@keyframes rsfxQOut {
  0%   { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
  20%  { transform: translateX(3px); clip-path: inset(0 0 40% 0); }
  40%  { transform: translateX(-3px); clip-path: inset(30% 0 10% 0); filter: hue-rotate(90deg); }
  60%  { opacity: .8; transform: scale(1.04) translateX(2px); clip-path: inset(10% 0 55% 0); filter: blur(1px); }
  80%  { opacity: .4; transform: scale(1.08); filter: blur(2px); }
  100% { opacity: 0; transform: scale(1.12); filter: blur(4px); }
}
@keyframes rsfxBar { 0% { top: 0; opacity: 1 } 95% { opacity: 1 } 100% { top: 100%; opacity: 0 } }
#inventory .inventory-item.rsfx-scanin { animation: rsfxScan .85s steps(14) both; }
@keyframes rsfxScan {
  0%   { clip-path: inset(0 0 100% 0); filter: brightness(2) saturate(.2); }
  70%  { filter: brightness(1.4) saturate(.8); }
  100% { clip-path: inset(0 0 0 0); filter: none; }
}
#inventory .inventory-item.rsfx-cardpulse { animation: rsfxCardPulse .65s ease-out both; }
@keyframes rsfxCardPulse {
  0%   { box-shadow: 0 0 0 2px rgba(200,255,255,.95), 0 0 22px rgba(0,255,255,.9); transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0 rgba(0,255,255,0), 0 0 0 rgba(0,255,255,0); transform: scale(1); }
}
/* wersja ograniczonego ruchu */
.rsfx-card.rsfx-card-rm .rsfx-q { opacity: 0; transition: opacity .3s; }
#inventory .inventory-item.rsfx-card-glow { box-shadow: 0 0 0 2px rgba(0,255,255,.8), 0 0 14px rgba(0,255,255,.6); transition: box-shadow .3s; }

/* ---------- ograniczenie ruchu ---------- */
@media (prefers-reduced-motion: reduce) {
  .rsfx-roll, .rsfx-crt-fx::before { animation: none !important; }
  .rsfx-crt.rsfx-boot #memory-log, .rsfx-crt.rsfx-refresh #memory-log { animation: none !important; }
  #memory-log .rsfx-in, #memory-log p.rsfx-in { animation: rsfxFade .15s linear both !important; }
  #memory-log .feed-entry.rsfx-glitching, .loot-tag.rsfx-loot { animation: none !important; }
  .rsfx-cur, #memory-log .feed-entry[data-temp="1"] { animation: none !important; }
  #inventory .inventory-item.rsfx-scanin, #inventory .inventory-item.rsfx-cardpulse { animation: none !important; }
}
@keyframes rsfxFade { from { opacity: 0 } to { opacity: 1 } }
