/* 章鱼软件 · 首页样式（飞书风格：克制、留白、单一主色、微交互）
   主题：light(默认) / dark / warm(暖阳) —— 通过 html[data-theme] 切换 */
:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --card: #ffffff;
  --line: rgba(31, 35, 41, .09);
  --line-strong: rgba(31, 35, 41, .16);
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --brand: #3370ff;
  --brand-weak: rgba(51, 112, 255, .08);
  --shadow-1: 0 2px 8px rgba(31, 35, 41, .06);
  --shadow-2: 0 8px 24px rgba(31, 35, 41, .10);
  --r: 12px;
  --r-lg: 16px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}
html[data-theme="dark"] {
  --bg: #17181c; --surface: #1e2024; --card: #212429;
  --line: rgba(255, 255, 255, .10); --line-strong: rgba(255, 255, 255, .18);
  --text: #e9eaec; --text-2: #a6a9b0; --text-3: #7d8189;
  --brand: #4e83fd; --brand-weak: rgba(78, 131, 253, .14);
  --shadow-1: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-2: 0 10px 28px rgba(0, 0, 0, .38);
}
html[data-theme="warm"] {
  --bg: #fdf9f3; --surface: #f6efe5; --card: #fffdf9;
  --line: rgba(93, 71, 45, .12); --line-strong: rgba(93, 71, 45, .2);
  --text: #33291f; --text-2: #7a6a58; --text-3: #a08e79;
  --brand: #b8792f; --brand-weak: rgba(184, 121, 47, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; transition: background .3s, color .3s;
}
a { color: inherit; text-decoration: none; }

/* 极淡的背景层：细网格 + 一抹主色光晕，不做彩斑 */
.bg-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.bg-layer::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; opacity: .5;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
}
.bg-layer::after {
  content: ''; position: absolute; left: 50%; top: -280px; width: 900px; height: 620px;
  transform: translateX(-50%); border-radius: 50%;
  background: var(--brand); opacity: .07; filter: blur(120px);
}

/* 顶部进度条 */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 90;
  background: var(--brand); transition: width .1s linear; }

.wrap { position: relative; z-index: 2; max-width: min(1720px, 96vw); margin: 0 auto; padding: 0 24px 88px; }

/* ---------- 顶栏 ---------- */
.nav { position: sticky; top: 0; z-index: 50; margin: 0 -24px 0; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 20px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px;
  background: none; border: 0; color: inherit; font-family: inherit; cursor: pointer; padding: 6px 10px;
  border-radius: 8px; transition: background .2s; }
.brand:hover { background: var(--brand-weak); }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 15px; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-links button { background: none; border: 0; color: var(--text-2); font-size: 13.5px; cursor: pointer;
  font-family: inherit; padding: 7px 12px; border-radius: 8px; transition: all .2s; }
.nav-links button:hover { background: var(--brand-weak); color: var(--brand); }

/* ---------- HERO ---------- */
.hero { padding: 92px 0 44px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font-size: 12.5px; margin-bottom: 26px; }
.eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.hero h1 { font-size: clamp(28px, 6.5vw, 60px); font-weight: 700; letter-spacing: -.02em; line-height: 1.18; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { margin: 20px auto 0; max-width: 560px; color: var(--text-2); font-size: 15.5px; line-height: 1.8; }

.stats { display: flex; justify-content: center; gap: 40px; margin-top: 34px; flex-wrap: wrap; }
.stats div { text-align: center; }
.stats b { display: block; font-size: 25px; font-weight: 650; letter-spacing: -.01em; }
.stats span { font-size: 12.5px; color: var(--text-3); }

.hero-actions { display: flex; gap: 10px; justify-content: center; margin-top: 34px; flex-wrap: wrap; }
.btn { height: 38px; padding: 0 18px; border-radius: 10px; font-size: 14px; cursor: pointer;
  font-family: inherit; border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  display: inline-flex; align-items: center; gap: 7px; transition: all .18s var(--ease); }
.btn:hover { border-color: var(--brand); color: var(--brand); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); color: #fff; box-shadow: var(--shadow-2); }

/* ---------- 工具条 ---------- */
.toolbar { position: sticky; top: 60px; z-index: 40; margin: 40px 0 22px; padding: 11px 14px;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { padding: 6px 14px; font-size: 13px; border-radius: 999px; cursor: pointer; font-family: inherit;
  border: 1px solid var(--line); background: none; color: var(--text-2); transition: all .18s var(--ease); }
.tag:hover { color: var(--text); border-color: var(--line-strong); }
.tag.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 16px; }
.grid.list { grid-template-columns: 1fr; gap: 10px; }
.card { position: relative; display: block; padding: 20px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  opacity: 0; transform: translateY(10px);
  transition: opacity .45s var(--ease), transform .28s var(--ease), box-shadow .28s var(--ease), border-color .2s; }
.card.show { opacity: 1; transform: none; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--brand); }
.card .ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; overflow: hidden;
  font-size: 17px; font-weight: 600; color: var(--c1); background: var(--csoft); margin-bottom: 13px; }
