/*
 * NG Arcade UI layer
 * Visual-only enhancement shared by the public site, lottery, line checker,
 * control center and tenant admin. It deliberately does not change grids,
 * spacing, content order or application behavior.
 */

:root {
  --arcade-blue: #2f6bff;
  --arcade-blue-2: #6a8cff;
  --arcade-cyan: #35dccb;
  --arcade-violet: #8d6bff;
  --arcade-gold: #ffcf65;
  --arcade-success: #28c995;
  --arcade-warning: #ffad42;
  --arcade-danger: #f05b72;
  --arcade-radius: 18px;
  --arcade-fast: 160ms;
  --arcade-normal: 260ms;
  --arcade-slow: 8s;
  --arcade-ease: cubic-bezier(.2, .72, .25, 1);
  --arcade-line: rgba(97, 137, 226, .28);
  --arcade-panel: rgba(255, 255, 255, .86);
  --arcade-glow: 0 12px 34px rgba(47, 107, 255, .13);
  --arcade-inset: inset 0 1px rgba(255, 255, 255, .82);
}

html[data-theme="dark"] {
  --arcade-line: rgba(92, 133, 205, .48);
  --arcade-panel: rgba(13, 27, 47, .9);
  --arcade-glow: 0 15px 38px rgba(0, 0, 0, .28), 0 0 28px rgba(47, 107, 255, .045);
  --arcade-inset: inset 0 1px rgba(255, 255, 255, .065);
}

html {
  background: #f1f5fb;
  transition: background-color var(--arcade-normal) ease, color var(--arcade-normal) ease;
}

