/* ===== layouts/head.html — 注入到 <head> ===== */

/* ---------- 基础 ---------- */
:root {
  --bg: #06090f;
  --bg2: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e6e9f0;
  --muted: #94a3b8;
  --dimmed: #64748b;
  --accent1: #6366f1;
  --accent2: #22d3bb;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---------- 背景氛围 ---------- */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-glow::before,
.bg-glow::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.28;
}

.bg-glow::before {
  width: 600px;
  height: 600px;
  background: var(--accent1);
  top: -120px;
  left: -80px;
}

.bg-glow::after {
  width: 500px;
  height: 500px;
  background: var(--accent2);
  bottom: -100px;
  right: -70px;
}

.topbar-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent2), var(--accent1), var(--accent2), transparent);
  opacity: 0.7;
}

/* ---------- 导航 ---------- */
nav {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(18px);
  background: rgba(6, 9, 15, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 13px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: .2s;
}

.back-link:hover {
  color: #fff;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}

.logo .mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 0 18px rgba(34, 211, 191, 0.3);
}

.breadcrumb {
  color: var(--dimmed);
  font-size: 13px;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: #fff;
}

.breadcrumb .sep {
  margin: 0 6px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: .2s;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-cta {
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  color: #070f1a !important;
  font-weight: 700;
}

.nav-cta:hover {
  filter: brightness(1.05);
}

/* ---------- 容器 ---------- */
.container {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}

.container-narrow {
  max-width: 900px;
}

/* ---------- Hero ---------- */
header.hero {
  padding: 70px 0 50px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  font-size: 13px;
  margin-bottom: 18px;
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 10px var(--accent2);
}

.hero-title {
  font-size: 54px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, #fff 0%, #94a3b8 100%) text;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  color: var(--muted);
  font-size: 17px;
  max-width: 580px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

.hero-search {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transition: .2s;
}

.hero-search:focus-within {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.hero-search input {
  flex: 1;
  background: transparent;
  outline: none;
  border: none;
  color: #fff;
  padding: 13px 10px 13px 16px;
  font-size: 15px;
}

.hero-search button {
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  color: #070f1a;
  border: none;
  font-weight: 800;
  border-radius: 12px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
}

/* ---------- 区块 ---------- */
section {
  padding: 30px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 18px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
}

.section-more {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

/* ---------- Bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.bento .card {
  position: relative;
  overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  transition: .2s;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bento .card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.card.wide {
  grid-column: span 4;
}

.card.half {
  grid-column: span 6;
}

.card.full {
  grid-column: span 12;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
}

.card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 6px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.card-tag {
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ---------- 工具卡片 ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.tool-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  transition: .2s;
  cursor: pointer;
}

.tool-card:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-2px);
}

.tool-card .icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.3), rgba(34, 211, 191, 0.2));
  display: grid;
  place-items: center;
  font-size: 18px;
  margin-bottom: 10px;
}

.tool-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: #e6e9f0;
}

.tool-card p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.5;
}

.tool-card .meta {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  font-size: 11px;
  color: var(--dimmed);
}

/* ---------- 文章 ---------- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.article-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  transition: .2s;
}

.article-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.article-card .title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  color: #e6e9f0;
}

.article-card .info {
  margin-top: 8px;
  font-size: 12px;
  color: var(--dimmed);
}

/* ---------- 工具详情页通用 ---------- */
.tool-content,
.tool-header {
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

header.tool-header {
  padding: 40px 0 22px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.tool-icon {
  width: 66px;
  height: 66px;
  border-radius: 18px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  display: grid;
  place-items: center;
  font-size: 32px;
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.3);
}

.tool-info {
  flex: 1;
}

.tool-info h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
}

.tool-info .desc {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
  line-height: 1.7;
  max-width: 620px;
}

.tool-tags {
  display: flex;
  gap: 7px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.tool-tag {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  border: 1px solid var(--border);
}

.tool-tag.free {
  background: rgba(34, 211, 191, 0.12);
  color: var(--accent2);
  border-color: rgba(34, 211, 191, 0.25);
}

.tool-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--dimmed);
}

.tool-stats b {
  color: var(--text);
  font-weight: 600;
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  padding-bottom: 50px;
  align-items: start;
}

/* 显式指定 page-layout 内各子元素的列位置，避免按文档顺序填充导致 tool-panel 跑到右栏
   规则：
   - 新式页面（88 文件）: page-layout > tool-main (col 1) + aside.tool-sidebar (col 2)
   - 老式页面（9 文件）: page-layout > ad-inline/tool-panel (col 1) + ad-sidebar/sidebar (col 2) */
.page-layout>.ad-inline {
  grid-column: 1;
}

.page-layout>.tool-panel {
  grid-column: 1;
}

.page-layout>.tool-main {
  grid-column: 1;
}

.page-layout>.ad-sidebar {
  grid-column: 2;
}

.page-layout>.sidebar,
.page-layout>aside.tool-sidebar {
  grid-column: 2;
}

.page-layout>.ad-slot {
  grid-column: 1;
  justify-self: center;
  margin-left: 0;
  margin-right: 0;
}

/* 侧栏内部纵向堆叠 */
.tool-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  position: sticky;
  top: 80px;
}

@media (max-width: 960px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .page-layout>.ad-inline,
  .page-layout>.tool-panel,
  .page-layout>.tool-main,
  .page-layout>.ad-sidebar,
  .page-layout>.sidebar,
  .page-layout>aside.tool-sidebar,
  .page-layout>.ad-slot {
    grid-column: 1;
  }

  .tool-sidebar {
    position: static;
  }
}

.tool-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  backdrop-filter: blur(8px);
  min-width: 0;
}

/* ---------- 表单 ---------- */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  color: #fff;
  font-size: 14px;
  font-family: "SF Mono", Menlo, monospace;
  transition: .2s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: .2s;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  color: #070f1a;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ---------- 输出区 ---------- */
.output-area {
  margin-top: 18px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: #e2e8f0;
  word-break: break-all;
  line-height: 1.6;
  min-height: 50px;
  display: none;
}

.output-area.active {
  display: block;
  animation: fadeIn .3s;
}

.output-label {
  display: block;
  font-size: 11px;
  color: var(--dimmed);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* ---------- 答题 ---------- */
.progress {
  margin-bottom: 20px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--dimmed);
  margin-bottom: 6px;
}

.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  width: 0%;
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

.question-num {
  color: var(--accent1);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.question-text {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.5;
  margin-bottom: 18px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: .2s;
}

.option:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
}

.option.selected {
  border-color: var(--accent1);
  background: rgba(99, 102, 241, 0.12);
}

.option-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #475569;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: .2s;
}

.option.selected .option-circle {
  border-color: var(--accent1);
  background: var(--accent1);
}

.option-circle::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transition: .2s;
}

