:root {
  --bg-0: #0a0f1c;
  --bg-1: #11192d;
  --title-0: #f1f6fc;
  --title-1: #b5d7f2;
  --text: #dce6f5;
  --text-soft: #8a9bb5;
  --text-faint: #586780;
  --rule: rgba(152, 205, 240, 0.16);
  --accent: #7ec2ec;
  --panel-bg: rgba(12, 18, 33, 0.86);
  --panel-border: rgba(152, 205, 240, 0.22);
  --dot-gold-hi: #ffe57a;
  --dot-gold: #ffc22e;
  --dot-ink-hi: #98cdf0;
  --dot-ink: #6fa6dc;
  --ring-stroke: rgba(152, 205, 240, 0.34);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background-color: var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.45s ease, color 0.35s ease;
}

body {
  background: radial-gradient(ellipse at 50% 38%, var(--bg-1) 0%, var(--bg-0) 74%);
  overflow-x: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* 不可用 display:none，否则浏览器会跳过内联 SVG 渐变定义 */
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* 矢量蝴蝶浮层（全 SVG） */
#butterfly-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}

.bf-node {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform, opacity;
  pointer-events: none;
  overflow: visible;
}

.click-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 1px solid var(--ring-stroke);
  pointer-events: none;
  animation: ringOut 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes ringOut {
  from { transform: scale(0.5); opacity: 0.72; }
  to   { transform: scale(4.8); opacity: 0; }
}

/* 右上角极简调色器 */
.palette-dock {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.swatch-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.swatch {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 0;
  position: relative;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.swatch:hover {
  transform: scale(1.22);
}

.swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 3.2px var(--accent);
}

.swatch-heilan  { background: linear-gradient(135deg, #101930 45%, #5f92cf 100%); }
.swatch-bailan  { background: linear-gradient(135deg, #f7f9fc 48%, #4a7cc4 100%); border-color: rgba(74, 124, 196, 0.38); }
.swatch-fenlan  { background: linear-gradient(135deg, #1b132e 45%, #e6a8dc 100%); }
.swatch-qinglan { background: linear-gradient(135deg, #0b1c20 45%, #66c9c2 100%); }
.swatch-sumo    { background: linear-gradient(135deg, #121316 48%, #d8dce2 100%); }

.swatch-custom {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: conic-gradient(#7ec2ec, #c79be8, #f2a9c8, #f5c962, #76d4c4, #7ec2ec);
  border: 1px solid rgba(255, 255, 255, 0.28);
  opacity: 0.78;
  transition: opacity 0.2s ease, transform 0.22s ease;
}

.swatch-custom:hover,
.swatch-custom.open {
  opacity: 1;
  transform: scale(1.16);
}

.tuner-pop {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  min-width: 210px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 12px;
  color: var(--text-soft);
}

.tuner-pop.open {
  display: flex;
}

.tuner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tuner-row label {
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.hue-range {
  width: 128px;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, #e87a7a, #e8c468, #70c994, #6fc7e8, #6b88e6, #c686e8, #e87a7a);
  outline: none;
  cursor: pointer;
}

.hue-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid rgba(15, 23, 42, 0.65);
}

.tuner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.tuner-chip {
  font-size: 11.5px;
  color: var(--text-soft);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--rule);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.tuner-chip:hover,
.tuner-chip.active {
  color: var(--accent);
  border-color: var(--accent);
}

.color-input {
  width: 22px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

/* 主单屏容器（最简留白排版） */
.sheet {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
}

.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 68px 0 42px;
  animation: fadeIn 0.85s ease both;
}

/* 顶部原版手绘矢量蝴蝶 */
.flower-btn {
  display: block;
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  animation: flowerBreathe 7.2s ease-in-out infinite;
}

.flower-btn:hover {
  transform: scale(1.06);
}

.flower-btn svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes flowerBreathe {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-4px) rotate(3deg); }
}

/* 手写书法标题（随主题自动变色） */
.title-heading {
  line-height: 0;
  margin-bottom: 22px;
}

.title-mark {
  display: block;
  width: min(396px, 80vw);
  aspect-ratio: 528 / 352;
  background: linear-gradient(106deg, var(--title-0) 0%, var(--title-1) 100%);
  -webkit-mask: url("/assets/title_signature.png") center / contain no-repeat;
  mask: url("/assets/title_signature.png") center / contain no-repeat;
  transition: background 0.4s ease;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.subtitle {
  font-size: 13.5px;
  color: var(--text-soft);
  letter-spacing: 0.08em;
}

.hairline {
  display: block;
  width: 34px;
  height: 1px;
  background: var(--accent);
  opacity: 0.45;
  margin: 26px 0 22px;
  transform-origin: center;
  animation: drawRule 0.9s ease 0.12s both;
}

.qq-link {
  font-size: 13px;
  color: var(--text-soft);
  letter-spacing: 0.08em;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--rule);
  transition: color 0.22s ease, border-color 0.22s ease;
}

.qq-link:hover,
.qq-link.copied {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* 底部纯 SVG 签名与落款 */
.foot {
  border-top: 1px solid var(--rule);
  padding: 22px 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.sig {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sig-hat {
  width: 32px;
  height: 32px;
  display: block;
  flex-shrink: 0;
}

.sig-name {
  width: 148px;
  height: 39px;
  display: block;
  flex-shrink: 0;
}

.license {
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes drawRule {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 0.45; }
}

@media (max-width: 600px) {
  .palette-dock {
    top: 16px;
    right: 16px;
  }
  .foot {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flower-btn, .center, .hairline {
    animation: none !important;
  }
}
