/* Word Counter — builds on aiwa-grammar.css (command bar, workspace grid, buttons, menus, empty state). */

.counter-page .wc-editor-scroll { display: flex; flex-direction: column; }
.wc-editor { flex: 1 1 auto; width: 100%; min-height: 100%; margin: 0; padding: 26px 34px 120px; border: 0; outline: 0; resize: none; background: transparent; color: var(--aiwa-ink); font: inherit; font-size: 17px; line-height: 1.85; overflow-wrap: anywhere; caret-color: var(--aiwa-brand-dark); }
.wc-editor::placeholder { color: #8a958e; }
.wc-speed select { width: 210px; }
.wc-selection { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 7px 18px; border-top: 1px solid var(--aiwa-line); background: var(--aiwa-brand-soft); color: var(--aiwa-brand-dark); font-size: 12.5px; font-weight: 650; }
.wc-selection[hidden] { display: none !important; }
.wc-selection b { font-weight: 760; }
.wc-selection .wc-sel-tag { padding: 2px 8px; border-radius: 999px; background: #fff; font-size: 11px; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; }

/* Stats pane */
.wc-stats-pane { min-height: 0; }
.wc-tabs { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--aiwa-line); background: #fff; }
.wc-tab { min-height: 36px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--aiwa-muted); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: background-color 140ms var(--aiwa-ease), color 140ms var(--aiwa-ease); }
.wc-tab:hover { background: var(--aiwa-bg); color: var(--aiwa-text); }
.wc-tab[aria-selected="true"] { border-color: var(--aiwa-brand); background: var(--aiwa-brand-soft); color: var(--aiwa-brand-dark); }
.wc-tab:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.45); outline-offset: 1px; }
.wc-panels { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px 12px 28px; scrollbar-width: thin; }
.wc-panel[hidden] { display: none !important; }
.wc-panel { display: flex; flex-direction: column; gap: 10px; }