.option.selected .option-circle::after {
  opacity: 1;
}

.option-text {
  font-size: 14px;
  color: #cbd5e1;
}

.nav-buttons {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.result-page {
  display: none;
  text-align: center;
  padding: 14px 0;
}

.result-page.active {
  display: block;
}

.result-icon {
  font-size: 52px;
  margin-bottom: 14px;
}

.result-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-desc {
  color: var(--muted);
  font-size: 14px;
  max-width: 440px;
  margin: 0 auto 22px;
  line-height: 1.7;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

/* ---------- 侧栏 ---------- */
.sidebar {
  display: grid;
  gap: 14px;
}

.sidebar-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
}

.sidebar-card h3 {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.sidebar-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-tool {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: .2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.sidebar-tool:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border);
}

.sidebar-tool .s-icon {
  font-size: 16px;
}

.sidebar-tool .s-title {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  flex: 1;
}

.sidebar-tool .s-tag {
  font-size: 10px;
  color: var(--dimmed);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 12px;
  background: #1e293b;
  color: var(--text);
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.5);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: .3s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

/* ---------- Footer ---------- */
footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 44px 0 34px;
  color: var(--dimmed);
  font-size: 13px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 30px;
}

.footer-brand {
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}

.footer-grid a {
  color: var(--dimmed);
  text-decoration: none;
  display: block;
  margin: 5px 0;
}

.footer-grid a:hover {
  color: #cbd5e1;
}

.footer-bottom {
  margin-top: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- 广告位 Core 样式 ---------- */
.ad-slot {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  transition: .2s;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.ad-slot:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.ad-slot .ad-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--dimmed);
  font-size: 12px;
  letter-spacing: 0.3px;
  user-select: none;
}

.ad-slot .ad-placeholder .ad-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent2);
  opacity: 0.8;
}

.ad-slot .ad-placeholder .ad-size {
  font-size: 11px;
  color: #475569;
}

/* --- 尺寸变体 --- */
.ad-leaderboard {
  width: 728px;
  max-width: 100%;
  height: 90px;
  margin: 2rem auto;
}

.ad-rectangle {
  width: 100%;
  height: 250px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.ad-square {
  width: 250px;
  height: 250px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.ad-inline {
  width: 100%;
  height: 120px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.ad-mobile {
  width: 100%;
  height: 50px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.ad-sidebar {
  width: 100%;
  height: 300px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

/* ========== 字符统计页专用样式 ========== */

/* 统计概览卡片 */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 28px 0;
}

.overview-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 20px;
  text-align: center;
  transition: .25s;
  backdrop-filter: blur(8px);
}

.overview-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.overview-icon {
  font-size: 32px;
  margin-bottom: 12px;
  filter: saturate(0.8);
}

.overview-number {
  font-size: 36px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 8px;
}

.overview-label {
  font-size: 13px;
  color: var(--dimmed);
  font-weight: 600;
}

/* 编辑器区域 */
.editor-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  margin: 24px 0;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.editor-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.editor-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
}

.editor-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

#textInput {
  width: 100%;
  min-height: 220px;
  padding: 20px;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Noto Sans SC", sans-serif;
}

#textInput::placeholder {
  color: var(--dimmed);
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--dimmed);
  background: rgba(255, 255, 255, 0.01);
}

