/* ============================================================
   Tool Maoyang — shared design system（与主站 liumeiti.vip 统一：Apple 极简浅色 + teal + Inter）
   ============================================================ */
@font-face { font-family:'InterPortal'; font-style:normal; font-weight:400; font-display:swap; src:url('fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family:'InterPortal'; font-style:normal; font-weight:500; font-display:swap; src:url('fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family:'InterPortal'; font-style:normal; font-weight:600; font-display:swap; src:url('fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family:'InterPortal'; font-style:normal; font-weight:700; font-display:swap; src:url('fonts/inter-700.woff2') format('woff2'); }
@font-face { font-family:'InterPortal'; font-style:normal; font-weight:800; font-display:swap; src:url('fonts/inter-800.woff2') format('woff2'); }
:root {
  --radius: 18px;
  --accent: #0f766e; --accent-2: #14b8a6; --accent-soft: rgba(15,118,110,.10); --accent-ink: #0b5b53;
  --ok: #16a34a; --warn: #b45309; --danger: #dc2626;
  --grad: linear-gradient(135deg, #0f766e, #14b8a6);
  --shadow: 0 4px 18px rgba(0,0,0,.06);
  --font: 'InterPortal', -apple-system, BlinkMacSystemFont, 'SF Pro Display', "Segoe UI", 'PingFang SC', 'Hiragino Sans GB', "Microsoft YaHei", Roboto, sans-serif;
  --mono: "SF Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;
}
/* 浅色（默认，Apple 调性，对齐主站） */
html[data-theme="light"], html:not([data-theme]) {
  --bg: #f5f5f7; --bg-2: #ececee; --surface: #ffffff; --surface-2: #f5f5f7;
  --border: rgba(0,0,0,.10); --border-soft: rgba(0,0,0,.055);
  --text: #1d1d1f; --muted: #6e6e73; --faint: #8a8a8e;
  --shadow: 0 4px 18px rgba(0,0,0,.06);
}
/* 深色（可选，teal 点缀的中性深底） */
html[data-theme="dark"] {
  --bg: #0c1012; --bg-2: #11161a; --surface: #161c20; --surface-2: #1d242b;
  --border: #2a333a; --border-soft: #1f262c;
  --text: #e9edf0; --muted: #9aa6ad; --faint: #5f6b72;
  --accent-soft: rgba(20,184,166,.16);
  --shadow: 0 10px 30px rgba(0,0,0,.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; line-height: 1.55; letter-spacing: -0.01em;
  background-attachment: fixed;
  background-image: radial-gradient(900px 420px at 100% -10%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 62%);
}
a { color: var(--accent); text-decoration: none; }
.container { max-width: 980px; margin: 0 auto; padding: 0 18px; }

/* ---- header / nav ---- */
.site-header { position: sticky; top: 0; z-index: 30; backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--border-soft); }
.top-ad { display: block; border-top: 1px solid var(--border-soft); color: var(--muted); background: transparent; }
.top-ad:hover { color: var(--text); }
.top-ad-inner { max-width: 980px; height: 28px; margin: 0 auto; padding: 0 18px;
  display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0;
  font-size: 12.5px; line-height: 1.2; }
.top-ad-main { min-width: 0; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-ad-cta { flex-shrink: 0; color: var(--accent); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.site-header .bar { display: flex; align-items: center; gap: 14px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text); white-space: nowrap; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: #fff;
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 2px 8px rgba(2,6,23,.28), inset 0 0 0 1px rgba(255,255,255,.6); }
.brand .logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { padding: 8px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface); }
.theme-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; }
@media (max-width: 560px) {
  .site-header .bar { height: 56px; }
  .brand { min-width: 0; font-size: 16px; }
  .brand .logo { width: 32px; height: 32px; border-radius: 9px; }
  .top-ad-inner { height: 26px; padding: 0 14px; gap: 5px; font-size: 11.5px; justify-content: center; }
  .top-ad-main { white-space: nowrap; }
  .nav a:not(.cta) { display: none; }
}

/* ---- buttons ---- */
.btn { height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: border-color .15s, transform .1s, background .15s; font-family: var(--font); }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border: none; color: #fff; }
.btn.primary:hover { border-color: transparent; filter: brightness(1.05); }
.btn.danger { background: var(--danger); border: none; color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- forms ---- */
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 12px; font-size: 14px; outline: none; font-family: var(--font);
  transition: border-color .15s, box-shadow .15s; }
textarea.input { resize: vertical; min-height: 120px; font-family: var(--mono); font-size: 13px; line-height: 1.55; }
.input:focus, textarea.input:focus, select.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono { font-family: var(--mono); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.range { display: flex; align-items: center; gap: 10px; }
.range input[type=range] { flex: 1; accent-color: var(--accent); }

/* ---- panels / cards ---- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; }
.panel + .panel { margin-top: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .split { grid-template-columns: 1fr; } }
.out { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word; min-height: 44px;
  color: var(--text); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-weight: 700; }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.6; background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; }
.err { color: var(--danger); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }

/* ---- tool page header ---- */
.tool-head { padding: 26px 0 18px; }
.tool-head .crumbs { font-size: 13px; color: var(--faint); margin-bottom: 8px; }
.tool-head h1 { font-size: 26px; font-weight: 800; letter-spacing: .2px; }
.tool-head .lead { color: var(--muted); font-size: 15px; margin-top: 6px; max-width: 70ch; }

/* ---- homepage ---- */
.hero { text-align: center; padding: 54px 0 26px; }
.hero h1 { font-size: 40px; font-weight: 800; letter-spacing: -.4px; line-height: 1.12; }
.hero h1 .g { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 16px; margin: 12px auto 0; max-width: 56ch; line-height: 1.6; }
.hero p strong { color: var(--text); }
.hero .search { max-width: 480px; margin: 24px auto 0; position: relative; }
.hero .search input { height: 50px; padding-left: 44px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); border-color: var(--border); }
.hero .search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.hero-pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.hero-pills .hp { font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 13px; display: inline-flex; align-items: center; gap: 7px; }
.hero-pills .hp b { color: var(--text); font-weight: 800; }
.hero-pills .hp::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); flex-shrink: 0; }
.cat-title { font-size: 15px; font-weight: 800; color: var(--text); margin: 32px 2px 14px;
  display: flex; align-items: center; gap: 12px; letter-spacing: .2px; }
.cat-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 13px; }
.tool-card { display: flex; gap: 13px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.tool-card .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex-shrink: 0; transition: background .18s, color .18s, transform .18s; }
.tool-card:hover .ic { background: var(--grad); color: #fff; transform: scale(1.04); }
.tool-card h3 { font-size: 15px; font-weight: 700; color: var(--text); }
.tool-card p { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* 综合「工具箱」卡片：accent 微染底 + 渐变图标，凸显为重点入口 */
.tool-card.collection-card { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface)); }
.tool-card.collection-card .ic { background: var(--grad); color: #fff; }
.tool-card.hidden { display: none; }
.tool-card { position: relative; }
.tool-card .tc-body { min-width: 0; flex: 1; }
.tool-card.faved { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

/* ---- favorites（收藏） ---- */
.card-star { position: absolute; top: 9px; right: 9px; width: 28px; height: 28px; border-radius: 8px; border: none;
  background: transparent; color: var(--faint); cursor: pointer; display: grid; place-items: center; opacity: 0; transition: all .15s; }
.tool-card:hover .card-star { opacity: 1; }
.card-star:hover { background: var(--surface-2); color: var(--accent); }
.card-star svg { fill: none; stroke: currentColor; }
.tool-card.faved .card-star { opacity: 1; color: var(--accent); }
.tool-card.faved .card-star svg { fill: currentColor; }
@media (hover: none) { .card-star { opacity: 1; } }

.fav-strip { border-bottom: 1px solid var(--border-soft); background: color-mix(in srgb, var(--bg) 72%, transparent); }
.fav-bar { display: flex; align-items: center; gap: 8px; padding: 8px 0; overflow-x: auto; scrollbar-width: none; }
.fav-bar::-webkit-scrollbar { display: none; }
.fav-label { font-size: 12px; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.fav-label svg { fill: var(--accent); stroke: var(--accent); }
.fav-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.fav-chip:hover { border-color: var(--accent); color: var(--accent); }
.fav-chip svg { fill: none; stroke: currentColor; color: var(--accent); }

.fav-star { background: none; border: none; cursor: pointer; color: var(--faint); margin-left: 12px; padding: 0; vertical-align: middle; line-height: 0; }
.fav-star svg { fill: none; stroke: currentColor; }
.fav-star.on { color: var(--accent); }
.fav-star.on svg { fill: currentColor; }

/* ---- 移动端优化 ---- */
@media (max-width: 560px) {
  .container { padding: 0 14px; }
  .hero { padding: 30px 0 16px; }
  .hero h1 { font-size: 25px; }
  .hero p { font-size: 13.5px; }
  .hero .search { margin-top: 16px; }
  .tool-head { padding: 16px 0 12px; }
  .tool-head h1 { font-size: 21px; }
  .tool-head .lead { font-size: 13.5px; }
  .panel { padding: 14px; }
  /* 表单行：文本输入独占一行，按钮在下一行平分，避免“一行行”错位 */
  .btn-row > input.input { flex: 1 1 100% !important; min-width: 0 !important; }
  .btn-row > input.input ~ .btn { flex: 1 0 auto; }
  .btn-row > select.input { flex: 1 1 auto !important; width: auto !important; height: 42px; }
  .cat-title { font-size: 13px; margin: 16px 2px 10px; }
  /* 移动端：图标 + 标题的方格卡片（不再长条，省空间） */
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 9px; }
  .tool-card { flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 14px 6px; }
  .tool-card .ic { width: 44px; height: 44px; }
  .tool-card .ic svg { width: 24px; height: 24px; }
  .tool-card .tc-body { flex: none; min-width: 0; width: 100%; }
  .tool-card .tc-body h3 { font-size: 12.5px; line-height: 1.25; }
  .tool-card .tc-body p { display: none; }
  .card-star { top: 4px; right: 4px; width: 24px; height: 24px; opacity: 1; }
}

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--border-soft); margin-top: 48px; padding: 26px 0 max(34px, env(safe-area-inset-bottom)); color: var(--faint); font-size: 13px; line-height: 1.8; position: relative; z-index: 1; }
.site-footer .bar { display: flex; gap: 10px 18px; flex-wrap: wrap; align-items: center; justify-content: space-between; min-height: 28px; }
.site-footer a { color: var(--muted); }
@media (max-width: 560px) {
  .site-footer { margin-top: 34px; padding-bottom: max(42px, env(safe-area-inset-bottom)); }
  .site-footer .bar { flex-direction: column; align-items: flex-start; }
}

/* ---- toast ---- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 11px;
  font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .22s; z-index: 80;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
