/* ═══════════════════════════════════════
   GAME PAGE STYLES — from original template
   نسخة منقولة من القالب الأصلي بدون أي تغيير في التصميم
═══════════════════════════════════════ */

/* ═══════════════════════════════════════ LAYOUT ═══════════════════════════════════════ */
.page-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 16px 48px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
.main-col { min-width: 0; }
.sidebar-col { display: flex; flex-direction: column; gap: 14px; }

/* ═══════════════════════════════════════ GAME BOX ═══════════════════════════════════════ */
.game-box {
  background: var(--surface-0);
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow: var(--sh-2);
  scroll-margin-top: 70px;
  position: relative;
}
.game-box-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
}
.game-progress-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.game-progress-bar {
  flex: 1; height: 5px;
  background: var(--surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
  position: relative;
}
.game-progress-fill {
  height: 100%;
  background: var(--game-color);
  border-radius: var(--r-full);
  width: 0%;
  transition: width 420ms cubic-bezier(.4,0,.2,1);
  position: relative;
}
.game-progress-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  animation: shine 2s ease-in-out infinite;
}
.game-step-label {
  font-size: 0.74rem; font-weight: 700;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.game-timer {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: var(--surface-2);
  border-radius: var(--r-full);
  font-size: 0.76rem; font-weight: 700;
  color: var(--text-2);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.game-timer.warning { color: var(--error); background: var(--error-soft); }

/* Start screen */
.start-screen { text-align: center; padding: 12px 0 4px; }
.start-screen-icon { font-size: 2.4rem; margin-bottom: 10px; }
.start-screen h2 { font-size: 1.18rem; font-weight: 800; margin-bottom: 6px; }
.start-screen p {
  color: var(--text-2);
  font-size: 0.9rem;
  margin-bottom: 18px;
  max-width: 340px;
  margin-inline: auto;
}

/* Question */
.question-screen { animation: qIn 280ms cubic-bezier(.4,0,.2,1) both; }
.question-screen.leaving { animation: qOut 200ms cubic-bezier(.4,0,.2,1) both; }
@keyframes qIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes qOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(12px); } }

.question-section { margin-bottom: 20px; }
.question-num {
  font-size: 0.72rem; font-weight: 700;
  color: var(--game-color);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.question-text {
  font-size: clamp(1.05rem, 2.8vw, 1.22rem);
  font-weight: 700; line-height: 1.45;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

/* Options */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.option-btn {
  padding: 13px 14px;
  background: var(--surface-1);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  font-size: 0.9rem; font-weight: 600;
  color: var(--text-1); text-align: right;
  transition: border-color var(--t-fast), background var(--t-fast), transform 100ms ease;
  display: flex; align-items: center; gap: 10px;
  min-height: 50px;
  position: relative;
  will-change: transform;
}
.option-btn:hover { background: var(--game-soft); }
.option-btn:active { transform: scale(0.98); }
.option-btn.selected {
  border-color: var(--game-color);
  background: var(--game-soft);
  color: var(--game-color);
  animation: pop 240ms cubic-bezier(.34,1.4,.64,1);
}
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
.option-letter {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
  flex-shrink: 0;
  color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-spring);
}
.option-btn.selected .option-letter {
  background: var(--game-color); color: white;
  transform: scale(1.08);
}

.game-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn-next {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 26px;
  background: var(--game-color); color: white;
  border-radius: var(--r-full);
  font-size: 0.92rem; font-weight: 700;
  transition: background var(--t-fast), opacity var(--t-fast), transform var(--t-fast);
  margin-right: auto;
}
.btn-next:hover:not(:disabled) { background: var(--brand-hover); }
.btn-next:not(:disabled):active { transform: scale(0.96); }
.btn-next:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }
.btn-skip {
  padding: 10px 16px;
  border-radius: var(--r-full);
  font-size: 0.84rem; font-weight: 600;
  color: var(--text-3);
  transition: color var(--t-fast), background var(--t-fast);
}
.btn-skip:hover { color: var(--text-2); background: var(--surface-2); }

/* Loading */
.loading-screen { text-align: center; padding: 28px 0; animation: qIn 220ms ease both; }
.loading-dots { display: inline-flex; gap: 6px; margin-bottom: 12px; }
.loading-dots span {
  width: 8px; height: 8px;
  background: var(--game-color);
  border-radius: 50%;
  animation: dot-pulse 1.1s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}
.loading-screen p { font-size: 0.95rem; font-weight: 600; color: var(--text-2); }