/* 详细统计面板 */
.detail-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  margin: 24px 0;
}

.detail-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: .2s;
}

.detail-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.detail-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.detail-value {
  font-size: 18px;
  font-weight: 800;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}

/* 柱状图 */
.bar-chart-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.bar-chart-section h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
}

.bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bar-label {
  width: 52px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(.4, 0, .2, 1);
  min-width: 0;
}

.bar-fill.chinese {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.bar-fill.english {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.bar-fill.numbers {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.bar-fill.punctuation {
  background: linear-gradient(90deg, #ec4899, #f472b6);
}

.bar-fill.spaces {
  background: linear-gradient(90deg, #64748b, #94a3b8);
}

.bar-percent {
  width: 44px;
  font-size: 12px;
  color: var(--dimmed);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ---------- 响应式 ---------- */

/* 入场动画 */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.tool-header,
.tool-panel,
.stats-overview,
.detail-panel,
.editor-section {
  animation: slideUp 0.5s ease-out both;
}

.tool-panel {
  animation-delay: 0.1s;
}

.stats-overview {
  animation-delay: 0.15s;
}

.detail-panel {
  animation-delay: 0.2s;
}

.editor-section {
  animation-delay: 0.25s;
}

/* 按钮涟漪效果 */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 70%);
  transform: scale(0);
  border-radius: 50%;
  transition: transform 0.5s;
}

.btn:active::after {
  transform: scale(3);
  transition: transform 0.3s;
}

/* 输入框焦点光晕增强 */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 0 20px rgba(99, 102, 241, 0.08);
}

/* 卡片悬浮增强 */
.tool-card:hover,
.bento .card:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(99, 102, 241, 0.15);
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 移动端工具页内容区调整 */
@media (max-width: 960px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .page-layout>.ad-inline,
  .page-layout>.tool-panel,
  .page-layout>.ad-sidebar,
  .page-layout>.sidebar {
    grid-column: 1;
  }

  .tool-sidebar {
    position: static;
  }
}

@media (max-width: 860px) {
  .hero-title {
    font-size: 34px;
  }

  .page-layout {
    grid-template-columns: 1fr;
  }

  .bento .card.wide,
  .bento .card.half {
    grid-column: span 12;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .nav-links {
    display: none;
  }

  header.tool-header {
    flex-direction: column;
  }

  .form-row {
    flex-direction: column;
  }

  .ad-square,
  .ad-rectangle,
  .ad-sidebar {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
  }

  .tool-content,
  .tool-header {
    max-width: 100%;
    padding: 0 12px;
  }

  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
  }

  .editor-actions {
    flex-wrap: wrap;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-overview {
    grid-template-columns: 1fr;
  }

  .overview-card {
    padding: 18px 14px;
  }

  .overview-number {
    font-size: 28px;
  }

  .editor-actions {
    gap: 4px;
  }

  .editor-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* ===== 语言切换器 ===== */
.lang-switcher {
  display: flex;
  gap: 4px;
  margin-right: 12px;
  align-items: center;
}

.lang-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
  line-height: 1.4;
}

.lang-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent1);
  color: #fff;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lang-switcher .lang-divider {
  color: var(--dimmed);
  font-size: 11px;
  margin: 0 1px;
}

/* ---------- 用户系统（导航栏用户区 / 登录弹窗 / 收藏 / 评论） ---------- */
/* 导航用户栏 */
#nav-user {
  position: relative;
  width: fit-content;
  align-self: flex-start;
}

.nav-user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  width: fit-content;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--accent1);
  flex-shrink: 0;
}

.nav-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.nav-username {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.nav-login-btn {
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
}

.nav-login-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent1);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 180px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  padding: 6px;
  z-index: 100;
  display: none;
}

.user-dropdown.show {
  display: block;
}

/* 登录弹窗 */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
  animation: fadeIn .2s;
}

.login-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  animation: slideUp .3s;
}

.login-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.login-header h2 {
  margin: 0;
  font-size: 20px;
}

.login-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.login-provider {
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: .2s;
}

.login-provider:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent1);
}

.login-icon {
  font-size: 20px;
}

.login-hint {
  text-align: center;
  color: var(--dimmed);
  font-size: 12px;
  margin-top: 16px;
}

/* 收藏按钮 */
.fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
}

.fav-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.fav-btn.favorited {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

.fav-icon {
  font-size: 16px;
}

/* 评论区域 */
.comments-section {
  margin-top: 32px;
}

.comment-input-area {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

#comment-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 14px;
  resize: none;
}

.comment-rating-input {
  appearance: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #f59e0b;
  font-size: 14px;
}

.comment-item {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: var(--accent2);
  font-size: 14px;
}

.comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comment-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-rating {
  color: #f59e0b;
  font-size: 11px;
}

.comment-time {
  color: var(--dimmed);
}

.comment-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.no-comments {
  color: var(--dimmed);
  text-align: center;
  padding: 24px 0;
  font-size: 14px;
}