/* App pages in 3D, part 2 (app-3d.js; founder 2026-10-09: "Do for all. Don't remove any of my 3DS, and animations").
   Adds to app-fx.css, never overrides it. Everything is scoped under html.a3d-on (set by the script, app only).
   --afx / --afx2 are the colours of the page's menu section. */

/* ---------- The section's 3D world, behind the page ---------- */
.a3d-world { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; perspective: 900px; perspective-origin: 50% 35%; }
html.taa-app body.as-on .a3d-world { left: var(--as-w, 252px); }
html.as-rail.taa-app body.as-on .a3d-world { left: var(--as-rail, 70px); }
.a3d-world.a3d-paused * { animation-play-state: paused !important; }
.a3d-obj { position: absolute; width: var(--s); height: var(--s); transform-style: preserve-3d; animation: a3dFloat var(--d) ease-in-out var(--dl) infinite alternate; opacity: .62; }
.a3d-obj > * { position: absolute; inset: 0; transform-style: preserve-3d; animation: a3dSpin calc(var(--d) * 1.3) linear var(--dl) infinite; }
@keyframes a3dFloat { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(3vw, -6vh, 60px); } }
@keyframes a3dSpin { from { transform: rotateX(0) rotateY(0); } to { transform: rotateX(360deg) rotateY(720deg); } }

/* Learn and Play: cubes */
.a3d-cube i { position: absolute; inset: 0; border: 1px solid rgba(var(--afx), .55); background: linear-gradient(135deg, rgba(var(--afx), .16), rgba(var(--afx2), .06)); border-radius: 4px !important; box-shadow: inset 0 0 12px rgba(var(--afx), .25); }
.a3d-cube i:nth-child(1) { transform: translateZ(calc(var(--s) / 2)); }
.a3d-cube i:nth-child(2) { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.a3d-cube i:nth-child(3) { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.a3d-cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.a3d-cube i:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.a3d-cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.a3d-dice i { border-radius: 18% !important; border-color: rgba(var(--afx), .7);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .85) 0 7%, transparent 8%), radial-gradient(circle at 70% 70%, rgba(255, 255, 255, .85) 0 7%, transparent 8%), radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .85) 0 7%, transparent 8%), linear-gradient(135deg, rgba(var(--afx), .45), rgba(var(--afx2), .3)); }

