:root {
  --red: #e11d2a;
  --red-bright: #ff2d3f;
  --red-deep: #8f0d16;
  --bg: #0a0708;
  --bg-2: #140a0c;
  --card: #1a1012;
  --card-2: #20141600;
  --line: #341a1f;
  --text: #f7eef0;
  --muted: #b89aa0;
  --green: #21c97a;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg); /* fallback color, sits BEHIND the video/canvas */
}
body {
  /* must stay transparent — an opaque body background paints over the
     negative z-index video & canvas and hides them */
  background: transparent;
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

/* background video (real waving red flag) */
#bg-video {
  position: fixed; inset: 0; z-index: -5;
  width: 100vw; height: 100vh; object-fit: cover;
  filter: saturate(1.15) contrast(1.05);
}
/* dark/red overlay so text + cards stay readable on top of the video */
.bg-overlay {
  position: fixed; inset: 0; z-index: -4; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10,7,8,.72) 0%, rgba(10,7,8,.55) 40%, rgba(10,7,8,.88) 100%),
    radial-gradient(circle at 50% 30%, rgba(225,29,42,.18), transparent 60%);
}

/* 3D embers canvas (layers on top of the video) */
#bg-canvas {
  position: fixed; inset: 0; z-index: -3;
  width: 100vw; height: 100vh; display: block; pointer-events: none;
}

/* ============================================================
   FLOATING CASE NUMBERS — drift up the screen in columns
   ============================================================ */
.cases-bg {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.float-case {
  position: absolute; top: 0; will-change: transform;
  color: #ff5460; font-weight: 700;
  font-family: 'Share Tech Mono', ui-monospace, monospace;
  letter-spacing: .12em; white-space: nowrap; text-transform: uppercase;
  text-shadow: 0 0 14px rgba(255,45,63,.6);
  animation: floatUp linear forwards;
  /* per-element opacity set in JS for depth */
}
@keyframes floatUp {
  from { transform: translateY(110vh); }
  to   { transform: translateY(-120vh); }
}
/* keep the centered column above the drifting watermarks */
.wrap { z-index: 2; }

/* ============================================================
   LIVE "CASE FILE" TERMINAL FEED — fixed left rail, CRT styling
   ============================================================ */
.feed {
  position: fixed; top: 0; left: 0; z-index: 20;
  width: 284px; height: 100vh;
  padding: 22px 14px;
  pointer-events: none;            /* purely decorative, never blocks clicks */
  font-family: 'Share Tech Mono', ui-monospace, monospace;
}
.feed-frame {
  position: relative; height: 100%;
  overflow: hidden;            /* borderless — just streaming text */
}
/* feed only shows when there is room beside the centered 640px column */
@media (max-width: 1180px) { .feed { display: none; } }

.feed-list {
  list-style: none; margin: 0; padding: 0 10px;
  display: flex; flex-direction: column; gap: 9px;
  /* fill the whole column; only a slim fade at the very top & bottom edges */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 3%, #000 95%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 3%, #000 95%, transparent 100%);
}
.feed-line {
  font-size: 11px; line-height: 1.2; letter-spacing: .01em;
  color: rgba(225,60,72,.92); text-shadow: 0 0 6px rgba(225,29,42,.35);
  white-space: nowrap; text-transform: uppercase;
  animation: feedIn .35s ease both;
}
.feed-line .t { color: rgba(225,29,42,.55); margin-right: 6px; }
/* status colour variants */
.feed-line.ok     { color: #2ee68a; text-shadow: 0 0 7px rgba(33,201,122,.5); }
.feed-line.ok .t  { color: rgba(46,230,138,.5); }
.feed-line.hot    { color: #ff5a68; text-shadow: 0 0 9px rgba(255,45,63,.7); }
.feed-line.dim    { color: rgba(184,90,96,.6); text-shadow: none; }
.feed-line.dim .t { color: rgba(184,90,96,.4); }
@keyframes feedIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* CRT scanlines + faint flicker over the whole rail */
.feed-scan {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    180deg, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.22) 3px, rgba(0,0,0,0) 4px);
  mix-blend-mode: multiply; animation: feedFlicker 5s steps(60) infinite;
}
@keyframes feedFlicker { 0%,100% { opacity: .55; } 48% { opacity: .42; } 50% { opacity: .62; } }

@media (prefers-reduced-motion: reduce) {
  .feed-scan, .feed-line { animation: none !important; }
}

/* sound toggle */
#sound-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 50;
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
  font-size: 18px; line-height: 1;
  background: rgba(26,16,18,.7); border: 1px solid var(--line);
  color: var(--text); backdrop-filter: blur(8px);
  transition: transform .15s, border-color .2s, background .2s;
}
#sound-toggle:hover { transform: scale(1.08); border-color: var(--red); }
#sound-toggle:active { transform: scale(.94); }

