/* ============================================================
 * CaseConvert.top — 全站样式
 * 设计：靛紫渐变主题 + 卡片式工作区，移动端优先
 * ============================================================ */
:root {
  --indigo: #4f46e5;
  --violet: #7c3aed;
  --indigo-dark: #3730a3;
  --ink: #1e293b;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --bg: #f4f5fb;
  --card: #ffffff;
  --line: #e2e8f0;
  --chip: #eef2ff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 41, 59, .06), 0 8px 24px -12px rgba(79, 70, 229, .18);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(60rem 20rem at 50% -8rem, rgba(124, 58, 237, .10), transparent 60%),
    radial-gradient(40rem 16rem at 85% -6rem, rgba(79, 70, 229, .10), transparent 60%),
    var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 19px; }
.logo-text em { font-style: normal; color: var(--indigo); }
.header-nav { display: flex; align-items: center; gap: 18px; }
.header-nav a { color: var(--ink-soft); text-decoration: none; font-size: 15px; font-weight: 500; }
.header-nav a:hover { color: var(--indigo); }
.lang-switch {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
  font-size: 14px; color: var(--ink-soft); background: var(--card); cursor: pointer;
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 44px 0 26px; }
.hero h1 {
  font-size: clamp(26px, 4.5vw, 40px);
  line-height: 1.2;
  background: linear-gradient(100deg, var(--indigo), var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  margin-bottom: 14px;
}
.hero-desc { max-width: 760px; margin: 0 auto; color: var(--ink-soft); font-size: clamp(15px, 2vw, 17px); }

/* ---------- 工具工作区 ---------- */
.tool-panel { margin-top: 8px; }
.workspace {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.ws-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.ws-label { font-weight: 600; font-size: 15px; color: var(--ink); }
.ws-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn {
  border: 1px solid var(--line); background: var(--chip); color: var(--indigo-dark);
  font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.chip-btn:hover { background: #e0e7ff; }
.chip-btn:active { transform: scale(.97); }

#inputText {
  width: 100%; resize: vertical; min-height: 140px;
  border: 1px solid var(--line); border-radius: 10px; padding: 14px;
  font-size: 16px; font-family: inherit; line-height: 1.6; color: var(--ink);
  background: #fbfcff;
}
#inputText:focus { outline: 2px solid rgba(79, 70, 229, .45); outline-offset: 1px; border-color: var(--indigo); }

.ws-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.stats-bar { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-faint); font-size: 13px; }
.stat b { color: var(--indigo); font-weight: 700; margin-right: 2px; }

/* 开关 */
.ws-toggles { display: flex; align-items: center; gap: 10px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider {
  width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative;
  transition: background .2s; flex: none;
}
.slider::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--indigo); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch-label { font-size: 13px; color: var(--ink-soft); font-weight: 500; }

/* ---------- 模式卡片网格 ---------- */
.modes-head { text-align: center; margin: 26px 0 16px; }
.modes-title { font-size: 22px; color: var(--ink); }
.modes-sub { color: var(--ink-soft); font-size: 14px; margin-top: 4px; }
.mode-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.mode-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 8px; min-height: 108px;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  font: inherit;
}
.mode-card:hover { border-color: var(--indigo); box-shadow: var(--shadow); transform: translateY(-2px); }
.mode-card.copied { border-color: #16a34a; }
.mc-name { font-weight: 700; font-size: 15px; color: var(--indigo-dark); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.mc-preview {
  color: var(--ink-faint); font-size: 13px; line-height: 1.45;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-all; min-height: 2.9em; flex: 1;
}
.mc-preview.empty { font-style: italic; opacity: .7; }
.mc-copy {
  align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--indigo);
  background: var(--chip); border-radius: 6px; padding: 3px 10px;
}
.mode-card.copied .mc-copy { color: #16a34a; background: #dcfce7; }

/* ---------- 内容区 ---------- */
.content-section { margin: 46px 0 10px; }
.content-section > h2 { font-size: 24px; margin-bottom: 14px; color: var(--ink); }
.content-section > p { color: var(--ink-soft); margin-bottom: 12px; }
.mode-doc { margin: 22px 0; }
.mode-doc h3 { font-size: 18px; color: var(--indigo-dark); margin-bottom: 6px; }
.mode-doc p { color: var(--ink-soft); }

.guide-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 16px; }
.guide-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.guide-card h3 { font-size: 16px; color: var(--ink); margin-bottom: 8px; }
.guide-card p { font-size: 14px; color: var(--ink-soft); }

/* FAQ */
.faq-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.faq-item summary { padding: 14px 18px; font-weight: 600; cursor: pointer; list-style: none; position: relative; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  color: var(--indigo); font-size: 20px; font-weight: 400;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { padding: 0 18px 16px; color: var(--ink-soft); font-size: 15px; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 56px; padding: 28px 0 36px; background: rgba(255,255,255,.6); }
.footer-inner { text-align: center; color: var(--ink-faint); font-size: 13px; }
.footer-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; margin: 10px 0; }
.footer-nav a { color: var(--ink-soft); text-decoration: none; }
.footer-nav a:hover { color: var(--indigo); }
.related-tool { margin-top: 6px; }
.related-tool a { color: var(--indigo); text-decoration: none; }
.disclaimer { max-width: 720px; margin: 10px auto 0; font-size: 12px; line-height: 1.5; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #16a34a; }

/* ---------- 合规页（About / Contact / Privacy） ---------- */
.legal { max-width: 780px; padding-top: 36px; padding-bottom: 20px; }
.legal article { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px 38px; }
.legal h1 { font-size: 28px; margin-bottom: 6px; color: var(--ink); }
.legal h2 { font-size: 19px; margin: 26px 0 8px; color: var(--indigo-dark); }
.legal p, .legal li { color: var(--ink-soft); font-size: 15px; line-height: 1.7; }
.legal p { margin: 10px 0; }
.legal ul { padding-left: 22px; margin: 8px 0; }
.legal li { margin: 6px 0; }
.legal a { color: var(--indigo); }
.legal .updated { color: var(--ink-faint); font-size: 14px; margin-bottom: 18px; }
.legal .callout {
  background: var(--chip); border-left: 4px solid var(--indigo);
  border-radius: 8px; padding: 14px 18px; margin: 16px 0;
}
.legal code { background: var(--chip); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
@media (max-width: 640px) {
  .legal article { padding: 22px 20px; }
  .legal h1 { font-size: 24px; }
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .header-inner { height: 54px; }
  .header-nav { gap: 12px; }
  .header-nav a { font-size: 14px; }
  .header-nav a:nth-child(2) { display: none; } /* 小屏隐藏 Modes 链接，保留 Converter/FAQ */
  .hero { padding: 30px 0 18px; }
  .card-pad { padding: 14px; }
  .mode-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mode-card { min-height: 118px; padding: 12px; }
  .mc-name { font-size: 13px; }
  .ws-foot { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 400px) {
  .mode-grid { grid-template-columns: 1fr; }
}
