/* AIAI MOBILE JOURNEY R1
   Mobile-only handoff from Home R2 to Result R2.
   No engine, ranking, routing, database, desktop, or result semantics change. */

/* Own the handoff explicitly on mobile; desktop keeps its existing behavior. */
@media (max-width:767px){
  @view-transition{navigation:none}

  :root{
    --jr-bg:#ffffff;
    --jr-ink:#0c111b;
    --jr-text:#4a5362;
    --jr-muted:#87909e;
    --jr-line:#e4e8ef;
    --jr-soft:#f6f8fb;
    --jr-blue:#2f5cff;
    --jr-blue-soft:#eef2ff;
    --jr-violet:#7357f6;
    --jr-font:"IBM Plex Sans Arabic","Tajawal",sans-serif;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing{
    position:relative!important;
    min-height:258px!important;
    padding:20px 18px 18px!important;
    background:var(--jr-bg)!important;
    overflow:hidden!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing::before{
    content:""!important;
    position:absolute!important;
    top:0!important;
    inset-inline-end:0!important;
    width:92px!important;
    height:3px!important;
    border-radius:0 0 0 99px!important;
    background:var(--jr-blue)!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing-top{
    min-height:26px!important;
    margin:0!important;
    padding-inline-end:29px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    color:#737d8d!important;
    font:700 9px/1.4 var(--jr-font)!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing-top>span:first-child{
    position:relative!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing-top>span:first-child::after{
    content:""!important;
    display:inline-block!important;
    width:5px!important;
    height:5px!important;
    margin-inline-start:7px!important;
    border-radius:50%!important;
    background:var(--jr-violet)!important;
    vertical-align:middle!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing-mark{
    position:absolute!important;
    top:14px!important;
    inset-inline-end:16px!important;
    width:8px!important;
    height:8px!important;
    border:0!important;
    border-radius:50%!important;
    background:var(--jr-blue)!important;
    box-shadow:
      -11px 0 0 rgba(47,92,255,.28),
      -22px 0 0 rgba(47,92,255,.12)!important;
    rotate:0!important;
    animation:none!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing-mark::after{
    display:none!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing p{
    display:-webkit-box!important;
    -webkit-box-orient:vertical!important;
    -webkit-line-clamp:2!important;
    overflow:hidden!important;
    margin:21px 0 0!important;
    min-height:51px!important;
    color:#222b38!important;
    font:580 14px/1.8 var(--jr-font)!important;
    letter-spacing:-.05px!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing-line{
    display:none!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway .aiai-flow2-processing>small{
    display:none!important;
  }

  .aiai-journey-r1{
    position:relative!important;
    margin-top:24px!important;
    padding:17px 4px 2px!important;
    border-top:1px solid var(--jr-line)!important;
  }

  .aiai-journey-r1__rail{
    position:relative!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    direction:rtl!important;
    gap:4px!important;
  }

  .aiai-journey-r1__rail::before{
    content:""!important;
    position:absolute!important;
    top:8px!important;
    inset-inline:16.66%!important;
    height:1px!important;
    background:#e2e6ed!important;
  }

  .aiai-journey-r1__step{
    position:relative!important;
    z-index:1!important;
    display:grid!important;
    justify-items:center!important;
    gap:8px!important;
    min-width:0!important;
    color:#9aa2ae!important;
    font:620 8px/1.45 var(--jr-font)!important;
    text-align:center!important;
    transition:color .16s ease!important;
  }

  .aiai-journey-r1__node{
    width:17px!important;
    height:17px!important;
    display:grid!important;
    place-items:center!important;
    border:1px solid #dce1e9!important;
    border-radius:50%!important;
    background:#fff!important;
    box-shadow:0 0 0 4px #fff!important;
    transition:border-color .16s ease,background .16s ease,transform .16s ease!important;
  }

  .aiai-journey-r1__node::after{
    content:""!important;
    width:4px!important;
    height:4px!important;
    border-radius:50%!important;
    background:#c6ccd6!important;
    transition:background .16s ease,transform .16s ease!important;
  }

  .aiai-journey-r1__step[data-state="done"]{
    color:#667083!important;
  }

  .aiai-journey-r1__step[data-state="done"] .aiai-journey-r1__node{
    border-color:#b9c6ff!important;
    background:var(--jr-blue-soft)!important;
  }

  .aiai-journey-r1__step[data-state="done"] .aiai-journey-r1__node::after{
    background:var(--jr-blue)!important;
  }

  .aiai-journey-r1__step[data-state="active"]{
    color:#25304a!important;
  }

  .aiai-journey-r1__step[data-state="active"] .aiai-journey-r1__node{
    border-color:var(--jr-blue)!important;
    background:var(--jr-blue)!important;
    transform:scale(1.06)!important;
    box-shadow:0 0 0 4px #eef2ff!important;
  }

  .aiai-journey-r1__step[data-state="active"] .aiai-journey-r1__node::after{
    background:#fff!important;
    transform:scale(.8)!important;
  }

  .aiai-journey-r1__status{
    margin:16px 0 0!important;
    min-height:20px!important;
    color:#5d6777!important;
    font:560 9.5px/1.6 var(--jr-font)!important;
    text-align:center!important;
  }

  .aiai-journey-r1__status b{
    color:#2d3850!important;
    font-weight:680!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway[data-journey-active="true"] .aiai-flow2-surface{
    border-color:#d7defe!important;
    box-shadow:
      0 0 0 4px rgba(47,92,255,.055),
      0 18px 44px rgba(16,25,44,.07)!important;
  }

  body.aiai-flow2-home-v1 .aiai-home-gateway[data-journey-active="true"] .aiai-flow2-intro{
    opacity:.72!important;
    transition:opacity .18s ease!important;
  }

  /* The READY result arrives as the continuation of the same decision surface. */
  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-result-r1__task{
    animation:aiaiJourneyR1TaskIn .44s cubic-bezier(.2,.75,.2,1) both!important;
  }

  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-result-r1__core{
    animation:aiaiJourneyR1CoreIn .52s .045s cubic-bezier(.2,.75,.2,1) both!important;
  }

  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-result-r1__facts,
  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-result-r1__why{
    animation:aiaiJourneyR1FactsIn .5s .11s cubic-bezier(.2,.75,.2,1) both!important;
  }

  @keyframes aiaiJourneyR1TaskIn{
    from{opacity:.76;transform:translateY(5px)}
    to{opacity:1;transform:none}
  }

  @keyframes aiaiJourneyR1CoreIn{
    from{opacity:.70;transform:translateY(7px)}
    to{opacity:1;transform:none}
  }

  @keyframes aiaiJourneyR1FactsIn{
    from{opacity:.74;transform:translateY(6px)}
    to{opacity:1;transform:none}
  }
}

@media (prefers-reduced-motion:reduce){
  .aiai-journey-r1 *,
  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-result-r1__task,
  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-result-r1__core,
  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-result-r1__facts,
  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-result-r1__why{
    animation:none!important;
    transition:none!important;
  }
}

/* AIAI_JOURNEY_R1_ACTUAL_WINNER_REVEAL_R2
   On the real /decision response, reveal the actual selected tool identity.
   No provisional winner is shown on Home; this uses server-rendered result.main. */
@media (max-width:767px){
  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-reveal{
    position:fixed!important;
    inset:68px 0 0!important;
    z-index:120!important;
    display:grid!important;
    place-items:center!important;
    align-content:center!important;
    gap:10px!important;
    padding:24px!important;
    background:
      radial-gradient(70% 42% at 50% 34%,rgba(115,87,246,.09),transparent 72%),
      #F7F6FB!important;
    opacity:0!important;
    visibility:hidden!important;
    pointer-events:none!important;
  }

  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-journey-r1__winner-reveal{
    visibility:visible!important;
    animation:aiaiJourneyWinnerReveal 1.25s cubic-bezier(.2,.72,.2,1) both!important;
  }

  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-orbit{
    position:relative!important;
    width:146px!important;
    height:146px!important;
    display:grid!important;
    place-items:center!important;
  }

  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-orbit::before,
  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-orbit::after{
    content:""!important;
    position:absolute!important;
    inset:12px!important;
    border-radius:50%!important;
    border:1px solid rgba(115,87,246,.28)!important;
  }

  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-orbit::after{
    inset:0!important;
    border-color:rgba(15,168,188,.20)!important;
    border-style:dashed!important;
    animation:aiaiJourneyWinnerOrbit 7s linear infinite!important;
  }

  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-logo{
    position:relative!important;
    z-index:1!important;
    width:78px!important;
    height:78px!important;
    padding:10px!important;
    border-radius:24px!important;
    display:grid!important;
    place-items:center!important;
    overflow:hidden!important;
    background:#fff!important;
    box-shadow:
      0 0 0 9px rgba(115,87,246,.07),
      0 18px 38px -16px rgba(79,57,180,.34)!important;
  }

  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-logo img,
  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-logo svg{
    display:block!important;
    width:100%!important;
    height:100%!important;
    max-width:58px!important;
    max-height:58px!important;
    object-fit:contain!important;
  }

  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-kicker{
    color:#7357F6!important;
    font:700 12px/1.3 var(--jr-font)!important;
  }

  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-reveal>strong{
    color:#15132B!important;
    font:700 30px/1.25 var(--jr-font)!important;
    letter-spacing:-.35px!important;
  }

  @keyframes aiaiJourneyWinnerReveal{
    0%{opacity:0;transform:scale(.985);filter:blur(5px)}
    16%{opacity:1;transform:none;filter:blur(0)}
    72%{opacity:1;transform:none;filter:blur(0)}
    100%{opacity:0;transform:scale(1.012);filter:blur(3px)}
  }

  @keyframes aiaiJourneyWinnerOrbit{
    to{transform:rotate(360deg)}
  }
}

@media (prefers-reduced-motion:reduce){
  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-reveal{
    animation:none!important;
  }
  body.aiai-flow2-result-v1.aiai-journey-r1-arrive .aiai-journey-r1__winner-reveal{
    opacity:1!important;
  }
  body.aiai-flow2-result-v1 .aiai-journey-r1__winner-orbit::after{
    animation:none!important;
  }
}
