* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: radial-gradient(circle at top, #1f2937 0, #020617 55%, #000 100%);
  color: #e5e7eb;
}

/* خلفية متحركة خفيفة */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.08) 0, transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(129, 140, 248, 0.08) 0, transparent 55%);
  opacity: 0.9;
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: -100px;
  background: conic-gradient(from 180deg at 50% 50%, #22d3ee, #6366f1, #a855f7, #22d3ee);
  mix-blend-mode: soft-light;
  opacity: 0.25;
  filter: blur(60px);
  animation: spin 30s linear infinite;
  z-index: -3;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app {
  width: 100%;
  max-width: 960px;
  margin: 24px;
  background: rgba(15, 23, 42, 0.96);
  border-radius: 24px;
  padding: 24px 24px 28px;
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.18),
    0 25px 60px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(24px);
  position: relative;
  overflow: hidden;
}

/* خطوط ديكورية */
.app::before,
.app::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.app::before {
  width: 140%;
  height: 140%;
  top: -60%;
  left: -20%;
  transform: rotate(4deg);
  opacity: 0.4;
}

.app::after {
  width: 140%;
  height: 140%;
  top: -55%;
  left: -18%;
  transform: rotate(-4deg);
  opacity: 0.25;
}

.header {
  position: relative;
  text-align: center;
  margin-bottom: 18px;
  z-index: 1;
}

.header h1 {
  font-size: 26px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e5e7eb;
}

.header .sub {
  font-size: 13px;
  margin-top: 6px;
  color: #9ca3af;
}

/* شاشات */

.screen {
  display: none;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.35s ease-out;
}

.screen.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* شاشة البداية */

.screen-title {
  font-size: 20px;
  margin-bottom: 6px;
}

.screen-text {
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 18px;
}

.start-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.start-controls label {
  font-size: 13px;
  color: #cbd5f5;
}

#question-count {
  width: 130px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

#question-count:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.difficulty-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid #4b5563;
  background: linear-gradient(135deg, #020617, #020617);
  color: #e5e7eb;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, background 0.25s, color 0.2s, transform 0.1s;
}

.pill::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.4), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}

.pill:hover {
  transform: translateY(-1px);
  border-color: #60a5fa;
}

.pill.active {
  background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.4), #020617);
  color: #e5e7eb;
  border-color: #60a5fa;
}

.pill.active::before {
  opacity: 1;
}

/* أزرار */

.primary-btn,
.secondary-btn {
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
}

.primary-btn::before,
.secondary-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0 0, rgba(248, 250, 252, 0.35), transparent 65%);
  opacity: 0;
  transition: opacity 0.2s;
}

.primary-btn:hover::before,
.secondary-btn:hover::before {
  opacity: 1;
}

.primary-btn:active,
.secondary-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.primary-btn {
  background: linear-gradient(135deg, #2563eb, #22d3ee);
  color: #f9fafb;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.45);
}

.primary-btn.big {
  margin-top: 8px;
  align-self: flex-start;
}

.secondary-btn {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border: 1px solid #4b5563;
}

/* زرار Finish مميز */

#accent,
.accent {
  background: linear-gradient(135deg, #db2777, #f97316);
  color: #f9fafb;
  border: none;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.5);
}

/* Hint */

.hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: #9ca3af;
}

.hint .dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
}

/* quiz screen */

.top-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
  color: #9ca3af;
}

#quiz-container {
  margin-bottom: 18px;
}

.question-block {
  padding: 16px 16px 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), #020617);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.8);
  position: relative;
  overflow: hidden;
}

.question-block::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 10% 0, rgba(56, 189, 248, 0.18), transparent 60%);
  opacity: 0.9;
  pointer-events: none;
}

.question-meta {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 4px;
}

.question-text {
  font-size: 15px;
  margin-bottom: 12px;
  color: #e5e7eb;
}

/* خيارات على شكل كروت */

.options {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.options li {
  position: relative;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.95);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.08s, box-shadow 0.18s;
}

.option-card:hover {
  border-color: #60a5fa;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
}

.option-card.selected {
  border-color: #38bdf8;
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.2), #020617);
}

.option-card.correct {
  border-color: #22c55e;
  background: radial-gradient(circle at 0 0, rgba(34, 197, 94, 0.25), #022c22);
}

.option-card.wrong {
  border-color: #f97373;
  background: radial-gradient(circle at 0 0, rgba(248, 113, 113, 0.25), #450a0a);
}

.option-badge {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #94a3b8;
}

.option-text {
  font-size: 14px;
  color: #e5e7eb;
}

/* نخفي الراديو الأصلي */

.options input[type="radio"] {
  display: none;
}

.feedback {
  margin-top: 6px;
  font-size: 12px;
  padding: 5px 7px;
  border-radius: 8px;
}

.feedback.correct {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}

.feedback.wrong {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

/* أزرار تحت السؤال */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.controls button {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.18s, transform 0.08s, box-shadow 0.18s, border-color 0.18s;
}

.controls button:hover:not(:disabled) {
  background: #020617;
  border-color: #60a5fa;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
}

.controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

#page-indicator,
#timer-indicator {
  font-size: 12px;
  color: #9ca3af;
  margin-left: auto;
}

/* result screen */

.result-card {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 16px 16px 14px;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), #020617);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.8);
}

.result-card h2 {
  margin-bottom: 10px;
}

#score-text {
  margin-bottom: 12px;
  font-size: 14px;
}

.result-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.result-stats .label {
  display: block;
  font-size: 11px;
  color: #9ca3af;
}

.result-stats .value {
  font-weight: 600;
  font-size: 14px;
}

.result-actions {
  display: flex;
  gap: 10px;
}

/* footer */

.site-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 11px;
  color: #6b7280;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* موبايل */

@media (max-width: 640px) {
  .app {
    margin: 8px;
    padding: 16px 12px 18px;
    max-width: 100%;
    border-radius: 16px;
  }

  .header h1 {
    font-size: 18px;
  }

  .screen-title {
    font-size: 18px;
  }

  .screen-text {
    font-size: 13px;
  }

  #question-count {
    width: 100%;
    max-width: 240px;
  }

  .pill {
    padding: 8px 10px;
    font-size: 13px;
  }

  .option-card {
    padding: 12px 14px;
    gap: 12px;
  }

  .option-badge {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .option-text {
    font-size: 16px;
  }

  /* Make bottom controls easier to tap and keep them accessible */
  .controls {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(2,6,23,0), rgba(2,6,23,0.6));
    padding: 10px;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
  }

  .controls button {
    width: 100%;
    padding: 12px;
    font-size: 15px;
  }

  .result-stats {
    flex-direction: column;
  }

  /* Give quiz content room so controls don't overlap */
  #quiz-container {
    margin-bottom: 80px;
  }

  button:focus-visible,
  input:focus-visible {
    outline-offset: 3px;
  }
}