.card .ico img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; background: var(--csoft); }
.card h3 { font-size: 15.5px; font-weight: 600; margin-bottom: 7px; letter-spacing: -.01em; }
.card p { font-size: 13px; color: var(--text-2); line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { margin-top: 13px; display: flex; gap: 6px; flex-wrap: wrap; }
.card .meta em { font-style: normal; font-size: 11.5px; padding: 2px 9px; border-radius: 5px;
  background: var(--surface); color: var(--text-3); border: 1px solid var(--line); }
.grid.list .card { display: flex; align-items: center; gap: 16px; padding: 14px 18px; }
.grid.list .card .ico { margin: 0; flex: 0 0 32px; width: 32px; height: 32px; font-size: 15px; }
.grid.list .card p { flex: 1; -webkit-line-clamp: 1; }
.grid.list .card .meta { margin: 0; }
.card.hit { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.card.dim { opacity: .32; }
.card.wave { animation: wave .5s var(--ease); }
@keyframes wave { 50% { transform: translateY(-10px); } }

.empty { grid-column: 1/-1; text-align: center; padding: 72px 0; color: var(--text-3); font-size: 14px; }

/* ---------- 大屏：尽量铺满，卡片适当放大 ---------- */
@media (min-width: 1440px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
  .card { padding: 22px; }
  .card .ico { width: 40px; height: 40px; font-size: 18px; }
  .card h3 { font-size: 16px; }
  .card p { font-size: 13.5px; }
}

/* ---------- 页脚 ---------- */
.footer { margin-top: 76px; padding-top: 26px; border-top: 1px solid var(--line);
  text-align: center; color: var(--text-3); font-size: 13px; line-height: 2; }
.footer a { color: var(--brand); }
.footer .secret { display: none; margin-top: 6px; color: var(--text-2); }
.footer.revealed .secret { display: block; animation: up .4s var(--ease); }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 命令面板 ---------- */
.palette { position: fixed; inset: 0; z-index: 100; display: none; background: rgba(20, 22, 26, .42);
  backdrop-filter: blur(3px); padding-top: 14vh; }
.palette.on { display: block; }
.palette-box { width: min(600px, 92vw); margin: 0 auto; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  overflow: hidden; animation: up .22s var(--ease); }
.palette-box input { width: 100%; height: 52px; padding: 0 18px; background: none; border: 0;
  outline: 0; color: var(--text); font-size: 15px; font-family: inherit;
  border-bottom: 1px solid var(--line); }
.palette-list { max-height: 44vh; overflow: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 9px; font-size: 14px; cursor: pointer; color: var(--text); }
.palette-item.sel, .palette-item:hover { background: var(--brand-weak); }
.palette-item.sel { box-shadow: inset 0 0 0 1px var(--brand); }
.palette-item .dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: var(--c1); background: var(--csoft); }
.palette-hint { padding: 9px 16px; font-size: 11.5px; color: var(--text-3); border-top: 1px solid var(--line); }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  border-radius: 10px; padding: 12px 16px; font-size: 13.5px; max-width: 320px;
  border-left: 3px solid var(--brand); animation: slideIn .28s var(--ease); transition: opacity .3s, transform .3s; }
