:root {
  --bg: #050505;
  --blood: #b3001b;
  --blood-dark: #5c0008;
  --bone: #e6ddcf;
  --dim: #8a8079;
  --green: #4fd28a;
  --sans: "Segoe UI", "SF Arabic", "Noto Sans Arabic", Tahoma, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.flicker main { opacity: .55; }
body.shake main { animation: shake .45s; }

/* ---------- الجو ---------- */
#grain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  opacity: .09; pointer-events: none; z-index: 5;
  image-rendering: pixelated;
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 4;
  background: radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(0,0,0,.85) 100%);
}
.scan {
  position: fixed; inset: 0; pointer-events: none; z-index: 6;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.25) 0 1px, transparent 1px 3px);
}
.flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 7;
  background: var(--blood); opacity: 0;
}
.flash.on { animation: flash .5s ease-out; }
.whisper {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  display: grid; place-items: center;
  font: 900 min(28vw, 180px)/1 var(--sans);
  color: var(--blood-dark); opacity: 0;
  transform: scale(1.1);
}
.whisper.on { animation: whisper 1.4s ease-out; }

.drips {
  position: fixed; top: 0; left: 0; width: 100%; height: 140px;
  z-index: 8; pointer-events: none;
}
.drips .d { transform-origin: top; transform: scaleY(0); animation: drip 9s ease-in infinite; }
.d1 { animation-delay: .5s !important; }
.d2 { animation-delay: 2.2s !important; animation-duration: 12s !important; }
.d3 { animation-delay: 4s !important; }
.d4 { animation-delay: 1.4s !important; animation-duration: 11s !important; }
.d5 { animation-delay: 6s !important; }

.sound {
  position: fixed; bottom: 14px; left: 14px; z-index: 9;
  background: rgba(0,0,0,.6); color: var(--dim);
  border: 1px solid #2a1a1a; border-radius: 99px;
  padding: 6px 14px; font: 13px var(--sans); cursor: pointer;
}

/* ---------- المحتوى ---------- */
.wrap {
  position: relative; z-index: 2;
  max-width: 520px; margin: 0 auto;
  min-height: 100vh;
  padding: 120px 16px 40px;
  display: flex; flex-direction: column;
}
.scene { flex: 1; animation: rise .8s ease-out both; }

.type { margin: 0 0 14px; min-height: 1.4em; white-space: pre-line; }
.type.big { font-size: 28px; font-weight: 800; line-height: 1.4; }
.type.mid { font-size: 20px; font-weight: 700; }
.red { color: var(--blood); text-shadow: 0 0 18px rgba(179,0,27,.45); }

.risks { list-style: none; padding: 0; margin: 10px 0 22px; }
.risks li {
  color: var(--dim); padding: 6px 0;
  border-bottom: 1px solid #1a0f0f;
  animation: rise .6s ease-out both;
}
.risks li::before { content: "— "; color: var(--blood); }

.tag { font-size: 14px; font-weight: 800; color: var(--blood); margin: 0 0 4px; letter-spacing: .02em; }
.tag.green { color: var(--green); }

h1 { font-size: 32px; line-height: 1.35; margin: 0 0 12px; font-weight: 900; }
.dim { color: var(--dim); margin: 0 0 14px; }
.small { font-size: 14px; }

.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  pointer-events: none;
}
.glitch::before { color: var(--blood); transform: translate(2px, 0); opacity: .7; clip-path: inset(0 0 60% 0); animation: g1 3.2s infinite steps(1); }
.glitch::after  { color: #3a0a0a; transform: translate(-2px, 0); opacity: .8; clip-path: inset(55% 0 0 0); animation: g2 2.7s infinite steps(1); }

form { display: grid; gap: 12px; margin-top: 22px; }
.field {
  width: 100%;
  background: #0b0606;
  border: 1px solid #3a0c0c;
  color: var(--bone);
  border-radius: 4px;
  padding: 16px 14px;
  font: 700 20px var(--mono);
  text-align: center;
  letter-spacing: .25em;
  text-transform: uppercase;
  outline: none;
  caret-color: var(--blood);
  transition: border-color .2s, box-shadow .2s;
}
.field::placeholder { color: #3d2a2a; }
.field:focus { border-color: var(--blood); box-shadow: 0 0 0 3px rgba(179,0,27,.2), inset 0 0 24px rgba(179,0,27,.15); }

.btn {
  display: inline-flex; justify-content: center; align-items: center;
  width: 100%;
  border: 0; border-radius: 4px;
  padding: 16px 18px;
  font: 800 18px/1.2 var(--sans);
  background: var(--blood); color: #fff;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 8px 30px -10px rgba(179,0,27,.8);
  transition: transform .1s, filter .2s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: progress; }
.btn.ghost { background: transparent; color: var(--bone); border: 1px solid #4a1616; box-shadow: none; }
#go { margin-top: 10px; animation: pulse 1.8s ease-in-out infinite, rise .8s ease-out both; }

.msg { min-height: 1.6em; margin: 14px 0 0; text-align: center; font-weight: 800; color: var(--blood); }
.tries { text-align: center; font: 12px var(--mono); color: #4a3a3a; margin: 4px 0 0; }

.flag-wrap { margin: 22px 0; display: grid; gap: 10px; }
.flag {
  display: block; text-align: center;
  font: 700 17px var(--mono);
  padding: 18px 10px;
  background: #0d0303;
  color: #ff2a3d;
  border: 1px solid var(--blood);
  border-radius: 4px;
  text-shadow: 0 0 12px rgba(255,42,61,.6);
  word-break: break-all; user-select: all;
  animation: beat 1.2s ease-in-out infinite;
}
.series {
  padding: 18px; border: 1px solid #2a1212; border-radius: 4px;
  background: rgba(20,4,4,.5); text-align: center;
}
.series p { margin: 0 0 10px; }

.foot { margin-top: 30px; text-align: center; font-size: 12px; color: #7a6d66; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- حركات ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes drip { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); } 100% { transform: scaleY(1.15); opacity: 0; } }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }
@keyframes whisper { 0% { opacity: 0; transform: scale(1.15); } 20% { opacity: .5; } 100% { opacity: 0; transform: scale(1); } }
@keyframes shake { 15%, 55% { transform: translate(-8px, 2px); } 35%, 75% { transform: translate(8px, -2px); } }
@keyframes pulse { 50% { box-shadow: 0 0 40px -6px rgba(179,0,27,1); } }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.02); } 24% { transform: scale(1); } 36% { transform: scale(1.015); } }
@keyframes g1 { 0%, 88%, 100% { transform: translate(2px, 0); } 90% { transform: translate(-6px, -2px); } 94% { transform: translate(5px, 1px); } }
@keyframes g2 { 0%, 82%, 100% { transform: translate(-2px, 0); } 84% { transform: translate(6px, 2px); } 87% { transform: translate(-4px, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .drips .d { transform: scaleY(1); }
}
