/* Aulama TV start-up screen, 2026-11-05. Loaded after tv.css; restyles the app's own markup:
   main.boot-screen > img, strong.boot-tagline, span.boot-line, p   (and .is-error > svg, h1, p, button).
   No frame: the logo floats in its own light while signal waves spread out from it, and a segmented
   signal bar tunes in below. Only transform and opacity move, so phones stay smooth. */

html .boot-screen {
  --boot-cyan: #22d3ee;
  --boot-blue: #4f8dff;
  --boot-pink: #ec4899;
  --boot-stage: min(240px, 62vw);
  grid-template-areas: "stage" "tagline" "signal" "status";
  align-content: center;
  gap: 0;
  isolation: isolate;
  font-family: var(--font);
}

/* a slow wash of the logo's colours behind everything */
html .boot-screen::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -2;
  background:
    radial-gradient(34% 30% at 34% 40%, color-mix(in srgb, var(--boot-blue) 14%, transparent), transparent 70%),
    radial-gradient(30% 28% at 66% 62%, color-mix(in srgb, var(--boot-pink) 11%, transparent), transparent 70%);
  animation: boot-drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

/* signal waves: two rings that grow out from behind the logo and fade */
html .boot-screen::before {
  content: "";
  grid-area: stage;
  align-self: center;
  justify-self: center;
  z-index: -1;
  width: var(--boot-stage);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 47%, color-mix(in srgb, var(--boot-cyan) 34%, transparent) 48.5%, transparent 50.5%),
    radial-gradient(circle, transparent 0 66%, color-mix(in srgb, var(--boot-pink) 22%, transparent) 67.5%, transparent 69.5%),
    radial-gradient(circle, color-mix(in srgb, var(--boot-blue) 20%, transparent) 0, transparent 46%);
  animation: boot-wave 2.6s cubic-bezier(.22, 1, .36, 1) .5s infinite both;
  pointer-events: none;
}

html .boot-screen img {
  grid-area: stage;
  align-self: center;
  justify-self: center;
  height: clamp(56px, 15vw, 76px);
  margin: calc((var(--boot-stage) - clamp(56px, 15vw, 76px)) / 2) 0;
  filter: drop-shadow(0 8px 24px color-mix(in srgb, var(--boot-blue) 45%, transparent));
  animation: boot-light .7s cubic-bezier(.22, 1, .36, 1) both;
}

html .boot-tagline {
  grid-area: tagline;
  margin-top: 8px;
  font-size: 20px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: .06em;
  animation: atv-rise .6s .2s cubic-bezier(.22, 1, .36, 1) both;
}

/* signal bar: twelve segments with a light passing through them */
html .boot-line {
  grid-area: signal;
  justify-self: center;
  width: min(216px, 60vw);
  height: 6px;
  margin-top: 16px;
  border-radius: 0;
  background: var(--fill-2);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 14px, transparent 14px 18px);
          mask: repeating-linear-gradient(90deg, #000 0 14px, transparent 14px 18px);
  animation: atv-rise .6s .3s cubic-bezier(.22, 1, .36, 1) both;
}
html .boot-line::after {
  width: 45%;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, var(--boot-cyan) 30%, var(--boot-blue) 60%, var(--boot-pink));
  animation: boot-tune 1.4s cubic-bezier(.45, 0, .2, 1) infinite;
}

html .boot-screen:not(.is-error) p {
  grid-area: status;
  margin-top: 12px;
  font-size: 13px;
  line-height: 20px;
  letter-spacing: .04em;
  animation: atv-rise .6s .4s cubic-bezier(.22, 1, .36, 1) both;
}
/* "正在連接 Aulama IPTV…" counts its dots; their room is kept so the line never shifts */
html .boot-screen:not(.is-error) p::after {
  content: "...";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  clip-path: inset(0 100% 0 0);
  animation: boot-dots 1.6s steps(4, jump-none) infinite;
}

/* could not connect: the waves stop and turn the colour of the warning */
html .boot-screen.is-error {
  grid-template-areas: "stage" "title" "message" "action";
}
html .boot-screen.is-error::before {
  background:
    radial-gradient(circle, transparent 0 47%, color-mix(in srgb, var(--danger) 30%, transparent) 48.5%, transparent 50.5%),
    radial-gradient(circle, color-mix(in srgb, var(--danger) 16%, transparent) 0, transparent 46%);
  width: calc(var(--boot-stage) * .72);
  animation: none;
}
html .boot-screen.is-error svg {
  grid-area: stage; align-self: center; justify-self: center;
  width: 44px; height: 44px;
  margin: calc((var(--boot-stage) * .72 - 44px) / 2) 0;
}
html .boot-screen.is-error h1 { grid-area: title; margin: 16px 0 0; font-size: 20px; line-height: 28px; font-weight: 700; }
html .boot-screen.is-error p { grid-area: message; margin-top: 8px; }
html .boot-screen.is-error button { grid-area: action; justify-self: center; margin-top: 20px; }

@keyframes boot-wave {
  0% { opacity: 0; transform: scale(.55); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.18); }
}
@keyframes boot-light {
  from { opacity: 0; transform: scale(.88); }
  to { opacity: 1; transform: none; }
}
@keyframes boot-tune {
  from { transform: translateX(-100%); }
  to { transform: translateX(225%); }
}
@keyframes boot-dots { to { clip-path: inset(0 0 0 0); } }
@keyframes boot-drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  html .boot-screen::after, html .boot-screen img, html .boot-tagline, html .boot-line,
  html .boot-screen p, html .boot-screen p::after { animation: none !important; }
  html .boot-screen:not(.is-error)::before { animation: none; opacity: .7; transform: scale(.86); }
  html .boot-line::after { animation: none; transform: translateX(60%); }
  html .boot-screen:not(.is-error) p::after { clip-path: none; }
}