.toast b { display: block; font-size: 12px; color: var(--brand); margin-bottom: 3px; font-weight: 600; }
.toast span { color: var(--text-2); }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } }

/* ---------- 成就 ---------- */
.achv { position: fixed; left: 20px; bottom: 20px; z-index: 120; }
.achv-btn { background: var(--card); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 999px; padding: 8px 15px; font-size: 13px; cursor: pointer; font-family: inherit;
  box-shadow: var(--shadow-1); transition: all .18s; }
.achv-btn:hover { color: var(--brand); border-color: var(--brand); }
.achv-panel { display: none; position: absolute; bottom: 46px; left: 0; width: 292px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--shadow-2); }
.achv-panel.on { display: block; animation: up .22s var(--ease); }
.achv-panel h4 { font-size: 13.5px; margin-bottom: 10px; }
.achv-item { display: flex; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--text-3); }
.achv-item.got { color: var(--text); }
.achv-item small { color: var(--text-3); font-size: 11.5px; }
.achv-item .lock { filter: grayscale(1); opacity: .4; }

/* ---------- 帮助 ---------- */
.help { position: fixed; inset: 0; z-index: 130; display: none; background: rgba(20, 22, 26, .42);
  backdrop-filter: blur(3px); }
.help.on { display: grid; place-items: center; }
.help-box { width: min(540px, 92vw); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 26px; box-shadow: var(--shadow-2); animation: up .24s var(--ease); }
.help-box h3 { font-size: 17px; margin-bottom: 14px; }
.help-box li { list-style: none; display: flex; justify-content: space-between; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); }
.help-box kbd { background: var(--surface); border: 1px solid var(--line); border-radius: 5px;
  padding: 2px 8px; font-size: 12px; font-family: ui-monospace, monospace; color: var(--text); }
.help-box .dim { color: var(--text-3); font-size: 12px; margin-top: 14px; line-height: 1.7; }

/* ---------- 贪吃蛇（克制配色） ---------- */
.snake { position: fixed; inset: 0; z-index: 140; display: none; place-items: center;
  background: rgba(20, 22, 26, .55); backdrop-filter: blur(3px); }
.snake.on { display: grid; }
.snake-box { text-align: center; }
.snake-box .score { font-size: 14px; color: var(--text-2); margin-bottom: 10px; }
.snake-box canvas { background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r); box-shadow: var(--shadow-2); }
.snake-box p { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }

/* ---------- 彩蛋粒子 ---------- */
.confetti { position: fixed; width: 7px; height: 12px; z-index: 151; pointer-events: none; border-radius: 2px; }
.ripple { position: fixed; width: 16px; height: 16px; border-radius: 50%; z-index: 151;
  pointer-events: none; border: 1.5px solid var(--brand); animation: ripple .65s var(--ease) forwards; }
@keyframes ripple { to { transform: scale(8); opacity: 0; } }
#snakeRain { display: none; position: fixed; inset: 0; z-index: 1; opacity: .3; }
body.matrix #snakeRain { display: block; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .wrap { padding: 0 16px 60px; }
  .nav { margin: 0 -16px; padding: 0 16px; }
  .hero { padding: 44px 0 26px; }
  .hero-actions .btn { flex: 1; justify-content: center; min-width: 130px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card { padding: 15px; }
  .card .ico { width: 30px; height: 30px; font-size: 14px; border-radius: 8px; }
  .card .ico img { border-radius: 8px; }
  .card p { -webkit-line-clamp: 3; }
  .stats { gap: 26px; }
  .toasts { right: 12px; left: 12px; bottom: 12px; }
  .achv { left: 12px; bottom: 68px; }
  /* 小屏工具条不再悬浮，随页面滚走，不挡住下面的卡片 */
  .toolbar { position: static; margin: 28px 0 18px; }
  /* 标签改为一行横滑，不再折行占高度 */
  .tags { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px 2px; }
  .tags::-webkit-scrollbar { display: none; }
  .tag { flex: 0 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
