/*!
 * Humanly — AI Text Cleaner & Humanizer | styles v2
 * Copyright (c) 2026 Dot2Shape. All rights reserved.
 */

/* ---------- Tokens ---------- */
:root {
  --lime: #65a30d;
  --lime-2: #a3e635;
  --grad: linear-gradient(135deg, #a3e635, #65a30d);
  --bg: #faf9f5;
  --bg-2: #ffffff;
  --ink: #1c2117;
  --ink-2: #5a614f;
  --line: #e4e3da;
  --card-sh: 0 1px 2px rgba(28, 33, 23, .05), 0 8px 28px rgba(28, 33, 23, .06);
  --link: #4d7c0f;
  --mark-filler: rgba(163, 230, 53, .38);
  --mark-dash: rgba(251, 146, 60, .34);
  --mark-quotes: rgba(56, 189, 248, .3);
  --mark-emoji: rgba(244, 114, 182, .32);
  --mark-md: rgba(167, 139, 250, .32);
  --mark-inv: rgba(148, 163, 184, .45);
  --r: 16px;
}
html.dark {
  --bg: #101408;
  --bg-2: #171c0e;
  --ink: #eef2e4;
  --ink-2: #9aa48a;
  --line: #2a3319;
  --card-sh: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 32px rgba(0, 0, 0, .35);
  --link: #bef264;
  --mark-filler: rgba(163, 230, 53, .26);
  --mark-dash: rgba(251, 146, 60, .26);
  --mark-quotes: rgba(56, 189, 248, .24);
  --mark-emoji: rgba(244, 114, 182, .24);
  --mark-md: rgba(167, 139, 250, .26);
  --mark-inv: rgba(148, 163, 184, .3);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; line-height: 1.15; letter-spacing: -.01em; }
a { color: var(--link); }
main { max-width: 780px; margin: 0 auto; padding: 0 20px; }
.wrap { max-width: 780px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 10px; padding: 12px 20px; max-width: 780px; margin: 0 auto; }
.logo { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.brand { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 19px; color: var(--ink); }
.brand > a { color: inherit; text-decoration: none; }
.brand small { display: block; font-family: "Inter", sans-serif; font-weight: 500; font-size: 11px; color: var(--ink-2); letter-spacing: .02em; margin-top: -2px; }
.brand small a { color: inherit; text-decoration: none; }
.brand small a:hover { color: var(--link); }
.nav .spacer { flex: 1; }
#themeToggle {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink); cursor: pointer;
  display: grid; place-items: center;
}
#themeToggle:hover { border-color: var(--lime); }
#themeToggle .moon { display: none; }
html.dark #themeToggle .moon { display: block; }
html.dark #themeToggle .sun { display: none; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 44px 0 8px; }
.hero h1 { font-size: clamp(30px, 5.6vw, 44px); margin: 0 0 10px; font-weight: 600; }
.hero h1 .hl {
  background: linear-gradient(transparent 58%, var(--mark-filler) 58%);
  border-radius: 4px; padding: 0 .08em;
}
.hero p { color: var(--ink-2); max-width: 560px; margin: 0 auto; font-size: 17px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px 0 0; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--bg-2);
  padding: 6px 12px; border-radius: 999px;
}
.badge svg { color: var(--lime); }

/* ---------- Tool ---------- */
.tool { margin: 26px 0 8px; }
.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--card-sh);
  padding: 18px;
}
.field-label { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 600; font-size: 14px; }
.field-label .hint { font-weight: 400; color: var(--ink-2); font-size: 13px; }
.field-label .grow { flex: 1; }
textarea {
  width: 100%; min-height: 150px; resize: vertical;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font: 15px/1.6 "Inter", system-ui, sans-serif;
}
textarea:focus { outline: 2px solid var(--lime-2); outline-offset: 1px; border-color: transparent; }
#output { min-height: 220px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--ink-2); font: 500 13px/1 "Inter", sans-serif;
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  transition: border-color .15s, color .15s, opacity .15s;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-2); opacity: .4; }
.chip .n {
  min-width: 20px; text-align: center; font-weight: 600; font-size: 12px;
  background: var(--line); color: var(--ink); border-radius: 999px; padding: 2px 6px;
}
.chip.on { color: var(--ink); border-color: color-mix(in srgb, var(--lime) 50%, var(--line)); }
.chip.on .dot { opacity: 1; }
.chip:not(.on) { opacity: .55; text-decoration: line-through; }
.chip.c-filler .dot { background: var(--lime-2); }
.chip.c-dash .dot { background: #fb923c; }
.chip.c-quotes .dot { background: #38bdf8; }
.chip.c-emoji .dot { background: #f472b6; }
.chip.c-md .dot { background: #a78bfa; }
.chip.c-inv .dot { background: #94a3b8; }

.previewBox {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; min-height: 120px; max-height: 340px; overflow: auto;
  font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-wrap: break-word;
}
.previewBox .ph { color: var(--ink-2); opacity: .7; }
mark {
  border-radius: 4px; padding: 0 2px; cursor: pointer; color: inherit;
  transition: opacity .12s;
}
mark.c-filler { background: var(--mark-filler); }
mark.c-dash { background: var(--mark-dash); }
mark.c-quotes { background: var(--mark-quotes); }
mark.c-emoji { background: var(--mark-emoji); }
mark.c-md { background: var(--mark-md); }
mark.c-inv { background: var(--mark-inv); }
mark.flag { outline: 1px dashed color-mix(in srgb, var(--ink) 35%, transparent); }
mark.off { background: transparent; opacity: .45; text-decoration: line-through; }
.legend { font-size: 12.5px; color: var(--ink-2); margin: 8px 2px 0; }

.stats { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 13.5px; margin: 14px 2px 2px; }
.stats b { color: var(--ink); font-weight: 600; }
.insight {
  margin: 12px 0 0; padding: 10px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--lime) 9%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--lime) 30%, var(--line));
  font-size: 13.5px; color: var(--ink);
}
.insight p { margin: 4px 0; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; padding: 12px 22px; cursor: pointer;
  font: 600 15px/1 "Inter", sans-serif; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.btn:hover { border-color: var(--lime); }
.btn:active { transform: scale(.98); }
.btn.primary {
  background: var(--grad); color: #17210a; border: none;
  box-shadow: 0 4px 16px rgba(101, 163, 13, .35);
}
.btn.primary:hover { box-shadow: 0 6px 22px rgba(101, 163, 13, .45); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn .tip { position: relative; }
#copyBtn { position: relative; }
#copyBtn::after {
  content: "Copied!"; position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%) scale(.9); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 8px; transition: opacity .15s, transform .15s;
  white-space: nowrap;
}
#copyBtn.copied::after { opacity: 1; transform: translateX(-50%) scale(1); }
.resultSummary { font-size: 14px; color: var(--ink-2); margin: 0 0 10px; }
.resultSummary:empty { display: none; }

/* ---------- Sticky mobile CTA ---------- */
.stickybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  display: none;
}
.stickybar .btn { width: 100%; }
@media (max-width: 640px) {
  .stickybar.show { display: block; }
  body.has-sticky { padding-bottom: 76px; }
}

/* ---------- Install banner ---------- */
.install {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60;
  max-width: 420px; margin: 0 auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--card-sh); padding: 14px 16px;
  display: flex; gap: 12px; align-items: center;
}
.install img { width: 40px; height: 40px; border-radius: 10px; }
.install .txt { flex: 1; font-size: 13.5px; }
.install .txt b { display: block; font-size: 14.5px; }
.install .txt span { color: var(--ink-2); }
.install .x { background: none; border: none; color: var(--ink-2); font-size: 18px; cursor: pointer; padding: 4px; }

