/* 多多拼豆坊 DuoduoBeads · 科技感炫酷站点样式 */
:root {
  --bg: #f5f7fb;
  --card: rgba(255, 255, 255, .82);
  --text: #1a2233;
  --muted: #6b7690;
  --accent: #5b63f2;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(120deg, #5b63f2, #8b5cf6 55%, #22d3ee);
  --border: rgba(120, 135, 170, .18);
  --shadow: 0 10px 40px rgba(40, 55, 100, .08);
  --topbar-h: 68px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== 粒子层 & 动态背景 ===== */
#ambient-canvas {
  position: fixed; inset: 0; z-index: -3; pointer-events: none;
}
#fx-canvas {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
}
.aurora {
  position: fixed; inset: -20%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(600px 600px at 10% 10%, rgba(91, 99, 242, .16), transparent 62%),
    radial-gradient(520px 520px at 85% 15%, rgba(34, 211, 238, .14), transparent 62%),
    radial-gradient(620px 620px at 60% 85%, rgba(139, 92, 246, .12), transparent 62%),
    linear-gradient(180deg, #f7f9fe 0%, #f5f7fb 40%);
  animation: aurora-drift 22s ease-in-out infinite alternate;
}
@keyframes aurora-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.12); }
}
.grid-overlay {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .35;
  background-image:
    linear-gradient(rgba(120, 135, 180, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 135, 180, .07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
}

/* ===== 顶部导航 ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 18, 38, .92);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 4px 24px rgba(10, 16, 36, .18);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; height: var(--topbar-h);
  padding: 0 24px; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #fff; }
.brand-logo {
  width: 40px; height: 40px; object-fit: contain;
  border-radius: 12px; background: rgba(255,255,255,.10);
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 4px 14px rgba(0,0,0,.2);
  transition: transform .3s;
}
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.08); }
.brand-text { font-size: 17px; font-weight: 750; letter-spacing: .5px; line-height: 1.25; }
.brand-sub { display: block; font-size: 9px; font-weight: 600; letter-spacing: 2.4px; color: #8fa4d8; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  position: relative; display: inline-block; padding: 8px 15px; border-radius: 9px;
  color: #b9c4de; font-size: 14px; font-weight: 600; text-decoration: none; transition: color .2s, background .2s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-link.active { color: #fff; background: rgba(255,255,255,.10); }
.nav-link.active::before {
  content: ""; position: absolute; left: 15px; right: 15px; bottom: -13px; height: 2px;
  background: var(--accent-grad); border-radius: 2px;
}
.topbar-tag {
  margin-left: auto; font-size: 12px; color: #93e6f5; letter-spacing: .3px;
  padding: 5px 11px; border: 1px solid rgba(34,211,238,.28); border-radius: 999px;
  background: rgba(34,211,238,.07);
}

#app { max-width: 860px; margin: 0 auto; padding: 28px 16px 64px; }

/* ===== 首页 Hero ===== */
.hero { text-align: center; padding: 52px 0 30px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
  color: var(--accent); background: rgba(91,99,242,.08); border: 1px solid rgba(91,99,242,.18);
  padding: 6px 13px; border-radius: 999px; letter-spacing: .5px;
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px rgba(34,211,238,.15); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(34,211,238,0); } }
.hero h1 { font-size: clamp(28px, 5vw, 44px); margin: 20px 0 14px; letter-spacing: -1px; font-weight: 800; line-height: 1.25; }
.grad-text {
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  background-size: 200% auto; animation: grad-shift 6s linear infinite;
}
@keyframes grad-shift { to { background-position: 200% center; } }
.hero-desc { color: var(--muted); font-size: 15px; margin: 0; max-width: 680px; margin-inline: auto; }
.hero-actions { margin-top: 32px; }
.hero-upload { width: auto; display: inline-flex; align-items: center; gap: 9px; padding: 16px 34px; font-size: 16px; }

/* ===== SEO 正文区块 ===== */
.seo-section { margin: 54px 0 0; animation: fade-up .7s both; }
.section-head { text-align: center; margin-bottom: 26px; }
.section-head h2 { font-size: clamp(21px, 3.2vw, 28px); margin: 6px 0 10px; }
.section-lead { color: var(--muted); font-size: 14px; max-width: 640px; margin: 0 auto; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature-card {
  position: relative; overflow: hidden; padding: 22px 20px;
  border: 1px solid var(--border); border-radius: 18px;
  background: var(--card); backdrop-filter: blur(12px); box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.feature-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--accent-grad); opacity: 0; transition: opacity .25s;
}
.feature-card:hover { transform: translateY(-5px); box-shadow: 0 18px 50px rgba(60, 70, 140, .14); border-color: rgba(91,99,242,.35); }
.feature-card:hover::before { opacity: 1; }
.feature-icon {
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; letter-spacing: 1px; border-radius: 12px; color: #fff;
}
.glow-1 { background: linear-gradient(135deg, #5b63f2, #8b5cf6); box-shadow: 0 6px 18px rgba(91,99,242,.35); }
.glow-2 { background: linear-gradient(135deg, #22d3ee, #3b82f6); box-shadow: 0 6px 18px rgba(34,211,238,.35); }
.glow-3 { background: linear-gradient(135deg, #f472b6, #8b5cf6); box-shadow: 0 6px 18px rgba(244,114,182,.3); }
.feature-card h3 { font-size: 15px; margin: 15px 0 7px; }
.feature-card p { color: var(--muted); font-size: 13px; margin: 0; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: step; }
.steps li {
  display: flex; gap: 13px; padding: 20px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--card); box-shadow: var(--shadow);
}
.steps li > span {
  flex: 0 0 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent-grad); color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 5px 16px rgba(91,99,242,.3);
}
.steps h3 { font-size: 14px; margin: 1px 0 5px; }
.steps p { color: var(--muted); font-size: 12.5px; margin: 0; }

.faq-list { display: grid; gap: 10px; }
.faq-list details {
  border: 1px solid var(--border); border-radius: 14px; background: var(--card);
  padding: 14px 18px; box-shadow: var(--shadow); transition: border-color .2s;
}
.faq-list details[open] { border-color: rgba(91,99,242,.35); }
.faq-list summary { cursor: pointer; font-weight: 700; font-size: 14px; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; float: right; color: var(--accent); font-size: 18px; line-height: 1; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list p { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.privacy-note { text-align: center; color: var(--muted); font-size: 12px; margin: 30px 0 0; }

/* ===== 通用卡片 / 排版 ===== */
.card { background: var(--card); backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: 16px; padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--accent); margin-bottom: 4px; }
.head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 20px; gap: 10px; }
h2 { font-size: 22px; margin: 0; font-weight: 750; }
.meta-pill { font-size: 12px; font-weight: 600; color: var(--accent); background: rgba(91,99,242,.08); border: 1px solid rgba(91,99,242,.16); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; }
.row + .row { border-top: 1px solid rgba(120,135,170,.10); }
.setting-label { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.hint-mark { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; font-size: 10px; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); cursor: help; }

/* ===== 炫酷按钮（扫光 + 悬停上浮） ===== */
.btn-primary, .btn-secondary {
  position: relative; overflow: hidden;
  display: block; width: 100%; padding: 14px; border: 0; border-radius: 12px;
  font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 8px 24px rgba(91,99,242,.28); background-size: 200% auto; animation: grad-shift 8s linear infinite; }
.btn-primary::after, .chip::after, .tab::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg); pointer-events: none;
}
.btn-primary:hover::after, .chip:hover::after, .tab:hover::after { animation: shine .6s ease-out; }
@keyframes shine { to { left: 140%; } }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(91,99,242,.4); }
.btn-primary:active { transform: translateY(0) scale(.985); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-secondary { background: transparent; color: var(--muted); margin-top: 8px; border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text); }
.btn-block { margin-top: 18px; }
.error { color: #d64545; border-color: rgba(214,69,69,.3); background: rgba(214,69,69,.06); }

/* ===== 标签栏 / 画布 ===== */
.tabs { display: flex; gap: 5px; background: rgba(255,255,255,.7); border: 1px solid var(--border); border-radius: 13px; padding: 5px; }
.tab { position: relative; overflow: hidden; flex: 1; padding: 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; cursor: pointer; transition: .15s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 14px rgba(91,99,242,.25); }
.canvas-wrap {
  position: relative; background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 14px; margin: 14px 0;
  display: flex; justify-content: center; box-shadow: var(--shadow);
}
.canvas-wrap::before {
  content: ""; position: absolute; inset: -1px; border-radius: 18px; padding: 1px; z-index: -1;
  background: var(--accent-grad); opacity: .28;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude; -webkit-mask-composite: xor;
}
canvas#grid-canvas, canvas#export-canvas { width: 100%; max-width: 640px; aspect-ratio: 1; background: #fff; touch-action: none; border-radius: 8px; }
#original-image { width: 100%; max-width: 640px; aspect-ratio: 1; object-fit: contain; border-radius: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { position: relative; overflow: hidden; padding: 8px 14px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: .12s; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tool-hint { margin-top: 10px; }

.palette-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin-top: 10px; }
.palette-item { text-align: center; cursor: pointer; padding: 5px; border-radius: 9px; transition: .12s; }
.palette-item:hover { background: rgba(91,99,242,.08); transform: scale(1.05); }
.palette-item.active { outline: 2px solid var(--accent); background: rgba(91,99,242,.06); }
.swatch { width: 100%; aspect-ratio: 1; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.palette-item span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }

#usage-list > div { display: flex; align-items: center; font-size: 13px; padding: 5px 0; }
#usage-list .swatch { width: 22px; aspect-ratio: 1; margin-right: 10px; }
#usage-list .count { margin-left: auto; color: var(--muted); font-weight: 600; }

.crop-hint[hidden] { display: none; }
.crop-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: linear-gradient(120deg, rgba(245,180,60,.12), rgba(255,220,130,.16)); border-color: rgba(220,160,50,.3); color: #8a6113; font-size: 13px; font-weight: 600; }
.hint-actions { display: flex; gap: 6px; }
#crop-toolbar[hidden] { display: none; }
.crop-toolbar { margin: 10px 0 0; align-items: center; }
.crop-toolbar .crop-tip { margin-right: auto; }
.progress-inline { margin: 12px 0; }
.progress-track { height: 6px; background: rgba(120,135,170,.18); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent-grad); transition: width .1s; }
.board-nav { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; }
.board-nav button { padding: 7px 15px; border: 1px solid var(--border); border-radius: 9px; background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; }
.board-nav button:hover { border-color: var(--accent); color: var(--accent); }

/* ===== 页脚 ===== */
.footer {
  border-top: 1px solid var(--border); padding: 30px 16px 40px; text-align: center; color: var(--muted); font-size: 12px;
  background: rgba(255,255,255,.45);
}
.footer img { width: 46px; height: 46px; object-fit: contain; border-radius: 12px; display: block; margin: 0 auto 10px; }
.footer strong { color: var(--text); font-size: 14px; }
.footer p { max-width: 620px; margin: 8px auto 10px; line-height: 1.7; }

@keyframes fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ===== 全端自适应 ===== */
.page { display: none; }
.page.active { display: block; animation: fade-up .35s both; }
#page-preview { min-height: calc(100dvh - var(--topbar-h)); }

/* 小屏手机（含折叠屏外屏 280~360） */
@media (max-width: 380px) {
  #app { padding: 18px 12px 48px; }
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .brand-text { font-size: 14px; }
  .brand-sub { font-size: 8px; letter-spacing: 1.6px; }
  .brand-logo { width: 34px; height: 34px; }
  .nav-link { padding: 7px 9px; font-size: 12px; }
  .hero { padding: 34px 0 20px; }
  .hero-upload { padding: 14px 22px; font-size: 14px; }
  .palette-grid { grid-template-columns: repeat(6, 1fr); gap: 6px; }
  .feature-grid, .steps { grid-template-columns: 1fr; }
  .meta-pill { font-size: 11px; padding: 5px 9px; }
}

@media (min-width: 560px) {
  #app { max-width: 1000px; padding: 32px 20px 64px; }
  canvas#grid-canvas, canvas#export-canvas { max-width: 640px; }
  .palette-grid { grid-template-columns: repeat(10, 1fr); }
}

/* 双列：折叠内屏 / 小平板 / PC（≥800） */
@media (min-width: 800px) {
  #app { max-width: 1240px; padding: 36px 24px 72px; }
  #page-preview .head { grid-column: 1 / -1; }
  #page-preview { display: none; }
  #page-preview.active {
    display: grid;
    grid-template-columns: minmax(400px, 1fr) minmax(290px, .7fr);
    grid-template-areas:
      "head head"
      "tabs tabs"
      "cropbar cropbar"
      "canvas settings"
      "canvas tools"
      "canvas palette"
      "canvas usage"
      "export export";
    gap: 0 20px;
    align-items: start;
  }
  #page-preview .head { grid-area: head; }
  #page-preview .tabs { grid-area: tabs; }
  #page-preview .crop-hint, #crop-toolbar { grid-area: cropbar; }
  #page-preview .canvas-wrap { grid-area: canvas; position: sticky; top: calc(var(--topbar-h) + 16px); margin-top: 0; align-self: start; }
  #page-preview .progress-inline { grid-area: settings; margin-top: 0; }
  #card-settings { grid-area: settings; }
  #card-tools { grid-area: tools; }
  #card-palette { grid-area: palette; }
  #card-usage { grid-area: usage; }
  #page-preview .palette-grid { grid-template-columns: repeat(8, 1fr); }
  #page-preview #btn-export { grid-area: export; }
  #page-preview .chips { justify-content: flex-start; }
}

@media (min-width: 800px) and (min-height: 600px) {
  #page-preview .canvas-wrap canvas { max-height: calc(100dvh - var(--topbar-h) - 60px); }
}

/* 桌面大屏：内容更宽松 */
@media (min-width: 1280px) {
  #app { max-width: 1320px; }
  .hero { padding: 70px 0 40px; }
  .feature-grid, .steps { gap: 18px; }
  .feature-card { padding: 26px 24px; }
}

/* 横屏矮视口（折叠展开 / 平板横屏） */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { padding: 20px 0; }
  .card { padding: 11px 14px; margin: 8px 0; }
  .canvas-wrap { padding: 8px; }
  canvas#grid-canvas, canvas#export-canvas { max-height: calc(100dvh - 80px); }
  .seo-section { margin-top: 30px; }
}

/* 触控设备：确保点击区域 ≥40px */
@media (pointer: coarse) {
  .chip { padding: 10px 15px; }
  .tab { padding: 13px; }
  .board-nav button { padding: 10px 16px; }
}

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