/* CodeBeautify — shared design system */
:root{
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #dde1e7;
  --text: #1a1d24;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-contrast: #ffffff;
  --success: #16a34a;
  --error-bg: #fef2f2;
  --error-border: #fca5a5;
  --error-text: #b91c1c;
  --code-bg: #f7f8fa;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 10px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1d212a;
    --border: #2a2f3a;
    --text: #e6e8ec;
    --text-muted: #9aa1ac;
    --accent: #818cf8;
    --accent-hover: #a5b0fb;
    --accent-contrast: #10121a;
    --success: #4ade80;
    --error-bg: #2a1416;
    --error-border: #7f1d1d;
    --error-text: #fca5a5;
    --code-bg: #12151b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
  }
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-ui);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}

.site-header{
  border-bottom:1px solid var(--border);
  background:var(--surface);
  position:sticky; top:0; z-index:20;
}
.site-header-inner{
  max-width:1200px; margin:0 auto; padding:14px 20px;
  display:flex; align-items:center; gap:24px; flex-wrap:wrap;
}
.site-logo{
  font-weight:700; font-size:17px; color:var(--text); display:flex; align-items:center; gap:8px;
}
.site-logo:hover{text-decoration:none}
.site-logo .logo-mark{border-radius:5px; display:block}
.site-logo .tld{color:var(--text-muted); font-weight:500}
.site-nav{display:flex; gap:4px; flex-wrap:wrap; margin-left:auto}
.site-nav a{
  color:var(--text-muted); font-size:13.5px; padding:7px 10px; border-radius:7px; font-weight:500;
}
.site-nav a:hover{background:var(--surface-2); color:var(--text); text-decoration:none}
.site-nav a.active{background:var(--accent); color:var(--accent-contrast)}

.container{max-width:1200px; margin:0 auto; padding:28px 20px 60px}

.page-title{font-size:24px; font-weight:700; margin:0 0 4px}
.page-sub{color:var(--text-muted); font-size:14.5px; margin:0 0 22px}

.toolbar{
  display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:14px;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:10px 12px;
}
.toolbar .spacer{flex:1 1 auto}
.toolbar .opt{
  display:flex; align-items:center; gap:6px; font-size:13px; color:var(--text-muted);
}
.toolbar select, .toolbar input[type="text"]{
  font-family:var(--font-ui); font-size:13px; padding:5px 8px; border-radius:6px;
  border:1px solid var(--border); background:var(--surface); color:var(--text);
}
.toolbar label.chk{display:flex; align-items:center; gap:5px; font-size:13px; color:var(--text-muted); cursor:pointer; user-select:none}

.btn{
  appearance:none; border:1px solid var(--border); background:var(--surface-2); color:var(--text);
  font-family:var(--font-ui); font-size:13px; font-weight:600; padding:7px 13px; border-radius:7px;
  cursor:pointer; transition:background .12s,border-color .12s,transform .04s;
  display:inline-flex; align-items:center; gap:6px; white-space:nowrap;
}
.btn:hover{background:var(--border)}
.btn:active{transform:translateY(1px)}
.btn.primary{background:var(--accent); border-color:var(--accent); color:var(--accent-contrast)}
.btn.primary:hover{background:var(--accent-hover); border-color:var(--accent-hover)}
.btn:disabled{opacity:.45; cursor:not-allowed}
.btn.small{padding:5px 10px; font-size:12px}

.panes{
  display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start;
}
@media (max-width:860px){ .panes{grid-template-columns:1fr} }