/* ═══════════════════════════════════════ RESULT CARD ═══════════════════════════════════════ */
.result-card {
  background: var(--surface-0);
  border-radius: var(--r-xl);
  padding: 32px 22px;
  box-shadow: var(--sh-2);
  text-align: center;
  display: none;
  scroll-margin-top: 70px;
}
.result-card.show {
  display: block;
  animation: resultReveal 480ms cubic-bezier(.34, 1.2, .64, 1) both;
}
@keyframes resultReveal {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.result-confetti {
  font-size: 2.4rem;
  margin-bottom: 6px;
  display: inline-block;
  animation: confettiPop 600ms cubic-bezier(.34, 1.5, .64, 1) 100ms both;
}
@keyframes confettiPop {
  0% { opacity: 0; transform: scale(0) rotate(-20deg); }
  60% { opacity: 1; transform: scale(1.15) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}
.result-score-ring {
  width: 92px; height: 92px;
  border-radius: 50%;
  background: var(--game-color);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  position: relative;
  animation: ringIn 500ms cubic-bezier(.34,1.4,.64,1) 200ms both;
}
@keyframes ringIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: none; }
}
.result-score-ring::after {
  content: '';
  position: absolute; inset: 5px;
  background: var(--surface-0);
  border-radius: 50%;
}
.result-score-num {
  font-size: 1.55rem; font-weight: 800;
  color: var(--game-color);
  position: relative; z-index: 1;
  font-variant-numeric: tabular-nums;
}
.result-title {
  font-size: 1.32rem; font-weight: 800;
  color: var(--text-1);
  margin-bottom: 6px;
  animation: fadeUp 400ms ease 350ms both;
}
.result-desc {
  font-size: 0.94rem;
  color: var(--text-2);
  max-width: 380px;
  margin: 0 auto 16px;
  line-height: 1.65;
  animation: fadeUp 400ms ease 450ms both;
}
.result-tags {
  display: flex; gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  animation: fadeUp 400ms ease 550ms both;
}
.result-tag {
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: var(--game-soft);
  color: var(--game-color);
  font-size: 0.76rem; font-weight: 700;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.share-box {
  background: var(--surface-1);
  border-radius: var(--r-md);
  padding: 16px;
  margin-top: 4px;
  animation: fadeUp 400ms ease 650ms both;
}
.share-title {
  font-size: 0.86rem; font-weight: 700;
  color: var(--text-2);
  margin-bottom: 11px;
  text-align: center;
}
.result-actions {
  margin-top: 18px;
  display: flex; gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeUp 400ms ease 750ms both;
}

/* ═══════════════════════════════════════ CTA ═══════════════════════════════════════ */
.cta-section {
  background: var(--surface-0);
  border-radius: var(--r-lg);
  padding: 18px 22px;
  margin-top: 14px;
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--sh-1);
}
.cta-content { flex: 1; min-width: 180px; }
.cta-section h3 { font-size: 0.98rem; font-weight: 800; margin-bottom: 2px; color: var(--text-1); }
.cta-section p { font-size: 0.84rem; color: var(--text-2); }
.btn-cta-main {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  background: var(--brand); color: white;
  border-radius: var(--r-full);
  font-size: 0.88rem; font-weight: 700;
  transition: background var(--t-fast), transform var(--t-fast);
  flex-shrink: 0;
}
.btn-cta-main:hover { background: var(--brand-hover); }
.btn-cta-main:active { transform: scale(0.96); }

/* ═══════════════════════════════════════ SIDEBAR ═══════════════════════════════════════ */
.sidebar-card { padding: 4px 0; }
.sidebar-card-title {
  font-size: 0.86rem; font-weight: 800;
  color: var(--text-1);
  margin-bottom: 10px;
  padding: 0 8px;
}
.related-game-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--r-md);
  transition: background var(--t-fast), transform var(--t-fast);
}
.related-game-item:hover { background: var(--surface-0); transform: translateX(-2px); }
.related-game-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.related-game-info { flex: 1; min-width: 0; }
.related-game-name {
  font-size: 0.84rem; font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  display: block;
}
.related-game-plays { font-size: 0.7rem; color: var(--text-3); }

.sidebar-cta {
  background: var(--brand);
  color: white; text-align: center;
  padding: 18px 14px;
  border-radius: var(--r-lg);
}
.sidebar-cta img { height: 28px; margin: 0 auto 8px; border-radius: 6px; filter: brightness(0) invert(1); }
.sidebar-cta h3 { font-size: 0.92rem; font-weight: 800; margin-bottom: 3px; }
.sidebar-cta p { font-size: 0.76rem; opacity: 0.9; margin-bottom: 12px; }
.sidebar-cta a {
  display: block;
  padding: 9px 16px;
  background: white; color: var(--brand);
  border-radius: var(--r-full);
  font-weight: 700; font-size: 0.84rem;
  transition: transform var(--t-fast);
}
.sidebar-cta a:active { transform: scale(0.96); }

@keyframes shine {
  0%, 100% { transform: translateX(-100%); }
  50%      { transform: translateX(100%); }
}

/* ═══════════════════════════════════════ RESPONSIVE ═══════════════════════════════════════ */
@media (max-width: 1024px) {
  .page-layout { grid-template-columns: 1fr; }
  .sidebar-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}
