:root{
  --bg:#f6f8fb;
  --nav-bg:#dbeafe;
  --nav-border:#bfdbfe;
  --surface:#ffffff;
  --surface-alt:#f1f5f9;
  --surface-soft:#f8fafc;
  --text:#111111;
  --muted:#555555;
  --border:#e5e7eb;
  --input-border:#dddddd;
  --primary:#3b82f6;
  --shadow:0 6px 20px rgba(0,0,0,0.06);
}

body.dark{
  --bg:#0f172a;
  --nav-bg:#0b2a52;
  --nav-border:#1d4f8f;
  --surface:#111827;
  --surface-alt:#1e293b;
  --surface-soft:#0b1220;
  --text:#f8fafc;
  --muted:#cbd5e1;
  --border:#334155;
  --input-border:#475569;
  --primary:#60a5fa;
  --shadow:0 10px 30px rgba(0,0,0,0.35);
}

*{box-sizing:border-box;font-family:Arial,Helvetica,sans-serif}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--text);transition:background .2s,color .2s;font-size:16px;line-height:1.45}
header{background:var(--nav-bg);border-bottom:1px solid var(--nav-border);padding:6px 16px;display:flex;align-items:center;justify-content:space-between;gap:10px;position:sticky;top:0;z-index:40;min-height:50px;flex-wrap:wrap}
.header-left{display:flex;align-items:center;gap:16px;min-width:0}
.header-actions{display:flex;align-items:center;gap:8px;min-width:0;flex:0 1 320px}
.logo{display:inline-flex;align-items:center;gap:8px;font-weight:700;font-size:20px;color:var(--text);text-decoration:none;line-height:1}
.nav-icon{display:inline-flex;align-items:center;justify-content:center;line-height:1;font-size:20px;flex:0 0 auto}
.nav{display:flex;align-items:center;gap:18px}
.nav a{display:inline-flex;align-items:center;gap:6px;color:var(--muted);text-decoration:none;font-size:15px;line-height:1}
.nav a:hover,.nav a.active{color:var(--text)}
.nav-fav{display:inline-flex;align-items:center;gap:6px}
.nav-fav-btn{display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--input-border);background:var(--surface);color:var(--text);border-radius:999px;padding:4px 8px;cursor:pointer;line-height:1}
.nav-theme-toggle{display:inline-flex;align-items:center;justify-content:center;min-width:34px;padding:0 10px;line-height:1}
.fav-count{display:inline-flex;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:#fee2e2;color:#b91c1c;align-items:center;justify-content:center;font-size:12px;line-height:1}
.fav-popover{position:absolute;top:56px;right:16px;width:320px;max-height:420px;overflow:auto;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow);padding:10px;z-index:30}
.fav-popover-head{font-weight:700;margin-bottom:8px}
.fav-popover-list{display:grid;gap:8px}
.fav-item{display:flex;gap:10px;align-items:flex-start;padding:8px;border-radius:8px;text-decoration:none;background:var(--surface-alt)}
.fav-item-icon{font-size:20px;line-height:1}
.fav-item-meta{display:grid;gap:4px}
.fav-item-meta strong{color:var(--text);font-size:14px}
.fav-item-meta em{font-style:normal;color:var(--muted);font-size:12px}
.fav-empty{color:var(--muted);font-size:13px}
.search{width:300px;max-width:100%;display:flex;align-items:center;position:relative}
.search-icon{position:absolute;left:10px;font-size:14px;line-height:1;color:var(--muted);pointer-events:none}
.search input{width:100%;height:34px;margin-top:0;padding:6px 10px 6px 32px;border-radius:8px;border:1px solid var(--input-border);background:var(--surface);color:var(--text);font-size:14px}
.theme-toggle{height:34px;margin-top:0;border:1px solid var(--input-border);background:var(--surface);color:var(--text);border-radius:8px;padding:6px 10px;cursor:pointer;font-size:13px;line-height:1}
.menu-toggle{display:none;height:34px;border:1px solid var(--input-border);background:var(--surface);color:var(--text);border-radius:8px;padding:6px 10px;cursor:pointer;font-size:17px;line-height:1}
.container{max-width:1100px;margin:auto;padding:16px 20px 24px}
.page-intro{margin-bottom:20px}
.page-intro h1,.page-intro h2{margin:0 0 8px}
.page-intro p{margin:0;color:var(--muted)}
.hero-card{background:var(--surface);border-radius:16px;padding:26px;box-shadow:var(--shadow);margin-bottom:24px}
.hero-card h1{margin:0 0 10px;font-size:36px;line-height:1.2}
.hero-card p{margin:0;color:var(--muted)}
.hero-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}
.kicker{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;background:var(--surface-alt);border:1px solid var(--border);font-size:12px;color:var(--muted)}
.empty-box{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:18px;color:var(--muted)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:20px}
.card,.tool-container,.info-panel{background:var(--surface);border-radius:12px;padding:18px;box-shadow:var(--shadow)}
.card{transition:.2s}
.card:hover{transform:translateY(-3px)}
.icon{font-size:32px;margin-bottom:10px}
.card h3{margin:6px 0;color:var(--text);font-size:23px}
.card p{font-size:16px;color:var(--muted)}
.button{display:inline-block;margin-top:10px;padding:10px 14px;border-radius:8px;background:var(--primary);color:white;text-decoration:none;font-size:16px;border:0;cursor:pointer}
.button.secondary{background:transparent;color:var(--primary);border:1px solid var(--primary)}
.tool-container{padding:24px}
textarea,input{width:100%;padding:12px;margin-top:10px;border-radius:8px;border:1px solid var(--input-border);background:var(--surface);color:var(--text);font-size:16px}
textarea{resize:vertical;min-height:220px}
.result{margin-top:10px;background:var(--surface-alt);padding:12px;border-radius:8px;font-family:monospace;word-break:break-word;white-space:pre-wrap;font-size:15px}
.back{display:inline-block;margin-bottom:20px;text-decoration:none;color:var(--primary)}
.breadcrumbs{display:flex;gap:6px;align-items:center;color:var(--muted);font-size:14px;margin-bottom:10px}
.breadcrumbs a{color:var(--primary);text-decoration:none}
.split{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(280px,1fr);gap:20px}
.meta-list{display:grid;gap:12px}
.meta-item strong{display:block;margin-bottom:4px}
.tool-actions{display:flex;gap:10px;flex-wrap:wrap}
.tool-shell{display:grid;gap:20px}
.tool-input{background:var(--surface-soft);border:1px solid var(--border);border-radius:12px;padding:16px}
.section-card{background:var(--surface);border-radius:12px;padding:20px;box-shadow:var(--shadow)}
.section-card h2{margin:0 0 12px;font-size:28px}
.section-card h3{margin:20px 0 8px;font-size:22px}
.section-card p,.section-card li{color:var(--muted)}
.section-card ul{margin:0;padding-left:18px}
.appstore-main{display:grid;gap:20px}
.tool-flow{display:grid;gap:0}
.tool-header-full{background:transparent;border:0;border-radius:0;padding:12px 0 8px;box-shadow:none}
.tool-header-full h1{margin:0 0 6px;font-size:32px;line-height:1.15}
.tool-header-full p{margin:0;color:var(--muted)}
.tool-header-full.full-bleed{
  width:auto;
  margin-left:calc(50% - 50dvw + 8px);
  margin-right:calc(50% - 50dvw + 8px);
  border-radius:0;
  margin-bottom:0;
  border-bottom:0;
  padding:6px max(20px, calc((100dvw - 1100px) / 2 + 12px)) 4px;
}
.meta-pill-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px;align-items:center}
.meta-pill{background:var(--surface-alt);border:1px solid var(--border);border-radius:999px;padding:5px 10px;font-size:13px;color:var(--text);line-height:1.2}
.meta-pill.meta-link{text-decoration:none;cursor:pointer}
.meta-pill.meta-link:hover{border-color:var(--primary);color:var(--primary)}
.fav-toggle{display:inline-flex;align-items:center;gap:6px;border:1px solid #fca5a5;background:#fff1f2;color:#be123c;border-radius:999px;padding:6px 12px;font-size:13px;cursor:pointer;line-height:1}
.fav-toggle.active{background:#ef4444;color:#ffffff;border-color:#dc2626}
.fullscreen-toggle{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--input-border);background:var(--surface);color:var(--text);border-radius:999px;padding:6px 12px;font-size:13px;cursor:pointer;line-height:1}
#tool-flow:fullscreen{
  background:var(--bg);
  padding:16px 24px;
  overflow:auto;
}
#tool-flow:fullscreen .tool-header-full.full-bleed,
#tool-flow:fullscreen .tool-runtime-card.full-bleed{
  width:100%;
  margin-left:0;
  margin-right:0;
  padding-left:0;
  padding-right:0;
}
#tool-flow:fullscreen .tool-area{
  margin-top:10px;
}
#tool-flow:fullscreen textarea{
  min-height:32vh;
}
#tool-flow:fullscreen .result{
  max-height:48vh;
  overflow:auto;
}
#tool-flow:-webkit-full-screen{
  background:var(--bg);
  padding:16px 24px;
  overflow:auto;
}
#tool-flow:-webkit-full-screen .tool-header-full.full-bleed,
#tool-flow:-webkit-full-screen .tool-runtime-card.full-bleed{
  width:100%;
  margin-left:0;
  margin-right:0;
  padding-left:0;
  padding-right:0;
}
#tool-flow:-webkit-full-screen textarea{
  min-height:32vh;
}
#tool-flow:-webkit-full-screen .result{
  max-height:48vh;
  overflow:auto;
}
.tool-runtime-card{background:transparent;border:0;border-radius:0;padding:0;box-shadow:none}
.tool-runtime-card h2{margin:0 0 10px;font-size:26px}
.tool-runtime-card p{margin:0;color:var(--muted)}
.tool-area{margin-top:8px;background:transparent;border:0;border-radius:0;padding:0}
.tool-area{
  --tool-gap:6px;
  --tool-pad-y:7px;
  --tool-pad-x:10px;
  --tool-radius:8px;
  --tool-btn-primary:#2563eb;
  --tool-btn-primary-hover:#1d4ed8;
  --tool-btn-copy:#0f9f6e;
  --tool-btn-copy-hover:#0b7f58;
  --tool-btn-danger:#dc2626;
  --tool-btn-danger-hover:#b91c1c;
  --tool-split-gap:10px;
}
.tool-area :where(form){display:grid;gap:var(--tool-gap);margin:0 0 var(--tool-gap)}
.tool-area :where(fieldset, section, article, div, p){margin:0 0 var(--tool-gap)}
.tool-area :where(form > *:last-child, section > *:last-child, article > *:last-child){margin-bottom:0}
.tool-area :where(label, legend){display:block;margin:0 0 4px;font-size:14px;font-weight:600;color:var(--text)}
.tool-area :where(input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="url"], textarea, select){
  width:100%;
  max-width:100%;
  min-height:36px;
  padding:var(--tool-pad-y) var(--tool-pad-x);
  border:1px solid var(--input-border);
  border-radius:var(--tool-radius);
  background:var(--surface);
  color:var(--text);
  font-size:14px;
  line-height:1.3;
}
.tool-area :where(input[type="color"]){
  width:100%;
  max-width:100%;
  min-height:60px;
  padding:6px;
  border:1px solid var(--input-border);
  border-radius:var(--tool-radius);
  background:var(--surface);
  cursor:pointer;
}
.tool-area :where(textarea){resize:vertical;min-height:110px}
.tool-area :where(textarea[data-size="sm"]){min-height:84px}
.tool-area :where(textarea[data-size="md"]){min-height:140px}
.tool-area :where(textarea[data-size="lg"]){min-height:220px}
.tool-area :where(pre, code, output){
  background:var(--surface-alt);
  border:1px solid var(--border);
  border-radius:var(--tool-radius);
  padding:7px 9px;
  color:var(--text);
  font-size:13px;
  line-height:1.35;
  overflow:auto;
}
.tool-area :where(fieldset){
  border:1px solid var(--border);
  border-radius:var(--tool-radius);
  padding:7px 9px;
  min-width:0;
}
.tool-area :where(fieldset > *:last-child){margin-bottom:0}
.tool-area :where(input[type="checkbox"], input[type="radio"]){
  width:auto;
  min-height:auto;
  margin:0 6px 0 0;
  vertical-align:middle;
}
.tool-area :where(input[type="checkbox"] + label, input[type="radio"] + label){
  display:inline;
  margin:0;
  font-weight:500;
}
.tool-area :where(button){
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:32px;
  padding:0 11px;
  border:0;
  border-radius:var(--tool-radius);
  background:var(--tool-btn-primary);
  color:#fff;
  font-size:13px;
  font-weight:600;
  line-height:1;
  cursor:pointer;
  margin:0 5px 5px 0;
}
.tool-area :where(button:hover){background:var(--tool-btn-primary-hover)}
.tool-area :where(button.secondary, button[data-variant="secondary"], #st-copy){background:var(--tool-btn-copy)}
.tool-area :where(button.secondary:hover, button[data-variant="secondary"]:hover, #st-copy:hover){background:var(--tool-btn-copy-hover)}
.tool-area :where(button.danger, button[type="reset"], button[data-variant="danger"], #st-reset){background:var(--tool-btn-danger)}
.tool-area :where(button.danger:hover, button[type="reset"]:hover, button[data-variant="danger"]:hover, #st-reset:hover){background:var(--tool-btn-danger-hover)}
.tool-area :where([data-layout="actions"], .st-actions){
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
}
.tool-area :where([data-layout="actions"] button, .st-actions button){margin:0}
.tool-area :where([data-layout="stack"], .st-stack){
  display:grid;
  gap:var(--tool-gap);
}
.tool-area :where([data-layout="split"], .st-split){
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:var(--tool-split-gap);
}
.tool-area :where([data-layout="wide-input"], .st-wide-input){
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);
  gap:var(--tool-split-gap);
}
.tool-area :where([data-layout="controls-side"], .st-controls-side){
  display:grid;
  grid-template-columns:minmax(240px,0.72fr) minmax(0,1.28fr);
  gap:var(--tool-split-gap);
}
.tool-area :where([data-layout="full-output"], .st-full-output){
  display:grid;
  gap:var(--tool-gap);
}
.tool-area :where([data-layout="inline"], .st-inline){
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
}
.tool-area :where([data-layout="options-2"], .st-options-2){
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:6px 12px;
}
.tool-area :where([data-layout="options-3"], .st-options-3){
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:6px 12px;
}
.tool-area :where([data-layout="options-2"] > *, [data-layout="options-3"] > *, .st-options-2 > *, .st-options-3 > *){margin:0}
.tool-area :where(#st-output, [data-role="result"], .st-result-target){scroll-margin-top:72px}
.tool-area :where(table){
  width:100%;
  border-collapse:collapse;
  border:1px solid var(--border);
  border-radius:var(--tool-radius);
  overflow:hidden;
  font-size:13px;
}
.tool-area :where(th, td){
  padding:7px 8px;
  border-bottom:1px solid var(--border);
  text-align:left;
}
.tool-area :where(tr:last-child td){border-bottom:0}
.tool-area :where(a){color:var(--primary)}
.tool-area :where([hidden]){display:none !important}
.tool-runtime-card.full-bleed{
  width:auto;
  margin-left:calc(50% - 50dvw + 8px);
  margin-right:calc(50% - 50dvw + 8px);
  border-radius:0;
  border-top:0;
  padding:0 max(20px, calc((100dvw - 1100px) / 2 + 12px)) 10px;
}
.tool-flow .tool-runtime-card.full-bleed{
  margin-top:0;
}
.tool-runtime-card.full-bleed .tool-area{
  max-width:100%;
}
.card-stack{display:grid;grid-template-columns:1fr;gap:14px}
.mini-card{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:18px;box-shadow:var(--shadow)}
.mini-card h3{margin:0 0 10px;font-size:24px}
.mini-card p,.mini-card li,.mini-card a{font-size:16px;color:var(--muted)}
.mini-card ul{margin:0;padding-left:18px}
.info-stack{max-width:880px}
.info-card h1,.info-card h2{margin:0 0 12px}
.info-card p{margin:0 0 12px;line-height:1.7}
.info-card p:last-child{margin-bottom:0}
.comment{padding:10px 0;border-bottom:1px solid var(--border)}
.comment:last-child{border-bottom:0}
.comment-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:4px}
.comment strong{display:inline-block;font-size:14px}
.comment span{font-size:13px;color:var(--muted)}
.comment-date{font-size:12px;color:var(--muted)}
.comment-rating{font-size:12px;color:#f59e0b;letter-spacing:1px}
.comment-form{display:grid;gap:8px;margin-bottom:10px}
.comment-form-top{display:grid;grid-template-columns:minmax(0,max-content) minmax(140px,220px) auto;gap:10px;align-items:end}
.comment-form input[type="text"]{margin-top:0}
.comment-form textarea{min-height:88px;margin-top:0}
.comment-alert{border:1px solid var(--border);border-radius:10px;padding:8px 10px;margin-bottom:8px;font-size:13px}
.comment-alert.success{background:#ecfdf5;color:#166534;border-color:#a7f3d0}
.comment-alert.error{background:#fef2f2;color:#b91c1c;border-color:#fecaca}
.comment-honeypot{position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden}
.rating-select{display:grid;gap:5px;align-self:center;min-width:0}
.rating-label{font-size:13px;font-weight:700;color:var(--text);line-height:1}
.rating-stars{display:flex;flex-direction:row-reverse;justify-content:flex-end;gap:1px;flex-wrap:nowrap;min-width:0;max-width:100%}
.rating-stars input{position:absolute;width:1px;height:1px;margin:0;padding:0;border:0;opacity:0;pointer-events:none}
.rating-stars label{cursor:pointer;font-size:22px;line-height:1;color:#cbd5e1;padding:1px 0;flex:0 0 auto}
.rating-stars label:hover,
.rating-stars label:hover ~ label,
.rating-stars input:checked ~ label{color:#f59e0b}
.comment-meta{font-size:13px;color:var(--muted)}
.comment-form button[disabled]{opacity:.75;cursor:not-allowed}
.footer{margin-top:40px;background:linear-gradient(180deg,var(--surface),var(--surface-alt));border-top:1px solid var(--border)}
.footer-inner{max-width:1100px;margin:auto;padding:28px 20px 22px;display:grid;grid-template-columns:minmax(220px,1.2fr) minmax(0,2fr);gap:28px;align-items:start}
.footer-brand{display:grid;gap:10px}
.footer-brand strong{font-size:18px;letter-spacing:-.02em}
.footer-brand p{margin:0;color:var(--muted);font-size:15px;line-height:1.6;max-width:42ch}
.footer-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
.footer-group{display:grid;gap:10px}
.footer-title{font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.footer-links{display:grid;gap:8px}
.footer-links a{color:var(--text);text-decoration:none;font-size:14px}
.footer-links a:hover{color:var(--primary)}
.footer-bottom{max-width:1100px;margin:auto;padding:14px 20px 20px;display:flex;justify-content:space-between;gap:16px;color:var(--muted);font-size:13px;border-top:1px solid var(--border)}

@media (max-width:768px){
  header{align-items:flex-start;padding:6px 14px 10px;height:auto}
  .header-left{width:100%;justify-content:space-between;position:relative}
  .menu-toggle{display:inline-flex;align-items:center;justify-content:center}
  .nav{
    display:none;
    position:absolute;
    top:42px;
    right:0;
    width:min(260px, calc(100vw - 28px));
    flex-direction:column;
    align-items:stretch;
    gap:8px;
    padding:10px;
    border:1px solid var(--nav-border);
    border-radius:12px;
    background:var(--surface);
    box-shadow:var(--shadow);
    z-index:60;
  }
  .nav.open{display:flex}
  .nav a,.nav .nav-fav-btn,.nav .nav-theme-toggle{width:100%;justify-content:flex-start}
  .header-actions{width:100%;order:3;position:relative;z-index:1;flex:1 1 100%}
  .search{width:100%}
  .split{grid-template-columns:1fr}
  .card-stack{grid-template-columns:1fr}
  .tool-runtime-card.full-bleed{
    padding:0 20px 8px;
    border-radius:0;
  }
  .tool-header-full.full-bleed{
    padding:6px 20px 2px;
    border-radius:0;
  }
  .footer-inner{grid-template-columns:1fr}
  .footer-grid{grid-template-columns:1fr 1fr}
  .footer-bottom{flex-direction:column;align-items:flex-start}
  .hero-actions{flex-direction:column;align-items:flex-start}
  .tool-header-full h1{font-size:28px}
  .theme-toggle{display:flex}
  .tool-area :where(button){
    width:100%;
    margin-right:0;
  }
  .tool-area :where([data-layout="split"], .st-split, [data-layout="wide-input"], .st-wide-input, [data-layout="controls-side"], .st-controls-side, [data-layout="options-2"], .st-options-2, [data-layout="options-3"], .st-options-3){
    grid-template-columns:1fr;
  }
  .comment-form-top{grid-template-columns:1fr}
}
