  :root {
    --sand: #f6efe3; --sand-2: #ede2cf; --sand-3: #dccbb0;
    --night: #1f2a44; --ink: #2b2b2b; --muted: #6f6556;
    --saffron: #d9902f; --saffron-dark: #b8741c;
    --oasis: #2a8c82; --oasis-soft: #d6ece8;
    --storm: #9a8f80; --storm-soft: #ece6dc;
    --card: #fffaf2; --radius: 16px;
    --ease: cubic-bezier(.2,.8,.2,1);
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body { background: var(--sand); color: var(--ink); font-family: "Inter", system-ui, sans-serif; min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
  html[dir="rtl"] body { font-family: "Tajawal", "Inter", system-ui, sans-serif; }
  .app { max-width: 460px; margin: 0 auto; padding: 16px 18px 40px; }

  header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
  .brand { display: flex; align-items: baseline; gap: 8px; }
  .brand h1 { font-family: "Fraunces", Georgia, serif; font-size: 26px; margin: 0; color: var(--night); }
  html[dir="rtl"] .brand h1 { font-family: "Tajawal", serif; font-weight: 700; }
  .brand .alt { color: var(--saffron-dark); font-size: 18px; font-weight: 600; }
  .head-right { display: flex; align-items: center; gap: 8px; }
  .chip { background: var(--sand-2); border-radius: 999px; padding: 5px 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
  .lang-btn { border: 1.5px solid var(--night); background: transparent; color: var(--night); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
  .lang-btn:hover { background: var(--night); color: var(--sand); }
  [hidden] { display: none !important; }

  /* Route with walking camel */
  .route-wrap { position: relative; height: 62px; margin: 2px 0 14px; }
  .route { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; }
  .route::before { content: ""; position: absolute; inset-inline: 16px; top: 50%; border-top: 2px dashed var(--sand-3); }
  .stop { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; background: var(--sand); border: 2px solid var(--sand-3); display: grid; place-items: center; font-size: 13px; color: var(--muted); font-weight: 700; }
  .stop.ok { background: var(--oasis-soft); border-color: var(--oasis); font-size: 15px; }
  .stop.bad { background: var(--storm-soft); border-color: var(--storm); font-size: 15px; }
  .stop.next { border-color: var(--saffron); color: var(--saffron-dark); animation: glow 1.6s infinite; }
  .stop.edge { border-style: dashed; font-size: 15px; }
  .stop.pop { animation: pop .55s cubic-bezier(.3,1.7,.5,1); }
  @keyframes glow { 0%,100% { box-shadow: 0 0 0 3px rgba(217,144,47,.18); } 50% { box-shadow: 0 0 0 8px rgba(217,144,47,.06); } }
  @keyframes pop { 0% { transform: scale(.4); } 100% { transform: scale(1); } }
  .camel { position: absolute; top: 0; left: 15px; font-size: 26px; line-height: 1; transform: translateX(-50%); transition: left 1s cubic-bezier(.45,0,.3,1); z-index: 3; pointer-events: none; }
  .camel .c { display: inline-block; }
  html[dir="ltr"] .camel .c { transform: scaleX(-1); }
  .camel.walking .c { animation: bob .22s ease-in-out infinite alternate; }
  @keyframes bob { from { translate: 0 0; rotate: 0deg; } to { translate: 0 -5px; rotate: -5deg; } }
  .dust { position: absolute; bottom: 30px; width: 6px; height: 6px; border-radius: 50%; background: #d8c19a; pointer-events: none; z-index: 2; }

  .card { background: var(--card); border-radius: var(--radius); padding: 22px 20px; box-shadow: 0 1px 0 var(--sand-3), 0 10px 30px -18px rgba(31,42,68,.35); }
  .card.enter { animation: cardIn .5s var(--ease) both; }
  @keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
  .card.shake { animation: shake .5s; }
  @keyframes shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
  .eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 11.5px; font-weight: 600; color: var(--saffron-dark); margin-bottom: 8px; }
  html[dir="rtl"] .eyebrow { letter-spacing: 0; font-size: 13px; }
  .q { font-size: 19px; line-height: 1.4; font-weight: 600; color: var(--night); margin: 0 0 16px; }
  html[dir="rtl"] .q { font-size: 21px; line-height: 1.6; }
  .opts { display: grid; gap: 10px; }
  .opts .opt { opacity: 0; animation: optIn .4s var(--ease) forwards; }
  .opts .opt:nth-child(1) { animation-delay: .12s; } .opts .opt:nth-child(2) { animation-delay: .19s; }
  .opts .opt:nth-child(3) { animation-delay: .26s; } .opts .opt:nth-child(4) { animation-delay: .33s; }
  @keyframes optIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .opt { width: 100%; text-align: start; padding: 13px 15px; border-radius: 12px; font: inherit; font-size: 16px; background: #fff; border: 1.5px solid var(--sand-3); color: var(--ink); cursor: pointer; transition: border-color .15s, background .25s, transform .15s; }
  .opt:hover:not(:disabled) { border-color: var(--saffron); transform: translateY(-2px); }
  .opt:active:not(:disabled) { transform: scale(.98); }
  .opt:disabled { cursor: default; }
  .opt.correct { background: var(--oasis-soft); border-color: var(--oasis); font-weight: 600; animation: correctPulse .6s var(--ease) both !important; opacity: 1; }
  .opt.wrong { background: var(--storm-soft); border-color: var(--storm); text-decoration: line-through; color: var(--muted); opacity: 1; }
  .opt.dim { opacity: .55 !important; }
  @keyframes correctPulse { 0% { transform: scale(1); } 35% { transform: scale(1.04); } 100% { transform: scale(1); } }
  .two { grid-template-columns: 1fr 1fr; }
  .two .opt { text-align: center; font-weight: 600; font-size: 17px; padding: 18px 10px; }
  .two .opt .ic { display: block; font-size: 28px; margin-bottom: 4px; }

  .clues { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
  .clues li { background: var(--sand-2); border-radius: 10px; padding: 10px 12px; font-size: 15px; line-height: 1.45; display: flex; gap: 8px; }
  .clues li.new { animation: clueIn .5s var(--ease); }
  @keyframes clueIn { from { opacity: 0; transform: translateY(-8px) scale(.97); max-height: 0; } to { max-height: 120px; } }
  .clues li b { color: var(--saffron-dark); }
  .link-btn { background: none; border: none; color: var(--saffron-dark); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 0 6px; font-size: 15px; }
  .hint { font-size: 13.5px; color: var(--muted); margin: 0 0 12px; }

  /* Drag-and-drop timeline */
  .tl-end { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 2px 4px 6px; display: flex; align-items: center; gap: 6px; }
  html[dir="rtl"] .tl-end { letter-spacing: 0; font-size: 13px; }
  .tl-end.bottom { margin: 6px 4px 2px; }
  .tl { position: relative; list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
  .tl-item { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid var(--sand-3); border-radius: 12px; padding: 12px; font-size: 15.5px; line-height: 1.35; }
  .tl-item .grip { color: var(--sand-3); font-size: 18px; line-height: 1; flex: 0 0 auto; }
  .tl-item:hover .grip { color: var(--saffron); }
  .tl-item.dragging { cursor: grabbing; z-index: 5; border-color: var(--saffron); box-shadow: 0 14px 30px -10px rgba(31,42,68,.45); scale: 1.03; }
  .tl.locked .tl-item { cursor: default; }
  .tl.locked .grip { display: none; }
  .tl-item.correct { background: var(--oasis-soft); border-color: var(--oasis); }
  .tl-item.off { background: var(--storm-soft); border-color: var(--storm); }
  .tl-item .yr { margin-inline-start: auto; font-weight: 700; color: var(--night); font-size: 13px; white-space: nowrap; animation: fadeIn .4s .2s both; }
  @keyframes fadeIn { from { opacity: 0; } }

  .primary { width: 100%; margin-top: 16px; padding: 14px; border-radius: 12px; border: none; cursor: pointer; background: var(--night); color: var(--sand); font: inherit; font-size: 16px; font-weight: 600; transition: background .15s, transform .15s; }
  .primary:hover { background: #2c3a5e; }
  .primary:active { transform: scale(.98); }

  .after .verdict { display: flex; align-items: center; gap: 10px; margin: 18px 0 4px; font-weight: 700; font-size: 18px; animation: verdictIn .5s cubic-bezier(.3,1.6,.5,1) both; }
  @keyframes verdictIn { from { opacity: 0; transform: scale(.7); } }
  .verdict.ok { color: var(--oasis); }
  .verdict.bad { color: var(--muted); }
  .after .sub-hint { font-size: 13.5px; color: var(--muted); margin: 0 0 6px; animation: fadeIn .4s .2s both; }
  .story { margin-top: 10px; background: #fff; border-radius: 12px; padding: 14px 16px; border-inline-start: 4px solid var(--saffron); transform-origin: top; animation: unroll .55s .15s var(--ease) both; }
  @keyframes unroll { from { opacity: 0; transform: scaleY(.3); } }
  .story .lbl { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--saffron-dark); margin-bottom: 6px; }
  html[dir="rtl"] .story .lbl { letter-spacing: 0; font-size: 13px; }
  .story p { margin: 0; font-size: 15.5px; line-height: 1.6; }
  .story .w { display: inline-block; opacity: 0; animation: wordIn .4s forwards; }
  @keyframes wordIn { from { opacity: 0; filter: blur(4px); transform: translateY(4px); } to { opacity: 1; filter: none; transform: none; } }
  .after .primary { animation: fadeIn .4s .6s both; }

  /* Language picker & start */
  .hero { text-align: center; }
  .hero .big { font-size: 58px; line-height: 1; margin-bottom: 6px; display: inline-block; animation: sway 3s ease-in-out infinite; }
  @keyframes sway { 50% { transform: translateY(-4px) rotate(-3deg); } }
  .hero h2 { font-family: "Fraunces", Georgia, serif; font-size: 24px; color: var(--night); margin: 6px 0 8px; }
  html[dir="rtl"] .hero h2 { font-family: "Tajawal", serif; font-weight: 700; font-size: 26px; }
  .hero p { color: var(--muted); line-height: 1.55; margin: 0 0 6px; }
  .picker .tag-ar { font-family: "Tajawal", sans-serif; font-size: 17px; display: block; margin-top: 2px; }
  .picker .label { font-size: 13px; font-weight: 600; color: var(--night); margin: 22px 0 10px; }
  .lang-choices { display: grid; gap: 12px; }
  .lang-choice { padding: 18px; border-radius: 14px; border: 2px solid var(--sand-3); background: #fff; cursor: pointer; font-size: 22px; font-weight: 700; color: var(--night); transition: all .18s; opacity: 0; animation: optIn .45s var(--ease) forwards; }
  .lang-choice:nth-child(1) { animation-delay: .15s; font-family: "Tajawal", sans-serif; }
  .lang-choice:nth-child(2) { animation-delay: .25s; font-family: "Inter", sans-serif; }
  .lang-choice:hover { border-color: var(--saffron); transform: translateY(-2px); box-shadow: 0 8px 20px -12px rgba(31,42,68,.4); }
  .lang-choice small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 2px; }
  .picker .small { font-size: 12.5px; color: var(--muted); margin-top: 14px; }
  .today { background: var(--sand-2); border-radius: 12px; padding: 12px 14px; margin: 16px 0 4px; text-align: start; }
  .today .t { font-weight: 700; color: var(--night); margin-top: 2px; }
  .rules { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; text-align: start; font-size: 14.5px; }
  .rules li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; opacity: 0; animation: optIn .4s var(--ease) forwards; }
  .rules li:nth-child(1) { animation-delay: .2s; } .rules li:nth-child(2) { animation-delay: .3s; } .rules li:nth-child(3) { animation-delay: .4s; }

  /* End */
  .score { text-align: center; }
  .score .grid { font-size: 32px; letter-spacing: 4px; margin: 4px 0 6px; }
  .score .grid .e { display: inline-block; opacity: 0; animation: emojiIn .5s cubic-bezier(.3,1.7,.5,1) forwards; }
  @keyframes emojiIn { from { opacity: 0; transform: translateY(14px) scale(.3); } to { opacity: 1; transform: none; } }
  .score h2 { font-family: "Fraunces", Georgia, serif; color: var(--night); margin: 6px 0 2px; font-size: 24px; animation: fadeIn .5s .9s both; }
  html[dir="rtl"] .score h2 { font-family: "Tajawal", serif; font-weight: 700; }
  .score .sub { color: var(--muted); margin: 0 0 6px; animation: fadeIn .5s 1s both; }
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
  .stat { background: var(--sand-2); border-radius: 12px; padding: 10px 6px; text-align: center; }
  .stat .n { font-size: 22px; font-weight: 700; color: var(--night); font-variant-numeric: tabular-nums; }
  .stat .l { font-size: 12px; color: var(--muted); }
  .share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
  .sbtn { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px; border-radius: 12px; border: 1.5px solid var(--sand-3); background: #fff; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--ink); transition: all .15s; }
  .sbtn:hover { border-color: var(--night); transform: translateY(-2px); }
  .sbtn .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700; }
  .imgcard { display: flex; gap: 14px; align-items: center; margin-top: 12px; background: var(--sand-2); border-radius: 12px; padding: 12px; }
  .imgcard img { width: 96px; border-radius: 8px; box-shadow: 0 6px 16px -8px rgba(31,42,68,.5); flex: 0 0 auto; background: var(--sand-3); aspect-ratio: 4/5; object-fit: cover; }
  .imgcard .cap { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
  .imgcard .cap b { display: block; color: var(--night); font-size: 14.5px; margin-bottom: 2px; }
  .imgcard a { display: inline-block; margin-top: 8px; padding: 7px 12px; border-radius: 999px; background: var(--night); color: var(--sand); text-decoration: none; font-weight: 600; font-size: 13px; }
  .learned { margin-top: 18px; }
  .learned h3 { font-size: 15px; color: var(--night); margin: 0 0 8px; }
  .learned ol { margin: 0; padding-inline-start: 20px; display: grid; gap: 7px; font-size: 14px; line-height: 1.5; }
  .sources { margin-top: 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }
  .sources h3 { font-size: 15px; color: var(--night); margin: 0 0 4px; }
  .sources p { margin: 0 0 6px; }
  .sources ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 3px; }
  .sources a { color: var(--night); overflow-wrap: anywhere; }
  .src-lang { font-size: 11.5px; color: var(--muted); }
  .site-foot { text-align: center; margin-top: 22px; font-size: 13px; }
  .site-foot a { color: var(--muted); }
  .next { text-align: center; color: var(--muted); font-size: 14px; margin-top: 18px; }
  .next b { color: var(--night); font-variant-numeric: tabular-nums; }
  .parent-tease { margin-top: 16px; border: 1.5px dashed var(--sand-3); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--muted); line-height: 1.5; }
  .parent-tease b { color: var(--night); }

  .toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--night); color: var(--sand); padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; transition: all .25s var(--ease); pointer-events: none; z-index: 60; }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }
  .fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
  .fx > span { position: absolute; will-change: transform, opacity; }
  .storm { position: absolute; inset: 0; background:
      repeating-linear-gradient(100deg, transparent 0 22px, rgba(200,164,112,.32) 22px 24px, transparent 24px 60px),
      linear-gradient(90deg, rgba(222,196,150,0), rgba(222,196,150,.45), rgba(222,196,150,0));
      background-size: 600px 100%, 200% 100%; animation: storm 1.2s ease-out forwards; }
  @keyframes storm { 0% { opacity: 0; background-position: 0 0, 100% 0; } 25% { opacity: 1; } 100% { opacity: 0; background-position: -600px 0, -100% 0; } }


  .still *, .still { animation: none !important; }
  .still .opt, .still .w, .still .e, .still .rules li, .still .lang-choice { opacity: 1 !important; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  }

  /* notices and report link */
  .notice { text-align: center; }
  .notice .big { font-size: 54px; line-height: 1; margin-bottom: 8px; }
  .notice p { color: var(--ink); font-size: 18px; line-height: 1.5; margin: 0; font-weight: 600; }
  .report { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--muted); }
  .opts.static .opt { opacity: 1; animation: none; }
  .opts.static .opt.correct { animation: correctPulse .6s var(--ease) both; }

  .tl-item .mv { margin-inline-start: auto; display: flex; gap: 6px; flex: 0 0 auto; }
  .mv-btn { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--sand-3); background: var(--card); color: var(--night); font-size: 13px; cursor: pointer; }
  .mv-btn:hover:not(:disabled) { border-color: var(--saffron); }
  .mv-btn:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
  .mv-btn:disabled { opacity: .35; cursor: default; }
  .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

  .ad-slot { margin: 12px 0; text-align: center; }
  .sponsor { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

  .q:focus, .verdict:focus, .score h2:focus { outline: none; }
