:root{
  color-scheme:light;
  --bg:#f8f7ff;
  --ink:#1a1533;
  --ink-soft:#6e6a8f;
  --ink-2:#3d3660;
  --muted:#6e6a8f;
  --teal:#4f46e5;
  --teal-light:#6366f1;
  --accent:#4f46e5;
  --accent-mid:#6366f1;
  --accent-pale:#eef2ff;
  --accent-glow:rgba(99,102,241,.18);
  --green:#059669;
  --amber:#fbbf24;
  --line:#ddd9f5;
  --border:#ddd9f5;
  --border-soft:#ebe8f8;
  --panel:#fff;
  --surface:#fff;
  --surface-2:#f3f2ff;
  --surface-3:#ede9fe;
  --error:#dc2626;
  --success:#059669;
  --shadow-sm:0 1px 3px rgba(79,70,229,.07),0 1px 2px rgba(0,0,0,.05);
  --shadow-md:0 4px 16px rgba(79,70,229,.1),0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:0 12px 40px rgba(79,70,229,.13),0 4px 12px rgba(0,0,0,.07);
  --header-background:rgba(248,247,255,.92);
  --header-shadow:0 1px 0 rgba(79,70,229,.06);
  --logo-border:rgba(99,102,241,.22);
  --logo-gradient:linear-gradient(135deg,#4f46e5,#6366f1);
  --logo-shadow:0 2px 8px rgba(79,70,229,.3);
  --input-background:#fff;
  --placeholder:#8e89ad;
  --table-stripe:#fafafe;
  --feedback-success-background:#ecfdf5;
  --feedback-success-border:#a7f3d0;
  --feedback-success-color:#047857;
  --feedback-error-background:#fef2f2;
  --feedback-error-border:#fecaca;
  --feedback-error-color:#b91c1c;
}

html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0d1020;
  --ink:#f4f3ff;
  --ink-soft:#b2aecb;
  --ink-2:#d5d2e8;
  --muted:#aaa6c4;
  --teal:#a5b4fc;
  --teal-light:#c7d2fe;
  --accent:#818cf8;
  --accent-mid:#a5b4fc;
  --accent-pale:#282644;
  --accent-glow:rgba(129,140,248,.24);
  --green:#6ee7b7;
  --amber:#fcd34d;
  --line:#34344f;
  --border:#34344f;
  --border-soft:#292941;
  --panel:#15182b;
  --surface:#15182b;
  --surface-2:#1b1e35;
  --surface-3:#252744;
  --error:#fca5a5;
  --success:#6ee7b7;
  --shadow-sm:0 1px 3px rgba(0,0,0,.2),0 1px 2px rgba(0,0,0,.18);
  --shadow-md:0 4px 16px rgba(0,0,0,.24),0 2px 6px rgba(0,0,0,.2);
  --shadow-lg:0 12px 40px rgba(0,0,0,.3),0 4px 12px rgba(0,0,0,.24);
  --header-background:rgba(17,19,36,.92);
  --header-shadow:0 1px 0 rgba(0,0,0,.2);
  --logo-border:rgba(165,180,252,.25);
  --logo-gradient:linear-gradient(135deg,#4f46e5,#818cf8);
  --logo-shadow:0 2px 10px rgba(79,70,229,.45);
  --input-background:#101326;
  --placeholder:#85819f;
  --table-stripe:#101326;
  --feedback-success-background:#12342e;
  --feedback-success-border:#1b6654;
  --feedback-success-color:#a7f3d0;
  --feedback-error-background:#3a202b;
  --feedback-error-border:#783b4d;
  --feedback-error-color:#fecaca;
}

html{scroll-behavior:smooth;}
body{background:var(--bg);color:var(--ink);}
h1,h2,h3,.logo,.code,.post-card .title{font-family:'Plus Jakarta Sans','Inter',system-ui,sans-serif;}
h1,h2,h3{color:var(--ink);}
p,li,.sub,.intro,.updated,.meta,.breadcrumb,.toolbar .hint,.editor-note,
.stat .label,.stat-detail,.limit-card .count,.post-card .excerpt{color:var(--muted);}
strong,label,.stat-title,.limit-card .platform{color:var(--ink);}
a{color:var(--accent);}
a:hover{color:var(--accent-mid);}
::selection{background:var(--accent);color:#fff;}

header.site,.site-header{
  position:sticky;
  top:0;
  z-index:20;
  border-color:var(--border-soft);
  background:var(--header-background);
  box-shadow:var(--header-shadow);
  backdrop-filter:blur(14px);
}
header.site .wrap{max-width:1180px;}
.site-header{border-bottom:1px solid var(--border-soft);}
.logo{
  display:inline-flex;
  align-items:center;
  gap:10px;
  color:var(--ink);
  font-family:'Plus Jakarta Sans','Inter',system-ui,sans-serif;
}
header.site .logo::before{
  display:grid;
  width:36px;
  height:36px;
  flex:none;
  place-items:center;
  border:1px solid var(--logo-border);
  border-radius:10px;
  background:var(--logo-gradient);
  box-shadow:var(--logo-shadow);
  color:#fff;
  content:"Aa";
  font-family:'Plus Jakarta Sans','Inter',system-ui,sans-serif;
  font-size:14px;
  font-weight:800;
}
nav.tools a{border-radius:8px;color:var(--ink-2);transition:background .15s ease,color .15s ease;}
nav.tools a:hover{background:var(--accent-pale);color:var(--accent);}

main.page{color:var(--ink);}
.hero{color:var(--ink);}
.sub,.intro{color:var(--muted);}
section.content h2,.faq h2{color:var(--ink);}
section.content p,.faq p{color:var(--muted);}

.tool,.stat,.limit-card,.contact-card,.audience-card,.cta-box,.highlight,
.browser-list li,.cookie-table th,.post-card{
  border:1px solid var(--border);
  border-radius:var(--radius,12px);
  background:var(--surface);
  color:var(--ink);
  box-shadow:var(--shadow-md);
}
.limit-card{min-width:0;}
.tool{overflow:hidden;}
.box{
  width:min(480px,100%);
  padding:32px;
  border:1px solid var(--border);
  border-radius:18px;
  background:var(--surface);
  box-shadow:var(--shadow-lg);
}
.stat:hover{border-color:var(--accent-mid);}
.stat-icon{
  border:1px solid rgba(99,102,241,.2);
  background:var(--accent-pale);
  color:var(--accent);
}
.stat .num,.code{color:var(--accent);}
.stat-details{border-color:var(--border-soft);}
.stat-detail strong{color:var(--ink);}
.reading-badge{
  border-color:rgba(99,102,241,.2);
  background:var(--accent-pale);
  color:var(--accent);
}
.toolbar,.editor-footer{
  border-color:var(--border-soft);
  background:var(--surface-2);
}
textarea,.msg{
  color:var(--ink);
  caret-color:var(--accent);
}
textarea::placeholder,.msg::placeholder,
input[type="text"]::placeholder,input[type="email"]::placeholder{color:#8e89ad;}
button.action,.btn-send,.cta-box a,a.btn{
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface);
  color:var(--ink-2);
  box-shadow:var(--shadow-sm);
}
button.action:hover:not(:disabled),.btn-send:hover,.cta-box a:hover,
a.btn:not(.primary):hover{
  border-color:var(--accent-mid);
  background:var(--accent-pale);
  color:var(--accent);
}
button.action.primary,.btn-send,a.btn.primary,.cta-box a{
  border-color:var(--accent);
  background:var(--accent);
  color:#fff;
  box-shadow:0 2px 8px rgba(79,70,229,.3);
}
button.action.primary:hover:not(:disabled),.btn-send:hover,a.btn.primary:hover,.cta-box a:hover{
  border-color:var(--accent-mid);
  background:var(--accent-mid);
  color:#fff;
}
input[type="text"],input[type="email"],textarea.msg{
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--input-background);
  color:var(--ink);
}
input[type="text"]:focus,input[type="email"]:focus,textarea.msg:focus{
  border-color:var(--accent-mid);
  box-shadow:0 0 0 3px var(--accent-glow);
}
.char-hint,.alt-contact{color:var(--muted);}
.alt-contact{border-color:var(--border);}
.alt-contact a,.highlight strong{color:var(--accent);}
.feedback.success{
  border-color:var(--feedback-success-border);
  background:var(--feedback-success-background);
  color:var(--feedback-success-color);
}
.feedback.error{
  border-color:var(--feedback-error-border);
  background:var(--feedback-error-background);
  color:var(--feedback-error-color);
}

.limits{gap:14px;}
.limit-card{padding:18px;}
.related a{border-color:var(--border);border-radius:9px;background:var(--surface);color:var(--ink-2);}
.related a:hover{border-color:var(--accent-mid);background:var(--accent-pale);color:var(--accent);}
.faq details{border-color:var(--border);}
.faq summary{color:var(--ink);}

.breadcrumb,.breadcrumb a{color:var(--muted);}
.breadcrumb a:hover{color:var(--accent);}
article p{color:var(--ink-2);}
article h2{color:var(--ink);}
article table{overflow:hidden;border:1px solid var(--border);border-radius:12px;background:var(--surface);color:var(--ink);}
article th,article td,.cookie-table th,.cookie-table td{border-color:var(--border-soft);}
article th,.cookie-table th{background:var(--surface-2);color:var(--ink-2);}
article tr:nth-child(even) td,.cookie-table tr:nth-child(even) td{background:var(--table-stripe);}
.post-card{
  display:block;
  margin:12px 0;
  padding:20px;
  text-decoration:none;
  transition:border-color .15s ease,transform .15s ease,background .15s ease,box-shadow .15s ease;
}
.post-card:first-child{padding:20px;}
.post-card:hover{transform:translateY(-2px);border-color:var(--accent-mid);background:var(--surface-2);box-shadow:0 8px 24px var(--accent-glow);}
.post-card .tag{color:var(--accent);}
.post-card .title{color:var(--ink);}
.post-card .excerpt{color:var(--muted);}
.post-card.disabled{opacity:.55;}

code{
  border-color:var(--border);
  border-radius:6px;
  background:var(--surface-2);
  color:var(--accent);
}
.audience-card strong{color:var(--ink);}
.audience-card span{color:var(--muted);}
.highlight{border-left:4px solid var(--accent);}
.browser-list li strong{color:var(--ink);}

footer{
  border-color:var(--border-soft);
  background:var(--surface);
  color:var(--muted);
}
footer a{color:var(--ink-2);}
footer a:hover{color:var(--accent);}

.code{font-family:'Plus Jakarta Sans','Inter',system-ui,sans-serif;}
.editor-tools{background:var(--surface-2);}
.theme-toggle{
  display:inline-flex;
  min-height:34px;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:6px 12px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface);
  box-shadow:var(--shadow-sm);
  color:var(--ink-2);
  cursor:pointer;
  font:600 12px 'Inter',system-ui,sans-serif;
  transition:background .15s ease,border-color .15s ease,color .15s ease;
}
.theme-toggle:hover{border-color:var(--accent-mid);background:var(--accent-pale);color:var(--accent);}
.theme-toggle-icon{font-size:15px;line-height:1;}
.theme-status{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}
a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,
summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px;}