/* ---------- SEO content ---------- */
.content { padding: 40px 0 20px; }
.content section { margin: 0 0 40px; }
.content h2 { font-size: 26px; margin: 0 0 14px; }
.content h3 { font-size: 18px; margin: 22px 0 8px; }
.content p, .content li { color: var(--ink-2); font-size: 15.5px; }
.content ul { padding-left: 22px; }
.content b, .content strong { color: var(--ink); }
.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 18px; }
.step { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.step .num {
  width: 28px; height: 28px; border-radius: 8px; background: var(--grad);
  color: #17210a; font-weight: 700; font-size: 14px; display: grid; place-items: center; margin-bottom: 10px;
}
.step b { font-size: 15px; }
.step p { font-size: 13.5px; margin: 6px 0 0; }
details {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 18px; margin: 0 0 10px;
}
details summary { cursor: pointer; font-weight: 600; font-size: 15px; }
details p { margin: 10px 0 0; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag { font-size: 13px; border: 1px solid var(--line); background: var(--bg-2); border-radius: 999px; padding: 5px 12px; color: var(--ink-2); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 26px 20px 34px; margin-top: 20px; }
.foot { max-width: 780px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--link); }
.foot .spacer { flex: 1; }

/* ---------- Ad rails (reserved, hidden until AdSense) ---------- */
.ad-rail { display: none; }
@media (min-width: 1240px) {
  .ad-rail.enabled { display: block; position: fixed; top: 120px; width: 160px; min-height: 600px; }
  .ad-rail.left { left: calc(50% - 390px - 180px); }
  .ad-rail.right { right: calc(50% - 390px - 180px); }
}

@media (max-width: 640px) {
  .hero { padding-top: 30px; }
  .card { padding: 14px; }
  .actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ================= v2 additions ================= */

/* FIX: the hidden attribute must always win over class display rules
   (.install{display:flex} made the banner undismissable; .btn{display:inline-flex} kept Copy visible) */
[hidden] { display: none !important; }

/* Side-by-side editor + issues/result panel */
.tool { width: min(1120px, 100vw - 40px); position: relative; left: 50%; transform: translateX(-50%); }
.duo { display: grid; gap: 18px; grid-template-columns: 1fr; margin-top: 4px; }
.duo .col { display: flex; flex-direction: column; min-width: 0; }
.duo #input { flex: 1; min-height: 220px; }
.duo .previewBox, .duo #output { flex: 1; min-height: 220px; max-height: none; }
.duo .actions { margin-top: 12px; }
.duo .resultSummary { margin: 8px 2px 0; }

@media (min-width: 900px) {
  .duo { grid-template-columns: 1fr 1fr; }
  .duo #input { min-height: 380px; }
  .duo .previewBox, .duo #output { min-height: 380px; max-height: 520px; }
}

/* Tabs on the right panel */
.tabbar { gap: 6px; }
.tab {
  border: 1px solid var(--line); background: var(--bg);
  color: var(--ink-2); font: 600 13px/1 "Inter", sans-serif;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.tab.on {
  color: #17210a; background: var(--grad); border-color: transparent;
}
html.dark .tab.on { color: #17210a; }
.tab:disabled { opacity: .4; cursor: not-allowed; }
.tab:not(.on):not(:disabled):hover { border-color: var(--lime); color: var(--ink); }

/* Copy tooltip still anchors to #copyBtn (now in the tabbar) */
#copyBtn { position: relative; }