@media (max-width: 768px) {
  .options-grid { grid-template-columns: 1fr; gap: 8px; }
  .sidebar-col { grid-template-columns: 1fr; }
  .page-layout { padding: 6px 12px 50px; gap: 14px; }
  .game-box { padding: 16px; border-radius: var(--r-lg); }
  .game-box-header { margin-bottom: 14px; }
  .result-card { padding: 26px 16px; border-radius: var(--r-lg); }
  .cta-section { padding: 14px 16px; flex-direction: column; align-items: stretch; text-align: center; }
  .btn-cta-main { width: 100%; justify-content: center; }
}

/* ════════ RARITY BADGE (player identity) ════════ */
.result-rarity-slot { margin-top: 16px; display: flex; justify-content: center; }
.result-rarity {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: 14px;
  animation: rarityIn .6s cubic-bezier(.34,1.3,.64,1) both;
  animation-delay: .8s;
}
.result-rarity .rarity-emoji { font-size: 18px; line-height: 1; }
.result-rarity.tone-ultra {
  background: linear-gradient(135deg, #FCD34D 0%, #F59E0B 100%);
  color: #78350F;
  box-shadow: 0 4px 14px rgba(245,158,11,.35);
}
.result-rarity.tone-rare {
  background: linear-gradient(135deg, #C4B5FD 0%, #8B5CF6 100%);
  color: #4C1D95;
  box-shadow: 0 4px 14px rgba(139,92,246,.3);
}
.result-rarity.tone-uncommon {
  background: linear-gradient(135deg, #BFDBFE 0%, #3B82F6 100%);
  color: #1E3A8A;
  box-shadow: 0 4px 14px rgba(59,130,246,.25);
}
.result-rarity.tone-normal {
  background: var(--brand-soft);
  color: var(--brand);
}
.result-rarity.tone-common {
  background: var(--surface-2);
  color: var(--text-2);
}
@keyframes rarityIn {
  from { opacity: 0; transform: translateY(8px) scale(.92); }
  to   { opacity: 1; transform: translateY(0)   scale(1);   }
}
[data-theme="dark"] .result-rarity.tone-common { background: var(--surface-2); color: var(--text-1); }

/* ════════ NEXT-GAME CHAIN (session chaining) ════════ */
.next-game-chain {
  margin-top: 24px;
  animation: nextGameIn .6s cubic-bezier(.34,1.3,.64,1) both;
  animation-delay: 1.2s;
}
.next-game-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 10px;
  letter-spacing: .2px;
}
.next-game-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 2px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: all var(--t-spring);
  position: relative;
  overflow: hidden;
}
.next-game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--game-color-soft, var(--brand-soft)) 0%, transparent 60%);
  opacity: .35;
  pointer-events: none;
}
.next-game-card:hover, .next-game-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--game-color, var(--brand));
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.next-game-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  font-size: 28px;
  flex-shrink: 0;
  z-index: 1;
}
.next-game-info { flex: 1; min-width: 0; z-index: 1; display: flex; flex-direction: column; gap: 4px; }
.next-game-title {
  font-weight: 800;
  font-size: 16px;
  color: var(--text-1);
}
.next-game-desc {
  font-size: 13px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.next-game-meta {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}
.next-game-meta .meta-sep { opacity: .5; }
.next-game-arrow {
  font-size: 22px;
  color: var(--game-color, var(--brand));
  font-weight: 700;
  transition: transform var(--t);
  z-index: 1;
}
.next-game-card:hover .next-game-arrow { transform: translateX(-4px); }
@keyframes nextGameIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0);    }
}
@media (max-width: 480px) {
  .next-game-card { padding: 12px; gap: 12px; }
  .next-game-icon { width: 48px; height: 48px; font-size: 24px; }
  .next-game-title { font-size: 15px; }
  .next-game-desc { font-size: 12px; }
}

/* ════════ HERO HOOK (rotating) ════════ */
.hero-hook {
  margin: 8px auto 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--game-color, var(--brand));
  background: var(--game-color-soft, var(--brand-soft));
  padding: 8px 16px;
  border-radius: var(--r-full);
  display: inline-block;
  max-width: 90%;
  transition: opacity .25s, transform .25s;
}
.hero-hook.fading { opacity: 0; transform: translateY(-4px); }

/* ════════ DIFFICULTY BADGE ════════ */
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 800;
}
.difficulty-easy   { background: #DCFCE7; color: #15803D; }
.difficulty-medium { background: #FEF3C7; color: #B45309; }
.difficulty-hard   { background: #FEE2E2; color: #B91C1C; }
[data-theme="dark"] .difficulty-easy   { background: rgba(34,197,94,.18); color: #86EFAC; }
[data-theme="dark"] .difficulty-medium { background: rgba(245,158,11,.18); color: #FCD34D; }
[data-theme="dark"] .difficulty-hard   { background: rgba(239,68,68,.18); color: #FCA5A5; }

/* ════════ REPLAY REASON ════════ */
.replay-reason {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  font-style: italic;
  opacity: 0;
  animation: replayIn .5s ease-out 1.6s forwards;
}
@keyframes replayIn { to { opacity: 1; } }