/* background flair */
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background-image:
    linear-gradient(rgba(225,29,42,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225,29,42,.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 70%);
}
.bg-glow {
  position: fixed; top: -25%; left: 50%; transform: translateX(-50%);
  width: 700px; height: 700px; z-index: -1;
  background: radial-gradient(circle, rgba(225,29,42,.22), transparent 60%);
  filter: blur(20px); pointer-events: none;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px 80px;
  position: relative;
}

/* staggered entrance */
.wrap > * { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
.hero { animation-delay: .05s; }
.manifesto { animation-delay: .14s; }
.progress { animation-delay: .2s; }
.tasks { animation-delay: .26s; }
.wallet { animation-delay: .32s; }
.submit { animation-delay: .38s; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wrap > * { animation: none; } }

/* hero */
.hero { text-align: center; margin-bottom: 36px; }
.flag {
  font-size: 56px; line-height: 1;
  filter: drop-shadow(0 6px 24px rgba(225,29,42,.5));
  animation: wave 3s ease-in-out infinite;
}
@keyframes wave { 0%,100%{ transform: rotate(-4deg);} 50%{ transform: rotate(4deg);} }
.hero h1 {
  font-size: clamp(40px, 9vw, 64px);
  font-weight: 900; letter-spacing: -2px; margin-top: 8px;
  text-shadow: 0 0 40px rgba(225,29,42,.35);
}
.hero h1 span { color: var(--red); animation: titleGlow 3s ease-in-out infinite; }
@keyframes titleGlow {
  0%,100% { text-shadow: 0 0 24px rgba(225,29,42,.5); }
  50% { text-shadow: 0 0 48px rgba(255,45,63,.95); }
}
.tag { color: var(--muted); margin-top: 12px; line-height: 1.6; font-size: 15px; }

.counter {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 18px; padding: 6px 14px;
  background: rgba(225,29,42,.1); border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.counter .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.counter #count { color: var(--text); }

/* manifesto */
.manifesto {
  background: linear-gradient(180deg, rgba(26,16,18,.72), rgba(19,11,13,.72));
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 32px;
}
.manifesto p { font-size: 15px; font-weight: 600; }
.manifesto ul { margin: 12px 0 12px 4px; list-style: none; }
.manifesto li { color: var(--muted); padding: 3px 0 3px 22px; position: relative; font-size: 14px; }
.manifesto li::before { content: '✕'; position: absolute; left: 0; color: var(--red); font-weight: 700; }
.manifesto .strong { color: var(--text); font-weight: 700; margin-top: 6px; }

/* progress */
.progress { margin-bottom: 22px; }
.progress-bar { height: 8px; background: #2a161a; border-radius: 999px; overflow: hidden; }
.progress-bar > div {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--red-deep), var(--red-bright));
  border-radius: 999px; transition: width .35s ease;
}
.progress-label { text-align: right; font-size: 12px; color: var(--muted); margin-top: 6px; font-weight: 600; }

/* tasks */
.tasks { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-bottom: 30px; }
.task {
  position: relative; overflow: hidden;
  display: flex; gap: 16px;
  background: linear-gradient(180deg, rgba(30,18,20,.78), rgba(20,12,14,.78));
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 18px; padding: 18px;
  transition: border-color .25s, transform .2s, box-shadow .25s;
}
/* left accent bar — uses the per-task accent colour */
.task::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; z-index: 2;
  background: linear-gradient(180deg, var(--accent), var(--accent-soft));
  opacity: .55; transition: opacity .25s, background .25s;
}
/* periodic light sweep across each card (staggered per task) */
.task::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.07) 50%, transparent 58%);
  transform: translateX(-130%);
  animation: cardSweep 7s ease-in-out infinite;
}
.task:nth-child(2)::after { animation-delay: 1.2s; }
.task:nth-child(3)::after { animation-delay: 2.4s; }
.task:nth-child(4)::after { animation-delay: 3.6s; }
.task.done::after { animation: none; }
@keyframes cardSweep {
  0%, 18% { transform: translateX(-130%); }
  38%, 100% { transform: translateX(130%); }
}
.task-body, .task-icon { position: relative; z-index: 2; }
.task:hover { transform: translateY(-3px); border-color: var(--accent-soft); box-shadow: 0 14px 36px var(--accent-soft); }
.task:hover::before { opacity: 1; }
.task.done { border-color: rgba(33,201,122,.45); }
.task.done::before { background: var(--green); opacity: 1; }
.task.done:hover { box-shadow: 0 14px 36px rgba(33,201,122,.18); }

