/* ============================================================
   Lapis Pandai — 基础样式
   ============================================================ */

/* ============================================================
   抗闪烁层（P0）
   ============================================================ */

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.2s;
  animation-timing-function: ease;
}

.site-header { view-transition-name: site-header; }
.site-footer { view-transition-name: site-footer; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

/* 首帧背景色 */
html { background: #f5f7fb; color-scheme: light; }
html[data-theme="dark"] { background: #0a1020; color-scheme: dark; }

/* 非中文用户：i18n 替换完成前隐藏 body */
html[data-i18n-pending] body { opacity: 0; }

/* 资源网格：数据加载前预留高度 */
.resource-grid:empty { min-height: 260px; }

/* ============================================================
   设计令牌
   ============================================================ */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --surface-3: #e3eaf4;
  --text: #0f172a;
  --text-muted: #5b6b82;
  --text-soft: #8494a8;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e0e9ff;
  --accent: #0ea5e9;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .07);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --header-h: 68px;
  --maxw: 1200px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
          "Noto Sans SC", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

img, svg { max-width: 100%; display: block; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

ul { margin: 0; padding: 0; list-style: none; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  position: relative;
  display: flex; align-items: center; gap: 18px;
  min-height: var(--header-h);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex-shrink: 0; }
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .18);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
  display: block;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .98rem; }
.brand-text small { font-size: .72rem; color: var(--text-muted); font-weight: 400; }

.primary-nav { margin-left: auto; }
.primary-nav ul { display: flex; align-items: center; gap: 4px; }
.primary-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px;
  color: var(--text-muted); font-size: .9rem; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: background .18s, color .18s;
}
.primary-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.primary-nav a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.pill {
  display: inline-grid; place-items: center;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--primary); color: #fff;
  font-size: .68rem; font-weight: 700; line-height: 1;
}
.pill:empty, .pill[data-empty="true"] { display: none; }

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.lang-select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: .82rem; font-weight: 600;
  padding: 7px 26px 7px 11px; border-radius: 999px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235b6b82' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.lang-select:hover { border-color: var(--primary); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 1rem;
  transition: background .18s, border-color .18s, transform .18s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--primary); }
.icon-btn:active { transform: scale(.94); }

.nav-toggle { display: none; margin-left: auto; }
.burger, .burger::before, .burger::after {
  display: block; width: 17px; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform .22s, opacity .22s;
}
.burger { position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -5px; }
.burger::after { top: 5px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: .92rem; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s, transform .12s, box-shadow .18s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; transform: none; box-shadow: none;
}

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .25); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }

.btn-soft { background: var(--surface-2); color: var(--text); }
.btn-soft:hover:not(:disabled) { background: var(--surface-3); }

.btn-sm { padding: 7px 14px; font-size: .84rem; border-radius: 8px; }

/* ---------------- Badges & tags ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.badge-grade { background: var(--primary-soft); color: var(--primary); }
.badge-type { background: var(--surface-2); color: var(--text-muted); }

.badge-copyright { font-size: .7rem; }
.copyright-open { background: var(--success-soft); color: var(--success); }
.copyright-authorized { background: #dbeafe; color: #1d4ed8; }
.copyright-original { background: #ede9fe; color: #6d28d9; }
.copyright-unclear { background: var(--warning-soft); color: var(--warning); }
.copyright-reference { background: var(--surface-2); color: var(--text-muted); }

.tag-ok { color: var(--success); font-weight: 600; }
.tag-free { color: var(--accent); font-weight: 600; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
}

.resource-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 16px 12px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.resource-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.rc-top { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rc-title { font-size: 1rem; margin: 0 0 6px; line-height: 1.4; }
.rc-title a { color: var(--text); }
.rc-title a:hover { color: var(--primary); text-decoration: none; }
.rc-desc {
  font-size: .84rem; color: var(--text-muted); margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 3.2em;
}
.rc-meta {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  font-size: .76rem; color: var(--text-soft); margin-top: auto; padding-top: 4px;
}
.rc-meta span { white-space: nowrap; }
.rc-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
}

.fav-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 1.15rem; line-height: 1; color: var(--text-soft);
  padding: 2px 4px; border-radius: 6px; transition: color .16s, transform .16s;
}
.fav-btn:hover { color: #f59e0b; transform: scale(1.14); }
.fav-btn.is-on { color: #f59e0b; }

/* ---------------- Sections ---------------- */
.section { padding: 44px 0; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--text-muted); font-size: .9rem; }
.section-link { font-size: .88rem; font-weight: 600; }

