*{box-sizing:border-box;margin:0;padding:0}
:root{
--bg:#ffffff;--bg2:#f7f7f5;--bg3:#f0f0ec;
--text:#1a1a1a;--text2:#555;--text3:#999;
--border:#e0e0da;--border2:#ccc;
--blue:#2563eb;--blue-bg:#eff6ff;--blue-text:#1d4ed8;
--green:#16a34a;--green-bg:#f0fdf4;--green-text:#15803d;
--red:#dc2626;--red-bg:#fef2f2;
--radius:8px;--radius-lg:12px
}
[data-theme="dark"]{
--bg:#1a1a1a;--bg2:#242424;--bg3:#121212;
--text:#eeeeee;--text2:#bbbbbb;--text3:#888888;
--border:#333333;--border2:#444444;
--blue:#3b82f6;--blue-bg:rgba(59,130,246,0.1);--blue-text:#93c5fd;
--green:#22c55e;--green-bg:rgba(34,197,94,0.1);--green-text:#86efac;
}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:var(--bg3);color:var(--text);font-size:14px;transition:background 0.3s, color 0.3s}
.app{display:grid;grid-template-columns:300px 1fr;height:100vh;overflow:hidden}
/* SIDEBAR */
.sidebar{background:var(--bg2);border-right:1px solid var(--border);display:flex;flex-direction:column;overflow-y:auto}
.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}
.logo{padding:14px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:8px}
.logo-l{display:flex;align-items:center;gap:8px}
.logo-icon{width:28px;height:28px;background:var(--blue);border-radius:6px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:14px}
.logo h1{font-size:14px;font-weight:600}
.logo span{font-size:11px;color:var(--text3);display:block;margin-top:1px}

/* THEME SWITCHER */
.theme-btn{background:var(--bg3);border:1px solid var(--border);border-radius:var(--radius);padding:4px;cursor:pointer;display:flex;gap:2px}
.theme-opt{padding:4px 6px;border-radius:4px;font-size:12px;color:var(--text3)}
.theme-opt.on{background:var(--bg);color:var(--blue);box-shadow:0 1px 2px rgba(0,0,0,0.1)}

.sec{border-bottom:1px solid var(--border)}
.sec summary{padding:12px 16px;font-size:10px;font-weight:600;color:var(--text3);text-transform:uppercase;letter-spacing:.7px;cursor:pointer;list-style:none;display:flex;align-items:center;justify-content:space-between;user-select:none;background:var(--bg2)}
.sec summary:hover{color:var(--text2)}
.sec summary::-webkit-details-marker{display:none}
.sec summary::after{content:'▼';font-size:8px;transition:0.2s;opacity:0.5}
.sec[open] summary{border-bottom:1px solid var(--border);margin-bottom:12px}
.sec[open] summary::after{transform:rotate(180deg)}
.sec-content{padding:0 16px 12px}

.fg{margin-bottom:14px}
.fg label{font-size:12px;color:var(--text2);display:block;margin-bottom:6px;font-weight:500}
.fg input,.fg select,.fg textarea{width:100%;padding:8px 10px;border:1px solid var(--border2);border-radius:var(--radius);background:var(--bg);color:var(--text);font-size:12px;font-family:inherit;transition:border 0.2s}
.fg input:focus,.fg select:focus,.fg textarea:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 2px var(--blue-bg)}
.fg textarea{resize:none;height:60px;line-height:1.5}

/* CHECKBOX GROUP */
.cb-group{display:flex;flex-direction:column;gap:8px;margin-top:4px}
.cb-item{display:flex;align-items:center;gap:10px;font-size:12px;color:var(--text2);cursor:pointer;user-select:none;padding:2px 0}
.cb-item:hover{color:var(--text)}
.cb-item input[type="checkbox"], .cb-item input[type="radio"]{width:15px;height:15px;cursor:pointer;accent-color:var(--blue);margin:0}

