/* تحدي اليوم الوطني — ساب × هوية اليوم الوطني 2026
   المسرح ثابت 1920×1080 ويُحجَّم بـ--scale ليملأ أي شاشة أفقية.
   الألوان من دليل الهوية (ص 16): الخلفية #002528، البطاقات #00343A، الأساسي #00894A، الأصالة #5ABA1C، الكرم #0050AF، الهمّة #971A4D.
   الخط السعودي الرسمي غير متاح للتنزيل، فالبديل IBM Plex Sans Arabic (الخط اللاتيني المعتمد في الدليل نفسه).
   بلاطات الصفات مرسومة على #002528، فتُدمج بـlighten لتأخذ لون البطاقة التي تحتها. */

@font-face { font-family: "Plex"; font-weight: 400; font-display: block; src: url(fonts/plex-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: block; src: url(fonts/plex-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Plex"; font-weight: 700; font-display: block; src: url(fonts/plex-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Plex"; font-weight: 400; font-display: block; src: url(fonts/plex-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: block; src: url(fonts/plex-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF; }
@font-face { font-family: "Plex"; font-weight: 700; font-display: block; src: url(fonts/plex-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF; }

:root {
  --bg: #002528; --card: #00343A; --card2: #003f46; --choice: #0A4A52;
  --green: #00894A; --green-l: #5ABA1C; --blue: #0050AF; --crimson: #971A4D;
  --ink: #ffffff; --muted: rgba(255,255,255,.74); --line: rgba(255,255,255,.12);
  --r-card: 32px; --r-btn: 24px;   /* نظام الزوايا: بطاقات 32، خيارات 24، أزرار وشارات حبّة كاملة */
  --scale: 1;
}
@property --p { syntax: "<number>"; inherits: true; initial-value: 1; }

* { box-sizing: border-box; margin: 0; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); }
body { font-family: "Plex", system-ui, sans-serif; color: var(--ink); touch-action: manipulation; }
img { -webkit-user-drag: none; display: block; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:active { transform: scale(.98); }
[hidden] { display: none !important; }
h1, h2, p { text-wrap: balance; }

.stage-wrap { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }
.stage { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; overflow: hidden; transform: translate(-50%, -50%) scale(var(--scale)); background: var(--bg);
  display: grid; grid-template-rows: 176px minmax(0, 1fr) 96px; padding: 0 72px; }

/* خلفية: وردة «الرؤية» مقصوصة عند الحافة اليسرى، تتلاشى نحو اليمين */
.bg { position: absolute; inset: 0; pointer-events: none; }
.bg::before { content: ""; position: absolute; width: 1100px; height: 1100px; left: -430px; top: 150px; background: url(img/rosette.jpg) center / contain no-repeat; opacity: .2;
  -webkit-mask-image: linear-gradient(to left, transparent 0%, #000 45%), linear-gradient(to bottom, transparent 0%, #000 14%); -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to left, transparent 0%, #000 45%), linear-gradient(to bottom, transparent 0%, #000 14%); mask-composite: intersect; }
body[data-view="gameView"] .bg::before { opacity: .08; }

/* الشعارات — دليل الهوية ص 14: شعار اليوم الوطني أعلى اليمين وعرضه ضعف أي شعار آخر؛ الجهة الشريكة أعلى اليسار؛ المنفّذ أسفل المنتصف */
.topbar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; }
.nd-logo { width: 520px; height: auto; }
.bank-logo { width: 250px; height: auto; }

main { position: relative; z-index: 1; min-height: 0; }
.view { position: absolute; inset: 0; display: none; }
.view.active { display: grid; }

/* الشاشة الرئيسية — انقسام غير متماثل: النص يميناً والتحديان يساراً */
.home { grid-template-columns: 1fr 1.12fr; gap: 72px; align-items: center; }
.eyebrow { display: inline-block; padding: 12px 28px; border-radius: 999px; background: rgba(0,137,74,.22); border: 2px solid rgba(90,186,28,.45); color: #c8f0b0; font-size: 28px; font-weight: 600; }
.home h1 { font-size: 112px; font-weight: 700; line-height: 1.2; margin: 36px 0 30px; }
.home-copy p { font-size: 36px; line-height: 1.6; color: var(--muted); max-width: 26ch; }

.mode-grid { display: grid; gap: 26px; }
.mode-card { display: grid; grid-template-columns: 1fr 196px; grid-template-rows: auto auto 1fr; column-gap: 36px; text-align: right; height: 250px; padding: 26px 36px 26px 26px; border-radius: var(--r-card); background: var(--card); border: 2px solid var(--line); overflow: hidden; transition: border-color .2s, background .2s; }
.mode-card:active { background: var(--card2); border-color: rgba(90,186,28,.6); }
.mode-art { grid-column: 2; grid-row: 1 / 4; align-self: center; width: 196px; height: 196px; border-radius: 18px; object-fit: cover; mix-blend-mode: lighten; }
.mode-card h2 { grid-column: 1; font-size: 46px; font-weight: 700; line-height: 1.25; }
.mode-card p { grid-column: 1; font-size: 28px; line-height: 1.45; color: var(--muted); margin-top: 6px; }
.play { grid-column: 1; align-self: end; justify-self: start; display: inline-flex; align-items: center; gap: 12px; padding: 12px 32px; border-radius: 999px; background: var(--green); font-size: 28px; font-weight: 700; }
.play::after { content: "←"; font-size: 30px; }

/* شاشة اللعب */
.view#gameView { grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: minmax(0, 1fr); gap: 36px; }
.game-card, .timer-card { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.game-card { display: flex; flex-direction: column; min-height: 0; padding: 32px 48px 36px; }
.game-head { display: flex; align-items: center; gap: 24px; }
.game-title { font-size: 34px; font-weight: 700; color: #c8f0b0; }
body[data-mode="proverb"] .game-title { color: #9fd8e6; }
body[data-mode="dialect"] .game-title { color: #cfcaff; }
.back { margin-inline-start: auto; padding: 14px 30px; border-radius: 999px; border: 2px solid rgba(255,255,255,.3); font-size: 28px; font-weight: 600; }
.badge { padding: 10px 26px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: 28px; font-weight: 600; color: var(--muted); }
.badge:empty { display: none; }
.progress { height: 12px; margin-top: 22px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--green-l); transition: width .5s ease; }
body[data-stage="startStage"] .progress { visibility: hidden; }

.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.question { font-size: 56px; font-weight: 700; line-height: 1.3; margin: 0 0 28px; max-width: 32ch; }
.question.long { font-size: 48px; max-width: 38ch; }
.lead { font-size: 36px; line-height: 1.6; color: var(--muted); }
.primary, .secondary { padding: 26px 80px; border-radius: 999px; font-size: 42px; font-weight: 700; }
.primary { background: var(--green); }
.secondary { border: 2px solid rgba(255,255,255,.35); }

.panel.start { flex-direction: row; align-items: center; justify-content: space-between; gap: 48px; }
.panel.start .badge { display: inline-block; }
#startTitle { font-size: 84px; margin: 26px 0 18px; }
.panel.start .primary { margin-top: 44px; }
.start-art { width: 440px; height: 440px; border-radius: 28px; object-fit: cover; mix-blend-mode: lighten; flex: none; }

.choice-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(124px, auto); gap: 22px; }
.choice { padding: 16px 30px; border-radius: var(--r-btn); background: var(--choice); border: 2px solid rgba(255,255,255,.28); font-size: 40px; font-weight: 600; line-height: 1.3; text-align: center; transition: background .2s, border-color .2s, opacity .2s; animation: rise .35s ease both; animation-delay: calc(var(--i) * 60ms); }
.choice:disabled { cursor: default; opacity: .5; }
.choice:disabled:active { transform: none; }
.choice.correct { opacity: 1; background: var(--green-l); border-color: var(--green-l); color: #002528; }
.choice.wrong { opacity: 1; background: var(--crimson); border-color: #c2406f; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* خانة التعليق محجوزة دائماً حتى لا يقفز التخطيط */
.answer-feedback { min-height: 52px; margin-top: 20px; font-size: 34px; font-weight: 700; line-height: 1.5; }
.answer-feedback[hidden] { display: block !important; visibility: hidden; }
.answer-feedback.success { color: #b8f08f; }
.answer-feedback.error, .answer-feedback.timeout { color: #ffb3cb; }

.panel.result { align-items: center; text-align: center; }
.result-art { width: 170px; height: 170px; border-radius: 24px; object-fit: cover; mix-blend-mode: lighten; }
.result-title { font-size: 64px; font-weight: 700; line-height: 1.3; margin: 26px 0 12px; }
/* الفوز أخضر وبلاطته أكبر بإطار ذهبي؛ الخسارة كرمزية — الفرق يُقرأ من مترين */
body[data-won="true"] .result-title { color: #c8f0b0; }
body[data-won="true"] .result-art { transform: scale(1.15); outline: 4px solid #b8943f; outline-offset: 6px; margin-bottom: 32px; }
body[data-won="false"] .result-title { color: #ffb3cb; }
body[data-won="false"] .timer-ring { --c: #e0457f; }
body[data-won="false"] .timer-ring strong { color: #ffb3cb; }
#resultNote { margin-bottom: 22px; }
.result-actions { display: flex; gap: 28px; margin-top: 40px; }

/* المؤقت */
.timer-card { display: flex; flex-direction: column; align-items: center; gap: 30px; padding: 44px 36px 0; text-align: center; }
.timer-ring { --p: 1; --c: var(--green-l); position: relative; flex: none; width: 290px; height: 290px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 360deg), rgba(255,255,255,.1) 0); transition: --p .9s linear; }
.timer-ring::before { content: ""; position: absolute; inset: 20px; border-radius: 50%; background: var(--card); }
.timer-ring > div { position: relative; }
.timer-ring strong { display: block; font-size: 124px; font-weight: 700; line-height: 1; }
.timer-ring small { font-size: 30px; color: var(--muted); }
.timer-ring.urgent { --c: #e0457f; }
.timer-ring.urgent strong { color: #ffb3cb; }
#timerText { font-size: 32px; font-weight: 600; line-height: 1.5; color: var(--muted); }
.timer-art { width: 260px; height: 260px; margin-top: auto; margin-bottom: 36px; border-radius: 24px; object-fit: cover; mix-blend-mode: lighten; opacity: .9; }
body[data-stage="resultStage"] .back { display: none; }
body[data-stage="resultStage"] .timer-art { display: none; }
body[data-stage="resultStage"] .timer-card { justify-content: center; }

/* الجوال العمودي: المسرح يصغر إلى نص غير مقروء، فتظهر رسالة التدوير بدله */
.rotate { display: none; }
@media (orientation: portrait) {
  .rotate { display: grid; place-items: center; position: fixed; inset: 0; z-index: 10; padding: 28px; background: var(--bg) url(img/nd-logo.png) center 18% / 70% auto no-repeat; font-size: 22px; line-height: 1.8; text-align: center; color: var(--ink); }
  .stage-wrap { visibility: hidden; }
}

/* المنفّذ: أسفل المنتصف، أصغر بكثير من شعار اليوم الوطني */
.footer { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; }
.exec { display: flex; align-items: center; gap: 14px; color: rgba(255,255,255,.6); font-size: 22px; font-weight: 600; opacity: .85; }
.exec img { width: 130px; height: auto; }
