/* =========================================================
   METOOL 全站设计系统（site.css）
   - 统一导航 / 页脚 / 字体 / 色彩 / 按钮 / 卡片
   - 放在各页面自身 CSS 之后加载，用于统一风格
   ========================================================= */
:root {
  --mt-brand: #4F46E5;
  --mt-brand-600: #4338CA;
  --mt-brand-50: #EEF2FF;
  --mt-brand-100: #E0E7FF;
  --mt-accent: #0D9488;
  --mt-accent-50: #F0FDFA;
  --mt-amber: #D97706;
  --mt-ink: #0F172A;
  --mt-text: #1E293B;
  --mt-slate: #475569;
  --mt-muted: #64748B;
  --mt-faint: #94A3B8;
  --mt-border: #E2E8F0;
  --mt-border-soft: #F1F5F9;
  --mt-bg: #F8FAFC;
  --mt-white: #FFFFFF;
  --mt-radius: 12px;
  --mt-radius-sm: 8px;
  --mt-radius-lg: 16px;
  --mt-shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --mt-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
  --mt-shadow-lg: 0 20px 48px rgba(15, 23, 42, .10);
  --mt-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mt-nav-h: 60px;

  /* 兼容各工具页旧变量，统一到同一品牌色 */
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --primary-dark: #4338CA;
  --primary-bg: #EEF2FF;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-light: #94A3B8;
  --bg-primary: #F8FAFC;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--mt-font) !important;
  color: var(--mt-text);
  background: var(--mt-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- 布局 ---------- */
.mt-container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; box-sizing: border-box; }
@media (max-width: 640px) { .mt-container { padding: 0 16px; } }

/* ---------- 顶部导航 ---------- */
.mt-nav {
  position: sticky; top: 0; z-index: 900;
  height: var(--mt-nav-h);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--mt-border);
  font-family: var(--mt-font);
}
.mt-nav * { box-sizing: border-box; }
.mt-nav-inner { height: 100%; display: flex; align-items: center; gap: 28px; }
.mt-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--mt-ink); font-weight: 800; letter-spacing: .06em; font-size: 16px; flex-shrink: 0; }
.mt-logo-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #4F46E5 0%, #0D9488 100%); color: #fff; font-size: 14px; font-weight: 800; letter-spacing: 0;
}
.mt-logo small { font-weight: 500; letter-spacing: 0; color: var(--mt-muted); font-size: 12px; margin-left: 2px; }
.mt-nav-links { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.mt-nav-links a {
  color: var(--mt-slate); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 7px 12px; border-radius: 8px; white-space: nowrap; transition: background .15s, color .15s;
}
.mt-nav-links a:hover { background: var(--mt-border-soft); color: var(--mt-ink); }
.mt-nav-links a.active { color: var(--mt-brand); background: var(--mt-brand-50); }
.mt-nav-auth { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mt-nav-auth .mt-user { font-size: 13px; color: var(--mt-slate); text-decoration: none; padding: 6px 10px; border-radius: 8px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-nav-auth .mt-user:hover { background: var(--mt-border-soft); }
.mt-nav-auth .mt-user b { color: var(--mt-ink); font-weight: 600; }
.mt-badge-plan { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--mt-border-soft); color: var(--mt-muted); margin-left: 4px; }
.mt-badge-plan.is-member { background: #FEF3C7; color: #92400E; }
.mt-burger { display: none; margin-left: auto; width: 38px; height: 38px; border: 1px solid var(--mt-border); background: #fff; border-radius: 8px; cursor: pointer; align-items: center; justify-content: center; }
.mt-burger span, .mt-burger span::before, .mt-burger span::after { display: block; width: 16px; height: 2px; background: var(--mt-ink); border-radius: 2px; position: relative; content: ""; }
.mt-burger span::before { position: absolute; top: -5px; }
.mt-burger span::after { position: absolute; top: 5px; }
.mt-nav-menu { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
@media (max-width: 900px) {
  .mt-burger { display: inline-flex; }
  .mt-nav-menu { display: none; }
  .mt-nav.open .mt-nav-menu {
    display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    position: absolute; left: 0; right: 0; top: var(--mt-nav-h);
    background: #fff; padding: 8px 16px 16px; border-bottom: 1px solid var(--mt-border); box-shadow: var(--mt-shadow);
  }
  .mt-nav.open .mt-nav-links { flex-direction: column; align-items: stretch; }
  .mt-nav.open .mt-nav-links a { padding: 12px; font-size: 15px; }
  .mt-nav.open .mt-nav-auth { padding-top: 8px; border-top: 1px solid var(--mt-border-soft); }
  .mt-nav.open .mt-nav-auth .mt-btn { flex: 1; }
}

/* ---------- 按钮 ---------- */
.mt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: var(--mt-radius-sm);
  font-family: var(--mt-font); font-size: 14px; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; border: 1px solid transparent; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.mt-btn:active { transform: translateY(1px); }
.mt-btn-primary { background: var(--mt-brand); color: #fff !important; box-shadow: 0 1px 2px rgba(79, 70, 229, .25); }
.mt-btn-primary:hover { background: var(--mt-brand-600); }
.mt-btn-ghost { background: #fff; color: var(--mt-ink) !important; border-color: var(--mt-border); }
.mt-btn-ghost:hover { border-color: #CBD5E1; background: var(--mt-bg); }
.mt-btn-text { background: transparent; color: var(--mt-slate) !important; padding: 0 10px; }
.mt-btn-text:hover { color: var(--mt-ink) !important; background: var(--mt-border-soft); }
.mt-btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.mt-btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------- 通用组件 ---------- */
.mt-card { background: #fff; border: 1px solid var(--mt-border); border-radius: var(--mt-radius); box-shadow: var(--mt-shadow-sm); }
.mt-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--mt-brand); background: var(--mt-brand-50); border: 1px solid var(--mt-brand-100); padding: 4px 10px; border-radius: 999px; }
.mt-note { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.6; margin: 0 0 14px; }
.mt-note a { color: #92400E; font-weight: 600; }
.mt-compliance-note { background: #F8FAFC; border: 1px dashed #CBD5E1; color: var(--mt-slate); border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.6; margin: 10px 0 12px; }

/* ---------- 页脚 ---------- */
.mt-footer { background: #0B1120; color: #94A3B8; font-family: var(--mt-font); margin-top: 64px; }
.mt-footer a { color: #CBD5E1; text-decoration: none; }
.mt-footer a:hover { color: #fff; }
.mt-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; padding: 48px 0 32px; }
.mt-footer h4 { color: #fff; font-size: 13px; font-weight: 600; margin: 0 0 14px; letter-spacing: .02em; }
.mt-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 13px; }
.mt-footer p { font-size: 13px; line-height: 1.7; margin: 10px 0 0; max-width: 320px; }
.mt-footer .mt-logo { color: #fff; }
.mt-footer-bottom { border-top: 1px solid #1E293B; padding: 18px 0 28px; font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) { .mt-footer-grid { grid-template-columns: 1fr 1fr; } .mt-footer-grid > div:first-child { grid-column: 1 / -1; } }

/* =========================================================
   工具页统一（body.mt-tool 由 site-shell.js 加上）
   ========================================================= */
body.mt-tool { background: var(--mt-bg); }
body.mt-tool .back-link { display: none !important; }
body.mt-tool #mtAuthBar { display: none !important; }

/* 工具页头：统一为浅色标题区 */
body.mt-tool .app > .header,
body.mt-tool .container > .header,
body.mt-tool > .header,
body.mt-tool .page > .header {
  background: #fff !important;
  color: var(--mt-ink) !important;
  border-bottom: 1px solid var(--mt-border);
  padding: 28px 24px 24px !important;
  margin: 0 0 24px !important;
  text-align: center;
  box-shadow: none !important;
  border-radius: 0 !important;
  position: relative;
}
body.mt-tool .header::before, body.mt-tool .header::after { display: none !important; }
body.mt-tool .header h1 {
  color: var(--mt-ink) !important; -webkit-text-fill-color: var(--mt-ink) !important; background: none !important;
  font-size: clamp(22px, 3vw, 28px) !important; font-weight: 750 !important; letter-spacing: -.01em; margin: 0 !important;
}
body.mt-tool .header .tagline, body.mt-tool .header p, body.mt-tool .header .subtitle {
  color: var(--mt-slate) !important; opacity: 1 !important; font-size: 14px !important; margin-top: 6px !important;
}
body.mt-tool .header .logo { justify-content: center; margin-bottom: 0 !important; }
body.mt-tool .header .logo-icon { display: none; }
body.mt-tool .header .header-badge {
  display: inline-block; background: var(--mt-brand-50) !important; color: var(--mt-brand) !important;
  border: 1px solid var(--mt-brand-100) !important; border-radius: 999px; font-size: 12px !important; font-weight: 600; padding: 3px 10px !important; margin-bottom: 8px;
}
body.mt-tool .header a:not(.mt-btn) { color: var(--mt-brand) !important; }
body.mt-tool .header button, body.mt-tool .header .btn, body.mt-tool .header .header-btn {
  border-radius: var(--mt-radius-sm) !important;
}
body.mt-tool .header .header-actions a, body.mt-tool .header .header-actions button,
body.mt-tool .header .download-btn, body.mt-tool .header .ext-btn {
  background: var(--mt-brand) !important; color: #fff !important; border: 0 !important;
}

/* 卡片与面板统一圆角/阴影/边框 */
body.mt-tool .panel, body.mt-tool .input-panel, body.mt-tool .output-panel, body.mt-tool .card,
body.mt-tool .result-panel, body.mt-tool .stat-card, body.mt-tool .section-card {
  border-radius: var(--mt-radius) !important;
  border: 1px solid var(--mt-border) !important;
  box-shadow: var(--mt-shadow-sm) !important;
}

/* 主按钮统一品牌色 */
body.mt-tool .submit-btn, body.mt-tool .btn-primary, body.mt-tool .generate-btn, body.mt-tool .btn-generate,
body.mt-tool #generateBtn, body.mt-tool .primary-btn {
  background: var(--mt-brand) !important; background-image: none !important; color: #fff !important;
  border-radius: var(--mt-radius-sm) !important; box-shadow: 0 1px 2px rgba(79, 70, 229, .25) !important;
}
body.mt-tool .submit-btn:hover, body.mt-tool .btn-primary:hover, body.mt-tool #generateBtn:hover { background: var(--mt-brand-600) !important; }
body.mt-tool .submit-btn.secondary-btn { background: #fff !important; color: var(--mt-ink) !important; border: 1px solid var(--mt-border) !important; box-shadow: none !important; }

/* 表单控件 */
body.mt-tool input[type="text"], body.mt-tool input[type="email"], body.mt-tool input[type="password"],
body.mt-tool input[type="number"], body.mt-tool input[type="url"], body.mt-tool select, body.mt-tool textarea {
  border-radius: var(--mt-radius-sm);
  font-family: var(--mt-font);
}
body.mt-tool input:focus, body.mt-tool select:focus, body.mt-tool textarea:focus {
  outline: none; border-color: var(--mt-brand) !important; box-shadow: 0 0 0 3px rgba(79, 70, 229, .15) !important;
}

/* 视频页额度条 */
.quota-bar { max-width: 1280px; margin: 0 auto 16px; padding: 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--mt-slate); }
.quota-bar:empty { display: none; }
.quota-pill { background: #fff; border: 1px solid var(--mt-border); border-radius: 999px; padding: 5px 12px; color: var(--mt-ink); }
.quota-pill b { color: var(--mt-brand); }
.quota-hint a { color: var(--mt-brand); font-weight: 600; }
.quota-warn { color: #B45309; }
.alert-member.is-trial { background: var(--mt-accent-50) !important; border-color: #99F6E4 !important; }

/* 客服浮窗统一色 */
.cs-fab-btn { background: var(--mt-brand) !important; box-shadow: 0 6px 20px rgba(79, 70, 229, .35) !important; }
.cs-fab-pulse { border-color: #A5B4FC !important; }
@media (max-width: 640px) { .cs-fab { bottom: 1rem !important; right: 1rem !important; } .cs-fab-btn { width: 48px !important; height: 48px !important; } }

/* 打印 / 无障碍 */
.mt-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--mt-brand); outline-offset: 2px; }

/* 教程页：隐藏旧导航/页脚，统一标题区 */
body.mt-tool .guide-nav, body.mt-tool .guide-footer { display: none !important; }
body.mt-tool .guide-hero { background: #fff !important; color: var(--mt-ink) !important; border-bottom: 1px solid var(--mt-border); }
body.mt-tool .guide-hero h1 { color: var(--mt-ink) !important; -webkit-text-fill-color: var(--mt-ink) !important; background: none !important; }
body.mt-tool .guide-hero .subtitle, body.mt-tool .guide-hero p { color: var(--mt-slate) !important; opacity: 1 !important; }
body.mt-tool .toast:not(.show) { opacity: 0; }
body.mt-tool .extension-bar { background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%) !important; }
.pm-privacy { font-size: 12.5px; line-height: 1.7; }
