/* Word counter (/word-counter and its language versions). The two-pane box reuses the AI detector
   layout from site.css (.hero, .facts, .tool, .pane, .pane-head, .pane-foot, .tool-tabs). */
.wcw-hero .lede { max-width: 800px; }
.wcw-hero .accent { color: var(--accent); }
.wcw-tool { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
textarea.wcw-text { display: block; width: 100%; height: 100%; resize: none; border: 0; outline: 0; margin: 0; padding: 18px 20px; font: 16px/1.75 var(--font); color: var(--text); background: transparent; }
textarea.wcw-text::placeholder { color: var(--text-3); }
.wcw-tool .head-tools .tool-btn span { display: none; }
.wcw-tool .head-tools .tool-btn { padding: 0 9px; }
.wcw-tool .pane-title { white-space: nowrap; }

/* Live count under the text */
.wcw-foot { flex-wrap: nowrap; gap: 10px; }
.wcw-strip { margin-right: auto; min-width: 0; font-size: .9rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.wcw-sel { font-size: .82rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.wcw-sel[hidden] { display: none; }
[dir="rtl"] .wcw-strip { margin-right: 0; margin-left: auto; }

/* Result views */
.wcw-views { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--border); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.wcw-views::-webkit-scrollbar { display: none; }
.wcw-view { border: 0; background: transparent; font: 600 .86rem var(--font); color: var(--text-2); padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.wcw-view:hover { color: var(--text); }
.wcw-view.is-on { background: var(--card); color: var(--accent); box-shadow: var(--shadow-sm); }
.wcw-view:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wcw-out { overflow: auto; padding: 16px 18px 18px; display: block; }
.wcw-pane[hidden] { display: none; }

/* Stat cards */
.wcw-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.wcw-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px 11px; background: var(--card); min-width: 0; }
.wcw-card dt { font-size: .8rem; font-weight: 600; color: var(--text-3); line-height: 1.3; }
.wcw-card dd { margin: 2px 0 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.wcw-card.is-main { background: var(--accent-soft); border-color: transparent; }
.wcw-card.is-main dd { color: var(--accent); font-size: 1.9rem; }
.wcw-card.is-wide { grid-column: span 2; }
.wcw-card small { display: block; font-size: .78rem; color: var(--text-3); font-weight: 500; margin-top: 1px; }
.wcw-card .wcw-two { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 1.12rem; }
.wcw-card .wcw-two span { white-space: nowrap; }
.wcw-card .wcw-two em { font-style: normal; font-size: .78rem; font-weight: 600; color: var(--text-3); margin-inline-start: 4px; }
.wcw-link { border: 0; background: none; padding: 0; font: 600 .8rem var(--font); color: var(--accent); cursor: pointer; }
.wcw-link:hover { text-decoration: underline; }
.wcw-h { font-size: .92rem; font-weight: 700; margin: 18px 0 8px; color: var(--text); }
.wcw-list { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.wcw-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 14px; font-size: .9rem; }
.wcw-list > div + div { border-top: 1px solid var(--border); }
.wcw-list dt { color: var(--text-2); }
.wcw-list dd { margin: 0; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; text-align: end; }
.wcw-rates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wcw-field { display: grid; gap: 4px; font-size: .84rem; font-weight: 600; color: var(--text-2); min-width: 0; }
.wcw-field input, .wcw-field select { -webkit-appearance: none; appearance: none; font: 500 .92rem var(--font); padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); width: 100%; min-width: 0; }
.wcw-field select { padding-right: 30px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
[dir="rtl"] .wcw-field select { padding-right: 10px; padding-left: 30px; background-position: 15px 50%, 10px 50%; }
.wcw-field input:focus, .wcw-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wcw-field select option { background: var(--card); color: var(--text); }
.wcw-unit { font-weight: 500; color: var(--text-3); font-size: .78rem; }
.wcw-note { font-size: .8rem; color: var(--text-3); margin: 8px 0 0; line-height: 1.45; }

/* Pages */
.wcw-big { border-radius: 14px; background: var(--accent-soft); padding: 14px 16px; margin-bottom: 12px; }
.wcw-big b { display: block; font-size: 2rem; font-weight: 800; color: var(--accent); letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.wcw-big span { font-size: .86rem; color: var(--text-2); }
.wcw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.wcw-grid .wcw-font { grid-column: span 2; }
.wcw-conv { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.wcw-conv-row { display: flex; gap: 10px; align-items: end; }
.wcw-conv-row .wcw-field { flex: 0 0 150px; }
.wcw-conv-out { margin: 8px 0 0; font-size: .92rem; color: var(--text); font-weight: 600; min-height: 1.4em; }

/* Keywords */
.wcw-kw-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.wcw-seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--border); }
.wcw-seg button { border: 0; background: transparent; font: 600 .84rem var(--font); color: var(--text-2); padding: 5px 11px; border-radius: 7px; cursor: pointer; }
.wcw-seg button.is-on { background: var(--card); color: var(--accent); box-shadow: var(--shadow-sm); }
.wcw-check { display: inline-flex; gap: 7px; align-items: center; font-size: .86rem; color: var(--text-2); cursor: pointer; }
.wcw-check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.wcw-kw { width: 100%; border-collapse: collapse; font-size: .9rem; }
.wcw-kw th { text-align: start; font-size: .76rem; font-weight: 600; color: var(--text-3); padding: 0 8px 6px; border-bottom: 1px solid var(--border); }
.wcw-kw td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.wcw-kw-i { color: var(--text-3); width: 2em; font-variant-numeric: tabular-nums; }
.wcw-kw-k { position: relative; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.wcw-kw-k span { position: relative; z-index: 1; }
.wcw-kw-k i { position: absolute; inset-inline-start: 0; top: 4px; bottom: 4px; background: var(--accent-soft); border-radius: 5px; z-index: 0; }
.wcw-kw-n, .wcw-kw-p { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; width: 4.5em; }
.wcw-kw-p { color: var(--text-2); }
.wcw-kw th:nth-child(3), .wcw-kw th:nth-child(4) { text-align: end; }
.wcw-empty { border: 1px dashed var(--border-2); border-radius: 12px; padding: 16px; color: var(--text-3); font-size: .9rem; background: var(--card-2); margin: 0; }
.wcw-empty[hidden], .wcw-kw[hidden] { display: none; }

/* Limits */
.wcw-goal { display: flex; gap: 10px; align-items: end; }
.wcw-goal .wcw-field:first-child { flex: 0 0 140px; }
.wcw-goal .wcw-field:last-child { flex: 1; }
.wcw-meter { border: 1px solid var(--border); border-radius: 12px; padding: 9px 14px 11px; }
.wcw-meter + .wcw-meter { margin-top: 6px; }
.wcw-meter[hidden] { display: none; }
.wcw-meter-top { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; }
.wcw-meter-top b { font-weight: 600; color: var(--text); }
.wcw-meter-top span { color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .82rem; }
.wcw-meter-bar { display: block; height: 6px; border-radius: 99px; background: var(--bg-soft); margin-top: 7px; overflow: hidden; }
.wcw-meter-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .2s var(--ease); }
.wcw-meter.is-near .wcw-meter-bar i { background: var(--mixed-ink); }
.wcw-meter.is-over .wcw-meter-bar i { background: var(--ai-ink); }
.wcw-meter.is-over .wcw-meter-top span { color: var(--ai-ink); font-weight: 600; }
#wcwGoalMeter { margin-top: 10px; }

.wcw-out-foot { flex-wrap: nowrap; }
.wcw-out-foot .wcw-hint { margin-right: auto; font-size: .8rem; color: var(--text-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[dir="rtl"] .wcw-out-foot .wcw-hint { margin-right: 0; margin-left: auto; }
.wcw-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: .92rem; font-weight: 600; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); text-align: center; }
.wcw-toast[hidden] { display: none; }

/* Other language versions (filled in by the server once they are live) */
.wcw-langs:empty { display: none; }

/* Page content */
.wcw-article { width: min(1180px, 100% - 40px); margin-inline: auto; }
.wcw-article .panel { padding: 8px 44px 36px; }
.wcw-hero + .wcw-article { padding-top: 56px; }
.wcw-table td { white-space: normal; vertical-align: top; }
.wcw-table td:first-child { font-weight: 600; color: var(--text); }
.wcw-table td.num, .wcw-table th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wcw-steps { counter-reset: s; list-style: none; padding: 0; }
.wcw-steps li { counter-increment: s; position: relative; padding-inline-start: 42px; margin-bottom: 14px; }
.wcw-steps li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 1px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem; display: grid; place-items: center; }
.wcw-answer { border-inline-start: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; padding: 14px 18px; margin: 18px 0; color: var(--text-2); }
[dir="rtl"] .wcw-answer { border-radius: 12px 0 0 12px; }
.wcw-answer p { margin: 0; }
.wcw-sources { font-size: .9rem; }
.wcw-sources li { word-break: break-word; }

@media (max-width: 960px), (orientation: portrait) {
  .wcw-tool.tab-result > #wcwInputPane, .wcw-tool:not(.tab-result) > #wcwResultPane { display: none; }
  .wcw-tool > .pane { flex: 1; min-height: 0; }
  .wcw-tool #wcwInputPane .pane-head { min-height: 0; padding-top: 10px; padding-bottom: 10px; }
  .wcw-tool .result-pane .pane-head { min-height: 0; padding-top: 10px; padding-bottom: 10px; justify-content: center; }
}
@media (max-width: 640px) {
  .wcw-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wcw-card.is-wide { grid-column: span 1; }
  .wcw-card .wcw-two { flex-direction: column; font-size: 1rem; gap: 2px; }
  textarea.wcw-text { padding: 16px; }
  .wcw-out { padding: 14px; }
  .wcw-card dd { font-size: 1.3rem; }
  .wcw-card.is-main dd { font-size: 1.6rem; }
  .wcw-grid { grid-template-columns: 1fr 1fr; }
  .wcw-grid .wcw-font { grid-column: 1 / -1; }
  .wcw-out-foot .wcw-hint { display: none; }
  .wcw-out-foot .btn { flex: 1; }
  .wcw-article .panel { padding: 4px 20px 24px; }
  .wcw-goal .wcw-field:first-child { flex-basis: 110px; }
}
@media (max-width: 380px) {
  .wcw-cards { gap: 6px; }
  .wcw-card { padding: 8px 10px; }
  .wcw-rates { grid-template-columns: 1fr; }
}
.wcw-langs-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.wcw-langs-list a { display: inline-block; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .92rem; }
.wcw-langs-list a:hover { border-color: var(--accent); }

/* Highlighting: a layer behind the text box draws the marks; the text box itself is transparent */
#wcwBox { isolation: isolate; }
.wcw-hl { position: absolute; inset: 0; z-index: 0; margin: 0; padding: 18px 20px; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; font: 16px/1.75 var(--font); color: transparent; pointer-events: none; }
textarea.wcw-text { position: relative; z-index: 1; }
.wcw-hl mark { color: transparent; border-radius: 4px; padding: 0; }
.wcw-hl .wcw-m-kw { background: rgba(250, 204, 21, .45); box-shadow: 0 0 0 1px rgba(202, 138, 4, .5); }
.wcw-hl .wcw-m-long { background: rgba(244, 114, 182, .22); }
:root[data-theme="dark"] .wcw-hl .wcw-m-kw { background: rgba(250, 204, 21, .3); }
:root[data-theme="dark"] .wcw-hl .wcw-m-long { background: rgba(244, 114, 182, .2); }
.wcw-hlbar { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 7px 20px; font-size: .84rem; color: var(--text-2); background: var(--accent-soft); border-top: 1px solid var(--border); }
.wcw-hlbar[hidden] { display: none; }
.wcw-hlbar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcw-kw-row { cursor: pointer; }
.wcw-kw-row:hover td { background: var(--card-2); }
.wcw-kw-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wcw-kw-row.is-on td { background: rgba(250, 204, 21, .18); }
.wcw-kw-hint { margin: 0 0 8px; }
.wcw-kw-hint[hidden] { display: none; }

/* Count options */
.wcw-opts { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: var(--card); }
.wcw-opts summary { display: flex; align-items: center; gap: 8px; padding: 9px 14px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--text); list-style: none; }
.wcw-opts summary::-webkit-details-marker { display: none; }
.wcw-opts summary svg { width: 17px; height: 17px; color: var(--accent); flex: none; }
.wcw-opts summary::after { content: ""; margin-inline-start: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform .15s; }
.wcw-opts[open] summary::after { transform: rotate(-135deg); }
.wcw-opts-n { font: 700 .72rem/1 var(--font); font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.wcw-opts-n[hidden] { display: none; }
.wcw-opts-body { display: grid; gap: 2px; padding: 0 14px 10px; }
.wcw-opt { align-items: flex-start; padding: 5px 0; }
.wcw-opt input { margin-top: 2px; flex: none; }
.wcw-opt small { display: block; color: var(--text-3); font-size: .78rem; }
.wcw-list > .wcw-longrow { background: var(--card-2); }
.wcw-longrow dt { color: var(--text); }

/* Focus mode */
html.wcw-noscroll { overflow: hidden; }
.wcw-tool.is-focus { position: fixed; inset: 0; z-index: 90; margin: 0; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border: 0; display: flex; flex-direction: column; }
.wcw-tool.is-focus > .tool-tabs, .wcw-tool.is-focus > #wcwResultPane { display: none !important; }
.wcw-tool.is-focus > #wcwInputPane { display: flex !important; flex: 1; min-height: 0; flex-direction: column; }
.wcw-tool.is-focus textarea.wcw-text, .wcw-tool.is-focus .wcw-hl { font-size: 18px; line-height: 1.8; padding-left: max(20px, calc(50% - 380px)) !important; padding-right: max(20px, calc(50% - 380px)) !important; padding-top: 5vh; }
.wcw-tool.is-focus .input-empty { display: none; }
.wcw-focus-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.wcw-tool.is-focus .head-tools .wcw-focus-btn span { display: inline; }

/* Split into posts */
.wcw-split { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 4px; }
.wcw-split-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-bottom: 10px; }
.wcw-split-bar .wcw-field { flex: 0 0 190px; }
.wcw-split-bar .btn { margin-inline-start: auto; }
.wcw-split-bar .btn[hidden] { display: none; }
.wcw-posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: post; }
.wcw-posts li { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: var(--card); }
.wcw-posts p { margin: 0 0 6px; white-space: pre-wrap; font-size: .92rem; color: var(--text); line-height: 1.55; overflow-wrap: anywhere; }
.wcw-post-foot { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Speech timer */
.wcw-h0 { margin-top: 2px; }
.wcw-timer { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--card); }
.wcw-timer-top { display: flex; align-items: baseline; gap: 8px; }
.wcw-timer-top b { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; color: var(--accent); font-variant-numeric: tabular-nums; }
.wcw-timer-top span { color: var(--text-3); font-variant-numeric: tabular-nums; }
.wcw-timer-btns { display: flex; gap: 8px; margin-top: 12px; }
.wcw-timer-now { margin: 12px 0 0; font-size: .92rem; color: var(--text); }
.wcw-timer-now[hidden] { display: none; }
.wcw-timer-now small { display: block; color: var(--text-3); font-size: .78rem; margin-bottom: 2px; }
@media (max-width: 640px) {
  .wcw-hl { padding: 16px; }
  .wcw-split-bar .wcw-field { flex: 1 1 100%; }
  .wcw-split-bar .btn { margin-inline-start: 0; }
}
