/* ==========================================================
   مسابقة الورقة المخفية - نادي نزاهة
   التصميم الأصلي: مساحة 1200×860 (سطح المكتب)
   الجوال والأجهزة الصغيرة: تخطيط متجاوب عمودي
   ========================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #0b3d26;
}

body {
  color: #ffffff;
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-weight: 700;
  overflow-x: hidden;
}

/* ---------- الحركات ---------- */
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-16px) rotate(4deg); }
}

@keyframes roam {
  0%, 100% { left: 940px; top: 330px; transform: rotate(-20deg); }
  50%      { left: 1020px; top: 420px; transform: rotate(12deg); }
}

@keyframes roam-m {
  0%, 100% { left: calc(50% + 118px); top: -22px; transform: rotate(-20deg); }
  50%      { left: calc(50% + 136px); top: -6px; transform: rotate(12deg); }
}

@keyframes fall {
  0%   { transform: translateY(-40px) rotate(0deg); }
  100% { transform: translateY(900px) rotate(540deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

@keyframes taunt {
  0%   { opacity: 0; transform: translateY(8px); }
  10%  { opacity: 1; transform: translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

.bob   { animation: bob 2.4s ease-in-out infinite; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }

/* ---------- الإطار والمسرح ---------- */
.frame {
  position: relative;
  width: 100%;
  height: 860px;
  overflow: hidden;
}

.stage {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 1200px;
  height: 860px;
  background: #0b3d26;
  color: #ffffff;
  overflow: hidden;
  transform: scale(var(--s, 1));
  transform-origin: top center;
}

/* ---------- الصفحة الرئيسية ---------- */
.fall {
  position: absolute;
  top: -40px;
  width: 18px;
  height: 24px;
  background: #fbfdfb;
  border-radius: 3px;
  opacity: .7;
  animation: fall 7s linear infinite;
}
.fall.alt  { background: #bfe6d0; }
.fall.dark { background: #2f9e62; }

.logos {
  position: absolute;
  top: 36px;
  left: 72px;
  right: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logos img {
  width: auto;
  mix-blend-mode: lighten;
}
.logo-imam  { height: 96px; }
.logo-nazaha { height: 66px; }

.title {
  position: absolute;
  top: 196px;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-size: 72px;
  line-height: 1.3;
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

.mag {
  position: absolute;
  left: 142px;
  top: -55px;
  width: 96px;
  height: 96px;
  animation: roam 6s ease-in-out infinite;
}

.subtitle {
  position: absolute;
  top: 290px;
  left: 0;
  right: 0;
  width: 1204px;
  height: 39px;
  margin: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 400;
  color: #e2f2e9;
}

.card {
  position: absolute;
  top: 363px;
  left: 276px;
  width: 645px;
  height: 298px;
  background: #fbfdfb;
  color: #0b3d26;
  border-radius: 28px;
  box-shadow: 0 12px 0 #062417;
}

.badge {
  position: absolute;
  top: 28px;
  right: 30px;
  background: #2f9e62;
  color: #ffffff;
  border-radius: 999px;
  padding: 4px 16px;
  font-size: 16px;
}

.card-title {
  position: absolute;
  top: 84px;
  left: 40px;
  right: 40px;
  margin: 0;
  font-size: 46px;
  line-height: 1.4;
  font-weight: 700;
}

.card-sub {
  position: absolute;
  top: 200px;
  left: 40px;
  right: 40px;
  margin: 0;
  font-size: 22px;
  line-height: 1.6;
  font-weight: 400;
  color: #1f7a4d;
}

.cta {
  position: absolute;
  bottom: 34px;
  left: 40px;
}

.cta a {
  display: inline-block;
  padding: 14px 44px;
  border-radius: 999px;
  background: #0b3d26;
  color: #ffffff;
  text-decoration: none;
  font-size: 26px;
  font-weight: 700;
}

.hero-mag {
  position: absolute;
  left: 733px;
  top: 252px;
  width: 180px;
  height: 180px;
}

.event,
.credit {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 400;
  color: #bfe6d0;
}
.event  { top: 771px; }
.credit { top: 800px; }

/* ---------- الغرفة (الصفحة الثانية) ---------- */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 110px;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-text {
  font-size: 30px;
  line-height: 1.4;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer {
  background: #062417;
  border: 2px solid #bfe6d0;
  border-radius: 14px;
  padding: 10px 22px;
  text-align: center;
}

.timer-label {
  font-size: 16px;
  color: #bfe6d0;
}

.timer-value {
  font-size: 34px;
  line-height: 1.2;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

.found {
  display: inline-block;
  padding: 14px 30px;
  border-radius: 999px;
  background: #ffffff;
  color: #0b3d26;
  font-size: 22px;
}

.room {
  position: absolute;
  top: 110px;
  left: 40px;
  width: 1120px;
  height: 710px;
  border-radius: 24px;
  overflow: hidden;
  background: #135235;
}

.room-art {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 1120px;
  height: 710px;
}

.taunt {
  position: absolute;
  left: 28px;
  top: 18px;
  background: #fbfdfb;
  color: #0b3d26;
  border-radius: 18px;
  padding: 10px 22px;
  font-size: 26px;
  line-height: 1.4;
  animation: taunt 2s infinite;
}

.taunt-tail {
  position: absolute;
  left: 26px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: #fbfdfb;
  transform: rotate(45deg);
}

/* ==========================================================
   التجاوب: الجوال والأجهزة اللوحية الصغيرة
   ========================================================== */
@media (max-width: 899px) {

  .frame {
    height: auto;
    overflow: visible;
  }

  /* الصفحة الرئيسية */
  .stage.page-main,
  .stage.page-room {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    height: auto;
    min-height: 100vh;
    margin: 0;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .stage.page-main {
    padding: 22px 18px 30px;
  }

  .logos {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    order: 1;
  }
  .logo-imam   { height: 64px; }
  .logo-nazaha { height: 44px; }

  .title {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    order: 2;
    margin: 28px 0 0;
    font-size: 42px;
    line-height: 1.35;
  }

  .mag {
    width: 48px;
    height: 48px;
    animation-name: roam-m;
  }

  .subtitle {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: auto;
    height: auto;
    order: 3;
    margin: 14px 0 0;
    padding: 0 8px;
    font-size: 19px;
    line-height: 1.7;
  }

  .card {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    max-width: 645px;
    height: auto;
    order: 4;
    margin: 30px auto 44px;
    padding: 64px 26px 30px;
  }

  .badge {
    top: 18px;
    right: 18px;
  }

  .card-title {
    position: static;
    font-size: 30px;
    line-height: 1.5;
  }

  .card-sub {
    position: static;
    margin-top: 10px;
    font-size: 17px;
    line-height: 1.7;
  }

  .cta {
    position: static;
    margin-top: 24px;
    text-align: center;
  }

  .cta a {
    padding: 12px 40px;
    font-size: 22px;
  }

  .hero-mag {
    position: absolute;
    left: auto;
    top: auto;
    right: -14px;
    bottom: -58px;
    width: 110px;
    height: 110px;
  }

  .event,
  .credit {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    padding: 0 8px;
  }
  .event {
    order: 5;
    margin-top: 40px;
    font-size: 15px;
  }
  .credit {
    order: 6;
    margin-top: 12px;
    font-size: 14px;
  }

  /* الغرفة */
  .stage.page-room {
    padding: 16px 12px 24px;
  }

  .hud {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    order: 1;
    height: auto;
    padding: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
  }

  .hud-text {
    font-size: 20px;
    line-height: 1.5;
    text-align: center;
  }

  .timer-value {
    font-size: 30px;
  }

  .found {
    font-size: 18px;
    padding: 12px 24px;
  }

  .room {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 1120 / 710;
    order: 2;
    margin-top: 18px;
    border-radius: 18px;
  }

  .room-art {
    width: 100%;
    height: 100%;
  }

  .taunt {
    left: 10px;
    top: 10px;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 16px;
  }

  .taunt-tail {
    left: 14px;
    bottom: -6px;
    width: 12px;
    height: 12px;
  }
}

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  .fall,
  .mag,
  .bob,
  .pulse,
  .taunt {
    animation: none;
  }
}

/* ==========================================================
   عقوبة زر «وجدت الورقة» (+30 ثانية)
   ========================================================== */
@keyframes penaltyBump {
  0%   { opacity: 0; transform: translateY(14px) scale(.6); }
  30%  { opacity: 1; transform: translateY(-8px) scale(1.15); }
  45%  { transform: translate(-6px, -4px) scale(1.1); }
  60%  { transform: translate(6px, -4px) scale(1.1); }
  75%  { transform: translate(-4px, 0) scale(1); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* الزر يحافظ على شكله السابق كما هو */
button.found {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: inherit;
  line-height: normal;
}

button.found:focus-visible {
  outline: 3px solid #bfe6d0;
  outline-offset: 3px;
}

.penalty {
  position: absolute;
  left: 50%;
  top: 40%;
  z-index: 5;
  width: min(560px, 80%);
  padding: 26px 30px 22px;
  background: #fbfdfb;
  color: #0b3d26;
  border-radius: 24px;
  box-shadow: 0 12px 0 #062417;
  text-align: center;
  line-height: 1.5;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.85);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}

.penalty.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.penalty-msg {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
}

.penalty-time {
  display: block;
  margin-top: 10px;
  font-size: 40px;
  font-weight: 700;
  color: #d93a3a;
}

.penalty-time.bump {
  animation: penaltyBump .7s ease-out;
}

@media (max-width: 899px) {
  .penalty {
    width: 86%;
    padding: 16px 18px 14px;
    border-radius: 18px;
  }
  .penalty-msg {
    font-size: 18px;
  }
  .penalty-time {
    font-size: 30px;
    margin-top: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .penalty,
  .penalty-time.bump {
    transition: none;
    animation: none;
  }
}