.page-head { padding: 30px 0 20px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { color: var(--text-muted); margin: 0; max-width: 720px; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative; overflow: hidden;
  padding: 56px 0 52px;
  background:
    radial-gradient(1000px 420px at 12% -10%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%),
    radial-gradient(900px 380px at 92% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 820px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: .78rem; font-weight: 600; color: var(--primary); margin-bottom: 16px;
}
.hero h1 { font-size: clamp(1.75rem, 4.2vw, 2.9rem); margin-bottom: 14px; }
.hero p.lead { font-size: clamp(.95rem, 1.6vw, 1.1rem); color: var(--text-muted); margin-bottom: 26px; }

.search-box {
  position: relative; display: flex; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 8px;
  box-shadow: var(--shadow);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.search-box input {
  flex: 1; min-width: 0; border: none; background: transparent;
  font: inherit; font-size: 1rem; color: var(--text); padding: 10px 12px; outline: none;
}
.search-box input::placeholder { color: var(--text-soft); }

.search-suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: 340px; overflow: auto; display: none;
}
.search-suggest.is-open { display: block; }
.search-suggest a {
  display: block; padding: 11px 16px; color: var(--text); font-size: .88rem;
  border-bottom: 1px solid var(--border); text-decoration: none;
}
.search-suggest a:last-child { border-bottom: none; }
.search-suggest a:hover { background: var(--surface-2); text-decoration: none; }
.search-suggest .ss-meta { display: block; font-size: .74rem; color: var(--text-soft); margin-top: 2px; }
.search-suggest .ss-empty { padding: 16px; color: var(--text-muted); font-size: .88rem; }

.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); font-size: .82rem; font-weight: 500;
  text-decoration: none; transition: all .16s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; transform: translateY(-1px); }

