/* ============================================================
   CSSForge.top - 全站样式
   设计语言：浅色清爽 + 靛蓝主色 + 深色代码面板
   ============================================================ */
:root {
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: #eef2ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --line: #e2e8f0;
  --bg: #f6f7fb;
  --card: #ffffff;
  --code-bg: #0f172a;
  --code-ink: #e2e8f0;
  --ok: #059669;
  --danger: #e11d48;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.wrap { width: min(1120px, 92%); margin: 0 auto; }
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- 页头 ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 0;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 800; font-size: 1.22rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-name em { font-style: normal; color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 18px; font-size: .95rem; }
.site-nav a { color: var(--ink-2); font-weight: 500; }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.lang-select {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink-2); font-size: .88rem; cursor: pointer;
}

/* ---------- 工具切换导航（全站矩阵内部链接） ---------- */
.tools-nav {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 2px;
  scrollbar-width: thin;
}
.tools-nav a {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink-2); font-size: .88rem; font-weight: 600;
  transition: all .15s ease;
}
.tools-nav a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.tools-nav a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 首屏标题 ---------- */
.hero { text-align: center; padding: 34px 0 26px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.03em; line-height: 1.2; }
.hero-sub { color: var(--ink-3); font-size: clamp(1rem, 2vw, 1.13rem); margin-top: 10px; max-width: 760px; margin-left: auto; margin-right: auto; }

/* ---------- 工具区布局 ---------- */
.toolapp { margin-bottom: 40px; }
.toolapp-main {
  display: grid; grid-template-columns: 372px 1fr; gap: 18px;
  align-items: stretch;
}
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.controls { padding: 18px; overflow-y: auto; max-height: 640px; }
.controls::-webkit-scrollbar { width: 8px; }
.controls::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.ctl-group { padding: 14px 0; border-top: 1px dashed var(--line); }
.ctl-group:first-child { border-top: 0; padding-top: 0; }
.ctl-group-title {
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* 控件：滑杆行 */
.range-row { display: grid; grid-template-columns: 86px 1fr 52px; align-items: center; gap: 10px; margin: 9px 0; font-size: .9rem; }
.range-row label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.range-val { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: .84rem; text-align: right; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; background: var(--line); outline: none; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--accent); box-shadow: var(--shadow-sm); cursor: grab;
}
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 2.5px solid var(--accent); cursor: grab; }

/* 控件：颜色行 */
.color-row { display: grid; grid-template-columns: 86px 1fr 52px; align-items: center; gap: 10px; margin: 9px 0; font-size: .9rem; }
.color-row label { color: var(--ink-2); }
.color-well { display: flex; align-items: center; gap: 8px; }
input[type="color"] {
  width: 38px; height: 28px; padding: 0; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; cursor: pointer;
}
.color-hex { font-family: ui-monospace, monospace; font-size: .82rem; color: var(--ink-3); }

/* 控件：按钮组 / 分段 */
.seg-control { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.seg-btn {
  padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); font-size: .86rem; font-weight: 600; cursor: pointer;
  transition: all .12s ease;
}
.seg-btn:hover { border-color: var(--accent); color: var(--accent); }
.seg-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: .9rem; font-weight: 600; cursor: pointer; transition: all .13s ease;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:hover { color: var(--accent); background: var(--accent-soft); }
.btn-sm { padding: 6px 11px; font-size: .83rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* 开关 */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; font-size: .9rem; color: var(--ink-2); }
.toggle { position: relative; width: 40px; height: 22px; flex: 0 0 auto; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(18px); }

/* 图层列表（box-shadow） */
.layer-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.layer-item {
  border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 12px;
  cursor: pointer; transition: border .12s; background: var(--card);
}
.layer-item.active { border-color: var(--accent); background: var(--accent-soft); }
.layer-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.layer-item-head .mini-actions { display: flex; gap: 4px; }
.layer-summary { font-size: .76rem; color: var(--ink-3); font-family: ui-monospace, monospace; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  border: 0; background: transparent; cursor: pointer; color: var(--ink-3);
  padding: 3px 6px; border-radius: 6px; font-size: .85rem; line-height: 1;
}
.icon-btn:hover { background: rgba(15,23,42,.07); color: var(--ink); }
.icon-btn.danger:hover { color: var(--danger); }

/* 预设网格 */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-top: 8px; }
.preset-cell {
  aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--line);
  cursor: pointer; background: #f1f5f9; position: relative; overflow: hidden;
  transition: transform .1s ease, border-color .1s ease;
}
.preset-cell:hover { transform: translateY(-2px); border-color: var(--accent); }
.preset-cell .preset-swatch { position: absolute; inset: 0; }
.preset-name { font-size: .72rem; color: var(--ink-3); text-align: center; margin-top: 4px; }
.preset-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; cursor: pointer; font-family: inherit; }
.preset-wrap .preset-cell { width: 100%; }
.preset-wrap:hover .preset-name { color: var(--accent); }

