:root{
  --bg:#f8fafc;
  --bg2:#eef2ff;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --primary:#0f172a;
  --accent:#4f46e5;
  --radius:18px;
  --shadow:0 18px 40px rgba(15,23,42,.08);
}

*{box-sizing:border-box;}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  color:var(--text);
  background:linear-gradient(180deg,var(--bg),var(--bg2));
}
a{color:inherit;text-decoration:none;}
.container{max-width:1200px;margin:0 auto;padding:44px 20px;}
.section{margin-bottom:56px;}
.card{
  background:var(--card);
  border:1px solid rgba(229,231,235,.75);
  border-radius:var(--radius);
  padding:28px;
  box-shadow:var(--shadow);
}
.muted{color:var(--muted);}
.kicker{font-size:13px;color:var(--muted);}
.h1{font-size:42px;line-height:1.2;margin:12px 0 0;}
.h2{font-size:22px;margin:0;}
.p{font-size:16px;line-height:1.75;margin-top:12px;}

header{
  position:sticky;top:0;z-index:10;
  background:rgba(255,255,255,.82);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
}
.nav{
  max-width:1200px;margin:0 auto;padding:14px 20px;
  display:flex;align-items:center;justify-content:space-between;
}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;letter-spacing:.2px;}
.brand-badge{
  width:34px;height:34px;border-radius:12px;
  background:linear-gradient(135deg,var(--accent),#1d4ed8);
  box-shadow:0 10px 18px rgba(79,70,229,.25);
}
nav a{font-size:14px;color:var(--muted);margin:0 14px;}
nav a:hover{color:var(--text);}
nav a.active{color:var(--text);font-weight:700;}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:10px 14px;border-radius:12px;
  border:1px solid var(--border);background:#fff;
  font-size:14px;cursor:pointer;
}
.btn.primary{
  border:none;color:#fff;
  background:linear-gradient(135deg,var(--primary),#111827);
}
.btn.soft{
  border:none;
  background:linear-gradient(135deg,#eef2ff,#ecfeff);
  color:#1e293b;
}
.btn.full{width:100%;}
.btn:disabled{opacity:.55;cursor:not-allowed;}
.btn.danger{
  border-color: rgba(239,68,68,.35);
  color: #b91c1c;
  background: #fff;
}
.btn.danger:hover{ background: rgba(239,68,68,.06); }

.grid2{display:grid;grid-template-columns:1.1fr .9fr;gap:34px;align-items:center;}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:24px;}

.badges{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px;}
.badge{
  padding:7px 12px;border-radius:999px;font-size:13px;
  color:#1e293b;background:linear-gradient(135deg,#eef2ff,#ecfeff);
  border:1px solid rgba(229,231,235,.6);
}
.hero-list{list-style:none;padding-left:0;margin:16px 0 0;}
.hero-list li{margin:10px 0;color:#334155;font-size:14px;}

.carousel{
  position:relative;overflow:hidden;height:340px;border-radius:var(--radius);
  background:linear-gradient(135deg,#e2e8f0,#eef2ff);
}
.slide{position:absolute;inset:0;opacity:0;transition:opacity .8s ease;}
.slide.active{opacity:1;}
.slide img{width:100%;height:100%;object-fit:cover;display:block;border-radius:var(--radius);}

.stat{text-align:center;padding:24px;}
.stat strong{display:block;font-size:34px;}
.stat .muted{margin-top:6px;font-size:13px;}

.feature-icon{
  width:54px;height:54px;border-radius:16px;
  background:linear-gradient(135deg,var(--accent),#2563eb);
  box-shadow:0 14px 22px rgba(79,70,229,.22);
  display:flex;align-items:center;justify-content:center;
  margin-bottom:16px;
}

.banner{
  border:1px solid rgba(99,102,241,.25);
  background:linear-gradient(135deg,#eef2ff,#ecfeff);
  box-shadow:none;
}

.hr{height:1px;background:var(--border);margin:18px 0;}
.stack{display:flex;flex-direction:column;gap:16px;}
.upload{
  border:2px dashed rgba(148,163,184,.55);
  background:#f1f5f9;border-radius:14px;padding:26px;text-align:center;cursor:pointer;
}
.upload .hint{margin-top:10px;font-size:12px;color:var(--muted);}

.steps{margin:14px 0 0;padding-left:0;list-style:none;}
.steps li{
  display:flex;gap:10px;align-items:flex-start;
  padding:10px 0;border-bottom:1px solid rgba(229,231,235,.7);
}
.dot{
  width:26px;height:26px;border-radius:999px;background:#e2e8f0;
  display:flex;align-items:center;justify-content:center;
  font-size:12px;color:#334155;
}
.dot.done{background:var(--primary);color:#fff;}
.dot.active{background:#c7d2fe;color:#1e293b;}

.steps.compact li{ padding:8px 0; }
.compact-flow{ padding: 18px; }
.compact-flow .h2{ font-size: 18px; }
.compact-flow .muted.small{ font-size: 12px; }

.editor{display:grid;grid-template-columns:1fr auto 1fr;gap:14px;align-items:stretch;}
textarea{
  width:100%;height:260px;border-radius:12px;border:1px solid var(--border);
  padding:12px;font-size:14px;resize:none;outline:none;
}
textarea:focus{border-color:rgba(99,102,241,.6);box-shadow:0 0 0 4px rgba(99,102,241,.12);}

table{width:100%;border-collapse:collapse;font-size:14px;}
th,td{padding:10px;border-bottom:1px solid rgba(229,231,235,.7);text-align:left;white-space:nowrap;}
thead th{color:var(--muted);font-weight:600;font-size:12px;}

.page{display:block;}


footer{text-align:center;padding:36px 20px;color:var(--muted);font-size:13px;}

/* ===== Detect layout: 1行2列 ===== */
.detect-layout{
  display:grid;
  grid-template-columns: 1fr 2fr;
  grid-template-rows: auto;
  gap: 10px;
  align-items:start;
}
.left-panel{ grid-column: 1; }
.right-panel{ grid-column: 2; }

.quota{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  font-size:14px;
}
.quota b{ font-size:15px; }
.quota .sep{ color: rgba(100,116,139,.9); }
.result-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
}
.history-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 8px;
}

/* Custom Modal Styles */
#commonModal, #rewriteViewModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.custom-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1001;
}

#rewriteViewModal .custom-modal {
  z-index: 1001;
}

.custom-modal-lg {
  max-width: 800px;
}

.custom-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
}

.custom-modal-close {
  font-size: 28px;
  line-height: 1;
  color: #0f172a;
  cursor: pointer;
  padding: 0 8px;
  user-select: none;
}

.custom-modal-close:hover {
  color: #666;
}

.custom-modal-body {
  padding: 20px;
  color: #0f172a;
  max-height: 60vh;
  overflow-y: auto;
}

.custom-modal-body h6 {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 10px;
}

.custom-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.custom-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.custom-btn-primary {
  background: #4a90e2;
  color: white;
}

.custom-btn-primary:hover {
  background: #357abd;
}

.custom-btn-secondary {
  background: #6c757d;
  color: white;
}

.custom-btn-secondary:hover {
  background: #5a6268;
}

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

@media (max-width:960px){
  .grid2,.grid3,.editor,.detect-layout{grid-template-columns:1fr;}
  .container{padding:40px 16px;}
  .h1{font-size:34px;}
}