/* Labs and Play: a moving grid floor */
.a3d-floor { position: absolute; left: -50%; right: -50%; bottom: -10%; height: 60%; transform: rotateX(72deg); transform-origin: 50% 100%; opacity: .45;
  background-image: linear-gradient(rgba(var(--afx), .55) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--afx), .55) 1px, transparent 1px); background-size: 60px 60px;
  -webkit-mask-image: linear-gradient(to top, #000, transparent 85%); mask-image: linear-gradient(to top, #000, transparent 85%); animation: a3dGrid 4s linear infinite; }
.a3d-w-play .a3d-floor { background-image: linear-gradient(rgba(var(--afx), .6) 2px, transparent 2px), linear-gradient(90deg, rgba(var(--afx2), .5) 2px, transparent 2px); opacity: .4; }
@keyframes a3dGrid { to { background-position: 0 60px, 0 0; } }

/* Labs: floating code symbols */
.a3d-glyph { display: grid; place-items: center; font: 800 calc(var(--s) * .55)/1 ui-monospace, Menlo, Consolas, monospace; color: rgb(var(--afx)); text-shadow: 0 0 12px rgba(var(--afx), .9), 2px 2px 0 rgba(var(--afx2), .5); animation-name: a3dSway !important; }
@keyframes a3dSway { 0% { transform: rotateY(-35deg) rotateX(10deg); } 50% { transform: rotateY(35deg) rotateX(-10deg); } 100% { transform: rotateY(-35deg) rotateX(10deg); } }

/* Tools: glass photo frames */
.a3d-frame { border: 2px solid rgba(var(--afx), .6); border-radius: 8px !important; background: linear-gradient(160deg, rgba(var(--afx), .18), rgba(var(--afx2), .05)); box-shadow: 0 0 18px rgba(var(--afx), .25); animation-name: a3dSway !important; }
.a3d-frame i { position: absolute; left: 15%; right: 15%; bottom: 18%; height: 35%; background: linear-gradient(135deg, transparent 50%, rgba(var(--afx), .55) 50%); clip-path: polygon(0 100%, 35% 30%, 55% 70%, 75% 45%, 100% 100%); }
.a3d-frame::after { content: ""; position: absolute; top: 16%; right: 20%; width: 18%; aspect-ratio: 1; border-radius: 50% !important; background: rgba(var(--afx2), .7); }

/* Create & Earn: spinning gold coins */
.a3d-coin { border-radius: 50% !important; background: radial-gradient(circle at 35% 30%, #fff6c8, #fbbf24 45%, #b7791f 100%); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35), inset 0 0 0 calc(var(--s) * .12) rgba(183, 121, 31, .55), 0 0 22px rgba(251, 191, 36, .45); animation-name: a3dCoin !important; }
.a3d-coin i { position: absolute; inset: 28%; border-radius: 50% !important; border: 2px solid rgba(120, 72, 6, .55); }
@keyframes a3dCoin { to { transform: rotateY(360deg); } }

/* Community: chat bubbles */
.a3d-bubble { width: 130%; height: 85%; border-radius: 40% 40% 40% 8% !important; background: linear-gradient(140deg, rgba(var(--afx), .4), rgba(var(--afx2), .2)); border: 1px solid rgba(var(--afx), .6); display: flex; align-items: center; justify-content: center; gap: 12%; animation-name: a3dSway !important; }
.a3d-bubble i { width: 12%; aspect-ratio: 1; border-radius: 50% !important; background: #fff; opacity: .85; animation: a3dDots 1.4s ease-in-out infinite; }
.a3d-bubble i:nth-child(2) { animation-delay: .2s; } .a3d-bubble i:nth-child(3) { animation-delay: .4s; }
@keyframes a3dDots { 50% { transform: translateY(-30%); opacity: .4; } }

/* My account: orbits with a medal */
.a3d-orbit { border: 2px solid rgba(var(--afx), .5); border-radius: 50% !important; transform: rotateX(70deg); animation-name: a3dOrbit !important; }
.a3d-orbit i { position: absolute; top: -12%; left: 44%; width: 24%; aspect-ratio: 1; border-radius: 50% !important; background: radial-gradient(circle at 35% 30%, #fff, rgb(var(--afx2)) 60%); box-shadow: 0 0 14px rgba(var(--afx2), .9); }
@keyframes a3dOrbit { from { transform: rotateX(70deg) rotateZ(0); } to { transform: rotateX(70deg) rotateZ(360deg); } }

/* ---------- The page title's 3D badge ---------- */
.a3d-badge { --rx: 0deg; --ry: 0deg; display: inline-grid; vertical-align: middle; margin: -6px 16px 0 0; place-items: center; width: 58px; height: 58px; perspective: 400px; -webkit-text-fill-color: initial; }
.a3d-badge-core { position: relative; width: 100%; height: 100%; display: grid; place-items: center; transform-style: preserve-3d; border-radius: 16px !important;
  background: radial-gradient(circle at 30% 25%, rgba(var(--afx), .55), rgba(10, 18, 38, .95) 70%); border: 1px solid rgba(var(--afx), .55);
  box-shadow: 0 14px 30px -12px rgba(var(--afx), .8), inset 0 1px 0 rgba(255, 255, 255, .25); transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .3s ease-out; animation: a3dBadge 6s ease-in-out infinite; }
@keyframes a3dBadge { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.a3d-layer { position: absolute; display: grid; place-items: center; transform: translateZ(var(--z)); color: rgba(var(--afx), .35); }
.a3d-layer:last-child { color: #fff; filter: drop-shadow(0 0 6px rgba(var(--afx), .9)); }
.a3d-layer svg { width: 28px; height: 28px; }

/* ---------- Headings draw a glowing line ---------- */
.a3d-on .a3d-h2 { background-image: linear-gradient(90deg, rgb(var(--afx)), rgb(var(--afx2)), transparent); background-repeat: no-repeat; background-size: 0 3px; background-position: 0 100%; padding-bottom: 6px; transition: background-size 1s cubic-bezier(.2, .8, .2, 1); }
.a3d-on .a3d-h2.a3d-seen { background-size: 72px 3px; }

/* ---------- The light under the mouse ---------- */
.a3d-spot { position: fixed; left: 0; top: 0; width: 600px; height: 600px; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(closest-side, rgba(var(--afx), .09), transparent); }
.a3d-spot.is-on { opacity: 1; }

/* ---------- Cards: a light sweep on hover; chosen tabs glow ---------- */
.a3d-sheen { position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .09) 48%, rgba(var(--afx), .12) 52%, transparent 65%); background-size: 250% 100%; background-position: 130% 0; transition: background-position .9s ease; }
.a3d-card:hover > .a3d-sheen { background-position: -30% 0; }
.a3d-on main :is([aria-selected="true"], [aria-pressed="true"], .is-active, .active):is(button, a, [role="tab"]) { box-shadow: 0 0 0 1px rgba(var(--afx), .5), 0 8px 22px -10px rgba(var(--afx), .9); }

/* ---------- Sparks ---------- */
.a3d-sparks { position: fixed; z-index: 3000; width: 0; height: 0; pointer-events: none; }
.a3d-sparks i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50% !important; background: rgb(var(--afx)); box-shadow: 0 0 8px rgb(var(--afx)); animation: a3dSpark .7s ease-out forwards; }
.a3d-sparks i:nth-child(even) { background: rgb(var(--afx2)); box-shadow: 0 0 8px rgb(var(--afx2)); }
@keyframes a3dSpark { to { transform: translate(var(--x), var(--y)) scale(.2); opacity: 0; } }

/* ---------- Labs: code boxes as glowing screens ---------- */
.a3d-on .a3d-screen { box-shadow: 0 0 0 1px rgba(var(--afx), .35), 0 18px 40px -24px rgba(var(--afx), .8), inset 0 0 24px rgba(var(--afx), .06) !important; transition: box-shadow .3s; }
.a3d-on .a3d-screen:focus, .a3d-on .a3d-screen:focus-within { box-shadow: 0 0 0 2px rgba(var(--afx), .7), 0 22px 50px -22px rgba(var(--afx), .95), inset 0 0 30px rgba(var(--afx), .1) !important; }

/* ---------- Tools: upload areas float and light up ---------- */
.a3d-on .a3d-drop { position: relative; transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s; box-shadow: 0 0 0 1px rgba(var(--afx), .25), 0 20px 50px -30px rgba(var(--afx), .9); }
.a3d-on .a3d-drop svg { animation: a3dBob 3s ease-in-out infinite; }
/* No tilt when the mouse passes over an upload area (founder 2026-10-12: "Just remove the wiggling feature"); dragging a file over it still lights it up. */
.a3d-on .a3d-drop.is-over { transform: perspective(900px) rotateX(6deg) translateY(-6px) scale(1.01); box-shadow: 0 0 0 2px rgb(var(--afx)), 0 30px 60px -24px rgba(var(--afx), 1); }
@keyframes a3dBob { 50% { transform: translateY(-6px) rotateY(20deg); } }

/* ---------- Play: neon edges ---------- */
.a3d-neon:hover { border-color: rgba(var(--afx), .9) !important; box-shadow: 0 0 0 1px rgba(var(--afx), .6), 0 0 26px -4px rgba(var(--afx), .8), 0 0 40px -10px rgba(var(--afx2), .8) !important; }

/* ---------- My account: badges turn, locked ones shimmer, leaderboard medals ---------- */
.a3d-on .a3d-spin { transition: transform .8s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.a3d-card:hover .a3d-spin { transform: perspective(300px) rotateY(360deg) scale(1.12); }
.a3d-locked .a3d-sheen { background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .06) 50%, transparent 60%); background-size: 250% 100%; animation: a3dShimmer 3.5s ease-in-out infinite; }
@keyframes a3dShimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }
.a3d-medal { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 10px; border-radius: 50% !important; color: rgba(58, 36, 5, .85);
  vertical-align: middle; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .6), 0 6px 14px -6px rgba(0, 0, 0, .8); animation: a3dMedal 4s ease-in-out infinite; }
@keyframes a3dMedal { 0%, 100% { transform: perspective(200px) rotateY(-28deg); } 50% { transform: perspective(200px) rotateY(28deg); } }
.a3d-medal svg { width: 14px; height: 14px; }
.a3d-m1 { background: radial-gradient(circle at 35% 30%, #fff6c8, #fbbf24 50%, #b7791f); }
.a3d-m2 { background: radial-gradient(circle at 35% 30%, #fff, #cbd5e1 50%, #64748b); }
.a3d-m3 { background: radial-gradient(circle at 35% 30%, #ffe2c4, #d97706 50%, #7c2d12); color: #fff; }
.a3d-podium { transition: transform .25s; }
.a3d-p1 { box-shadow: inset 3px 0 0 #fbbf24; } .a3d-p2 { box-shadow: inset 3px 0 0 #cbd5e1; } .a3d-p3 { box-shadow: inset 3px 0 0 #d97706; }

/* ---------- Phones, print, reduced motion ---------- */
@media (max-width: 860px) { html.taa-app body.as-on .a3d-world { left: 0; } .a3d-obj { opacity: .35; } .a3d-badge { width: 46px; height: 46px; } .a3d-layer svg { width: 22px; height: 22px; } }
@media print { .a3d-world, .a3d-spot, .a3d-sparks, .a3d-badge { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .a3d-world *, .a3d-badge-core, .a3d-medal, .a3d-drop svg, .a3d-locked .a3d-sheen { animation: none !important; }
  .a3d-on .a3d-h2 { transition: none; background-size: 72px 3px; }
  .a3d-sheen, .a3d-spin, .a3d-drop { transition: none !important; }
}