/* 渐变 stops 编辑条 */
.stopbar-wrap { padding: 10px 0 2px; }
.stopbar {
  position: relative; height: 22px; border-radius: 7px; border: 1px solid var(--line);
  cursor: copy; margin-top: 14px;
}
.stop-marker {
  position: absolute; top: 26px; width: 16px; height: 16px; margin-left: -8px;
  border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  cursor: grab; touch-action: none;
}
.stop-marker.active { outline: 2.5px solid var(--accent); z-index: 2; }
.stopbar-ticks { height: 26px; position: relative; }

/* ---------- 预览区 ---------- */
.preview { display: flex; flex-direction: column; overflow: hidden; }
.preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  font-size: .82rem; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .06em;
}
.preview-head .preview-tools { display: flex; gap: 6px; }
.stage {
  flex: 1; min-height: 420px; display: flex; align-items: center; justify-content: center;
  padding: 30px; position: relative; overflow: hidden;
  background-color: #f1f5f9;
  background-image: radial-gradient(circle, #cbd5e1 1.1px, transparent 1.1px);
  background-size: 18px 18px;
}
.stage.stage-plain { background-image: none; }
.stage.checker {
  background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%), linear-gradient(-45deg, #e2e8f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e2e8f0 75%), linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 22px 22px; background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  background-color: #fff;
}
.demo-box { width: 220px; height: 160px; background: #6366f1; border-radius: 16px; }

/* 玻璃拟态预览背景（三套场景） */
.glass-scene { position: absolute; inset: 0; overflow: hidden; }
.glass-scene::before, .glass-scene::after,
.glass-scene .blob-extra {
  content: ""; position: absolute; border-radius: 50%;
}
.scene-aurora { background: linear-gradient(135deg, #312e81 0%, #6d28d9 45%, #db2777 100%); }
.scene-aurora::before { width: 230px; height: 230px; background: #f59e0b; top: -70px; left: 8%; opacity: .85; }
.scene-aurora::after { width: 190px; height: 190px; background: #22d3ee; bottom: -60px; right: 10%; opacity: .8; }
.scene-sunset { background: linear-gradient(160deg, #7c2d12 0%, #ea580c 40%, #f43f5e 100%); }
.scene-sunset::before { width: 210px; height: 210px; background: #fde047; top: 12%; left: 14%; opacity: .9; }
.scene-sunset::after { width: 240px; height: 240px; background: #7c3aed; bottom: -90px; right: -40px; opacity: .75; }
.scene-ocean { background: linear-gradient(150deg, #082f49 0%, #0369a1 50%, #0d9488 100%); }
.scene-ocean::before { width: 200px; height: 200px; background: #67e8f9; top: -50px; right: 16%; opacity: .75; }
.scene-ocean::after { width: 170px; height: 170px; background: #a3e635; bottom: -40px; left: 12%; opacity: .65; }
.glass-card { position: relative; width: min(320px, 78%); height: 190px; display: flex; align-items: center; justify-content: center; color: #1e293b; font-weight: 700; text-align: center; padding: 12px; }

/* border-radius 拖点 */
.radius-stage .radius-box { position: relative; width: min(340px, 86%); aspect-ratio: 4/3; background: #6366f1; }
.radius-handle {
  position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); box-shadow: var(--shadow-md);
  cursor: grab; touch-action: none; transform: translate(-50%, -50%); z-index: 3;
}
.radius-handle:active { cursor: grabbing; }
.radius-handle::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent); }

/* clip-path 编辑画布 */
.clip-stage { user-select: none; }
.clip-canvas-wrap { position: relative; width: min(380px, 90%); aspect-ratio: 1; }
.clip-canvas-wrap .clip-grid { position: absolute; inset: 0; border: 1px dashed #cbd5e1; }
.clip-shape { position: absolute; inset: 0; background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.clip-pt {
  position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); box-shadow: var(--shadow-md);
  cursor: grab; touch-action: none; transform: translate(-50%, -50%); z-index: 3;
  pointer-events: auto;
}
.clip-pt:active { cursor: grabbing; }

/* ---------- 代码面板 ---------- */
.codepanel { margin-top: 18px; background: var(--code-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid rgba(226, 232, 240, .12); }
.code-tabs { display: flex; gap: 6px; }
.code-tab {
  padding: 6px 14px; border-radius: 8px; border: 0; background: transparent;
  color: #94a3b8; font-size: .85rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.code-tab.active { background: rgba(99, 102, 241, .25); color: #c7d2fe; }
.code-tab:hover:not(.active) { color: #e2e8f0; }
.code-copy {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px; border: 0; background: var(--accent);
  color: #fff; font-size: .83rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.code-copy:hover { background: var(--accent-dark); }
.codepanel pre {
  padding: 16px 18px; overflow-x: auto; font-family: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  font-size: .88rem; line-height: 1.65; color: var(--code-ink); white-space: pre-wrap; word-break: break-all;
}
.code-note { padding: 0 18px 12px; color: #64748b; font-size: .78rem; }

/* ---------- 首页工具卡片 ---------- */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin: 8px 0 40px; }
.tool-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  color: var(--ink);
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent); text-decoration: none; }
.tool-card .tool-thumb { height: 86px; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--line); }
.tool-card h2 { font-size: 1.12rem; margin-bottom: 6px; }
.tool-card p { color: var(--ink-3); font-size: .9rem; }
.tool-card .open-hint { display: inline-block; margin-top: 12px; font-size: .85rem; font-weight: 600; color: var(--accent); }
.thumb-shadow { background: #f1f5f9; display: flex; align-items: center; justify-content: center; }
.thumb-shadow span { display: block; width: 64px; height: 44px; background: #6366f1; border-radius: 8px; box-shadow: 10px 12px 18px rgba(30, 27, 75, .45); }
.thumb-radius { background: #f1f5f9; display: flex; align-items: center; justify-content: center; }
.thumb-radius span { display: block; width: 62px; height: 62px; background: #8b5cf6; border-radius: 62% 38% 46% 54% / 44% 55% 45% 56%; }
.thumb-gradient { background: linear-gradient(120deg, #6366f1, #ec4899, #f59e0b); }
.thumb-glass { background: linear-gradient(135deg, #0ea5e9, #8b5cf6, #ec4899); display: flex; align-items: center; justify-content: center; }
.thumb-glass span { display: block; width: 78px; height: 48px; border-radius: 10px; background: rgba(255, 255, 255, .28); border: 1px solid rgba(255, 255, 255, .55); backdrop-filter: blur(4px); }
.thumb-neu { background: #e2e8f0; display: flex; align-items: center; justify-content: center; }
.thumb-neu span { display: block; width: 62px; height: 44px; border-radius: 12px; background: #e2e8f0; box-shadow: 6px 6px 12px #c3ccd9, -6px -6px 12px #ffffff; }
.thumb-clip { background: #f1f5f9; display: flex; align-items: center; justify-content: center; }
.thumb-clip span { display: block; width: 66px; height: 56px; background: linear-gradient(135deg, #6366f1, #8b5cf6); clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%); }

/* ---------- 内容 / FAQ ---------- */
.content-section {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 30px; margin: 0 0 26px; box-shadow: var(--shadow-sm);
}
.content-section h2 { font-size: 1.35rem; letter-spacing: -.02em; margin-bottom: 14px; }
.content-section h3 { font-size: 1.05rem; margin: 18px 0 6px; }
.content-section p { color: var(--ink-2); margin: 10px 0; }
.content-section ul, .content-section ol { color: var(--ink-2); padding-left: 22px; margin: 10px 0; }
.content-section li { margin: 6px 0; }
.content-section code { background: var(--accent-soft); color: var(--accent-dark); padding: 1px 6px; border-radius: 6px; font-size: .87em; }
.howto-list li { margin: 8px 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 26px; margin-top: 8px; }
.feature-item h3 { margin: 0 0 4px; font-size: 1rem; }
.feature-item p { margin: 0; font-size: .92rem; color: var(--ink-3); }
.faq-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.faq-item { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.faq-item summary {
  padding: 13px 16px; font-weight: 600; cursor: pointer; color: var(--ink);
  list-style: none; position: relative; padding-right: 40px; font-size: .97rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 1.2rem; color: var(--ink-3); transition: transform .15s;
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item p { padding: 0 16px 14px; color: var(--ink-2); font-size: .93rem; }

/* ---------- 页脚 ---------- */
.site-footer { background: var(--card); border-top: 1px solid var(--line); margin-top: 40px; }
.footer-inner { padding: 26px 0; text-align: center; color: var(--ink-3); font-size: .9rem; }
.footer-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 22px; margin: 10px 0; }
.footer-nav a { color: var(--ink-2); font-weight: 500; }
.disclaimer { font-size: .8rem; color: #94a3b8; margin-top: 8px; }

/* ---------- toast ---------- */
.copied-toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: .9rem; font-weight: 600; opacity: 0; pointer-events: none;
  transition: all .25s ease; z-index: 200; box-shadow: var(--shadow-md);
}
.copied-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 静态页（privacy/about/contact） ---------- */
.static-page { max-width: 800px; margin: 0 auto; padding: 36px 0 10px; }
.static-page h1 { font-size: 2rem; letter-spacing: -.02em; margin-bottom: 8px; }
.static-page .page-sub { color: var(--ink-3); margin-bottom: 26px; }
.static-page h2 { font-size: 1.25rem; margin: 26px 0 8px; }
.static-page p, .static-page li { color: var(--ink-2); margin: 9px 0; }
.static-page ul { padding-left: 22px; }
.static-page a { word-break: break-all; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .toolapp-main { grid-template-columns: 1fr; }
  .controls { max-height: none; order: 2; }
  .preview { order: 1; }
  .stage { min-height: 320px; padding: 22px; }
  .site-nav { gap: 12px; font-size: .88rem; }
  .content-section { padding: 22px 18px; }
}
@media (max-width: 560px) {
  .brand { font-size: 1.05rem; }
  .site-nav a.hide-sm { display: none; }
  .hero { padding: 24px 0 18px; }
  .range-row { grid-template-columns: 76px 1fr 48px; font-size: .85rem; }
  .codepanel pre { font-size: .8rem; }
  .demo-box { width: 180px; height: 130px; }
}
