/* Instant loading screen shown before the Flutter bundle arrives.
   CSS and one small logo image (logo.webp, ~30 KB), so it paints at once.
   Glass on warm light: soft orange/amber auras drift slowly behind frosted
   panes. The features are the tiers of a ziggurat (echoing the logo), laid
   from the base upward. Only opacity and transform are animated, so it
   stays smooth on phones. */
#sumer-loading {
  --orange: #F8600A;
  --clay: #B8400C;
  --ink: #2A1E14;
  --muted: rgba(42, 30, 20, .58);
  --glass: rgba(255, 255, 255, .42);
  --glass-edge: rgba(255, 255, 255, .75);
  --ease: cubic-bezier(.22, 1, .36, 1);
  position: fixed; inset: 0; z-index: 9999; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(160deg, #FFF8F1 0%, #FDEBDD 55%, #FBE3D2 100%);
  font-family: -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", sans-serif;
  color: var(--ink);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
#sumer-loading.leave { opacity: 0; transform: scale(1.02); }

/* Auras: large blurred colour fields the glass picks up. */
#sumer-loading .aura {
  position: absolute; border-radius: 50%; filter: blur(60px);
  will-change: transform; pointer-events: none;
}
#sumer-loading .a1 {
  width: 62vmax; height: 62vmax; left: -22vmax; top: 18vh;
  background: radial-gradient(circle, rgba(248,96,10,.55), rgba(248,96,10,0) 70%);
  animation: sl-drift1 18s ease-in-out infinite alternate;
}
#sumer-loading .a2 {
  width: 55vmax; height: 55vmax; right: -20vmax; top: 34vh;
  background: radial-gradient(circle, rgba(255,170,70,.6), rgba(255,170,70,0) 70%);
  animation: sl-drift2 22s ease-in-out infinite alternate;
}
#sumer-loading .a3 {
  width: 48vmax; height: 48vmax; left: 20vw; bottom: -30vmax;
  background: radial-gradient(circle, rgba(232,80,40,.45), rgba(232,80,40,0) 70%);
  animation: sl-drift1 26s ease-in-out infinite alternate-reverse;
}

/* Brand: the logo on a frosted plate, rising out of a mask. */
#sumer-loading .brand {
  position: relative; margin-top: max(6vh, 28px);
  padding: 18px 30px; border-radius: 26px;
  background: rgba(255,255,255,.55);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
          backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--glass-edge);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 30px 60px -30px rgba(150,60,10,.35);
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .9s var(--ease), transform 1.1s var(--ease);
}
#sumer-loading.go .brand { opacity: 1; transform: none; }
#sumer-loading .logo { overflow: hidden; }
#sumer-loading .logo img {
  display: block; height: 112px; width: auto;
  transform: translateY(102%);
  transition: transform 1.2s var(--ease) .15s;
}
#sumer-loading.go .logo img { transform: none; }

/* Stage: lead line + glass ziggurat */
#sumer-loading .stage {
  position: relative; flex: 1; width: 100%; max-width: 540px;
  padding: 0 16px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#sumer-loading .lead {
  margin: 0 0 20px; font-size: 14px; font-weight: 500; letter-spacing: .2px; color: var(--muted);
  opacity: 0; transform: translateY(10px);
  transition: opacity .9s var(--ease) .55s, transform .9s var(--ease) .55s;
}
#sumer-loading.go .lead { opacity: 1; transform: none; }

#sumer-loading .zig { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 7px; }
#sumer-loading .tier {
  /* Narrow at the top, widest at the base: 52% to 100%. */
  width: calc(52% + (48% * var(--i) / (var(--n) - 1)));
  height: 48px; padding: 0 18px; box-sizing: border-box; border-radius: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.62), var(--glass));
  -webkit-backdrop-filter: blur(18px) saturate(170%);
          backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid var(--glass-edge);
  box-shadow:
    0 1px 0 rgba(255,255,255,.95) inset,
    0 14px 30px -18px rgba(150,60,10,.38);
  opacity: 0; transform: translateY(36px) scale(.97);
  will-change: transform, opacity;
  /* The base (highest --i) is laid first, then each tier above it. */
  transition:
    opacity .8s var(--ease) calc(.75s + (var(--n) - 1 - var(--i)) * .085s),
    transform 1.1s var(--ease) calc(.75s + (var(--n) - 1 - var(--i)) * .085s);
}
#sumer-loading.go .tier { opacity: 1; transform: none; }
#sumer-loading .tier b { font-size: 15px; font-weight: 700; color: var(--ink); white-space: nowrap; }
#sumer-loading .tier small { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* A thin orange accent on the right edge of each tier (RTL start). */
#sumer-loading .tier b::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 9px;
  border-radius: 50%; background: var(--orange); vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(248,96,10,.14);
}

/* Footer: a small glass pill with the running bar. */
#sumer-loading .foot {
  margin-bottom: max(5vh, 24px);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(255,255,255,.45);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
          backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-edge);
  opacity: 0; transform: translateY(10px);
  transition: opacity .9s var(--ease) 1.45s, transform .9s var(--ease) 1.45s;
}
#sumer-loading.go .foot { opacity: 1; transform: none; }
#sumer-loading .foot span { font-size: 12px; color: var(--muted); }
#sumer-loading .bar {
  width: 70px; height: 3px; border-radius: 3px;
  background: rgba(184,64,12,.14); overflow: hidden; position: relative;
}
#sumer-loading .bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 3px;
  background: linear-gradient(90deg, #FFB067, var(--orange));
  animation: sl-slide 1.5s cubic-bezier(.65,0,.35,1) infinite;
}

@keyframes sl-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
@keyframes sl-drift1 { from { transform: translate3d(0,0,0); } to { transform: translate3d(8vw, -6vh, 0); } }
@keyframes sl-drift2 { from { transform: translate3d(0,0,0); } to { transform: translate3d(-7vw, 5vh, 0); } }

/* Browsers without backdrop-filter get a more opaque pane instead. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #sumer-loading .tier, #sumer-loading .brand, #sumer-loading .foot { background: rgba(255,255,255,.82); }
}

@media (max-width: 600px) {
  #sumer-loading .brand { padding: 14px 22px; border-radius: 22px; }
  #sumer-loading .logo img { height: 88px; }
  #sumer-loading .tier { height: 44px; padding: 0 14px; border-radius: 12px; }
  #sumer-loading .tier b { font-size: 14px; }
  #sumer-loading .tier small { font-size: 11px; }
  #sumer-loading .lead { font-size: 13px; }
}
@media (max-width: 380px) {
  #sumer-loading .tier small { display: none; }
  #sumer-loading .tier { justify-content: center; }
}
@media (max-height: 640px) {
  #sumer-loading .brand { margin-top: 14px; padding: 10px 20px; }
  #sumer-loading .logo img { height: 64px; }
  #sumer-loading .tier { height: 34px; }
  #sumer-loading .zig { gap: 5px; }
  #sumer-loading .lead { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #sumer-loading *, #sumer-loading *::before, #sumer-loading *::after {
    transition-duration: .01s !important; transition-delay: 0s !important; animation: none !important;
  }
}