html,
body {
  width: 100%;
  min-width: 0 !important;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

.page-shell,
.page-shell > *,
.collector-catalog-panel,
.collector-catalog-shell,
.common-tools-panel,
.lottery-inline-panel {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.page-shell img,
.page-shell video,
.page-shell iframe { max-width: 100%; }

html[data-theme="dark"] { background: #06101e; }

body {
  position: relative;
  isolation: isolate;
  background: transparent;
  transition: background-color var(--arcade-normal) ease, color var(--arcade-normal) ease;
}

body::before {
  content: "";
  position: fixed;
  inset: -16%;
  z-index: -3;
  display: block;
  background:
    radial-gradient(44% 36% at 7% 8%, rgba(47, 107, 255, .18), transparent 72%),
    radial-gradient(38% 32% at 94% 16%, rgba(53, 220, 203, .13), transparent 74%),
    radial-gradient(34% 30% at 52% 92%, rgba(141, 107, 255, .09), transparent 75%),
    linear-gradient(155deg, #f8faff 0%, #f0f5fc 48%, #f6f9fd 100%);
  background-size: 120% 120%, 118% 118%, 125% 125%, 100% 100%;
  animation: arcade-aurora 20s ease-in-out infinite alternate;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  display: block;
  opacity: .48;
  background-image:
    linear-gradient(rgba(68, 103, 170, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(68, 103, 170, .045) 1px, transparent 1px),
    radial-gradient(circle, rgba(47, 107, 255, .23) .7px, transparent .95px);
  background-size: 46px 46px, 46px 46px, 24px 24px;
  mask-image: linear-gradient(to bottom, #000, rgba(0,0,0,.3) 38%, rgba(0,0,0,.18) 72%, #000);
  animation: arcade-grid-drift 28s linear infinite;
  pointer-events: none;
}

html[data-theme="dark"] body::before {
  background:
    radial-gradient(46% 38% at 5% 5%, rgba(47, 107, 255, .24), transparent 72%),
    radial-gradient(40% 34% at 96% 14%, rgba(45, 207, 197, .16), transparent 74%),
    radial-gradient(34% 32% at 54% 92%, rgba(130, 91, 255, .12), transparent 76%),
    linear-gradient(155deg, #050d18 0%, #09172a 50%, #06111f 100%);
}

html[data-theme="dark"] body::after {
  opacity: .34;
  background-image:
    linear-gradient(rgba(100, 142, 218, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 142, 218, .07) 1px, transparent 1px),
    radial-gradient(circle, rgba(94, 145, 242, .35) .72px, transparent 1px);
}

@keyframes arcade-aurora {
  0% { background-position: 0% 0%, 100% 0%, 50% 100%, 0 0; }
  100% { background-position: 7% 4%, 92% 8%, 56% 92%, 0 0; }
}

@keyframes arcade-grid-drift { to { background-position: 46px 23px, 23px 46px, 24px 24px; } }
@keyframes arcade-energy { to { background-position: 200% 50%; } }
@keyframes arcade-breathe { 50% { box-shadow: 0 0 0 7px rgba(47, 107, 255, .055), 0 0 24px rgba(47, 107, 255, .22); } }
@keyframes arcade-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes arcade-scan { 0%, 28% { transform: translateX(-130%); } 70%, 100% { transform: translateX(230%); } }

/* Shared glass and energy surfaces. */
:where(.page-shell header, .page-shell .nav-section, .page-shell .marquee-wrap,
  .collector-catalog-shell, .common-tools-group, .lottery-shell .site-header,
  .lottery-shell .draw-card, .lottery-shell .panel, .lottery-shell .stat-card,
  .lottery-shell .prediction-card, .line-shell, .panel, .stat-card,
  .domain-card, .site-summary-card, .control-card, .auth-card) {
  border-color: var(--arcade-line);
  box-shadow: var(--arcade-glow), var(--arcade-inset);
}

:where(.page-shell header, .page-shell .nav-section, .page-shell .marquee-wrap,
  .collector-catalog-shell, .common-tools-group, .lottery-shell .site-header,
  .lottery-shell .draw-card, .lottery-shell .panel, .line-shell, .panel,
  .stat-card, .domain-card, .collector-card, .site-summary-card, .auth-card) {
  transition: border-color var(--arcade-normal) ease, box-shadow var(--arcade-normal) ease,
    background-color var(--arcade-normal) ease, transform var(--arcade-normal) var(--arcade-ease);
}

/* Header energy line; sits inside the existing box and never affects layout. */
:where(.page-shell header, .lottery-shell .site-header, .topbar) {
  position: relative;
  overflow: hidden;
}

:where(.page-shell header, .lottery-shell .site-header, .topbar)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--arcade-blue), var(--arcade-cyan), transparent);
  background-size: 200% 100%;
  opacity: .72;
  animation: arcade-energy 7s linear infinite;
  pointer-events: none;
}

/* Existing cards keep their dimensions; only their material and feedback change. */
:where(.page-shell .card, .page-shell .game-card, .common-tool-card, .collector-card,
  .lottery-shell .stat-card, .lottery-shell .prediction-card, .route-card,
  .domain-card, .site-summary-card, .rank-row, .metric-box, .el-card) {
  border-color: var(--arcade-line);
  box-shadow: var(--arcade-glow), var(--arcade-inset);
  transition: transform var(--arcade-normal) var(--arcade-ease), border-color var(--arcade-normal) ease,
    box-shadow var(--arcade-normal) ease, filter var(--arcade-normal) ease;
  will-change: auto;
}

@media (hover: hover) and (pointer: fine) {
  :where(.page-shell .card, .page-shell .game-card, .common-tool-card, .collector-card,
    .lottery-shell .stat-card, .lottery-shell .prediction-card, .route-card,
    .domain-card, .site-summary-card, .el-card):hover {
    border-color: rgba(90, 137, 239, .7);
    box-shadow: 0 17px 40px rgba(47, 107, 255, .16), 0 0 0 1px rgba(53, 220, 203, .08), var(--arcade-inset);
    transform: translateY(-2px);
  }
}

/* Navigation and category controls use one game-console language. */
:where(.page-shell .category-button, .lottery-shell .main-nav a, .collector-category-list button,
  .nav-item, .tab-button, [role="tab"]) {
  position: relative;
  isolation: isolate;
  border-color: var(--arcade-line);
  transition: color var(--arcade-fast) ease, border-color var(--arcade-fast) ease,
    background var(--arcade-normal) ease, box-shadow var(--arcade-normal) ease,
    transform var(--arcade-fast) var(--arcade-ease);
}

:where(.page-shell .category-button.active, .lottery-shell .main-nav a.active,
  .lottery-shell .main-nav a[aria-current="page"], .collector-category-list button.is-active,
  .nav-item.is-active, .tab-button.is-active, [role="tab"][aria-selected="true"]) {
  border-color: rgba(137, 171, 255, .72);
  background-image: linear-gradient(115deg, #2259d8, #407cff 45%, #735fff 76%, #2ebfb5);
  background-size: 220% 100%;
  box-shadow: 0 10px 28px rgba(47, 107, 255, .28), inset 0 1px rgba(255, 255, 255, .24);
  animation: arcade-energy 7s linear infinite;
}

@media (hover: hover) and (pointer: fine) {
  :where(.page-shell .category-button, .lottery-shell .main-nav a, .collector-category-list button,
    .nav-item, [role="tab"]):hover { transform: translateY(-1px); }
}

/* Arcade-style icon sockets. */
:where(.category-icon, .nav-icon, .stat-icon, .domain-icon, .collector-icon,
  .brand-mark, .auth-brand-mark, .result-icon, .service-icon, .theme-icon) {
  border: 1px solid rgba(120, 158, 242, .35);
  box-shadow: inset 0 1px rgba(255, 255, 255, .18), 0 7px 18px rgba(38, 88, 196, .12);
  text-shadow: 0 0 14px currentColor;
  transition: transform var(--arcade-normal) var(--arcade-ease), box-shadow var(--arcade-normal) ease;
}

:where(.category-button.active, .nav-item.is-active, [role="tab"][aria-selected="true"]) :where(.category-icon, .nav-icon) {
  box-shadow: inset 0 1px rgba(255,255,255,.22), 0 0 0 4px rgba(255,255,255,.07), 0 0 22px rgba(100, 149, 255, .34);
}

/* Buttons keep their original size and position. */
:where(button, .button, .go, .back-link, .retry-button, #enter-button, .el-button) {
  position: relative;
  overflow: hidden;
  transition: transform var(--arcade-fast) var(--arcade-ease), box-shadow var(--arcade-normal) ease,
    border-color var(--arcade-fast) ease, filter var(--arcade-fast) ease;
  -webkit-tap-highlight-color: transparent;
}

:where(.button.primary, .go, #enter-button, .el-button--primary, button[type="submit"]) {
  background-image: linear-gradient(115deg, #245ddb, #3f7dff 48%, #735fff 77%, #33c9bb);
  background-size: 220% 100%;
  box-shadow: 0 10px 24px rgba(47, 107, 255, .24), inset 0 1px rgba(255,255,255,.24);
}

@media (hover: hover) and (pointer: fine) {
  :where(.button.primary, .go, #enter-button, .el-button--primary, button[type="submit"]):hover {
    background-position: 100% 50%;
    box-shadow: 0 13px 30px rgba(47, 107, 255, .32), 0 0 18px rgba(53, 220, 203, .1), inset 0 1px rgba(255,255,255,.28);
  }
}

:where(button, .button, .go, .back-link, .retry-button, #enter-button, .el-button):active,
.arcade-press { transform: scale(.975) !important; filter: brightness(.98); }

:where(button, .button, .go, .back-link, .retry-button, #enter-button, .el-button):disabled {
  box-shadow: none;
  filter: grayscale(.2) saturate(.65);
}

/* Tags and live statuses: only important items breathe. */
:where(.status, .badge, .source-badge, .overall-status, .card-badge, .best-label) {
  border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
  box-shadow: inset 0 1px rgba(255,255,255,.16);
}

:where(.overall-status.is-checking, .source-badge, .card-badge) {
  animation: arcade-breathe 2.8s ease-in-out infinite;
}

/* Forms become a quiet control console. */
:where(input, select, textarea, .el-input__wrapper, .el-select__wrapper, .el-textarea__inner) {
  transition: border-color var(--arcade-fast) ease, box-shadow var(--arcade-fast) ease,
    background-color var(--arcade-normal) ease;
}

:where(input, select, textarea):focus,
:where(.el-input__wrapper, .el-select__wrapper, .el-textarea__inner):focus-within {
  border-color: rgba(67, 119, 240, .82) !important;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12), 0 0 20px rgba(47, 107, 255, .08) !important;
  outline: none;
}

/* Modals and overlays gain a short, consistent entrance without moving layout. */
:where(.modal, .popup-modal, .collector-detail-dialog, .player-panel) {
  border-color: var(--arcade-line);
  box-shadow: 0 24px 70px rgba(6, 17, 37, .28), 0 0 0 1px rgba(95, 140, 235, .08), var(--arcade-inset);
  animation: arcade-rise 240ms var(--arcade-ease) both;
}

:where(.modal-backdrop, .popup-backdrop, .collector-detail-backdrop) {
  backdrop-filter: blur(9px) saturate(.88);
}

/* Loading states share an energy sweep. */
:where(.skeleton, .is-placeholder > *, .loading-placeholder, .collector-loading) {
  background-image: linear-gradient(100deg, rgba(116, 145, 194, .11) 20%, rgba(88, 137, 240, .22) 42%, rgba(53, 220, 203, .12) 52%, rgba(116, 145, 194, .11) 72%);
  background-size: 240% 100%;
  animation: arcade-energy 1.6s linear infinite;
}

/* Floating actions: compact energy cores that stay clear of the page content. */
:where(.theme-toggle, .service-float, .customer-service-float, .floating-service, .floating-button) {
  border-color: rgba(116, 158, 250, .72);
  box-shadow: 0 0 0 6px rgba(47, 107, 255, .055), 0 12px 30px rgba(20, 66, 166, .28), inset 0 1px rgba(255,255,255,.26);
  animation: arcade-breathe 3.2s ease-in-out infinite;
}

/* The actual home-page theme and service launchers use their own class names. */
.theme-mode-toggle,
.page-shell .service-float-btn {
  width: 50px;
  height: 50px;
  min-width: 50px;
  min-height: 50px;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(29, 79, 190, .28), 0 0 0 3px rgba(72, 128, 255, .05), inset 0 1px rgba(255,255,255,.24);
  animation: arcade-float-breathe 3.5s ease-in-out infinite;
}

.theme-mode-toggle { bottom: 84px; }
.theme-mode-label,
.page-shell .service-float-btn::after { display: none !important; }
.theme-mode-icon { width: 21px; height: 21px; font-size: 15px; }
.page-shell .service-float-btn span { width: 21px; height: 18px; flex-basis: 21px; }
.page-shell .service-float-btn b {
  display: none !important;
  top: -5px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-width: 2px;
  font-size: 10px;
}

@keyframes arcade-float-breathe {
  0%, 100% { box-shadow: 0 8px 20px rgba(29, 79, 190, .27), 0 0 0 0 rgba(72, 128, 255, .16), inset 0 1px rgba(255,255,255,.24); }
  50% { box-shadow: 0 10px 24px rgba(29, 79, 190, .34), 0 0 0 4px rgba(72, 128, 255, 0), inset 0 1px rgba(255,255,255,.28); }
}

/* Main-site carousel receives an edge scan without changing its crop. */
.page-shell .carousel-wrap {
  position: relative;
  border-color: rgba(91, 136, 229, .45);
  box-shadow: 0 20px 52px rgba(31, 73, 154, .18), 0 0 0 1px rgba(53, 220, 203, .055), inset 0 1px rgba(255,255,255,.2);
}

.page-shell .carousel-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -34%;
  z-index: 3;
  width: 20%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
  transform: skewX(-18deg);
  animation: arcade-scan 8s ease-in-out infinite;
  pointer-events: none;
}

/* Dark-theme material overrides. */
html[data-theme="dark"] :where(.page-shell header, .page-shell .nav-section, .page-shell .marquee-wrap,
  .collector-catalog-shell, .common-tools-group, .lottery-shell .site-header,
  .lottery-shell .draw-card, .lottery-shell .panel, .lottery-shell .stat-card,
  .lottery-shell .prediction-card) {
  background-color: rgba(12, 25, 43, .9);
  border-color: rgba(75, 108, 158, .66);
}

html[data-theme="dark"] :where(.page-shell .card, .page-shell .game-card, .common-tool-card,
  .collector-card, .lottery-shell .stat-card, .lottery-shell .prediction-card, .route-card) {
  border-color: rgba(67, 98, 143, .7);
  box-shadow: 0 15px 36px rgba(0,0,0,.25), inset 0 1px rgba(255,255,255,.055);
}

/* Control center and tenant admin: same arcade language, existing layout intact. */
.app-shell .sidebar {
  background:
    radial-gradient(circle at 50% -4%, rgba(61, 112, 244, .22), transparent 30%),
    linear-gradient(180deg, #09172c 0%, #071321 100%);
  box-shadow: inset -1px 0 rgba(102, 148, 236, .14), 12px 0 36px rgba(7, 21, 45, .08);
}

.app-shell .brand-mark,
.auth-brand-mark {
  background: linear-gradient(145deg, #6c8fff, #2f64ec 55%, #644ff0);
  box-shadow: 0 0 0 5px rgba(73, 119, 235, .09), 0 10px 28px rgba(43, 100, 245, .32);
}

.app-shell .topbar {
  border-color: rgba(187, 204, 235, .75);
  background: rgba(250, 252, 255, .82);
  box-shadow: 0 10px 30px rgba(30, 65, 127, .07);
}

.app-shell :where(.panel, .stat-card, .domain-card, .collector-card, .site-summary-card) {
  background-image:
    radial-gradient(circle at 100% 0, rgba(47, 107, 255, .07), transparent 38%),
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(248,251,255,.96));
}

.hero-strip {
  background:
    radial-gradient(circle at 84% 20%, rgba(82, 221, 210, .21), transparent 25%),
    radial-gradient(circle at 70% 90%, rgba(130, 91, 255, .23), transparent 30%),
    linear-gradient(115deg, #0b1b39, #174281 58%, #3268dc);
  background-size: 115% 115%;
  animation: arcade-aurora 14s ease-in-out infinite alternate;
}

.auth-page {
  background:
    radial-gradient(circle at 12% 8%, rgba(47,107,255,.22), transparent 32rem),
    radial-gradient(circle at 88% 90%, rgba(53,220,203,.12), transparent 28rem),
    #081426;
}

.auth-card { background: rgba(255,255,255,.95); }

/* Line selector stays exceptionally light and fast. */
.line-hero {
  background:
    radial-gradient(circle at 86% 16%, rgba(70, 227, 212, .24), transparent 26%),
    linear-gradient(125deg, #1f51cf, #3c77ff 55%, #745fff);
  background-size: 115% 115%;
  animation: arcade-aurora 14s ease-in-out infinite alternate;
}

.progress-track span,
.health-bar i,
.collector-progress i {
  background-image: linear-gradient(90deg, var(--arcade-blue), var(--arcade-violet), var(--arcade-cyan), var(--arcade-blue));
  background-size: 220% 100%;
  animation: arcade-energy 3.6s linear infinite;
}

/* Mobile and touch devices keep the same look with fewer expensive effects. */
@media (max-width: 900px), (pointer: coarse) {
  body::after { opacity: .26; animation-duration: 46s; }
  body::before { animation-duration: 32s; }
  :where(.page-shell .card, .page-shell .game-card, .common-tool-card, .collector-card,
    .lottery-shell .stat-card, .route-card, .domain-card, .site-summary-card) {
    will-change: auto;
  }
  :where(.theme-toggle, .service-float, .customer-service-float, .floating-service, .floating-button) {
    animation-duration: 4.5s;
  }
}

@media (max-width: 560px) {
  body::after {
    background-size: 58px 58px, 58px 58px, 28px 28px;
    opacity: .2;
  }
  .page-shell .carousel-wrap::after { animation: none; opacity: .24; transform: translateX(270%) skewX(-18deg); }
  :where(.page-shell header, .page-shell .nav-section, .page-shell .marquee-wrap,
    .collector-catalog-shell, .common-tools-group, .lottery-shell .site-header,
    .lottery-shell .draw-card, .lottery-shell .panel, .line-shell, .panel,
    .stat-card, .domain-card, .collector-card, .site-summary-card, .auth-card) {
    backdrop-filter: none;
  }

  .theme-mode-toggle,
  .page-shell .service-float-btn {
    right: 14px;
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0;
  }
  .theme-mode-toggle { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  body:not(.theme-has-service) .theme-mode-toggle { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .theme-mode-icon { width: 21px; height: 21px; font-size: 17px; }
  .page-shell .service-float-btn {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 50%;
  }
  .page-shell .service-float-btn span { transform: scale(.9); }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .page-shell .carousel-wrap::after,
  :where(.page-shell header, .lottery-shell .site-header, .topbar)::after,
  :where(.overall-status.is-checking, .source-badge, .card-badge),
  :where(.theme-toggle, .service-float, .customer-service-float, .floating-service, .floating-button),
  :where(.skeleton, .is-placeholder > *, .loading-placeholder, .collector-loading),
  :where(.page-shell .category-button.active, .lottery-shell .main-nav a.active,
    .collector-category-list button.is-active, .nav-item.is-active) {
    animation: none !important;
  }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* Movie/adult catalogs use the same section-heading language as the fixed categories. */
.page-shell .collector-page-heading {
  position: relative;
  margin-top: 0;
  margin-bottom: 18px;
}

.page-shell .collector-page-heading .collector-page-title {
  margin-top: 0;
  margin-bottom: 8px;
}

.page-shell .collector-page-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 9px 0 0;
  padding-left: 15px;
  color: #74839b;
}

.page-shell .collector-page-meta p { margin: 0; font-size: 13px; }
.page-shell .collector-page-meta .collector-catalog-updated { font-size: 12px; }

html[data-theme="dark"] .page-shell .collector-page-heading .collector-page-title { color: #edf4ff; }
html[data-theme="dark"] .page-shell .collector-page-meta,
html[data-theme="dark"] .page-shell .collector-page-meta p,
html[data-theme="dark"] .page-shell .collector-page-meta .collector-catalog-updated { color: #94a6bf; }

@media (max-width: 620px) {
  .page-shell .collector-page-heading { margin-bottom: 14px; }
  .page-shell .collector-page-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    margin-top: 7px;
    padding-left: 15px;
  }
}

.arcade-page-paused *,
.arcade-page-paused *::before,
.arcade-page-paused *::after { animation-play-state: paused !important; }

@supports not (color: color-mix(in srgb, white, black)) {
  :where(.status, .badge, .source-badge, .overall-status, .card-badge, .best-label) {
    border-color: rgba(99, 133, 198, .35);
  }
}
