:root{
  --bg:#f5f5f7;
  --card:#ffffff;
  --text:#111;
  --muted:#666;
  --stroke:rgba(0,0,0,.12);
  --blue:#0071e3;
  --radius:14px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

.app{
  display:grid;
  grid-template-columns:340px 1fr;
  min-height:100vh;
}

/* Sidebar */
.sidebar{
  border-right:1px solid var(--stroke);
  padding:16px;
  background:rgba(255,255,255,.65);
  backdrop-filter:blur(10px);
  display:flex;
  flex-direction:column;
  gap:12px;
}

.brand-title{font-weight:800;font-size:16px}
.brand-sub{font-size:12px;color:var(--muted);margin-top:4px}

.side-actions{display:grid;gap:10px}
.side-actions.two-col{grid-template-columns:1fr 1fr}

.search-row{display:flex;gap:8px}

.article-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow:auto;
  padding-right:6px;
  flex:1;
  align-items:stretch;
}

.article-item{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:12px;
  padding:12px 12px 10px;
  cursor:pointer;
  transition:transform .06s ease, box-shadow .06s ease, border-color .06s ease;
  min-height:auto;
  height:auto;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.article-head{
  display:flex;
  gap:10px;
  align-items:flex-start;
}

.article-icon{
  width:30px;
  height:30px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.04);
  font-size:15px;
  flex-shrink:0;
}

.article-head-text{
  min-width:0;
  flex:1;
}

.article-title{
  font-weight:700;
  font-size:15px;
  line-height:1.3;
  color:var(--text);
  word-break:break-word;
}

.article-meta-top{
  font-size:12px;
  color:var(--muted);
  margin-top:3px;
  line-height:1.35;
}

.article-sub{
  font-size:12px;
  color:var(--muted);
  line-height:1.35;
}

.article-stage-badge{
  align-self:flex-start;
  font-size:11px;
  line-height:1;
  padding:6px 8px;
  border-radius:999px;
  background:rgba(0,113,227,.08);
  color:#0071e3;
  border:1px solid rgba(0,113,227,.14);
}
.article-item:hover{
  transform:translateY(-1px);
}

.article-item.active {
  border-color: #3b82f6;
  background: #eef5ff;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.article-title{font-weight:700;font-size:14px}
.article-sub{font-size:12px;color:var(--muted);margin-top:4px}

.sidebar-footer{display:grid;gap:10px}
.hint{font-size:12px;color:var(--muted);line-height:1.4}

/* Main */
.main{padding:16px}

.topbar{
  display:flex;
  gap:12px;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:12px;
}

.meta{
  display:grid;
  grid-template-columns:1.2fr 1fr 1fr;
  gap:10px;
  flex:1;
}

.input{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--stroke);
  border-radius:12px;
  background:var(--card);
  font-size:14px;
}
.input.title{font-weight:750}

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