.api-wrap{position:relative}
.api-wrap input{padding-right:34px}
.eye{position:absolute;right:8px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;color:var(--text3);font-size:16px;padding:0;line-height:1}
.badge{display:inline-flex;align-items:center;gap:3px;font-size:10px;padding:2px 7px;border-radius:20px;font-weight:500}
.badge-blue{background:var(--blue-bg);color:var(--blue-text)}
.badge-green{background:var(--green-bg);color:var(--green-text)}
.badge-warn{background:#fffbeb;color:#92400e}
.slider-row{display:flex;align-items:center;gap:8px}
.slider-row input[type=range]{flex:1;accent-color:var(--blue)}
.sv{font-size:12px;font-weight:500;min-width:34px;text-align:right}
.tags{display:flex;flex-wrap:wrap;gap:5px;margin-top:4px}
.tag{font-size:11px;padding:3px 9px;border-radius:20px;border:1px solid var(--border2);color:var(--text2);cursor:pointer;user-select:none;transition:.15s}
.tag:hover{border-color:var(--blue);color:var(--blue)}
.tag.on{background:var(--blue-bg);border-color:transparent;color:var(--blue-text)}
.toggle-row{display:flex;align-items:center;justify-content:space-between}
.toggle{position:relative;display:inline-block;width:34px;height:19px;cursor:pointer;flex-shrink:0}
.toggle input{opacity:0;width:0;height:0;position:absolute}
.t-track{position:absolute;inset:0;border-radius:20px;background:var(--border2);transition:.2s}
.t-thumb{position:absolute;left:2px;top:2px;width:15px;height:15px;border-radius:50%;background:#fff;transition:.2s;box-shadow:0 1px 3px rgba(0,0,0,.2)}
.toggle input:checked ~ .t-track{background:var(--blue)}
.toggle input:checked ~ .t-thumb{left:17px}
/* MAIN */
.main{display:flex;flex-direction:column;overflow:hidden}
.topbar{padding:12px 16px;border-bottom:1px solid var(--border);background:var(--bg);display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.topbar h2{font-size:14px;font-weight:600}
.topbar-r{display:flex;gap:6px;align-items:center}
.btn{display:inline-flex;align-items:center;gap:5px;padding:6px 12px;border-radius:var(--radius);border:1px solid var(--border2);background:transparent;color:var(--text);font-size:12px;cursor:pointer;font-family:inherit;transition:.15s}
.btn:hover{background:var(--bg2)}
.btn:active{transform:scale(.98)}
.btn-blue{background:var(--blue);border-color:transparent;color:#fff}
.btn-blue:hover{background:#1d4ed8}
.btn-green{background:var(--green-bg);border-color:var(--green);color:var(--green-text)}
.body{flex:1;display:flex;flex-direction:column;overflow:hidden;padding:14px;gap:12px}
/* KEYWORD AREA */
.kw-box{background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-lg);padding:14px;flex-shrink:0}
.kw-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.kw-header span{font-size:13px;font-weight:500}
.kw-row{display:flex;gap:8px}
.kw-row input{flex:1;padding:7px 12px;border:1px solid var(--border2);border-radius:var(--radius);font-size:13px;font-family:inherit;color:var(--text);background:var(--bg)}
.kw-row input:focus{outline:none;border-color:var(--blue)}
.kw-tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
#title-list{max-height:160px;overflow-y:auto;padding-right:4px}
#title-list::-webkit-scrollbar{width:4px}
#title-list::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}
.kw-pill{display:inline-flex;align-items:center;gap:5px;font-size:12px;padding:4px 10px;border-radius:20px;border:1px solid var(--border2);background:var(--bg2);color:var(--text)}
.kw-pill.main-kw{border-color:var(--blue);background:var(--blue-bg);color:var(--blue-text)}
.kw-pill .rm{background:none;border:none;cursor:pointer;color:inherit;padding:0;font-size:13px;line-height:1;opacity:.6}
.kw-pill .rm:hover{opacity:1}
.ctx-row{margin-top:10px;padding-top:10px;border-top:1px solid var(--border)}
.ctx-row label{font-size:12px;color:var(--text2);display:block;margin-bottom:4px}
.ctx-row textarea{width:100%;padding:7px 10px;border:1px solid var(--border2);border-radius:var(--radius);font-size:12px;color:var(--text);background:var(--bg);resize:none;height:46px;line-height:1.5;font-family:inherit}
.ctx-row textarea:focus{outline:none;border-color:var(--blue)}
/* PREVIEW */
.preview-box{flex:1;background:var(--bg);border:1px solid var(--border);border-radius:var(--radius-lg);display:flex;flex-direction:column;overflow:hidden;min-height:300px}
.tab-bar{display:flex;border-bottom:1px solid var(--border);background:var(--bg2);flex-shrink:0}
.tab{padding:8px 14px;font-size:12px;cursor:pointer;color:var(--text2);border-bottom:2px solid transparent;margin-bottom:-1px;transition:.15s;white-space:nowrap}
.tab:hover{color:var(--text)}
.tab.on{color:var(--blue);font-weight:500;border-bottom-color:var(--blue)}
.fs-btn{background:none;border:none;color:var(--text3);cursor:pointer;padding:0 12px;font-size:16px;display:flex;align-items:center;transition:.15s}
.fs-btn:hover{color:var(--blue);background:var(--bg3)}

/* FULLSCREEN MODE */
.preview-box.expanded{
  position:fixed;
  inset:20px;
  z-index:1000;
  box-shadow:0 0 0 100vmax rgba(0,0,0,0.5), 0 20px 50px rgba(0,0,0,0.3);
  border-radius:var(--radius-lg);
  min-height:0 !important;
}
.preview-box.expanded .tab-content{
  max-width:900px;
  margin:0 auto;
  width:100%;
}

.tab-content{display:none;flex:1;overflow-y:auto;padding:16px}
.tab-content.on{display:flex !important;flex-direction:column}
.tab-content::-webkit-scrollbar{width:4px}.tab-content::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}
/* preview rendered */
.rendered h1{font-size:22px;font-weight:700;margin:0 0 12px}
.featured-img{width:100%;height:auto;border-radius:var(--radius);margin-bottom:20px;display:block;background:var(--bg2);min-height:200px;object-fit:cover;border:1px solid var(--border)}
.inline-img{width:100%;height:auto;border-radius:var(--radius);margin:16px 0;display:block;background:var(--bg2);min-height:150px;object-fit:cover;border:1px solid var(--border)}
.rendered h2{font-size:18px;font-weight:600;margin:20px 0 8px}
.rendered h3{font-size:15px;font-weight:600;margin:16px 0 6px}
.rendered p{line-height:1.75;margin-bottom:12px;font-size:14px}
.rendered ul,.rendered ol{padding-left:20px;margin-bottom:12px}
.rendered li{line-height:1.75;font-size:14px}
.rendered strong{font-weight:600}
.rendered a{color:var(--blue)}
/* code */
.code-view{font-family:monospace;font-size:12px;line-height:1.7;white-space:pre-wrap;color:var(--text);background:var(--bg2);padding:14px;border-radius:var(--radius);border:1px solid var(--border);flex:1;overflow-y:auto}
/* seo */
.seo-grid{display:grid;gap:10px}
.seo-card{background:var(--bg2);border-radius:var(--radius);padding:12px;border:1px solid var(--border)}
.seo-card .slabel{font-size:11px;color:var(--text3);margin-bottom:4px;font-weight:500;text-transform:uppercase;letter-spacing:.5px}
.seo-card .sval{font-size:13px;color:var(--text);line-height:1.5}
.seo-card .sval.good{color:var(--green-text)}
.seo-card .sval.warn{color:#d97706}
/* empty state */
.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1;gap:10px;color:var(--text3)}
.empty-icon{font-size:36px}
.empty p{font-size:13px}
/* export bar */
.export-bar{padding:10px 16px;border-top:1px solid var(--border);background:var(--bg2);display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.export-bar .elabel{font-size:12px;color:var(--text2)}
.export-btns{display:flex;gap:6px}
/* progress */
.prog{padding:20px;display:flex;flex-direction:column;align-items:center;gap:12px;flex:1;justify-content:center}
.prog-bar{width:100%;max-width:300px;height:4px;background:var(--border);border-radius:4px;overflow:hidden}
.prog-fill{height:100%;background:var(--blue);border-radius:4px;transition:width .3s}
.prog p{font-size:13px;color:var(--text2)}
/* toast container */
.toast-container{position:fixed;bottom:20px;right:20px;display:flex;flex-direction:column;gap:10px;z-index:999;pointer-events:none}
.toast{background:var(--text);color:var(--bg);padding:10px 16px;border-radius:var(--radius);font-size:13px;opacity:0;transform:translateY(10px);transition:.3s;pointer-events:auto;box-shadow:0 4px 12px rgba(0,0,0,0.15);border:1px solid var(--border)}
.toast.show{opacity:1;transform:translateY(0)}
/* fm preview */
.fm-pre{font-family:monospace;font-size:12px;line-height:1.8;white-space:pre-wrap;background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);padding:14px;color:var(--text)}

/* HISTORY */
.history-list{display:flex;flex-direction:column;gap:10px}
.history-item{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);padding:12px;display:flex;flex-direction:column;gap:6px;transition:.15s}
.history-item:hover{border-color:var(--blue)}
.history-top{display:flex;justify-content:space-between;align-items:flex-start}
.history-title{font-weight:600;font-size:13px;color:var(--text);cursor:pointer}
.history-title:hover{color:var(--blue);text-decoration:underline}
.history-date{font-size:11px;color:var(--text3)}
.history-meta{display:flex;gap:10px;font-size:11px;color:var(--text2)}
.history-btns{display:flex;gap:8px;margin-top:4px}
.btn-sm{padding:4px 8px;font-size:11px}
