/* =========================================================
   WILLIAM — 3D floating panel scene (hero + auth backdrop)
   Only transform/opacity are animated.
   ========================================================= */
.w-scene {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  perspective: 1400px;
}
.w-scene-glow {
  position: absolute;
  inset: -15%;
  pointer-events: none;
  /* closest-side: each glow fades to fully transparent before the box edge (no visible rectangle) */
  background:
    radial-gradient(closest-side at 62% 38%, rgba(99, 102, 241, .38), rgba(99, 102, 241, 0)),
    radial-gradient(closest-side at 50% 78%, rgba(6, 182, 212, .24), rgba(6, 182, 212, 0));
  -webkit-mask-image: radial-gradient(closest-side, #000 60%, transparent);
  mask-image: radial-gradient(closest-side, #000 60%, transparent);
}
.w-scene-stage {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(var(--tilt-y, 0deg)) rotateX(var(--tilt-x, 0deg));
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}

/* ---- Panel ---- */
.w-scene-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(440px, 88%);
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(30, 30, 42, .96), rgba(18, 18, 26, .98));
  border: 1px solid rgba(var(--w-ov), .09);
  box-shadow: 0 40px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(99, 102, 241, .08), 0 0 60px rgba(99, 102, 241, .15);
  transform: translate(-50%, -50%) rotateY(-18deg) rotateX(8deg);
  animation: w-scene-sway 7s ease-in-out infinite;
}
.w-scene-panel-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.w-scene-panel-top > span {
  width: 9px; height: 9px; border-radius: 50%;
  background: #ef4444;
}
.w-scene-panel-top > span:nth-child(2) { background: #f59e0b; }
.w-scene-panel-top > span:nth-child(3) { background: #10b981; }
.w-scene-panel-url {
  margin-left: 10px;
  flex: 1;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--w-text-muted);
  background: rgba(var(--w-ov), .05);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w-scene-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }
.w-scene-tile {
  padding: 12px;
  border-radius: 12px;
  background: rgba(var(--w-ov), .04);
  border: 1px solid rgba(var(--w-ov), .06);
}
.w-scene-tile i { color: var(--w-primary-light); font-size: 14px; }
.w-scene-tile strong { display: block; margin-top: 6px; font-size: 22px; font-weight: 800; color: var(--w-heading); line-height: 1; }
.w-scene-tile small { font-size: 11px; color: var(--w-text-muted); }

.w-scene-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 70px;
  margin: 14px 0;
}
.w-scene-chart i {
  flex: 1;
  height: var(--h);
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--w-primary-light), var(--w-primary));
  opacity: .9;
  transform-origin: bottom;
  animation: w-scene-grow 1.2s cubic-bezier(.2, .8, .2, 1) both;
}
.w-scene-chart i:nth-child(2) { animation-delay: .08s; } .w-scene-chart i:nth-child(3) { animation-delay: .16s; }
.w-scene-chart i:nth-child(4) { animation-delay: .24s; } .w-scene-chart i:nth-child(5) { animation-delay: .32s; }
.w-scene-chart i:nth-child(6) { animation-delay: .40s; } .w-scene-chart i:nth-child(7) { animation-delay: .48s; background: linear-gradient(180deg, #22d3ee, var(--w-accent)); }

.w-scene-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-top: 1px solid rgba(var(--w-ov), .05);
  font-size: 13px;
}
.w-scene-row-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(99, 102, 241, .15); color: var(--w-primary-light);
}
.w-scene-row-name { flex: 1; color: var(--w-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-scene-row-price { color: var(--w-ok-text); font-weight: 700; white-space: nowrap; }

/* ---- Floating cards ---- */
.w-scene-card {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(22, 22, 29, .82);
  border: 1px solid rgba(var(--w-ov), .12);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  transform: translateZ(140px);
  animation: w-scene-float 5s ease-in-out infinite;
  white-space: nowrap;
}
.w-scene-card small { display: block; font-size: 11px; color: var(--w-text-muted); }
.w-scene-card b { display: block; font-size: 14px; color: var(--w-heading); }
.w-scene-card-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(99, 102, 241, .18); color: var(--w-primary-light); font-size: 15px;
}
.w-scene-card-icon.is-accent { background: rgba(6, 182, 212, .18); color: #22d3ee; }
.w-scene-card-icon.is-success { background: rgba(16, 185, 129, .18); color: var(--w-ok-text); }
.w-scene-card--a { top: 8%;  left: 2%; }
/* below the panel, bottom-left: the left edge recedes (rotateY<0), so nothing intersects or hides content */
.w-scene-card--b { bottom: -5%; left: 2%; animation-delay: -1.6s; }
.w-scene-card--c { top: 14%; right: 4%; animation-delay: -3.2s; }

/* ---- Backdrop variant (auth pages) ---- */
.w-scene.is-backdrop {
  position: fixed;
  inset: 0;
  min-height: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .55;
  filter: blur(2px);
}
.w-scene.is-backdrop .w-scene-panel { left: 22%; top: 62%; width: 420px; }
.w-scene.is-backdrop .w-scene-card--a { top: 10%; left: 6%; }
.w-scene.is-backdrop .w-scene-card--c { top: 12%; right: 6%; }
.w-scene.is-backdrop .w-scene-card--b { bottom: 8%; right: 10%; left: auto; } /* one horizontal anchor only (both = stretched card) */

@keyframes w-scene-sway {
  0%, 100% { transform: translate(-50%, -50%) rotateY(-18deg) rotateX(8deg); }
  50%      { transform: translate(-50%, calc(-50% - 10px)) rotateY(-12deg) rotateX(5deg); }
}
@keyframes w-scene-float {
  0%, 100% { transform: translateZ(140px) translateY(0); }
  50%      { transform: translateZ(140px) translateY(-12px); }
}
@keyframes w-scene-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---- Responsive ---- */
@media (max-width: 991px) {
  .w-scene { min-height: 380px; }
  .w-scene-card--a { left: 0; }
  /* stacked layout: smaller 3D depth so cards don't project over the text above */
  .w-scene-card { transform: translateZ(70px); animation-name: w-scene-float-sm; }
}
@keyframes w-scene-float-sm {
  0%, 100% { transform: translateZ(70px) translateY(0); }
  50%      { transform: translateZ(70px) translateY(-8px); }
}
@media (max-width: 575px) {
  .w-scene { min-height: 340px; }
  .w-scene-panel { width: 92%; padding: 12px; transform: translate(-50%, -50%) rotateY(-8deg) rotateX(6deg); animation: none; }
  .w-scene-card { padding: 8px 10px; }
  .w-scene-card b { font-size: 12px; }
  .w-scene-card--c, .w-scene-card--b { display: none; }
  .w-scene.is-backdrop { opacity: .3; }
  .w-scene.is-backdrop .w-scene-panel { left: 50%; top: 80%; width: 92%; }
  .w-scene.is-backdrop .w-scene-card--b { display: none; }
}

/* ---- Reduced motion: no continuous animation ---- */
@media (prefers-reduced-motion: reduce) {
  .w-scene-panel, .w-scene-card, .w-scene-chart i { animation: none !important; }
  .w-scene-stage { transition: none; }
}

/* light theme: the floating panel becomes a light card */
html[data-theme="light"] .w-scene-panel { background: linear-gradient(160deg, #ffffff, #f4f6fb); border-color: rgba(15,23,42,.08); box-shadow: 0 40px 80px rgba(15,23,42,.14), 0 0 0 1px rgba(99,102,241,.08), 0 0 60px rgba(99,102,241,.12); }
html[data-theme="light"] .w-scene-card { background: rgba(255,255,255,.92); border-color: rgba(15,23,42,.08); box-shadow: 0 18px 40px rgba(15,23,42,.12); }
html[data-theme="light"] .w-scene-card-icon.is-accent { color: #0e7490; }
