:root{
  --bg:#ffffff; --bg-alt:#f7f8fb; --bg-card:#ffffff;
  --text:#1a1c2c; --text-mute:#5b6172; --border:#e4e6ee;
  --accent:#4f46e5; --accent-2:#7c3aed; --accent-grad:linear-gradient(135deg,#4f46e5,#7c3aed);
  --success:#10b981; --warn:#f59e0b; --danger:#ef4444;
  --shadow:0 1px 2px rgba(20,20,40,.04),0 8px 24px rgba(20,20,40,.06);
  --radius:14px; --radius-sm:8px;
  --max:1180px;
  --font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  --mono:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
}
[data-theme="dark"]{
  --bg:#0f1117; --bg-alt:#151823; --bg-card:#1a1d29;
  --text:#e8eaf2; --text-mute:#9aa0b3; --border:#2a2e3d;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 8px 24px rgba(0,0,0,.4);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:var(--font); color:var(--text); background:var(--bg);
  line-height:1.6; -webkit-font-smoothing:antialiased;
}
.container{max-width:var(--max); margin:0 auto; padding:0 20px}
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}
.skip-link{position:absolute;left:-9999px;top:auto}
.skip-link:focus{left:10px;top:10px;background:var(--accent);color:#fff;padding:8px 12px;border-radius:6px;z-index:9999}

/* Header */
.site-header{position:sticky; top:0; z-index:50; background:var(--bg); border-bottom:1px solid var(--border); backdrop-filter:saturate(180%) blur(8px)}
.header-inner{display:flex; align-items:center; justify-content:space-between; padding:14px 20px; gap:18px}
.brand{display:flex; align-items:center; gap:8px; font-weight:700; font-size:18px; color:var(--text)}
.brand-icon{display:inline-grid;place-items:center;width:32px;height:32px;border-radius:9px;background:var(--accent-grad);color:#fff;font-size:16px}
.brand-tld{color:var(--accent); font-weight:600}
.main-nav{display:flex; gap:18px; flex-wrap:wrap}
.main-nav a{color:var(--text-mute); font-weight:500; font-size:15px}
.main-nav a:hover{color:var(--text); text-decoration:none}
.header-actions{display:flex; gap:8px}
.btn{cursor:pointer; border:1px solid var(--border); background:var(--bg-card); color:var(--text); padding:8px 14px; border-radius:8px; font-size:14px; font-family:inherit; transition:all .15s}
.btn:hover{border-color:var(--accent); color:var(--accent)}
.btn-ghost{background:transparent}
.btn-primary{background:var(--accent-grad); color:#fff; border:none}
.btn-primary:hover{filter:brightness(1.08); color:#fff}

/* Hero */
.hero{padding:42px 20px 22px; text-align:center}
.hero h1{font-size:clamp(28px,4vw,44px); margin:0 0 10px; line-height:1.15}
.hero h1 .accent{background:var(--accent-grad); -webkit-background-clip:text; background-clip:text; color:transparent}
.hero .lead{max-width:720px; margin:0 auto; color:var(--text-mute); font-size:17px}

/* Editor */
.editor-section{padding-bottom:30px}
.editor-toolbar{display:flex; flex-wrap:wrap; gap:8px; padding:10px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius) var(--radius) 0 0; box-shadow:var(--shadow)}
.tb-group{display:flex; gap:4px; padding-right:8px; border-right:1px solid var(--border)}
.tb-group:last-child{border-right:none}
.editor-toolbar button, .editor-toolbar select{cursor:pointer; border:1px solid transparent; background:transparent; color:var(--text); padding:6px 10px; border-radius:6px; font-size:14px; font-family:inherit; min-width:34px}
.editor-toolbar button:hover, .editor-toolbar select:hover{background:var(--bg-alt); border-color:var(--border)}
.editor-toolbar select{padding:6px 8px}
.dropdown{position:relative}
.dropdown-menu{position:absolute; top:calc(100% + 4px); right:0; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); box-shadow:var(--shadow); min-width:200px; z-index:30; padding:6px; display:flex; flex-direction:column; gap:2px}
.dropdown-menu button{padding:8px 12px; text-align:left; border:none; background:transparent; color:var(--text); cursor:pointer; border-radius:6px; font-size:14px; font-family:inherit}
.dropdown-menu button:hover{background:var(--bg-alt)}

.editor-wrapper{background:var(--bg-card); border:1px solid var(--border); border-top:none}
#editor{
  min-height:420px; padding:24px; outline:none; font-size:16px; line-height:1.7; color:var(--text);
}
#editor:empty:before{content:attr(data-placeholder); color:var(--text-mute); pointer-events:none}
#editor h1,#editor h2,#editor h3{margin:20px 0 8px}
#editor pre{background:var(--bg-alt); padding:12px; border-radius:8px; font-family:var(--mono); overflow:auto}
#editor blockquote{border-left:4px solid var(--accent); margin:14px 0; padding:6px 14px; color:var(--text-mute)}
.editor-wrapper.fullscreen{position:fixed; inset:0; z-index:90; border-radius:0; border:none}
.editor-wrapper.fullscreen #editor{min-height:calc(100vh - 80px); max-width:780px; margin:0 auto; padding:60px 24px}

.editor-statusbar{display:flex; flex-wrap:wrap; gap:18px; padding:10px 16px; background:var(--bg-card); border:1px solid var(--border); border-top:none; font-size:13px; color:var(--text-mute); border-radius:0 0 var(--radius) var(--radius)}
.editor-statusbar strong{color:var(--text); font-weight:600}
.status-saved{color:var(--success); margin-left:auto; font-weight:500}

.share-bar, .ai-bar{display:flex; flex-wrap:wrap; gap:8px; padding:14px 0; align-items:center}
.share-bar span{color:var(--text-mute); font-size:14px; margin-right:6px}
.chip{display:inline-flex; align-items:center; gap:6px; padding:7px 12px; border-radius:999px; font-size:13px; font-weight:500; border:1px solid var(--border); background:var(--bg-card); color:var(--text); cursor:pointer; font-family:inherit}
.chip:hover{border-color:var(--accent); text-decoration:none}
.chip.wa{color:#25d366} .chip.tw{color:#1da1f2} .chip.fb{color:#1877f2}
.chip.tg{color:#0088cc} .chip.rd{color:#ff4500} .chip.em{color:var(--text-mute)}
.chip.ln{color:var(--accent)}
.ai-btn{background:var(--accent-grad); color:#fff; border:none; padding:8px 14px; border-radius:999px; font-size:13px; font-weight:500; cursor:pointer; font-family:inherit}
.ai-btn:hover{filter:brightness(1.08)}

/* Features */
.features, .tools, .templates, .faq{padding:40px 20px}
.features h2, .tools h2, .templates h2, .faq h2{font-size:clamp(22px,3vw,30px); margin:0 0 22px}
.feature-grid, .tool-grid, .template-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:14px}
.feature, .tool-card, .template-card{background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:18px; transition:all .15s; display:block}
.tool-card, .template-card{color:var(--text)}
.tool-card:hover, .template-card:hover, .feature:hover{transform:translateY(-2px); border-color:var(--accent); text-decoration:none; box-shadow:var(--shadow)}
.feature h3, .tool-card h3, .template-card h3{margin:0 0 6px; font-size:16px}
.feature p, .tool-card p, .template-card p{margin:0; color:var(--text-mute); font-size:14px}

/* FAQ */
.faq details{background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); padding:14px 18px; margin-bottom:10px}
.faq summary{cursor:pointer; font-weight:600}
.faq details[open] summary{margin-bottom:8px}

/* Footer */
.site-footer{background:var(--bg-alt); border-top:1px solid var(--border); padding:40px 0 16px; margin-top:40px}
.footer-grid{display:grid; grid-template-columns:1.5fr repeat(3,1fr); gap:30px}
.site-footer h4{font-size:15px; margin:0 0 10px}
.site-footer ul{list-style:none; padding:0; margin:0}
.site-footer ul li{margin-bottom:6px}
.site-footer a{color:var(--text-mute); font-size:14px}
.site-footer a:hover{color:var(--accent)}
.footer-bottom{border-top:1px solid var(--border); padding-top:14px; margin-top:24px; font-size:13px; color:var(--text-mute); text-align:center}
@media (max-width:760px){
  .footer-grid{grid-template-columns:1fr 1fr}
  .main-nav{display:none}
}

/* Misc */
.legal-page{padding:40px 20px; max-width:820px; margin:0 auto}
.legal-page h1{font-size:32px}
.legal-page h2{font-size:20px; margin-top:30px}
.legal-page p{color:var(--text); line-height:1.75}

/* Modal */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);display:none;align-items:center;justify-content:center;z-index:100;padding:20px}
.modal-overlay.show{display:flex}
.modal{background:var(--bg-card);border-radius:var(--radius);padding:24px;max-width:480px;width:100%;box-shadow:var(--shadow);border:1px solid var(--border)}
.modal h3{margin:0 0 14px}
.modal input, .modal textarea{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--text);font-family:inherit;font-size:14px;margin-bottom:12px}
.modal-actions{display:flex;gap:8px;justify-content:flex-end}

@media print{
  .site-header,.editor-toolbar,.editor-statusbar,.share-bar,.ai-bar,.site-footer,.features,.tools,.templates,.faq,.hero{display:none!important}
  .editor-wrapper{border:none}
  #editor{padding:0; min-height:auto}
}
