/* Configurable visual skins. The original UI is intentionally untouched and is the fail-safe. */
:root {
  --ng-theme-color: #2f6bff;
  --ng-motion-speed: 1;
}

html.ng-skin-active {
  --ng-accent: #2f6bff;
  --ng-accent-2: #22c8c3;
  --ng-accent-rgb: 47, 107, 255;
  --ng-page: #eff5ff;
  --ng-page-deep: #dfeaff;
  --ng-panel: rgba(255, 255, 255, .9);
  --ng-panel-solid: #fff;
  --ng-ink: #14223a;
  --ng-muted: #687b98;
  --ng-line: rgba(74, 126, 211, .28);
  --ng-shadow: 0 18px 42px rgba(22, 59, 118, .15);
  --ng-radius: 22px;
  --ng-blur: 18px;
}

html.ng-skin-active body {
  color: var(--ng-ink);
  background-color: var(--ng-page);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(var(--ng-accent-rgb), .14), transparent 32%),
    radial-gradient(circle at 88% 16%, color-mix(in srgb, var(--ng-accent-2) 14%, transparent), transparent 30%),
    linear-gradient(145deg, var(--ng-page), var(--ng-page-deep));
  background-attachment: fixed;
}

html.ng-skin-active body::before,
html.ng-skin-active body::after {
  content: "";
  position: fixed;
  inset: -22vmax;
  z-index: -2;
  pointer-events: none;
  will-change: transform, opacity, background-position;
}

html.ng-skin-active body::before {
  opacity: .24;
  background-image:
    radial-gradient(circle, rgba(var(--ng-accent-rgb), .8) 0 1px, transparent 1.8px),
    radial-gradient(circle, color-mix(in srgb, var(--ng-accent-2) 72%, transparent) 0 1px, transparent 1.7px);
  background-position: 0 0, 31px 21px;
  background-size: 58px 58px, 83px 83px;
  animation: ng-skin-drift calc(30s / var(--ng-motion-speed)) linear infinite;
}

html.ng-skin-active body::after {
  z-index: -1;
  opacity: .31;
  filter: blur(62px);
  background: conic-gradient(from 0deg at 50% 50%, transparent, rgba(var(--ng-accent-rgb), .22), transparent 35%, color-mix(in srgb, var(--ng-accent-2) 25%, transparent), transparent 70%);
  animation: ng-skin-turn calc(42s / var(--ng-motion-speed)) linear infinite;
}

html.ng-skin-active :is(.site-header, .carousel-wrap, .marquee-wrap, .category-buttons, .card, .game-card, .common-tool-card, .collector-card, .service-panel, .line-shell, .popup-modal, input, textarea, select, table) {
  border-color: var(--ng-line) !important;
  border-radius: var(--ng-radius) !important;
  box-shadow: var(--ng-shadow) !important;
}

html.ng-skin-active :is(.site-header, .marquee-wrap, .category-buttons, .card, .game-card, .common-tool-card, .collector-card, .service-panel, .popup-modal, input, textarea, select, table) {
  color: var(--ng-ink);
  background-color: var(--ng-panel) !important;
  -webkit-backdrop-filter: blur(var(--ng-blur)) saturate(122%);
  backdrop-filter: blur(var(--ng-blur)) saturate(122%);
}

html.ng-skin-active :is(.category-button.active, .go, .load-more, .trial-tools button, button.el-button--primary) {
  color: #fff !important;
  border-color: color-mix(in srgb, var(--ng-accent) 50%, #fff) !important;
  background: linear-gradient(135deg, var(--ng-accent), var(--ng-accent-2)) !important;
  box-shadow: 0 10px 24px rgba(var(--ng-accent-rgb), .28) !important;
}

html.ng-skin-active :is(.card, .game-card, .common-tool-card, .collector-card, button, a, input, textarea, select) {
  transition: transform calc(220ms / var(--ng-motion-speed)) ease, border-color calc(220ms / var(--ng-motion-speed)) ease, box-shadow calc(220ms / var(--ng-motion-speed)) ease, filter calc(180ms / var(--ng-motion-speed)) ease;
}

html.ng-skin-active :is(.card, .game-card, .common-tool-card, .collector-card) { position: relative; overflow: hidden; }
html.ng-skin-active :is(.card, .game-card, .common-tool-card, .collector-card)::before {
  content: "";
  position: absolute;
  inset: -65% auto -65% -42%;
  z-index: 1;
  width: 23%;
  pointer-events: none;
  opacity: .25;
  transform: rotate(16deg) translateX(-360%);
  background: linear-gradient(90deg, transparent, #fff, transparent);
  animation: ng-skin-sheen calc(7.4s / var(--ng-motion-speed)) ease-in-out infinite;
}

@media (hover: hover) {
  html.ng-skin-active :is(.card, .game-card, .common-tool-card, .collector-card):hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--ng-accent) 62%, transparent) !important; }
  html.ng-skin-active :is(button, a, .category-button):hover { filter: brightness(1.06); }
}

