/* Startup / splash / recovery surface. Static markup lives in mobile-index.html
   so it paints on the very first frame, before any JavaScript runs; the
   controller is mobile-startup.js. Colours mirror the native Android splash
   (android/app/src/main/res/values{,-night}/colors.xml: startup_background) so
   the hand-off from the system splash has no flash. Animations are one-shot,
   transform/opacity only; the ring is the only looping motion and it stops as
   soon as the overlay leaves. */

.startup{
  --su-bg-top:#ffffff;--su-bg:#f5f8ff;--su-bg-bottom:#e8efff;
  --su-ink:#0f1b3d;--su-muted:#56627f;--su-accent:#294fbd;--su-accent-2:#4a74e8;
  --su-track:#dbe4fa;--su-curve:rgba(41,79,189,.075);--su-curve-2:rgba(74,116,232,.06);
  --su-card:#ffffff;--su-card-line:#e3e9f7;--su-tile:#eaf0ff;
  --su-danger:#be123c;--su-danger-tile:#ffe8ee;
  --il-halo:#e4ecff;--il-globe-a:#6f98ff;--il-globe-b:#2a50c0;--il-line:rgba(255,255,255,.34);--il-land:rgba(255,255,255,.3);
  --il-cap:#13275f;--il-cap-top:#1d3a8a;--il-tassel:#f5b544;--il-orbit:#9fb6ec;--il-plane:#294fbd;
  --il-book-1:#1fa64a;--il-book-2:#e5484d;--il-book-3:#f5b544;--il-page:#ffffff;--il-shadow:rgba(20,40,110,.12);
  --il-doc:#ffffff;--il-doc-line:#d8e2f7;--il-check:#1fa64a;--il-spark:#f5b544;
  position:fixed;inset:0;z-index:2147483000;display:flex;flex-direction:column;
  overflow-x:hidden;overflow-y:auto;scrollbar-width:none;overscroll-behavior:none;
  background:linear-gradient(180deg,var(--su-bg-top) 0%,var(--su-bg) 46%,var(--su-bg-bottom) 100%);
  color:var(--su-ink);font-family:var(--font-sans,system-ui,sans-serif);
  -webkit-font-smoothing:antialiased;text-align:center;
  transition:opacity .26s cubic-bezier(.4,0,.2,1),transform .26s cubic-bezier(.4,0,.2,1);
  contain:layout paint;
}
.startup::-webkit-scrollbar{display:none}
[data-theme=dark] .startup{
  --su-bg-top:#121d36;--su-bg:#0e1628;--su-bg-bottom:#0a1120;
  --su-ink:#eef3ff;--su-muted:#a9b6d3;--su-accent:#9db8ff;--su-accent-2:#c3d3ff;
  --su-track:#24345a;--su-curve:rgba(120,150,255,.09);--su-curve-2:rgba(120,150,255,.06);
  --su-card:#16213b;--su-card-line:#2a3a60;--su-tile:#1c2a4b;
  --su-danger:#ffadc1;--su-danger-tile:#3b2430;
  --il-halo:#16244a;--il-globe-a:#4f7cf0;--il-globe-b:#1c3a9a;--il-line:rgba(255,255,255,.26);--il-land:rgba(255,255,255,.2);
  --il-cap:#0a1533;--il-cap-top:#c3d3ff;--il-orbit:#3c5590;--il-plane:#c3d3ff;
  --il-page:#e9eefc;--il-shadow:rgba(0,0,0,.35);--il-doc:#1c2a4b;--il-doc-line:#33467a;--il-check:#4ade80;
}
.startup.is-leaving{opacity:0;transform:scale(1.015);pointer-events:none}
.startup[hidden]{display:none}