.pane{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  overflow:hidden; box-shadow:var(--shadow); display:flex; flex-direction:column;
}
.pane-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:9px 12px; border-bottom:1px solid var(--border); background:var(--surface-2);
  font-size:12.5px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.03em;
}
.pane-head .meta{font-weight:400; text-transform:none; letter-spacing:0; color:var(--text-muted)}
.pane-head-actions{display:inline-flex; align-items:center; gap:8px}
.copy-icon-btn{
  appearance:none; border:1px solid var(--border); background:var(--surface); color:var(--text-muted);
  border-radius:6px; width:24px; height:24px; padding:0; font-size:13px; line-height:1; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; transition:background .12s, color .12s;
}
.copy-icon-btn:hover{background:var(--surface-2); color:var(--text)}
textarea.code{
  width:100%; min-height:440px; resize:vertical; border:0; outline:0; padding:14px;
  font-family:var(--font-mono); font-size:13px; line-height:1.55; background:var(--code-bg); color:var(--text);
  tab-size:2;
}
pre.code-view{
  margin:0; min-height:440px; max-height:70vh; overflow:auto; padding:14px;
  font-family:var(--font-mono); font-size:13px; line-height:1.55; background:var(--code-bg); color:var(--text);
  white-space:pre;
}

.error-box{
  display:none; margin:0 0 14px; padding:11px 14px; border-radius:8px;
  background:var(--error-bg); border:1px solid var(--error-border); color:var(--error-text);
  font-size:13.5px; font-family:var(--font-mono); white-space:pre-wrap; word-break:break-word;
}
.error-box.show{display:block}
.status-msg{
  font-size:12.5px; color:var(--success); opacity:0; transition:opacity .2s; font-weight:600;
}
.status-msg.show{opacity:1}

.home-grid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:14px; margin-top:22px;
}
.tool-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px; box-shadow:var(--shadow); display:block; color:var(--text);
  transition:border-color .15s, transform .1s;
}
.tool-card:hover{border-color:var(--accent); transform:translateY(-2px); text-decoration:none}
.tool-card .icon{
  width:38px;height:38px;border-radius:9px;background:var(--surface-2);display:flex;align-items:center;justify-content:center;
  font-family:var(--font-mono); font-weight:700; font-size:13px; color:var(--accent); margin-bottom:12px;
}
.tool-card h3{margin:0 0 4px; font-size:15.5px}
.tool-card p{margin:0; font-size:13px; color:var(--text-muted)}

.site-footer-full{background:var(--surface); border-top:1px solid var(--border); margin-top:48px}
.footer-container{max-width:1200px; margin:0 auto; padding:40px 20px 24px}
.footer-columns{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:26px 16px; margin-bottom:32px;
}
.footer-col{display:flex; flex-direction:column; gap:7px; min-width:0}
.footer-col h4{
  font-size:12px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted);
  margin:0 0 4px; font-weight:700;
}
.footer-col a{font-size:13px; color:var(--text)}
.footer-col a:hover{color:var(--accent)}
.footer-bottom{
  border-top:1px solid var(--border); padding-top:18px; text-align:center; color:var(--text-muted); font-size:12.5px;
}
.footer-bottom .footer-links{margin-top:8px; display:flex; justify-content:center; gap:14px}
.footer-bottom .footer-links a{color:var(--text-muted); font-weight:600}
.footer-bottom .footer-links a:hover{color:var(--accent)}

.hint{font-size:12px; color:var(--text-muted); margin-top:8px}
code.inline{font-family:var(--font-mono); background:var(--surface-2); padding:1px 5px; border-radius:4px; font-size:12.5px}

/* Content / SEO sections */
.content-section{max-width:820px; margin:48px auto 0}
.content-section h2{font-size:20px; font-weight:700; margin:36px 0 12px}
.content-section h2:first-child{margin-top:0}
.content-section h3{font-size:15.5px; font-weight:700; margin:20px 0 8px}
.content-section p{font-size:14.5px; line-height:1.75; margin:0 0 14px; color:var(--text)}
.content-section ul, .content-section ol{padding-left:22px; margin:0 0 14px}
.content-section li{font-size:14.5px; line-height:1.7; margin-bottom:6px}

.example-table{width:100%; border-collapse:collapse; margin:0 0 20px; font-size:13.5px}
.example-table th, .example-table td{text-align:left; padding:9px 10px; border-bottom:1px solid var(--border); vertical-align:top}
.example-table th{color:var(--text-muted); font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.03em}
.example-table td code{font-family:var(--font-mono); background:var(--surface-2); padding:2px 6px; border-radius:4px; font-size:12.5px; word-break:break-all}
.example-table-wrap{overflow-x:auto; margin:0 0 20px}
.example-table-wrap .example-table{margin-bottom:0}

