* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a0033 0%, #330066 50%, #660099 100%);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

body.game-active {
  padding: 0;
}

body.game-active #app {
  max-width: 100%;
  padding-top: 0;
}

body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  z-index: 0;
}

body::before {
  width: 400px;
  height: 400px;
  background: #ff00cc;
  top: -100px;
  left: -100px;
}

body::after {
  width: 400px;
  height: 400px;
  background: #3333ff;
  bottom: -100px;
  right: -100px;
}

#app {
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 1;
  padding-top: 20px;
}

.game-header {
  text-align: center;
  margin-bottom: 32px;
  animation: fadeIn 0.6s ease-out;
}

.game-title {
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.game-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  font-weight: 400;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  animation: fadeIn 0.6s ease-out;
}

.character-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.character-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.character-card:active {
  transform: translateY(-2px);
}

.card-img-wrapper {
  width: 100%;
  aspect-ratio: 7 / 9;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-name {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.back-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.8);
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
  margin-bottom: 16px;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff006e, #ff4d94);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.stage-num {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.sticky-image-wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  background: #1a0033;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticky-image-wrap .game-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.sticky-image-wrap .game-img.blurred {
  filter: blur(8px);
}

.sticky-image-wrap .back-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  margin: 0;
}

.scroll-hint {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: hintFade 4s ease-in-out forwards;
}

@keyframes hintFade {
  0%, 60% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; transform: translateX(-50%) translateY(-4px); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
}

.sticky-image-wrap .progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 10px 16px 12px;
  z-index: 2;
  background: linear-gradient(to top, rgba(26,0,51,0.7), transparent);
}

.scroll-content {
  position: relative;
  z-index: 1;
  margin-top: var(--img-h, 100vh);
  padding: 24px 16px 48px;
  background: linear-gradient(135deg, #1a0033 0%, #330066 50%, #660099 100%);
  border-radius: 20px 20px 0 0;
  min-height: 50vh;
  animation: fadeIn 0.5s ease-out;
}

.question-area {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 20px;
  animation: fadeIn 0.5s ease-out;
}

.question-text {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.5;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
  text-align: center;
}

.option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.option-btn:active:not(:disabled) {
  transform: translateY(0);
}

.option-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.option-btn.correct {
  background: rgba(0, 200, 83, 0.3);
  border-color: #00c853;
  animation: pulseGreen 0.4s ease;
}

.option-btn.wrong {
  background: rgba(255, 23, 68, 0.3);
  border-color: #ff1744;
  animation: shake 0.4s ease;
}

@keyframes pulseGreen {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.unlock-btn {
  display: block;
  width: 100%;
  padding: 18px 24px;
  background: linear-gradient(135deg, #ff006e, #ff4d94);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
  animation: fadeIn 0.6s ease-out, premiumGlow 1.2s ease-in-out infinite alternate;
  margin-top: 20px;
}

.unlock-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 40px rgba(255, 0, 108, 0.5);
}

@keyframes premiumGlow {
  from { box-shadow: 0 0 20px rgba(255, 0, 108, 0.5); }
  to   { box-shadow: 0 0 50px rgba(255, 0, 108, 0.8); }
}

html[dir="rtl"] .sticky-image-wrap .back-btn {
  left: auto;
  right: 12px;
}

html[dir="rtl"] .question-text {
  text-align: center;
}

html[dir="rtl"] body {
  font-family: 'Noto Sans Arabic', 'Poppins', sans-serif;
}

.motivation-banner {
  background: rgba(255, 0, 108, 0.15);
  border: 1px solid rgba(255, 0, 108, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 14px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.5;
  animation: fadeIn 0.8s ease-out;
}

.celebration {
  text-align: center;
  padding: 24px 0 8px;
  animation: celebrationPop 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.celebration-emoji {
  font-size: 3rem;
  animation: celebrationBounce 1s ease-in-out infinite;
}

.celebration-text {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 10px;
}

@keyframes celebrationPop {
  0% { opacity: 0; transform: scale(0.3); }
  60% { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes celebrationBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@media (max-width: 480px) {
  body { padding: 12px; }
  body.game-active { padding: 0; }
  #app { padding-top: 12px; }
  .game-title { font-size: 1.5rem; }
  .character-grid { gap: 12px; }
  .character-card { padding: 12px; }
  .card-name { font-size: 0.8rem; }
  .scroll-content { padding: 20px 12px 36px; }
  .question-area { padding: 16px; }
  .question-text { font-size: 0.95rem; }
  .option-btn { padding: 12px 14px; font-size: 0.9rem; }
  .unlock-btn { font-size: 1rem; padding: 16px 20px; }
}