.btn{
  padding:10px 12px;
  border:1px solid var(--stroke);
  border-radius:12px;
  background:var(--card);
  cursor:pointer;
  font-size:14px;
}
.btn:hover{filter:brightness(.98)}
.btn.primary{background:var(--blue);border-color:transparent;color:#fff}
.btn.danger{border-color:rgba(255,0,0,.18);color:#b00020}

.tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.tab{
  padding:8px 10px;
  border:1px solid var(--stroke);
  border-radius:999px;
  background:var(--card);
  cursor:pointer;
  font-size:13px;
}
.tab.active{
  border-color:rgba(0,113,227,.45);
  box-shadow:0 12px 28px rgba(0,0,0,.06);
}

/* Editor + Preview */
.editor-wrap{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  overflow:hidden;
}

.editor-split{
  display:grid;
  grid-template-columns:1fr 1fr;
  min-height:72vh;
}

.editor-pane{
  border-right:1px solid var(--stroke);
  padding-left:1px;
}

.preview-pane{
  display:flex;
  flex-direction:column;
  min-height:72vh;
}

.preview-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-bottom:1px solid var(--stroke);
  background:rgba(255,255,255,.6);
}

.preview-title{font-weight:750;font-size:13px;color:var(--muted)}
.preview-sub{font-size:12px;color:var(--muted);margin-top:2px}

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

.preview-frame{
  width:100%;
  height:100%;
  border:0;
  flex:1;
  background:#fff;
}

.statusbar{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-top:1px solid var(--stroke);
  color:var(--muted);
  font-size:12px;
}

/* Mobile */
@media (max-width: 980px){
  .app{grid-template-columns:1fr}
  .sidebar{display:none}
  .meta{grid-template-columns:1fr}
  .editor-split{grid-template-columns:1fr}
  .editor-pane{border-right:0;border-bottom:1px solid var(--stroke)}
}
/* Heading labels like NeuronWriter */

h1,h2,h3,h4,h5,h6{
  position:relative;
}

h1::before,
h2::before,
h3::before,
h4::before,
h5::before,
h6::before{
  position:absolute;
  left:-48px;
  top:0.2em;
  font-size:12px;
  font-weight:700;
  letter-spacing:.04em;
  color:#9ca3af;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

h1::before{content:"H1";}
h2::before{content:"H2";}
h3::before{content:"H3";}
h4::before{content:"H4";}
h5::before{content:"H5";}
h6::before{content:"H6";}

.seo-review-pane{
  background:var(--card);
  border-left:1px solid var(--stroke);
  min-height:72vh;
  padding:18px;
  overflow:auto;
}

.seo-review{
  display:grid;
  gap:18px;
}

.seo-top{
  display:grid;
  grid-template-columns: 340px 1fr;
  gap:16px;
  align-items:stretch;
}

.seo-score-card{
  display:flex;
  align-items:center;
  gap:16px;
  padding:18px;
  border:1px solid var(--stroke);
  border-radius:16px;
  background:#fff;
}

.seo-score-ring{
  --score: 0;
  --score-color: #2563eb;
  width:110px;
  height:110px;
  border-radius:50%;
  background:
    conic-gradient(var(--score-color) calc(var(--score) * 1%), rgba(0,0,0,.08) 0);
  display:grid;
  place-items:center;
  position:relative;
  flex-shrink:0;
}

.seo-score-ring::before{
  content:"";
  position:absolute;
  inset:10px;
  background:#fff;
  border-radius:50%;
}

.seo-score-value{
  position:relative;
  z-index:1;
  font-size:28px;
  font-weight:800;
  color:#111;
}

.seo-score-meta h3{
  margin:0 0 6px;
  font-size:22px;
}
.seo-score-meta p{
  margin:0 0 4px;
  font-weight:700;
}
.seo-score-meta small{
  color:var(--muted);
}

.seo-stats-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:12px;
}

.seo-stat{
  border:1px solid var(--stroke);
  border-radius:14px;
  background:#fff;
  padding:14px;
}
.seo-stat span{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:8px;
}
.seo-stat strong{
  font-size:20px;
}

.seo-bars{
  display:grid;
  gap:12px;
  border:1px solid var(--stroke);
  border-radius:16px;
  background:#fff;
  padding:16px;
}

.seo-bar-row{
  display:grid;
  grid-template-columns:140px 1fr 50px;
  gap:12px;
  align-items:center;
}

.seo-bar-label{
  font-weight:700;
}

.seo-bar-track{
  height:10px;
  border-radius:999px;
  background:rgba(0,0,0,.08);
  overflow:hidden;
}

.seo-bar-fill{
  height:100%;
  border-radius:999px;
}

.seo-bar-value{
  font-weight:700;
  text-align:right;
}

.seo-columns{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}

.seo-box{
  border:1px solid var(--stroke);
  border-radius:16px;
  background:#fff;
  padding:16px;
}

.seo-box h4{
  margin:0 0 12px;
  font-size:16px;
}

.seo-box ul{
  margin:0;
  padding-left:18px;
}

.seo-box li{
  margin:8px 0;
}

.seo-empty{
  padding:24px;
  color:var(--muted);
}

@media (max-width: 980px){
  .seo-top{
    grid-template-columns:1fr;
  }

  .seo-stats-grid{
    grid-template-columns:1fr 1fr;
  }

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

  .seo-bar-row{
    grid-template-columns:110px 1fr 42px;
  }
}
.seo-bar-label{
  font-weight:700;
  display:flex;
  align-items:center;
  gap:8px;
  position:relative;
}

.seo-info-wrap{
  position:relative;
  display:inline-flex;
  align-items:center;
}

.seo-info-btn{
  width:18px;
  height:18px;
  border-radius:50%;
  border:1px solid rgba(0,0,0,.15);
  background:#fff;
  color:#666;
  font-size:11px;
  font-weight:700;
  line-height:1;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
}

.seo-info-btn:hover{
  background:#f5f5f7;
}

.seo-tooltip{
  position:absolute;
  left:26px;
  top:50%;
  transform:translateY(-50%);
  width:240px;
  padding:10px 12px;
  border-radius:12px;
  background:#111;
  color:#fff;
  font-size:12px;
  line-height:1.5;
  box-shadow:0 16px 40px rgba(0,0,0,.18);
  opacity:0;
  visibility:hidden;
  transition:all .15s ease;
  z-index:20;
  pointer-events:none;
}

.seo-info-wrap:hover .seo-tooltip,
.seo-info-wrap:focus-within .seo-tooltip{
  opacity:1;
  visibility:visible;
}

.seo-tooltip strong{
  display:block;
  margin-bottom:6px;
  font-size:12px;
}
.seo-check-list{
  margin:0;
  padding:0;
  list-style:none;
  display:grid;
  gap:10px;
}

.seo-check-item{
  display:flex;
  gap:10px;
  align-items:flex-start;
  line-height:1.45;
}

.seo-check-icon{
  flex-shrink:0;
  width:20px;
  text-align:center;
  font-size:14px;
  margin-top:1px;
}

.seo-item-good{
  color:#166534;
}

.seo-item-warn{
  color:#9a6700;
}

.seo-item-bad{
  color:#b42318;
}
/* Disable heading labels inside SEO review */
.seo-review h1::before,
.seo-review h2::before,
.seo-review h3::before,
.seo-review h4::before,
.seo-review h5::before,
.seo-review h6::before{
  content: none !important;
}