/* CYBER BALL key page (key.ball8.store). Same family as get.ball8.store: no web fonts, no libraries,
   transform/opacity animations only. Everything shows without JavaScript; app.js only adds the step progress. */
:root, :host {
  --bg: #00070d;
  --bg2: #001420;
  --panel: rgba(0, 30, 46, .62);
  --line: rgba(111, 243, 255, .16);
  --cyan: #00e1ff;
  --cyan2: #6ff3ff;
  --ice: #c8faff;
  --text: #e7f6ff;
  --muted: #96b8c8;
  --violet: #8b5cff;
  --gold: #ffd166;
  --ok: #34ffba;
  --r: 20px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, .kx-page {
  margin: 0; min-height: 100vh; min-height: 100svh;
  background: radial-gradient(120% 70% at 50% -10%, #002a3c 0%, var(--bg2) 38%, var(--bg) 75%) fixed, var(--bg);
  color: var(--text); font: 16px/1.65 var(--font);
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
img { display: block; max-width: 100%; }

/* ---------- background ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.grid {
  position: absolute; inset: -20% -10% auto; height: 140%;
  background-image: linear-gradient(rgba(0, 225, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 225, 255, .07) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(70% 55% at 50% 25%, #000 0%, transparent 72%);
          mask-image: radial-gradient(70% 55% at 50% 25%, #000 0%, transparent 72%);
  transform: perspective(600px) rotateX(58deg) translateY(-8%); transform-origin: 50% 0;
  animation: drift 14s linear infinite;
}
@keyframes drift { to { background-position: 0 46px, 0 0; } }
.glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; will-change: transform; }
.g1 { width: 360px; height: 360px; top: -120px; inset-inline-end: -120px; background: #0090b0; animation: float 16s ease-in-out infinite; }
.g2 { width: 320px; height: 320px; top: 55%; inset-inline-start: -150px; background: #4c2bb8; opacity: .35; animation: float 19s ease-in-out infinite reverse; }
@keyframes float { 50% { transform: translate3d(40px, 50px, 0) scale(1.08); } }

/* reading progress (filled by app.js) */
.bar { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 5; background: rgba(0, 225, 255, .08); }
.bar i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: right; background: linear-gradient(90deg, var(--violet), var(--cyan), var(--ok)); box-shadow: 0 0 12px var(--cyan); transition: transform .25s ease; }

/* ---------- top ---------- */
.top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 560px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 0; }
.brand { display: flex; align-items: center; gap: 8px; direction: ltr; }
.brand img { border-radius: 8px; box-shadow: 0 0 14px rgba(0, 225, 255, .35); }
.brand span { font-weight: 800; letter-spacing: .14em; font-size: 13px; color: var(--ice); }
.brand b { color: var(--cyan); margin-inline-start: 4px; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--ok); background: rgba(52, 255, 186, .08); border: 1px solid rgba(52, 255, 186, .25); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: ping 2s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(52, 255, 186, .6); } 70%, 100% { box-shadow: 0 0 0 8px rgba(52, 255, 186, 0); } }

/* ---------- layout ---------- */
.wrap { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 4px 16px 24px; }
.hero { text-align: center; padding-top: 10px; }

/* the key orb */
.orb { position: relative; width: 150px; height: 150px; margin: 14px auto 0; }
.ring { position: absolute; inset: 0; border-radius: 50%; }
.r1 { border: 1.5px dashed rgba(0, 225, 255, .4); animation: turn 24s linear infinite; }
.r2 { inset: 18px; border: 1px solid rgba(139, 92, 255, .4); background: radial-gradient(circle, rgba(0, 225, 255, .16), rgba(0, 20, 32, .2) 70%); box-shadow: inset 0 0 26px rgba(0, 225, 255, .14), 0 0 40px rgba(0, 225, 255, .12); animation: turn 36s linear infinite reverse; }
.spin { position: absolute; inset: 0; animation: turn 6s linear infinite; }
.spin i { position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--cyan2) 35%, #0083a3 80%); box-shadow: 0 0 14px var(--cyan), 0 0 28px rgba(0, 225, 255, .5); }
.key { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; fill: none; stroke: var(--gold); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 10px rgba(255, 209, 102, .55)); animation: bob 5s ease-in-out infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes bob { 50% { transform: translate3d(0, -5px, 0) rotate(-6deg); } }