.wc-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wc-tile { position: relative; padding: 12px 14px 11px; border: 1px solid var(--aiwa-line); border-radius: 12px; background: #fff; }
.wc-tile b { display: block; font-size: 22px; font-weight: 780; letter-spacing: -0.03em; line-height: 1.1; color: var(--aiwa-ink); font-variant-numeric: tabular-nums; }
.wc-tile span { display: block; margin-top: 4px; color: var(--aiwa-muted); font-size: 11.5px; font-weight: 650; }
.wc-tile small { display: block; margin-top: 2px; color: #8a958e; font-size: 11px; font-weight: 550; }
.wc-tile.accent { border-color: #cfe6d7; background: var(--aiwa-brand-soft); }
.wc-tile.accent b { color: var(--aiwa-brand-dark); }

.wc-card { padding: 12px 14px 13px; border: 1px solid var(--aiwa-line); border-radius: 12px; background: #fff; }
.wc-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.wc-card-head h2 { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 13px; font-weight: 760; color: var(--aiwa-text); }
.wc-card-head h2 .aiwa-ui-icon { width: 15px; height: 15px; opacity: 0.8; }
.wc-muted { margin: 8px 0 0; color: #8a958e; font-size: 11.5px; line-height: 1.5; }
.wc-details { display: grid; grid-template-columns: 1fr auto; gap: 0; margin: 0; }
.wc-details dt, .wc-details dd { margin: 0; padding: 6px 0; border-top: 1px solid #eef1ef; font-size: 12.5px; }
.wc-details dt { color: var(--aiwa-muted); font-weight: 600; }
.wc-details dd { text-align: right; font-weight: 750; color: var(--aiwa-ink); font-variant-numeric: tabular-nums; }
.wc-details dd small { color: #8a958e; font-weight: 550; }
.wc-details dt:first-of-type, .wc-details dt:first-of-type + dd { border-top: 0; }

/* Goal */
.wc-goal-input { display: inline-flex; align-items: center; gap: 4px; }
.wc-goal-input input { width: 76px; min-height: 30px; padding: 3px 8px; border: 1px solid var(--aiwa-line); border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--aiwa-ink); text-align: right; }
.wc-goal-input select { min-height: 30px; padding: 2px 4px; border: 1px solid var(--aiwa-line); border-radius: 8px; background: #fff; font: inherit; font-size: 12px; font-weight: 650; color: var(--aiwa-text); }
.wc-goal-input input:focus, .wc-goal-input select:focus, .wc-find input:focus { outline: 0; border-color: var(--aiwa-brand); box-shadow: 0 0 0 3px rgba(19, 122, 61, 0.15); }
.wc-progress { height: 8px; border-radius: 6px; background: #eceff0; overflow: hidden; }
.wc-progress span { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--aiwa-brand); transition: width 220ms var(--aiwa-ease); }
.wc-progress span.over { background: #d28a0c; }
.wc-progress span.done { background: var(--aiwa-brand); }
.wc-goal-text { margin: 8px 0 0; color: var(--aiwa-muted); font-size: 12.5px; font-weight: 600; }
.wc-goal-text.done { color: var(--aiwa-brand-dark); }

/* Keywords */
.wc-toggle { min-height: 30px; padding: 0 8px; font-size: 11.5px; }
.wc-seg { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 8px; border-radius: 9px; background: #eef2ef; }
.wc-seg-btn { min-height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--aiwa-muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.wc-seg-btn[aria-pressed="true"] { background: #fff; color: var(--aiwa-brand-dark); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1); }
.wc-keywords { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.wc-keywords li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; overflow: hidden; font-size: 12.5px; cursor: pointer; }
.wc-keywords li:hover { background: var(--aiwa-bg); }
.wc-keywords li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0%); background: #e3f1e8; z-index: 0; border-radius: 8px; }
.wc-keywords li > * { position: relative; z-index: 1; }
.wc-keywords .wc-kw { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--aiwa-ink); }
.wc-keywords .wc-kw-n { font-weight: 750; color: var(--aiwa-text); font-variant-numeric: tabular-nums; }
.wc-keywords .wc-kw-p { min-width: 44px; text-align: right; color: var(--aiwa-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.wc-find { display: flex; align-items: center; gap: 8px; }
.wc-find input { flex: 1; min-width: 0; min-height: 36px; padding: 6px 10px; border: 1px solid var(--aiwa-line); border-radius: 9px; font: inherit; font-size: 13px; color: var(--aiwa-ink); }
.wc-find-count { flex: 0 0 auto; min-width: 60px; text-align: right; font-size: 13px; font-weight: 760; color: var(--aiwa-brand-dark); font-variant-numeric: tabular-nums; }

/* Readability */
.wc-read-hero { display: flex; align-items: center; gap: 14px; }
.wc-ring { width: 64px; height: 64px; flex: 0 0 64px; }
.wc-ring b { font-size: 17px; }
.wc-ring::before { inset: 5px; }
.wc-read-hero h2 { margin: 0 0 3px; font-size: 15px; font-weight: 770; letter-spacing: -0.01em; color: var(--aiwa-ink); }
.wc-read-hero p { margin: 0; color: var(--aiwa-muted); font-size: 12.5px; line-height: 1.5; }
.wc-bars { display: flex; align-items: flex-end; gap: 4px; height: 64px; padding: 4px 0 0; }
.wc-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; font-size: 10px; color: var(--aiwa-muted); font-weight: 650; }
.wc-bar i { display: block; width: 100%; max-width: 34px; min-height: 2px; border-radius: 4px 4px 0 0; background: #cfe6d7; }
.wc-bar.hi i { background: var(--aiwa-brand); }
.wc-bar.warn i { background: #e0a23b; }
.wc-bar.bad i { background: #d92d20; }
.wc-longest { margin: 8px 0 0; padding: 0 0 0 18px; display: grid; gap: 5px; }
.wc-longest li { font-size: 12.5px; color: var(--aiwa-text); line-height: 1.45; }
.wc-longest li button { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.wc-longest li button:hover { color: var(--aiwa-brand-dark); text-decoration: underline; }
.wc-longest li b { color: var(--aiwa-brand-dark); font-weight: 750; }

/* Limits */
.wc-limits { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.wc-limit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; }
.wc-limit .wc-limit-name { font-size: 12.5px; font-weight: 700; color: var(--aiwa-ink); }
.wc-limit .wc-limit-val { font-size: 12px; font-weight: 700; color: var(--aiwa-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wc-limit .wc-limit-val.ok { color: var(--aiwa-brand-dark); }
.wc-limit .wc-limit-val.over { color: #b42318; }
.wc-limit .wc-progress { grid-column: 1 / -1; height: 6px; }
.wc-limit .wc-progress span.over { background: #d92d20; }
.wc-limit .wc-progress span.near { background: #e0a23b; }

/* Footer stats: the stats pane already shows everything, so only hide them when space really runs out */
.counter-page .gc-stats > span.wc-foot-stat { display: inline !important; }
@media (max-width: 1500px) { .counter-page .gc-stats > span.wc-foot-stat:nth-child(3) { display: none !important; } }
@media (max-width: 1380px) { .counter-page .gc-stats > span.wc-foot-stat:nth-child(2) { display: none !important; } }
@media (max-width: 1100px) { .counter-page .gc-stats { display: none; } }
.wc-tile b.long { font-size: 17px; padding-top: 3px; }

/* Busy / misc */
.wc-stats-pane .gc-btn.is-busy, #wcPasteBtn.is-busy { opacity: 0.7; pointer-events: none; }
#wcDocTitle { cursor: default; }

@media (max-width: 1260px) { .wc-speed select { width: 180px; } }
@media (max-width: 900px) {
  .wc-speed select { width: 150px; }
  .wc-editor { padding: 18px 16px 100px; font-size: 16px; line-height: 1.8; }
  body[data-gc-view="editor"] .wc-stats-pane { display: none; }
  body[data-gc-view="review"] .gc-editor-pane { display: none; }
  .wc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1500px) { .wc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.gc-editor-pane.is-importing .wc-editor { opacity: 0.5; pointer-events: none; }
.wc-longest { list-style: none; padding-left: 0; }