/* icon tile */
.task-icon {
  position: relative; flex: 0 0 54px; width: 54px; height: 54px;
  display: grid; place-items: center; border-radius: 15px;
  background: radial-gradient(circle at 30% 25%, #2a181b, #14090b);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  transition: all .25s;
  animation: tileGlow 3.2s ease-in-out infinite;
}
@keyframes tileGlow {
  0%,100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 0 0 rgba(0,0,0,0); border-color: var(--line); }
  50%     { box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 0 18px var(--accent-soft); border-color: var(--accent-soft); }
}
.task:hover .task-icon { transform: scale(1.06) rotate(-2deg); animation-play-state: paused; border-color: var(--accent); }
.task.done .task-icon { animation: none; }
.task-icon svg { width: 25px; height: 25px; transition: opacity .2s; transform-origin: 50% 50%; }

/* per-task accent color (drives icon, tile glow & accent bar) */
.task[data-task="follow"]  { --accent: #ffffff; --accent-soft: rgba(255,255,255,.5); }
.task[data-task="like"]    { --accent: #ff3b5c; --accent-soft: rgba(255,59,92,.5); }
.task[data-task="retweet"] { --accent: #21c97a; --accent-soft: rgba(33,201,122,.5); }
.task[data-task="quote"]   { --accent: #4aa8ff; --accent-soft: rgba(74,168,255,.5); }
.task .task-icon svg { fill: var(--accent); }

/* idle icon micro-animations — each task type moves in its own way */
.task[data-task="follow"]  .task-icon svg { animation: pulseScale 2.8s ease-in-out infinite; }
.task[data-task="like"]    .task-icon svg { animation: heartbeat 2.4s ease-in-out infinite; }
.task[data-task="retweet"] .task-icon svg { animation: spinTick 5s cubic-bezier(.7,0,.3,1) infinite; }
.task[data-task="quote"]   .task-icon svg { animation: bob 2.6s ease-in-out infinite; }
.task.done .task-icon svg,
.task:hover .task-icon svg { animation-play-state: paused; }

@keyframes pulseScale { 0%,100% { transform: scale(1); } 50% { transform: scale(1.16); } }
@keyframes heartbeat {
  0%,100% { transform: scale(1); } 12% { transform: scale(1.28); }
  24% { transform: scale(1); } 36% { transform: scale(1.18); } 48% { transform: scale(1); }
}
@keyframes spinTick { 0%,62% { transform: rotate(0deg); } 80%,100% { transform: rotate(360deg); } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.task-icon .step {
  position: absolute; top: -7px; left: -7px;
  width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: var(--red); color: #fff; border: 2px solid #15090b;
}
.task.done .task-icon { background: radial-gradient(circle at 30% 25%, rgba(33,201,122,.25), rgba(20,12,14,.6)); border-color: rgba(33,201,122,.5); }
.task.done .task-icon svg { opacity: 0; }
.task.done .task-icon::after {
  content: '✓'; position: absolute; font-size: 26px; font-weight: 800; color: var(--green);
  animation: checkPop .45s cubic-bezier(.2,1.5,.4,1) both;
}
@keyframes checkPop {
  0%   { transform: scale(0) rotate(-35deg); opacity: 0; }
  60%  { transform: scale(1.25) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.task.done .step { background: var(--green); }

.task-body { flex: 1; min-width: 0; }
.task-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-body h3 { font-size: 16px; font-weight: 700; }
.task-body h3 .handle { color: var(--red); }
.task-body > p { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* status tag */
.status {
  flex: 0 0 auto; font-size: 10px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; padding: 4px 9px; border-radius: 999px;
  background: rgba(225,29,42,.12); color: var(--red-bright); border: 1px solid var(--line);
}
.status::after { content: 'Required'; }
.task:not(.done) .status { animation: badgePulse 2.2s ease-in-out infinite; }
@keyframes badgePulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.task.done .status { animation: none; background: rgba(33,201,122,.14); color: var(--green); border-color: rgba(33,201,122,.4); }
.task.done .status::after { content: 'Completed ✓'; }

.quote-preview {
  margin: 12px 0 4px; padding: 12px 14px;
  background: rgba(8,5,6,.6); border: 1px solid var(--line); border-radius: 12px;
  font-size: 13px; color: var(--muted); white-space: pre-wrap; line-height: 1.5;
}

.task-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 11px; font-weight: 700; font-size: 14px;
  text-decoration: none; cursor: pointer; border: none;
  transition: transform .12s, filter .2s, opacity .2s, background .2s;
}
.btn:active { transform: scale(.96); }
.btn svg { width: 16px; height: 16px; }
.x-btn { background: var(--text); color: #0a0708; }
.x-btn svg { fill: #0a0708; }
.x-btn:hover { filter: brightness(.92); transform: translateY(-1px); }
.x-btn.clicked { background: #2a1a1d; color: var(--muted); }
.x-btn.clicked svg { fill: var(--muted); }

/* confirm pill (hidden checkbox + styled label) */
.confirm { cursor: pointer; user-select: none; }
.confirm input { position: absolute; opacity: 0; width: 0; height: 0; }
.confirm-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; border-radius: 11px; font-weight: 700; font-size: 14px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted);
  transition: all .2s;
}
.confirm-pill .check { font-size: 13px; opacity: .35; transition: opacity .2s; }
.confirm:hover .confirm-pill { border-color: rgba(33,201,122,.5); color: var(--text); }
.confirm input:checked + .confirm-pill {
  background: rgba(33,201,122,.16); border-color: rgba(33,201,122,.6); color: var(--green);
}
.confirm input:checked + .confirm-pill .check { opacity: 1; }
.confirm input:focus-visible + .confirm-pill { outline: 2px solid var(--green); outline-offset: 2px; }

/* wallet */
.wallet { margin-bottom: 22px; }
.wallet h3 { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.wallet > p { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
#wallet {
  width: 100%; padding: 16px; border-radius: 12px;
  background: rgba(26,16,18,.72); backdrop-filter: blur(10px);
  border: 1px solid var(--line); color: var(--text);
  font-size: 15px; font-family: 'SFMono-Regular', ui-monospace, monospace;
  letter-spacing: .3px; transition: border-color .2s;
}
#wallet:focus { outline: none; border-color: var(--red); }
#wallet.valid { border-color: var(--green); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.field-error { color: var(--red-bright); font-size: 13px; margin-top: 8px; min-height: 18px; font-weight: 600; }

/* submit */
.submit {
  width: 100%; padding: 18px; border-radius: 14px; border: none; cursor: pointer;
  font-size: 16px; font-weight: 800; letter-spacing: .2px;
  background: linear-gradient(180deg, var(--red-bright), var(--red));
  color: #fff; transition: transform .12s, filter .2s, opacity .2s;
  box-shadow: 0 8px 30px rgba(225,29,42,.35);
}
.submit:hover:not(:disabled) { filter: brightness(1.08); }
.submit:active:not(:disabled) { transform: scale(.98); }
.submit:disabled { background: #2a161a; color: #6b4a50; box-shadow: none; cursor: not-allowed; }

.result {
  margin-top: 18px; padding: 18px; border-radius: 12px; text-align: center;
  font-weight: 700; font-size: 15px; line-height: 1.5;
}
.result.ok { background: rgba(33,201,122,.12); border: 1px solid rgba(33,201,122,.4); color: var(--green); }
.result.err { background: rgba(225,29,42,.1); border: 1px solid var(--line); color: var(--red-bright); }

.foot { text-align: center; margin-top: 30px; }
.foot p { color: #6b4a50; font-size: 12px; }

@media (max-width: 480px) {
  .wrap { padding: 32px 16px 60px; }
  .task { padding: 14px; gap: 12px; }
}

/* respect reduced-motion: kill the idle/ambient loops, keep instant states */
@media (prefers-reduced-motion: reduce) {
  .task-icon, .task-icon svg, .task::after, .task:not(.done) .status,
  .task.done .task-icon::after, .progress-bar > div { animation: none !important; }
}