/* ---------------- Stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 18px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat b { display: block; font-size: 1.85rem; font-weight: 800; color: var(--primary); line-height: 1.2; }
.stat span { font-size: .82rem; color: var(--text-muted); }

/* ---------------- Category tiles ---------------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 15px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: .88rem; font-weight: 500;
  text-decoration: none; box-shadow: var(--shadow-sm);
  transition: all .18s ease;
}
.tile:hover {
  border-color: var(--primary); color: var(--primary);
  transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none;
}
.tile-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: .82rem; font-weight: 800;
}
.tile-name { flex: 1; min-width: 0; }
.tile-count { font-size: .74rem; color: var(--text-soft); font-weight: 600; }

/* ---------------- UASA banner ---------------- */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 30px 32px; border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--primary), var(--accent));
  color: #fff; box-shadow: 0 12px 32px rgba(37, 99, 235, .28);
}
.banner h2 { color: #fff; margin: 0 0 6px; }
.banner p { color: rgba(255, 255, 255, .88); margin: 0; max-width: 560px; font-size: .92rem; }
.banner .btn { background: #fff; color: var(--primary); }
.banner .btn:hover { background: #f1f5ff; }

/* ---------------- Layout: filters + results ---------------- */
.layout {
  display: grid; grid-template-columns: 268px minmax(0, 1fr);
  gap: 26px; align-items: start; padding-bottom: 60px;
}

.filters {
  position: sticky; top: calc(var(--header-h) + 16px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm);
}
.filters-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.filters-head h2 { font-size: .95rem; margin: 0; }
.filters-reset {
  border: none; background: none; color: var(--primary);
  font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; padding: 2px;
}
.filters-reset:hover { text-decoration: underline; }

.filter-group { display: block; margin-bottom: 14px; }
.filter-label {
  display: block; font-size: .78rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.filter-group select {
  width: 100%; appearance: none; -webkit-appearance: none;
  padding: 9px 30px 9px 11px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: .86rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235b6b82' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.filter-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }

.filter-toggle { display: none; }

/* ---------------- Toolbar ---------------- */
.results-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.results-count { font-size: .88rem; color: var(--text-muted); }
.results-count b { color: var(--text); font-size: 1rem; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.sort-group { display: flex; align-items: center; gap: 7px; font-size: .84rem; color: var(--text-muted); }
.sort-group select {
  padding: 7px 28px 7px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .84rem; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235b6b82' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

.active-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: .78rem; font-weight: 600;
}
.filter-chip button {
  border: none; background: rgba(37, 99, 235, .16); color: inherit;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font-size: .72rem; line-height: 1; padding: 0;
}
.filter-chip button:hover { background: rgba(37, 99, 235, .3); }

/* ---------------- Empty state ---------------- */
.empty {
  text-align: center; padding: 64px 24px;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty-icon { font-size: 2.6rem; margin-bottom: 12px; opacity: .5; }
.empty h3 { margin: 0 0 8px; }
.empty p { color: var(--text-muted); margin: 0 0 18px; font-size: .9rem; }

/* ---------------- Pagination ---------------- */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 32px; }
.page-btn {
  min-width: 38px; height: 38px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: .86rem; font-weight: 600;
  cursor: pointer; transition: all .16s;
}
.page-btn:hover:not(:disabled):not(.is-active) { border-color: var(--primary); color: var(--primary); }
.page-btn.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-dots { display: grid; place-items: center; padding: 0 4px; color: var(--text-soft); }

/* ---------------- Detail page ---------------- */
.detail-wrap { padding: 26px 0 64px; }
.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  font-size: .82rem; color: var(--text-muted); margin-bottom: 18px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span[aria-hidden] { opacity: .5; }

.detail-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 30px;
  box-shadow: var(--shadow-sm);
}
.detail-title { font-size: clamp(1.35rem, 2.6vw, 1.9rem); margin: 14px 0 10px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-desc { color: var(--text-muted); font-size: .95rem; margin: 18px 0 24px; }

.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; padding: 20px; margin-bottom: 24px;
  background: var(--surface-2); border-radius: var(--radius);
}
.meta-item dt { font-size: .74rem; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.meta-item dd { margin: 0; font-size: .9rem; font-weight: 600; }

.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 22px; border-top: 1px solid var(--border); }
.detail-note {
  margin-top: 18px; padding: 13px 16px; border-radius: 10px;
  background: var(--warning-soft); color: var(--warning);
  font-size: .84rem; border: 1px solid color-mix(in srgb, var(--warning) 22%, transparent);
}
.detail-note b { display: block; margin-bottom: 3px; }

.related { margin-top: 40px; }

/* ---------------- Favorites page ---------------- */
.fav-summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
  padding: 16px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.fav-summary p { margin: 0; font-size: .92rem; color: var(--text-muted); }
.fav-summary b { color: var(--text); }

/* ---------------- Tools page ---------------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tool-card {
  position: relative; display: flex; flex-direction: column;
  padding: 22px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.tool-card h3 { margin: 0 0 6px; font-size: 1rem; }
.tool-card p { margin: 0 0 16px; font-size: .85rem; color: var(--text-muted); flex: 1; }

/* 工具图标容器：支持 emoji 或图片 */
.tool-icon {
  width: 42px; height: 42px; border-radius: 12px; margin-bottom: 14px;
  display: grid; place-items: center; font-size: 1.1rem;
  background: var(--primary-soft); color: var(--primary);
  overflow: hidden;
}
.tool-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
  display: block;
}

.tool-soon {
  position: absolute; top: 16px; right: 16px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-soft);
  font-size: .68rem; font-weight: 700;
}
.tool-live { background: var(--success-soft); color: var(--success); }

.timer-display {
  font-size: 3rem; font-weight: 800; text-align: center;
  font-variant-numeric: tabular-nums; color: var(--primary);
  letter-spacing: .02em; margin: 18px 0;
}
.timer-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------------- About page ---------------- */
.prose { max-width: 820px; }
.prose h2 { margin-top: 34px; }
.prose h2:first-child { margin-top: 0; }
.prose ul.bullets { list-style: disc; padding-left: 22px; }
.prose ul.bullets li { margin-bottom: 8px; color: var(--text-muted); font-size: .93rem; }
.notice {
  padding: 16px 20px; border-radius: var(--radius);
  background: var(--surface-2); border-left: 4px solid var(--primary);
  font-size: .9rem; color: var(--text-muted); margin: 20px 0;
}

/* ---------------- Footer ---------------- */
.site-footer {
  margin-top: auto; background: var(--surface);
  border-top: 1px solid var(--border); padding: 44px 0 24px;
}
.footer-grid {
  display: grid; grid-template-columns: 1.7fr 1fr 1fr 1.3fr;
  gap: 32px; padding-bottom: 30px;
}
.footer-col h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); margin-bottom: 12px; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col a { color: var(--text-muted); font-size: .88rem; }
.footer-col a:hover { color: var(--primary); }
.footer-brand strong { font-size: 1.05rem; display: block; margin-bottom: 8px; }
.footer-brand p { font-size: .86rem; color: var(--text-muted); margin: 0; max-width: 320px; }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 20px; border-top: 1px solid var(--border);
  font-size: .8rem; color: var(--text-soft);
}
.footer-bottom p { margin: 0; }
.footer-disclaimer { max-width: 520px; }

/* ---------------- Back to top & toast ---------------- */
.back-to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 1.1rem; cursor: pointer;
  box-shadow: var(--shadow); display: grid; place-items: center;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .22s, transform .22s, visibility .22s;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { border-color: var(--primary); color: var(--primary); }

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 200;
  transform: translate(-50%, 20px);
  padding: 11px 22px; border-radius: 999px;
  background: #0f172a; color: #fff; font-size: .86rem; font-weight: 500;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .3);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .22s, transform .22s, visibility .22s;
  max-width: calc(100vw - 40px); text-align: center;
}
.toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); }
.toast-success { background: var(--success); }

/* ---------------- Loading ---------------- */
.loading { display: grid; place-items: center; padding: 60px 20px; gap: 14px; color: var(--text-muted); font-size: .9rem; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  padding: 26px; border-radius: var(--radius);
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  text-align: center;
}
.error-box p { margin: 0 0 14px; }

/* ---------------- 404 ---------------- */
.notfound {
  display: grid; place-items: center; text-align: center;
  min-height: 62vh; padding: 60px 20px;
}
.notfound-code {
  font-size: clamp(4rem, 14vw, 8rem); font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

[hidden] { display: none !important; }