/* Shared, module-scoped UI refinements based on the local UI/UX Pro Max skill. */
:root {
  --uupm-ink: #18181b;
  --uupm-muted: #71717a;
  --uupm-surface: #ffffff;
  --uupm-border: #e4e4e7;
  --uupm-focus: #0f766e;
  --uupm-radius: 8px;
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--uupm-focus);
  outline-offset: 3px;
}

/* Portal */
.portal-home.gradient-bg {
  background: #f8fafc;
}

.dark .portal-home.gradient-bg {
  background: linear-gradient(180deg, #0d0d1f 0%, #131328 100%);
}

.portal-home #particles-canvas,
.portal-home .glow {
  display: none;
}

.portal-home .portal-card {
  border: 1px solid var(--uupm-border);
  border-radius: var(--uupm-radius);
  background: var(--uupm-surface);
  backdrop-filter: none;
  box-shadow: none;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.dark .portal-home .portal-card {
  background: #1c1c32;
  border-color: rgba(255, 255, 255, 0.08);
}

.portal-home .portal-card:hover {
  border-color: rgba(83, 82, 237, 0.45);
  background: #fafafa;
  box-shadow: none;
  transform: none;
}

.dark .portal-home .portal-card:hover {
  border-color: rgba(140, 150, 255, 0.35);
  background: #20203a;
}

.portal-home .portal-card > div {
  border-radius: 8px;
}

.portal-home .logo-float {
  animation: none;
}

.portal-home .theme-toggle {
  position: fixed;
  inset: 24px 24px auto auto;
  z-index: 100;
  width: 48px;
  height: 48px;
  border: 1px solid var(--uupm-border);
  border-radius: 8px;
  box-shadow: none;
}

.dark .portal-home .theme-toggle,
.dark .portal-home .social-link {
  border-color: rgba(255, 255, 255, 0.12);
}

.portal-home .social-link {
  border: 1px solid var(--uupm-border);
  box-shadow: none;
}

.portal-home .social-link:hover {
  transform: none;
}

/* Software directory */
.module-software {
  background: #f8fafc !important;
}

.module-software header {
  border-color: var(--uupm-border) !important;
  box-shadow: none;
}

.software-home > section,
.software-home > div:last-child,
.software-home #softwareGrid > div {
  border-radius: var(--uupm-radius) !important;
  box-shadow: none !important;
}

.software-home > section,
.software-home > div:last-child {
  border-color: var(--uupm-border) !important;
}

.software-home input[type="search"] {
  min-height: 44px;
  border-color: #d4d4d8 !important;
}

.software-home input[type="search"]:focus {
  border-color: #059669 !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14);
}

/* Software directory - visual refresh */
.software-home .software-hero {
  background: linear-gradient(125deg, #eff6ff 0%, #eef2ff 55%, #f5f3ff 100%);
  border-radius: 16px !important;
  min-height: 224px;
}

.software-home .software-hero-orb {
  position: absolute;
  border-radius: 9999px;
  pointer-events: none;
}

.software-home .software-hero-orb-one {
  width: 210px;
  height: 210px;
  right: -60px;
  top: -90px;
  background: rgba(96, 165, 250, .18);
}

.software-home .software-hero-orb-two {
  width: 150px;
  height: 150px;
  right: 23%;
  bottom: -95px;
  background: rgba(167, 139, 250, .14);
}

.software-home #softwareGrid > .software-card {
  border-color: #e6ebf4;
  border-radius: 16px !important;
  box-shadow: 0 4px 16px rgba(30, 64, 175, .045) !important;
}

.software-home .software-file-icon {
  border-color: transparent !important;
  background: transparent !important;
}

.software-home .software-icon-glyph {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.55rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 6px 14px rgba(15, 23, 42, .06);
}

.software-home .software-icon-windows { color: #2563eb; background: linear-gradient(145deg, #dbeafe, #bfdbfe); }
.software-home .software-icon-archive { color: #ea580c; background: linear-gradient(145deg, #ffedd5, #fed7aa); }
.software-home .software-icon-unknown { color: #6366f1; background: linear-gradient(145deg, #e0e7ff, #c7d2fe); }
.software-home .software-icon-android { color: #16a34a; background: linear-gradient(145deg, #dcfce7, #bbf7d0); }
.software-home .software-icon-apple { color: #334155; background: linear-gradient(145deg, #e2e8f0, #cbd5e1); }
.software-home .software-icon-pdf,
.software-home .software-icon-presentation { color: #dc2626; background: linear-gradient(145deg, #fee2e2, #fecaca); }
.software-home .software-icon-doc { color: #2563eb; background: linear-gradient(145deg, #dbeafe, #c7d2fe); }
.software-home .software-icon-sheet { color: #16a34a; background: linear-gradient(145deg, #dcfce7, #bbf7d0); }
.software-home .software-icon-text { color: #64748b; background: linear-gradient(145deg, #f1f5f9, #e2e8f0); }
.software-home .software-icon-image { color: #9333ea; background: linear-gradient(145deg, #f3e8ff, #e9d5ff); }
.software-home .software-icon-video { color: #e11d48; background: linear-gradient(145deg, #ffe4e6, #fecdd3); }
.software-home .software-icon-audio { color: #0284c7; background: linear-gradient(145deg, #e0f2fe, #bae6fd); }

.software-home .software-trust-icon {
  display: inline-flex;
  width: 1.15rem;
  height: 1.15rem;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: #059669;
  background: #d1fae5;
  font-size: .65rem;
}

.software-home #softwareGrid > .software-card:hover {
  border-color: rgba(37, 99, 235, .3);
  box-shadow: 0 14px 30px rgba(37, 99, 235, .12) !important;
  transform: translateY(-4px);
}

.software-home .software-hero-content > div:first-child h1 {
  letter-spacing: -.04em;
}

.software-home #softwareGrid {
  gap: 1.25rem;
}

.software-home #softwareGrid > .software-card {
  min-height: 238px;
}

.software-home #softwareGrid > .software-card h3 {
  line-height: 1.35;
}

.software-home #categoryList .category-item {
  border-radius: 10px;
  padding-top: .65rem;
  padding-bottom: .65rem;
}

@media (max-width: 639px) {
  .software-home .software-hero { min-height: 0; padding: 1.25rem; }
  .software-home .software-hero h1 { font-size: 1.5rem; }
}

/* Software detail */
.module-software .software-detail-hero,
.module-software .software-detail-panel,
.module-software .software-side-card {
  border-color: #e6ebf4 !important;
  box-shadow: 0 10px 30px rgba(30, 64, 175, .055) !important;
}

.module-software .software-detail-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.module-software .software-detail-icon {
  background: linear-gradient(145deg, #eff6ff, #e0e7ff);
}

.module-software .software-detail-hero h1 {
  overflow-wrap: anywhere;
}

.module-software .software-info-item {
  min-height: 48px;
  align-items: center;
  border: 1px solid #f1f3f7;
}

.module-software .software-info-item span:last-child {
  text-align: right;
  overflow-wrap: anywhere;
  margin-left: 1rem;
}

.module-software .software-detail-panel .tab-btn.active {
  background: #eff6ff;
}

.module-software .software-side-card p {
  line-height: 1.8;
}

@media (max-width: 1023px) {
  .module-software .software-detail-hero {
    padding: 1.5rem;
  }
}

/* Bookmark directory */
.module-bookmark {
  background: #fffbeb;
  color: #0f172a;
}

.module-bookmark .site-header,
.module-bookmark .search-box,
.module-bookmark .sidebar,
.module-bookmark .bookmark-card {
  border-color: #faeee1 !important;
  box-shadow: none !important;
}

.module-bookmark .bookmark-card,
.module-bookmark .search-box,
.module-bookmark .sidebar {
  border-radius: var(--uupm-radius) !important;
}

.module-bookmark .bookmark-card:hover {
  border-color: #d97706 !important;
  box-shadow: none !important;
  transform: none !important;
}

.module-bookmark .search-section {
  padding-top: 2rem;
}

.module-bookmark .search-box input {
  min-height: 48px;
}

.module-bookmark .btn,
.module-bookmark #loadMoreBtn {
  min-height: 40px;
  border-radius: 6px;
}

/* Member center */
.member-container {
  background: #f8fafc !important;
}

.member-container .sidebar,
.member-container .content-card,
.member-container .stat-card {
  border-color: var(--uupm-border) !important;
  border-radius: var(--uupm-radius) !important;
  box-shadow: none !important;
}

.member-container .sidebar,
.member-container .content-card,
.member-container .stat-card {
  background: #ffffff;
}

.member-container .stat-card:hover {
  border-color: #18181b !important;
  box-shadow: none !important;
  transform: none !important;
}

.member-container .vip-status-card {
  border-radius: var(--uupm-radius) !important;
  box-shadow: none !important;
}

@media (max-width: 768px) {
  .portal-home main {
    justify-content: flex-start;
  }

  .portal-home .portal-card {
    min-height: 116px;
  }

  .module-tool .tool-card {
    min-height: 168px;
  }

  .module-bookmark .search-section {
    padding-top: 1.25rem;
  }
}

/* Portal: compact, touch-friendly layout for narrow screens. */
@media (max-width: 640px) {
  .portal-home .theme-toggle {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
  }

  /* Keep the member entry and theme control in one header row. */
  .portal-home .fixed.top-5.right-24 {
    top: 12px;
    right: 68px;
  }

  .portal-home main {
    min-height: 0;
    padding: 104px 16px 32px;
  }

  .portal-home .portal-hero {
    width: 100%;
    margin-bottom: 28px;
  }

  .portal-home .logo-float {
    margin-bottom: 16px;
  }

  .portal-home .logo-float > div {
    width: 60px;
    height: 60px;
    border-radius: 16px;
  }

  .portal-home .logo-float span {
    font-size: 28px;
  }

  .portal-home .portal-hero h1 {
    margin-bottom: 12px;
    font-size: 28px;
    line-height: 1.2;
    text-wrap: balance;
  }

  .portal-home .portal-hero > p {
    margin-bottom: 16px;
    font-size: 16px;
    letter-spacing: 0.12em;
  }

  .portal-home .portal-hero > .flex {
    gap: 8px;
  }

  .portal-home .clock-pill {
    max-width: 100%;
    padding: 6px 12px;
  }

  .portal-home #weather-pill {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
  }

  .portal-home #weather-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .portal-home #card-grid {
    gap: 14px;
    margin-bottom: 28px;
  }

  .portal-home .portal-card {
    gap: 14px;
    min-height: 112px;
    padding: 18px;
    border-radius: 12px;
  }

  .portal-home .card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
  }

  .portal-home .card-arrow {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 375px) {
  .portal-home .portal-hero h1 {
    font-size: 26px;
  }

  .portal-home .fixed.top-5.right-24 {
    right: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
