/* Skin switcher UI + shared motion (layout unchanged) */

html[data-skin] {
  transition: background-color 0.45s ease;
}

html[data-skin] body {
  transition: background 0.45s ease;
}

@keyframes skin-shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes skin-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--skin-glow, rgba(60, 116, 247, 0.35)); }
  50% { box-shadow: 0 0 18px 4px var(--skin-glow, rgba(60, 116, 247, 0.45)); }
}

@keyframes skin-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes skin-sparkle {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.05); }
}

html[data-skin]:not([data-skin="classic"]) body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--skin-ambient-opacity, 0.08);
  background: var(--skin-ambient, radial-gradient(circle at 20% 20%, #fff 0%, transparent 50%));
  animation: skin-sparkle 8s ease-in-out infinite;
}

html[data-skin]:not([data-skin="classic"]) #app {
  position: relative;
  z-index: 1;
}

/* ── Dropdown skin switcher ── */
.xtw-skin-wrap {
  position: fixed;
  top: max(6px, env(safe-area-inset-top, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  z-index: 2147483000;
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

.app-header {
  position: sticky !important;
  top: 0;
  z-index: 999;
}

.app-header .xtw-skin-wrap {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.xtw-skin-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 96px;
  height: 34px;
  padding: 0 10px 0 8px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, #3c74f7 0%, #6a5acd 100%);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.22);
  transition: box-shadow 0.2s, filter 0.2s;
  white-space: nowrap;
}

.xtw-skin-trigger:hover {
  filter: brightness(1.06);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}

.xtw-skin-trigger__icon {
  font-size: 16px;
  line-height: 1;
}

.xtw-skin-trigger__arrow {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.85;
  transition: transform 0.2s;
}

.xtw-skin-wrap.is-open .xtw-skin-trigger__arrow {
  transform: rotate(180deg);
}

.xtw-skin-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(220px, calc(100vw - 16px));
  max-height: min(320px, calc(100vh - 80px));
  overflow-y: auto;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  border: 1px solid #e8e8e8;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
}

.xtw-skin-wrap.is-open .xtw-skin-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.xtw-skin-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.xtw-skin-menu__item:hover {
  background: #f0f4ff;
}

.xtw-skin-menu__item.is-active {
  color: #3c74f7;
  font-weight: 700;
  background: #eef3ff;
}

.xtw-skin-menu__item.is-active::after {
  content: "✓";
  margin-left: auto;
  font-size: 12px;
  color: #3c74f7;
}

.xtw-skin-menu__dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

@media (max-width: 500px) {
  .xtw-skin-trigger {
    min-width: 84px;
    height: 30px;
    padding: 0 8px 0 6px;
    font-size: 12px;
  }
  .xtw-skin-trigger__icon {
    font-size: 14px;
  }
}