.title {
  margin: 16px 0 4px; font-size: clamp(27px, 8vw, 38px); line-height: 1.25; font-weight: 900;
  background: linear-gradient(100deg, #ffffff 0%, var(--ice) 35%, var(--cyan2) 55%, #ffffff 70%, #c9b8ff 100%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px rgba(0, 225, 255, .22)); animation: shine 7s ease-in-out infinite;
  overflow-wrap: anywhere;
}
@keyframes shine { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
.intro { margin: 6px auto 0; max-width: 420px; color: #cfe9f4; font-size: 15.5px; overflow-wrap: anywhere; }
.count { display: inline-block; margin: 14px 0 0; padding: 5px 14px; border-radius: 999px; font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); }
.count b { color: var(--cyan2); }

/* ---------- the path of steps ---------- */
.path { position: relative; list-style: none; margin: 26px 0 0; padding: 0; }
.path::before { content: ""; position: absolute; top: 18px; bottom: 18px; inset-inline-start: 19px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, rgba(0, 225, 255, .55), rgba(139, 92, 255, .4) 70%, rgba(52, 255, 186, .5)); }
.step { position: relative; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.node {
  position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: #00121c; border: 2px solid rgba(0, 225, 255, .6); color: var(--cyan2); font-weight: 900; font-size: 16px;
  box-shadow: 0 0 14px rgba(0, 225, 255, .3), inset 0 0 10px rgba(0, 225, 255, .15);
  transition: background .3s ease, color .3s ease, border-color .3s ease, transform .3s ease;
}
.card { flex: 1; min-width: 0; padding: 14px 15px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); transition: border-color .3s ease; }
.card h2 { margin: 0 0 4px; font-size: 16.5px; line-height: 1.45; color: var(--ice); overflow-wrap: anywhere; }
.card p { margin: 0; color: #cfe9f4; font-size: 15px; overflow-wrap: anywhere; }
.card figure { margin: 12px 0 2px; border-radius: 14px; overflow: hidden; border: 1px solid rgba(111, 243, 255, .22); background: #00101a; }
.card figure img { width: 100%; height: auto; cursor: zoom-in; }
.card h2:only-child, .card p:only-child { margin: 0; }
.card figure:first-child { margin-top: 0; }

/* steps rise in once on load (pure CSS, never hidden); app.js only lights up the ones already read */
.step { animation: rise .55s ease both; }
.step:nth-child(2) { animation-delay: .08s; } .step:nth-child(3) { animation-delay: .16s; } .step:nth-child(4) { animation-delay: .24s; }
.step:nth-child(5) { animation-delay: .32s; } .step:nth-child(n+6) { animation-delay: .4s; }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 14px, 0); } }
.step.seen .node { background: linear-gradient(135deg, #00d6f5, #0087c0); border-color: transparent; color: #00121b; transform: scale(1.06); }
.step.seen .card { border-color: rgba(0, 225, 255, .32); }

/* ---------- finish ---------- */
.finish { position: relative; display: flex; align-items: center; gap: 14px; margin-top: 8px; padding: 16px; border-radius: var(--r); background: linear-gradient(135deg, rgba(52, 255, 186, .1), rgba(0, 225, 255, .06)); border: 1px solid rgba(52, 255, 186, .35); box-shadow: 0 0 30px rgba(52, 255, 186, .08); }
.tick { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(52, 255, 186, .14); border: 2px solid var(--ok); box-shadow: 0 0 18px rgba(52, 255, 186, .35); animation: beat 2.4s ease-in-out infinite; }
.tick svg { width: 24px; height: 24px; fill: none; stroke: var(--ok); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
@keyframes beat { 50% { transform: scale(1.08); } }
.finish div { display: flex; flex-direction: column; min-width: 0; }
.finish b { font-size: 15.5px; color: #eafff6; overflow-wrap: anywhere; }
.finish small { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.finish.done { border-color: var(--ok); box-shadow: 0 0 34px rgba(52, 255, 186, .22); }

.foot { position: relative; z-index: 1; display: flex; justify-content: center; padding: 4px 16px max(20px, env(safe-area-inset-bottom)); color: #6f8f9e; font-size: 12.5px; }

/* image viewer (app.js) */
.zoom { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; padding: 16px; background: rgba(0, 6, 12, .92); cursor: zoom-out; animation: fade .2s ease; }
.zoom img { max-height: 92vh; width: auto; border-radius: 12px; box-shadow: 0 0 40px rgba(0, 225, 255, .25); }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 360px) {
  .path::before { inset-inline-start: 16px; }
  .node { width: 34px; height: 34px; font-size: 14px; }
  .card { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.paused *, .paused *::before, .paused *::after { animation-play-state: paused !important; }
.lite .glow, .lite .grid { display: none; }