.tool-widget{
  margin:20px 0 0;
  padding:24px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:var(--surface);
  box-shadow:var(--shadow-md);
}
.tool-widget h2{margin:0 0 10px;font-size:22px;}
.tool-widget h3{margin:22px 0 8px;font-size:16px;}
.tool-widget p{max-width:70ch;color:var(--muted);}
.widget-controls,.widget-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:12px;
  margin:16px 0;
}
.widget-controls label,.widget-toggle{display:flex;align-items:center;gap:8px;color:var(--ink-2);}
.widget-controls input[type="number"]{
  width:120px;
  min-height:40px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--input-background);
  color:var(--ink);
}
.widget-toggle input{accent-color:var(--accent);}
.tool-widget progress{
  display:block;
  width:100%;
  height:12px;
  overflow:hidden;
  border:0;
  border-radius:999px;
  background:var(--surface-3);
  accent-color:var(--accent);
}
.tool-widget progress::-webkit-progress-bar{border-radius:999px;background:var(--surface-3);}
.tool-widget progress::-webkit-progress-value{border-radius:999px;background:var(--accent);}
.tool-widget progress::-moz-progress-bar{border-radius:999px;background:var(--accent);}
.widget-status{min-height:1.5em;margin:10px 0;color:var(--ink-2);}
.widget-list{padding-left:24px;color:var(--ink-2);}
.widget-list li{padding:4px 0;}
.line-editor{display:flex;align-items:stretch;min-width:0;}
.line-numbers{
  flex:0 0 48px;
  max-height:100%;
  overflow:hidden;
  padding:24px 10px 24px 8px;
  border-right:1px solid var(--border-soft);
  background:var(--surface-2);
  color:var(--muted);
  font:16px/1.6 'Inter',system-ui,sans-serif;
  text-align:right;
  white-space:pre;
  user-select:none;
}
.line-editor textarea{width:auto;min-width:0;flex:1;}
.sentence-preview{
  min-height:48px;
  padding:14px;
  border:1px solid var(--border-soft);
  border-radius:8px;
  background:var(--surface-2);
  color:var(--ink-2);
  line-height:1.7;
  overflow-wrap:anywhere;
}
.sentence-preview .long-sentence{
  border-radius:3px;
  background:#fef3c7;
  color:#713f12;
  text-decoration:underline;
  text-decoration-color:#d97706;
  text-decoration-thickness:2px;
  text-underline-offset:3px;
}
html[data-theme="dark"] .sentence-preview .long-sentence{background:#513b17;color:#fde68a;text-decoration-color:#fbbf24;}
.limit-progress.near-limit{accent-color:#eab308;}
.limit-progress.near-limit::-webkit-progress-value{background:#eab308;}
.limit-progress.near-limit::-moz-progress-bar{background:#eab308;}
.limit-progress.over-limit{accent-color:var(--error);}
.limit-progress.over-limit::-webkit-progress-value{background:var(--error);}
.limit-progress.over-limit::-moz-progress-bar{background:var(--error);}
.limit-card.over-limit{border-color:var(--error);}
.limit-note{font-size:13px;}
.social-limits .limits{grid-template-columns:repeat(auto-fit,minmax(220px,1fr));}

@media(max-width:480px){
  .scoreboard{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
  }
  .scoreboard > .stat:first-child{grid-column:1 / -1;}
  .tool-widget{padding:18px;}
  .widget-controls,.widget-actions{align-items:stretch;}
  .widget-actions .action{flex:1 1 100%;}
  .line-numbers{flex-basis:40px;padding-right:7px;padding-left:4px;font-size:14px;}
  .social-limits .limits{grid-template-columns:1fr;}
}

html[data-theme="dark"] .eyebrow{
  background:#12342e;
  color:#6ee7b7;
}
html[data-theme="dark"] .eyebrow-dot{box-shadow:0 0 8px rgba(52,211,153,.5);}
html[data-theme="dark"] .site-header .logo-mark{box-shadow:0 2px 10px rgba(79,70,229,.45);}
html[data-theme="dark"] .hero::before{
  background:radial-gradient(ellipse 80% 60% at 20% 40%,rgba(129,140,248,.16) 0%,transparent 70%);
}
html[data-theme="dark"] .h1-accent{
  background:linear-gradient(100deg,#a5b4fc 0%,#c4b5fd 100%);
  -webkit-background-clip:text;
  background-clip:text;
}
html[data-theme="dark"] .local-badge{background:#12342e;color:#6ee7b7;}
html[data-theme="dark"] .local-badge::before{background:#34d399;}
html[data-theme="dark"] .editor-tools{background:#111426;}
html[data-theme="dark"] textarea::placeholder{color:var(--placeholder);}
html[data-theme="dark"] .stat-icon{border-color:rgba(165,180,252,.22);}
html[data-theme="dark"] .tool-mark{
  border-color:rgba(165,180,252,.22);
  background:linear-gradient(135deg,#282644,#333054);
}
html[data-theme="dark"] .why-icon{box-shadow:0 3px 12px rgba(79,70,229,.4);}

@media(max-width:600px){
  header.site{padding:12px 0;}
  header.site .wrap{gap:8px;}
  nav.tools{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:2px;}
  nav.tools a{margin-left:0;padding:7px 8px;font-size:12px;}
  .post-card,.post-card:first-child{padding:16px;}
}
@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto;}
  *,*::before,*::after{scroll-behavior:auto!important;transition:none!important;}
}