/* Theme and motion chooser */
.theme-skin-toggle {
  position: fixed; right: 22px; bottom: 142px; z-index: 84; display: inline-flex; width: 112px; height: 48px;
  align-items: center; justify-content: center; gap: 8px; color: #fff; border: 1px solid rgba(255,255,255,.64); border-radius: 999px;
  background: linear-gradient(135deg, #6b55e7, #2f7cff 56%, #21bfc1); box-shadow: 0 13px 30px rgba(50,88,201,.34), inset 0 1px rgba(255,255,255,.25);
  font-size: 12px; font-weight: 850; cursor: pointer;
}
.theme-skin-toggle span { font-size: 18px; }
body:not(.theme-has-service) .theme-skin-toggle { bottom: 82px; }
body.theme-service-open .theme-skin-toggle { opacity: 0; pointer-events: none; }
.theme-skin-panel {
  position: fixed; right: 22px; bottom: 198px; z-index: 100; width: min(352px, calc(100vw - 28px)); padding: 15px;
  color: var(--ng-ink, #17233a); border: 1px solid var(--ng-line, rgba(63,107,173,.23)); border-radius: 22px;
  background: var(--ng-panel-solid, #fff); box-shadow: 0 24px 64px rgba(12, 32, 72, .28); backdrop-filter: blur(20px);
}
.theme-skin-panel[hidden] { display: none !important; }
.theme-skin-panel header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.theme-skin-panel header strong { font-size: 16px; }
.theme-skin-panel header button { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; color: var(--ng-muted, #687892); border: 0; border-radius: 11px; background: rgba(var(--ng-accent-rgb, 47,107,255), .09); font-size: 24px; line-height: 1; }
.theme-skin-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.theme-skin-options button { display: flex; min-width: 0; min-height: 42px; align-items: center; gap: 8px; padding: 7px 9px; color: var(--ng-ink, #17233a); border: 1px solid var(--ng-line, #d7e1ef); border-radius: 12px; background: var(--ng-panel, #fff); }
.theme-skin-options button i { width: 18px; height: 18px; flex: 0 0 auto; border: 3px solid rgba(255,255,255,.72); border-radius: 50%; background: linear-gradient(135deg, var(--ng-accent, #2f6bff), var(--ng-accent-2, #22c8c3)); box-shadow: 0 0 0 1px rgba(var(--ng-accent-rgb, 47,107,255),.24); }
.theme-skin-options button.is-active, .theme-motion-options button.is-active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--ng-accent, #2f6bff), var(--ng-accent-2, #22c8c3)); }
.theme-motion-title { margin: 15px 0 8px; color: var(--ng-muted, #687892); font-size: 12px; font-weight: 800; }
.theme-motion-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.theme-motion-options button { min-height: 34px; padding: 5px; color: var(--ng-ink, #17233a); border: 1px solid var(--ng-line, #d7e1ef); border-radius: 10px; background: var(--ng-panel, #fff); font-size: 12px; font-weight: 800; }
.theme-skin-locked { margin: 0; color: var(--ng-muted, #687892); font-size: 13px; }

html[data-motion="high"] { --ng-motion-speed: 1.22; }
html[data-motion="standard"] { --ng-motion-speed: 1; }
html[data-motion="low"] { --ng-motion-speed: .65; }
html[data-motion="low"] body::after, html[data-motion="low"] :is(.card, .game-card, .common-tool-card, .collector-card)::before { display: none; }
html[data-motion="off"] body::before, html[data-motion="off"] body::after, html[data-motion="off"] :is(.card, .game-card, .common-tool-card, .collector-card)::before { display: none !important; animation: none !important; }
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after,
html.ng-page-hidden *, html.ng-page-hidden *::before, html.ng-page-hidden *::after { animation-play-state: paused !important; }

@keyframes ng-skin-drift { to { background-position: 116px 58px, -83px 104px; } }
@keyframes ng-skin-turn { to { transform: rotate(1turn); } }
@keyframes ng-skin-sheen { 0%, 61% { transform: rotate(16deg) translateX(-360%); } 78%, 100% { transform: rotate(16deg) translateX(860%); } }
@keyframes ng-stars-float { to { background-position: 84px 126px, -97px 194px; } }
@keyframes ng-nebula-breathe { to { transform: scale(1.1) rotate(8deg); opacity: .5; } }
@keyframes ng-aurora-flow { to { transform: translate3d(6%, -4%, 0) rotate(24deg) scale(1.08); } }
@keyframes ng-particles-rise { to { background-position: 34px -102px, -71px -142px; } }
@keyframes ng-scanline { to { transform: translateY(52px); } }
@keyframes ng-grid-drift { to { background-position: 104px 52px; } }
@keyframes ng-bubbles-float { to { background-position: 74px -148px, -121px -242px; } }
@keyframes ng-dream-breathe { to { transform: translate3d(-3%, 4%, 0) scale(1.08); } }

@media (max-width: 768px) {
  html.ng-skin-active { --ng-blur: 12px; }
  html.ng-skin-active body::before { opacity: .15; background-size: 62px 62px, 103px 103px; }
  html.ng-skin-active body::after { opacity: .2; filter: blur(42px); }
  html.ng-skin-active :is(.card, .game-card, .common-tool-card, .collector-card)::before { display: none; }
  .theme-skin-toggle { right: 12px; bottom: 132px; width: 52px; height: 52px; padding: 0; }
  .theme-skin-toggle b { display: none; }
  body:not(.theme-has-service) .theme-skin-toggle { bottom: 76px; }
  .theme-skin-panel { right: 12px; bottom: 192px; }
}

@media (prefers-reduced-motion: reduce) {
  html.ng-skin-active body::before, html.ng-skin-active body::after, html.ng-skin-active :is(.card, .game-card, .common-tool-card, .collector-card)::before { display: none !important; animation: none !important; }
  html.ng-skin-active *, html.ng-skin-active *::before, html.ng-skin-active *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