.faq-item{border-bottom:1px solid var(--border); padding:14px 0}
.faq-item:last-child{border-bottom:none}
.faq-item h3{margin:0 0 6px; font-size:15px}
.faq-item p{margin:0; color:var(--text-muted); font-size:14px; line-height:1.65}

.related-tools-grid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:10px; margin:16px 0 0;
}
.related-tool-link{
  display:block; padding:12px 14px; border:1px solid var(--border); border-radius:8px;
  background:var(--surface); font-size:13.5px; font-weight:600; color:var(--text);
  transition:border-color .15s;
}
.related-tool-link:hover{border-color:var(--accent); text-decoration:none}
.related-tool-link span{display:block; font-weight:400; color:var(--text-muted); font-size:12px; margin-top:2px}

mark{background:rgba(250,204,21,.5); color:inherit; border-radius:2px; padding:0 1px}

.result-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:14px 16px; box-shadow:var(--shadow);
}
.result-row{display:flex; align-items:baseline; justify-content:space-between; gap:10px; padding:6px 0; border-bottom:1px solid var(--border); font-size:13.5px}
.result-row:last-child{border-bottom:none}
.result-row .k{color:var(--text-muted); font-weight:600}
.result-row .v{font-family:var(--font-mono); font-size:13px; text-align:right; word-break:break-all}

.field-row{display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:10px}
.field-row label{font-size:13px; color:var(--text-muted); font-weight:600; min-width:70px}
.field-row input[type="text"], .field-row input[type="number"], .field-row input[type="datetime-local"]{
  flex:1 1 160px; font-family:var(--font-ui); font-size:13.5px; padding:7px 10px; border-radius:7px;
  border:1px solid var(--border); background:var(--surface); color:var(--text);
}
.field-row select{
  font-family:var(--font-ui); font-size:13.5px; padding:7px 8px; border-radius:7px;
  border:1px solid var(--border); background:var(--surface); color:var(--text);
}
.field-row input[type="range"]{flex:1 1 140px}
.field-row input[type="color"]{
  width:44px; height:34px; padding:2px; border-radius:7px; border:1px solid var(--border); background:var(--surface);
}
.field-row .val{font-family:var(--font-mono); font-size:12.5px; color:var(--text-muted); min-width:36px; text-align:right}

.swatch-row{display:flex; flex-wrap:wrap; gap:8px; margin:10px 0}
.swatch{
  width:56px; height:56px; border-radius:8px; border:1px solid var(--border);
  display:flex; align-items:flex-end; justify-content:center; padding-bottom:4px;
  font-family:var(--font-mono); font-size:10px; cursor:pointer; box-shadow:var(--shadow);
}

.upload-zone{
  border:2px dashed var(--border); border-radius:var(--radius); padding:28px 16px; text-align:center;
  color:var(--text-muted); font-size:13.5px; background:var(--surface); cursor:pointer; transition:border-color .15s;
}
.upload-zone:hover, .upload-zone.drag{border-color:var(--accent); color:var(--text)}
.upload-zone input[type="file"]{display:none}

.preview-box{
  background:var(--code-bg); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px; display:flex; align-items:center; justify-content:center; min-height:120px; margin:12px 0;
}
.preview-box img{max-width:100%; max-height:220px}

.diff-add{background:rgba(34,197,94,.18)}
.diff-del{background:rgba(239,68,68,.18); text-decoration:line-through; text-decoration-color:rgba(239,68,68,.5)}

.tool-hub-grid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px; margin-top:20px;
}
.tool-hub-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:14px 16px; box-shadow:var(--shadow); color:var(--text); display:block;
  transition:border-color .15s, transform .1s;
}
.tool-hub-card:hover{border-color:var(--accent); transform:translateY(-1px); text-decoration:none}
.tool-hub-card h3{margin:0 0 3px; font-size:14px}
.tool-hub-card p{margin:0; font-size:12.5px; color:var(--text-muted)}
.hub-category{font-size:12.5px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); margin:32px 0 4px}
.hub-category:first-of-type{margin-top:0}