/* Decorative curves: two large soft rings and one wave. Static, no blur. */
.startup-decor{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.startup-curve{position:absolute;border-radius:50%;border:clamp(28px,8vw,46px) solid var(--su-curve)}
.startup-curve-a{width:min(118vw,620px);aspect-ratio:1;top:calc(min(118vw,620px) * -.58);right:calc(min(118vw,620px) * -.38)}
.startup-curve-b{width:min(96vw,520px);aspect-ratio:1;bottom:calc(min(96vw,520px) * -.62);left:calc(min(96vw,520px) * -.42);border-color:var(--su-curve-2)}
.startup-wave{position:absolute;left:0;right:0;bottom:0;width:100%;height:clamp(70px,14vh,130px);fill:var(--su-curve-2)}

.startup-main{
  position:relative;flex:1 0 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;
  width:100%;max-width:460px;margin:0 auto;
  padding:calc(var(--safe-top,env(safe-area-inset-top,0px)) + clamp(20px,4.5vh,44px)) 24px calc(var(--safe-bottom,env(safe-area-inset-bottom,0px)) + 16px);
  gap:clamp(10px,2.2vh,20px);box-sizing:border-box;
}
.startup-brand{display:flex;align-items:center;justify-content:center;width:clamp(176px,54vw,232px);padding:6px 10px;border-radius:18px;box-sizing:content-box}
[data-theme=dark] .startup-brand{background:#ffffff;box-shadow:0 8px 24px rgba(0,0,0,.28)}
.startup-logo{display:block;width:100%;height:auto;aspect-ratio:392/177}

.startup-art{display:block;width:min(80vw,312px);height:auto;aspect-ratio:300/200;overflow:visible}
.startup-copy{display:flex;flex-direction:column;align-items:center;gap:8px}
.startup-title{margin:0;font-size:clamp(26px,7.4vw,34px);line-height:1.14;font-weight:700;letter-spacing:-.022em;color:var(--su-ink);text-wrap:balance}
.startup-title span{display:block;color:var(--su-accent)}
.startup-lead{margin:0;max-width:300px;font-size:15px;line-height:1.45;color:var(--su-muted)}

/* Progress and recovery share one grid cell, so the cell keeps the height of
   the taller one and switching between them never moves anything else. */
.startup-slot{display:grid;width:100%;max-width:360px;margin-top:clamp(2px,1vh,8px)}
.startup-slot>*{grid-area:1/1;transition:opacity .22s ease,visibility .22s}
.startup-progress{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:12px}
.startup-ring{width:38px;height:38px;border-radius:50%;border:3.5px solid var(--su-track);border-top-color:var(--su-accent);animation:startup-spin .85s linear infinite;box-sizing:border-box}
.startup-status{margin:0;min-height:2.9em;font-size:13.5px;line-height:1.45;font-weight:600;color:var(--su-muted);transition:opacity .16s ease}
.startup-status.is-changing{opacity:.15}

.startup-features{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;width:100%;margin:2px 0 0;padding:0;list-style:none}
.startup-features li{display:flex;flex-direction:column;align-items:center;gap:7px;font-size:11.5px;line-height:1.25;font-weight:600;color:var(--su-muted)}
.startup-feature-icon{display:grid;place-items:center;width:40px;height:40px;border-radius:13px;background:var(--su-tile);color:var(--su-accent)}
.startup-feature-icon svg,.startup-btn svg,.startup-recovery-icon svg,.startup-footnote svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.startup-feature-icon svg{width:20px;height:20px}

.startup-recovery{display:flex;flex-direction:column;align-items:center;gap:8px;padding:18px 18px 16px;border:1px solid var(--su-card-line);border-radius:22px;background:var(--su-card);box-shadow:0 14px 34px rgba(20,40,110,.08);visibility:hidden;opacity:0}
[data-theme=dark] .startup-recovery{box-shadow:0 14px 34px rgba(0,0,0,.3)}
.startup-recovery-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:14px;background:var(--su-tile);color:var(--su-accent)}
.startup-recovery-icon svg{width:22px;height:22px}
.startup[data-tone=danger] .startup-recovery-icon{background:var(--su-danger-tile);color:var(--su-danger)}
.startup-recovery h2{margin:2px 0 0;font-size:17px;line-height:1.3;font-weight:700;color:var(--su-ink)}
.startup-recovery p{margin:0;max-width:300px;font-size:13.5px;line-height:1.5;color:var(--su-muted)}
.startup-actions{display:flex;flex-direction:column;align-items:stretch;gap:6px;width:100%;margin-top:8px}
.startup-btn{
  position:relative;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:50px;padding:0 22px;
  border:0;border-radius:999px;font:inherit;font-size:15px;font-weight:700;text-decoration:none;cursor:pointer;
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;user-select:none;
  transition:transform .12s ease,box-shadow .2s ease,opacity .2s ease,background-color .2s ease;
}
.startup-btn svg{width:18px;height:18px}
.startup-btn-primary{background:linear-gradient(135deg,var(--su-accent-2),#294fbd 70%);color:#fff;box-shadow:0 10px 22px rgba(41,79,189,.3)}
[data-theme=dark] .startup-btn-primary{background:linear-gradient(135deg,#c3d3ff,#9db8ff);color:#0f2457;box-shadow:0 10px 22px rgba(0,0,0,.35)}
.startup-btn-ghost{min-height:46px;background:transparent;color:var(--su-accent)}
.startup-btn:active{transform:scale(.97)}
.startup-btn-primary:active{box-shadow:0 4px 12px rgba(41,79,189,.28)}
.startup-btn:focus-visible{outline:3px solid color-mix(in srgb,var(--su-accent) 45%,transparent);outline-offset:3px}
.startup-btn[aria-busy=true]{opacity:.78;pointer-events:none}
.startup-btn[aria-busy=true] svg{animation:startup-spin .8s linear infinite}
.startup-btn[hidden]{display:none}

.startup-footnote{display:inline-flex;align-items:center;gap:6px;margin:clamp(4px,1.6vh,14px) 0 0;font-size:11.5px;font-weight:600;color:var(--su-muted);opacity:.85}
.startup-footnote svg{width:14px;height:14px}

/* Slot states */
.startup[data-mode=recovery] .startup-progress{visibility:hidden;opacity:0}
.startup[data-mode=recovery] .startup-recovery{visibility:visible;opacity:1}
.startup[data-mode=recovery] .startup-ring{animation:none}

/* Without JavaScript (a failed or blocked bundle) the static page still
   reveals the recovery card after a while. mobile-startup.js sets
   data-controlled as soon as it runs and owns the slot from then on. */
.startup:not([data-controlled]) .startup-progress{animation:startup-fallback-hide 0s 15s forwards}
.startup:not([data-controlled]) .startup-recovery{animation:startup-fallback-show 0s 15s forwards}

/* One-shot entrance. */
.startup-brand{animation:startup-rise .5s cubic-bezier(.16,1,.3,1) both}
.startup-art{animation:startup-pop .6s cubic-bezier(.16,1,.3,1) .06s both}
.startup-copy{animation:startup-rise .5s cubic-bezier(.16,1,.3,1) .12s both}
.startup-slot,.startup-footnote{animation:startup-fade .5s ease .2s both}
.startup-art .il-plane{animation:startup-plane .9s cubic-bezier(.16,1,.3,1) .25s both}
.startup-art .il-cap{animation:startup-cap .7s cubic-bezier(.16,1,.3,1) .18s both}

@keyframes startup-spin{to{transform:rotate(360deg)}}
@keyframes startup-rise{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@keyframes startup-pop{from{opacity:0;transform:scale(.95)}to{opacity:1;transform:none}}
@keyframes startup-fade{from{opacity:0}to{opacity:1}}
@keyframes startup-plane{from{opacity:0;transform:translate(-18px,14px)}to{opacity:1;transform:none}}
@keyframes startup-cap{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:none}}
@keyframes startup-fallback-hide{to{visibility:hidden;opacity:0}}
@keyframes startup-fallback-show{to{visibility:visible;opacity:1}}

/* Illustration paint (classes, not attributes: the CSP blocks inline styles
   and presentation attributes cannot read custom properties). */
.il-halo{fill:var(--il-halo)}
.il-shadow{fill:var(--il-shadow)}
.il-stop-a{stop-color:var(--il-globe-a)}
.il-stop-b{stop-color:var(--il-globe-b)}
.il-line{fill:none;stroke:var(--il-line);stroke-width:1.4}
.il-land{fill:var(--il-land)}
.il-orbit{fill:none;stroke:var(--il-orbit);stroke-width:1.6;stroke-dasharray:2 6;stroke-linecap:round}
.il-plane{fill:var(--il-plane)}
.il-cap-body{fill:var(--il-cap)}
.il-cap-board{fill:var(--il-cap-top)}
[data-theme=dark] .il-cap-board{fill:#2c4aa8}
.il-tassel{fill:none;stroke:var(--il-tassel);stroke-width:2;stroke-linecap:round}
.il-tassel-end{fill:var(--il-tassel)}
.il-book-1{fill:var(--il-book-1)}.il-book-2{fill:var(--il-book-2)}.il-book-3{fill:var(--il-book-3)}
.il-page{fill:var(--il-page)}
.il-doc{fill:var(--il-doc);stroke:var(--il-doc-line);stroke-width:1.2}
.il-doc-line{fill:none;stroke:var(--il-doc-line);stroke-width:3;stroke-linecap:round}
.il-check-bg{fill:var(--il-check)}
.il-check{fill:none;stroke:#fff;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.il-spark{fill:var(--il-spark)}
.il-dot{fill:var(--il-orbit)}

/* Short screens: drop the decorative preview and footnote, compact the
   recovery card (it sets the reserved slot height), then shrink the art. */
@media (max-height:700px){
  .startup-features{display:none}
  .startup-art{width:min(64vw,240px)}
  .startup-main{gap:clamp(8px,1.8vh,14px)}
  .startup-recovery{padding:14px 16px 12px;gap:6px}
  .startup-recovery-icon{display:none}
  .startup-recovery p{font-size:13px}
}
@media (max-height:820px){.startup-recovery-icon{display:none}.startup-recovery{padding-top:16px}}
@media (max-height:680px){.startup-footnote{display:none}}
@media (max-height:600px){.startup-art{width:min(52vw,200px)}.startup-title{font-size:clamp(23px,6.6vw,28px)}.startup-lead{font-size:14px}.startup-brand{width:clamp(150px,46vw,196px)}}
/* Landscape phones: illustration beside the text. */
@media (orientation:landscape) and (max-height:560px){
  .startup-main{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-areas:'art brand' 'art copy' 'art slot';align-content:center;align-items:center;column-gap:32px;row-gap:10px;max-width:860px;
    padding:calc(env(safe-area-inset-top,0px) + 12px) calc(env(safe-area-inset-right,0px) + 28px) calc(env(safe-area-inset-bottom,0px) + 12px) calc(env(safe-area-inset-left,0px) + 28px)}
  .startup-art{grid-area:art;width:min(40vw,320px);justify-self:center;align-self:center}
  .startup-brand{grid-area:brand;justify-self:center;width:clamp(140px,22vw,190px)}
  .startup-copy{grid-area:copy;gap:4px}
  .startup-title{font-size:clamp(22px,3.6vw,28px)}
  .startup-title span{display:inline}
  .startup-lead{font-size:14px}
  .startup-slot{grid-area:slot;justify-self:center;margin-top:0}
  .startup-actions{flex-direction:row;justify-content:center}
  .startup-btn{min-height:46px}
}
/* Tablets: a little more presence, same composition. */
@media (min-width:600px) and (min-height:760px){
  .startup-main{max-width:520px}
  .startup-art{width:340px}
  .startup-title{font-size:38px}
  .startup-lead{font-size:16px}
}

@media (prefers-reduced-motion:reduce){
  .startup,.startup *{animation-duration:.01ms!important;animation-delay:0s!important;transition-duration:.01ms!important}
  /* The ring is the only progress signal; keep it, just calmer. */
  .startup-ring{animation:startup-spin 2.4s linear infinite!important}
  .startup:not([data-controlled]) .startup-progress{animation:startup-fallback-hide 0s 15s forwards!important}
  .startup:not([data-controlled]) .startup-recovery{animation:startup-fallback-show 0s 15s forwards!important}
}
