:root {
  --bg: #040613;
  --panel-bg: rgba(10, 16, 41, 0.9);
  --gold: #e6c364;
  --gold-gradient: linear-gradient(135deg, #9a7a20, #e6c364, #ffe08f, #e6c364);
  --hex-border: rgba(230, 195, 100, 0.35);
  --hex-hover: rgba(230, 195, 100, 0.6);
  --text-main: #ede3c8;
  --green: #22c55e;
  --red: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Cairo', sans-serif; }
body, html { width: 100%; height: 100%; background: var(--bg); color: var(--text-main); overflow-x: hidden; direction: rtl; }

/* الخلفيات والأنيميشن */
#starCanvas, #confCanvas { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
#confCanvas { z-index: 100; }
.bg-glow { position: fixed; inset: 0; z-index: 0; background: radial-gradient(circle at 50% 50%, rgba(230,195,100,0.03) 0%, transparent 80%); pointer-events: none; }

.screen { position: relative; z-index: 10; width: 100%; min-height: 100vh; display: flex; flex-direction: column; }

/* ════════════════ SCREEN 1: CHOOSE LEVEL ════════════════ */
.header-nav { width: 100%; padding: 20px 40px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05); }
.nav-title { font-weight: 700; color: #a1b0cb; font-size: 15px; }
.nav-icons { display: flex; gap: 15px; cursor: pointer; opacity: 0.8; }

.level-container { width: 100%; max-width: 1200px; margin: 40px auto; padding: 0 20px; text-align: center; flex: 1; }
.welcome-badge { display: inline-block; background: rgba(230,195,100,0.1); border: 1px solid var(--gold); color: var(--gold); padding: 4px 16px; border-radius: 20px; font-size: 14px; font-weight: bold; margin-bottom: 15px; }
.main-title { font-size: 42px; font-weight: 900; background: linear-gradient(to bottom, #fff, var(--gold)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 8px; }
.sub-title-text { color: #7688a6; font-size: 16px; margin-bottom: 40px; }

.levels-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; margin-bottom: 40px; }
.level-card { background: rgba(13, 21, 49, 0.7); border: 2px solid rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 35px 25px; cursor: pointer; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); text-align: center; position: relative; overflow: hidden; }
.level-card:hover { transform: translateY(-8px); box-shadow: 0 12px 30px rgba(0,0,0,0.5); }

/* ألوان الكروت المستوحاة من الصورة */
.level-card.purple:hover { border-color: #8b5cf6; box-shadow: 0 0 20px rgba(139, 92, 246, 0.2); }
.level-card.blue:hover { border-color: #3b82f6; box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
.level-card.teal:hover { border-color: #10b981; box-shadow: 0 0 20px rgba(16, 185, 129, 0.2); }
.level-card.dark-blue:hover { border-color: #1e3a8a; box-shadow: 0 0 20px rgba(30, 58, 138, 0.2); }
.level-card.orange:hover { border-color: #f97316; box-shadow: 0 0 20px rgba(249, 115, 22, 0.2); }
.level-card.red-card:hover { border-color: #ef4444; box-shadow: 0 0 20px rgba(239, 68, 68, 0.2); }

.level-icon { font-size: 45px; margin-bottom: 15px; }
.level-card h3 { font-size: 22px; font-weight: 700; margin-bottom: 20px; color: #fff; }
.level-btn { width: 100%; background: var(--gold-gradient); color: #050714; border: none; padding: 12px; border-radius: 8px; font-weight: 900; font-size: 15px; cursor: pointer; transition: opacity 0.2s; }
.level-card:hover .level-btn { opacity: 0.9; }
.footer-note { color: #526685; font-size: 13px; margin-top: 20px; }

/* ════════════════ SCREEN 2: GAMEPLAY ════════════════ */
.game-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; width: 100%; max-width: 1500px; margin: auto; padding: 20px; height: 95vh; }

.prize-ladder { background: var(--panel-bg); border: 1px solid var(--hex-border); border-radius: 16px; padding: 15px; display: flex; flex-direction: column; gap: 5px; overflow-y: auto; }
.ladder-header { font-size: 14px; text-align: center; color: var(--gold); font-weight: bold; padding-bottom: 10px; border-bottom: 1px solid rgba(230,195,100,0.1); margin-bottom: 5px; }
.prize-item { display: flex; justify-content: space-between; padding: 6px 12px; border-radius: 8px; font-size: 14px; color: rgba(237,227,200,0.4); font-weight: 600; }
.prize-item.current { background: rgba(230,195,100,0.15); border: 1px solid var(--gold); color: #fff; font-weight: 900; }
.prize-item.safe-level { color: var(--green); }
.prize-item.passed { opacity: 0.2; }

.center-area { display: flex; flex-direction: column; justify-content: space-between; padding: 10px 0; }
.game-topbar { display: flex; justify-content: space-between; align-items: center; background: var(--panel-bg); padding: 15px 30px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.04); }
.qnum-badge, .prize-badge { font-size: 16px; font-weight: 700; }
.qnum-badge span, .pamount { color: var(--gold); font-weight: 900; }

.timer-wrap { flex: 1; max-width: 300px; margin: 0 20px; }
.timer-track { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: var(--gold-gradient); transform-origin: right; transition: width 1s linear; }
.timer-text { font-size: 12px; text-align: center; margin-top: 4px; color: #7688a6; }

/* وسائل المساعدة بالأعلى لتماثل شكل الصورة الثالثة */
.lifelines-top { display: flex; justify-content: center; gap: 30px; margin: 20px 0; }
.ll-btn { background: var(--panel-bg); border: 1px solid var(--hex-border); width: 85px; height: 85px; border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; transition: all 0.25s; }
.ll-btn:hover:not(:disabled) { border-color: var(--gold); transform: scale(1.05); box-shadow: 0 0 15px rgba(230,195,100,0.2); }
.ll-btn:disabled { opacity: 0.15; cursor: not-allowed; text-decoration: line-through; }
.ll-icon { font-size: 20px; font-weight: 900; color: var(--gold); margin-bottom: 2px; }
.ll-label { font-size: 11px; color: #7688a6; }

/* تصميم السؤال الممتد الأطراف والمسحوب (الشكل السداسي) */
.question-hex { background: var(--panel-bg); border: 1px solid var(--hex-border); padding: 35px 50px; text-align: center; position: relative; margin-bottom: 25px; border-radius: 4px; clip-path: polygon(4% 0%, 96% 0%, 100% 50%, 96% 100%, 4% 100%, 0% 50%); min-height: 130px; display: flex; align-items: center; justify-content: center; }
.question-text { font-size: 26px; font-weight: 700; color: #fff; line-height: 1.6; }

/* شبكة الإجابات بحجم مكبر وأطراف مشطوفة احترافية */
.answers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 35px; margin-bottom: 20px; }
.ans-btn { background: rgba(11, 18, 43, 0.9); border: 1px solid var(--hex-border); padding: 22px 30px; text-align: right; color: #fff; font-size: 19px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 15px; clip-path: polygon(3% 0%, 97% 0%, 100% 50%, 97% 100%, 3% 100%, 0% 50%); position: relative; }
.ans-btn:hover:not(:disabled) { border-color: var(--gold); background: rgba(230, 195, 100, 0.08); padding-right: 35px; }

.ans-letter { width: 32px; height: 32px; background: rgba(230,195,100,0.15); border: 1px solid var(--gold); color: var(--gold); display: flex; align-items: center; justify-content: center; border-radius: 4px; font-weight: 900; font-size: 16px; }

/* حالات الإجابة الفورية والمؤثرات */
.ans-btn.selected { border-color: #fff; background: rgba(255,255,255,0.15); }
.ans-btn.correct { border-color: var(--green); background: rgba(34, 197, 94, 0.2) !important; color: #86efac; }
.ans-btn.correct .ans-letter { background: var(--green); color: #000; border-color: var(--green); }
.ans-btn.wrong { border-color: var(--red); background: rgba(239, 68, 68, 0.2) !important; color: #fca5a5; }
.ans-btn.wrong .ans-letter { background: var(--red); color: #fff; border-color: var(--red); }
.ans-btn.removed { opacity: 0.05; pointer-events: none; }

.bottom-bar { display: flex; justify-content: center; }
.walk-btn { background: transparent; border: 1px solid rgba(255,255,255,0.1); padding: 10px 30px; border-radius: 30px; color: #7688a6; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.walk-btn:hover { border-color: var(--gold); color: #fff; }

/* النوافذ المنبثقة Overlays */
.overlay { position: fixed; inset: 0; background: rgba(3, 5, 15, 0.85); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 200; opacity: 1; transition: opacity 0.3s; }
.overlay.hidden { opacity: 0; pointer-events: none; display: none; }
.ov-card { background: #0c122c; border: 1px solid var(--gold); border-radius: 20px; padding: 40px; max-width: 500px; width: 90%; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.6); }

.phone-avatar { font-size: 50px; margin-bottom: 10px; }
.ph-bubble { background: rgba(255,255,255,0.03); border: 1px solid rgba(230,195,100,0.2); padding: 20px; border-radius: 12px; margin: 20px 0; font-size: 18px; line-height: 1.7; text-align: center; color: var(--gold-l); }

.aud-bars-wrap { display: flex; justify-content: space-around; align-items: flex-end; height: 180px; margin: 25px 0; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bar-fill { width: 45px; background: var(--gold-gradient); border-radius: 4px 4px 0 0; height: 10px; transition: height 1s ease-out; }
.bar-pct { font-size: 14px; font-weight: bold; color: var(--gold); }

.btn-gold { background: var(--gold-gradient); color: #000; border: none; padding: 12px 35px; border-radius: 25px; font-weight: 900; font-size: 16px; cursor: pointer; margin-top: 15px; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.2); padding: 10px 25px; border-radius: 25px; color: #fff; cursor: pointer; margin-top: 15px; }
.btn-ghost:hover { border-color: var(--gold); }