:root {
  --wc-bg            : #f8f9fc;
  --wc-surface       : #ffffff;
  --wc-surface-2     : #f1f3f8;
  --wc-border        : #e2e6ef;
  --wc-border-2      : #d0d5e8;
  --wc-text-primary  : #1a1d2e;
  --wc-text-secondary: #5a6282;
  --wc-text-muted    : #9399b2;
  --wc-accent        : #4f6ef7;
  --wc-accent-dark   : #3a56d4;
  --wc-accent-light  : #eef1fe;
  --wc-success       : #10b981;
  --wc-success-light : #d1fae5;
  --wc-warning       : #f59e0b;
  --wc-warning-light : #fef3c7;
  --wc-danger        : #ef4444;
  --wc-danger-light  : #fee2e2;
  --wc-shadow-sm     : 0 1px 3px rgba(0,0,0,.07);
  --wc-shadow-md     : 0 4px 12px rgba(0,0,0,.08);
  --wc-radius-sm     : 8px;
  --wc-radius-md     : 12px;
  --wc-radius-lg     : 16px;
  --wc-font          : 'Inter', system-ui, -apple-system, sans-serif;
  --wc-mono          : 'JetBrains Mono', 'Fira Code', monospace;
  --wc-transition    : 0.2s ease;
  --wc-stat-accent-1 : #4f6ef7;
  --wc-stat-accent-2 : #7c3aed;
  --wc-stat-accent-3 : #10b981;
  --wc-stat-accent-4 : #f59e0b;
  --wc-stat-accent-5 : #ef4444;
  --wc-stat-accent-6 : #06b6d4;
}
[data-theme="dark"] {
  --wc-bg            : #0f1117;
  --wc-surface       : #1a1d2e;
  --wc-surface-2     : #222538;
  --wc-border        : #2e3150;
  --wc-border-2      : #373c62;
  --wc-text-primary  : #e8eaf6;
  --wc-text-secondary: #9399b2;
  --wc-text-muted    : #6b7280;
  --wc-accent        : #6b84f8;
  --wc-accent-dark   : #5470f0;
  --wc-accent-light  : #1e2244;
  --wc-success       : #34d399;
  --wc-success-light : #064e3b;
  --wc-warning       : #fbbf24;
  --wc-warning-light : #451a03;
  --wc-danger        : #f87171;
  --wc-danger-light  : #450a0a;
  --wc-shadow-sm     : 0 1px 3px rgba(0,0,0,.3);
  --wc-shadow-md     : 0 4px 12px rgba(0,0,0,.4);
}
.twt-tool-section[data-tool="word-counter"] {
  font-family  : var(--wc-font);
  background   : var(--wc-bg);
  color        : var(--wc-text-primary);
  width        : 100%;
  max-width    : 100%;
  overflow-x   : hidden;          /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  display      : flex;
  flex-direction: column;
  position     : relative;
}
.wc-stats-bar {
  display               : grid;
  grid-template-columns : repeat(6, 1fr);   /* Desktop: 6 cols */
  width                 : 100%;
  background            : var(--wc-surface);
  border-bottom         : 1px solid var(--wc-border);
  box-shadow            : var(--wc-shadow-sm);
  overflow              : hidden;           /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
}

.wc-stat-card {
  display         : flex;
  flex-direction  : column;
  align-items     : center;
  justify-content : center;
  padding         : 14px 8px;
  gap             : 4px;
  border-right    : 1px solid var(--wc-border);
  position        : relative;
  overflow        : hidden;
  min-width       : 0;                      /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  transition      : background var(--wc-transition);
}

.wc-stat-card:last-child {
  border-right: none;
}
.wc-stat-card::after {
  content    : '';
  position   : absolute;
  bottom     : 0;
  left       : 0;
  right      : 0;
  height     : 3px;
}

.wc-stat-card:nth-child(1)::after { background: var(--wc-stat-accent-1); }
.wc-stat-card:nth-child(2)::after { background: var(--wc-stat-accent-2); }
.wc-stat-card:nth-child(3)::after { background: var(--wc-stat-accent-3); }
.wc-stat-card:nth-child(4)::after { background: var(--wc-stat-accent-4); }
.wc-stat-card:nth-child(5)::after { background: var(--wc-stat-accent-5); }
.wc-stat-card:nth-child(6)::after { background: var(--wc-stat-accent-6); }

.wc-stat-card:hover {
  background: var(--wc-surface-2);
}

.wc-stat-card__value {
  font-size     : clamp(1.1rem, 3vw, 1.8rem);
  font-weight   : 700;
  line-height   : 1;
  letter-spacing: -0.02em;
  white-space   : nowrap;
  overflow      : hidden;
  text-overflow : ellipsis;
  max-width     : 100%;
}
.wc-stat-card:nth-child(1) .wc-stat-card__value { color: var(--wc-stat-accent-1); }
.wc-stat-card:nth-child(2) .wc-stat-card__value { color: var(--wc-stat-accent-2); }
.wc-stat-card:nth-child(3) .wc-stat-card__value { color: var(--wc-stat-accent-3); }
.wc-stat-card:nth-child(4) .wc-stat-card__value { color: var(--wc-stat-accent-4); }
.wc-stat-card:nth-child(5) .wc-stat-card__value { color: var(--wc-stat-accent-5); }
.wc-stat-card:nth-child(6) .wc-stat-card__value { color: var(--wc-stat-accent-6); }

.wc-stat-card__label {
  font-size     : clamp(0.55rem, 1.2vw, 0.7rem);
  font-weight   : 600;
  color         : var(--wc-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space   : nowrap;
}
.wc-editor-wrap {
  display               : grid;
  grid-template-columns : 1fr 280px;
  width                 : 100%;
  min-height            : 0;
  overflow              : hidden;           /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
}
.wc-editor-panel {
  display        : flex;
  flex-direction : column;
  background     : var(--wc-surface);
  border-right   : 1px solid var(--wc-border);
  min-width      : 0;                       /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  overflow       : hidden;
}
.wc-editor-toolbar {
  display         : flex;
  align-items     : center;
  justify-content : space-between;
  padding         : 10px 14px;
  border-bottom   : 1px solid var(--wc-border);
  background      : var(--wc-surface-2);
  gap             : 10px;
  flex-wrap       : wrap;
  width           : 100%;
  min-width       : 0;                      /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
}

.wc-editor-toolbar__title {
  display     : flex;
  align-items : center;
  gap         : 6px;
  font-size   : 0.8rem;
  font-weight : 600;
  color       : var(--wc-text-secondary);
  white-space : nowrap;
  min-width   : 0;
  overflow    : hidden;
  text-overflow: ellipsis;
}

.wc-editor-toolbar__actions {
  display     : flex;
  align-items : center;
  gap         : 8px;
  flex-wrap   : wrap;
  flex-shrink : 0;                          /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
}
.wc-limit-wrap {
  display     : flex;
  align-items : center;
  gap         : 6px;
}

.wc-limit-label {
  font-size  : 0.74rem;
  font-weight: 500;
  color      : var(--wc-text-muted);
  white-space: nowrap;
}

.wc-limit-input {
  width        : 80px;                      /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> Reduced width */
  padding      : 5px 8px;
  border       : 1px solid var(--wc-border);
  border-radius: var(--wc-radius-sm);
  background   : var(--wc-surface);
  color        : var(--wc-text-primary);
  font-size    : 0.76rem;
  font-family  : var(--wc-font);
  outline      : none;
  transition   : border-color var(--wc-transition),
                 box-shadow var(--wc-transition);
  min-width    : 0;
}

.wc-limit-input:focus {
  border-color: var(--wc-accent);
  box-shadow  : 0 0 0 3px rgba(79,110,247,.15);
}

.wc-limit-input::-webkit-inner-spin-button,
.wc-limit-input::-webkit-outer-spin-button { opacity: 0.4; }
.wc-toolbar-btn {
  display      : flex;
  align-items  : center;
  gap          : 5px;
  padding      : 5px 10px;
  border       : 1px solid var(--wc-border);
  border-radius: var(--wc-radius-sm);
  background   : var(--wc-surface);
  color        : var(--wc-text-secondary);
  font-size    : 0.76rem;
  font-weight  : 600;
  font-family  : var(--wc-font);
  cursor       : pointer;
  white-space  : nowrap;
  transition   : all var(--wc-transition);
  flex-shrink  : 0;
}

.wc-toolbar-btn:hover {
  background  : var(--wc-accent-light);
  border-color: var(--wc-accent);
  color       : var(--wc-accent);
}
.wc-textarea-wrap {
  flex       : 1;
  display    : flex;
  flex-direction: column;
  position   : relative;
  min-height : 0;
  min-width  : 0;                           /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  overflow   : hidden;
}

.wc-textarea {
  flex       : 1;
  width      : 100%;
  padding    : 16px;
  border     : none;
  outline    : none;
  resize     : none;
  background : var(--wc-surface);
  color      : var(--wc-text-primary);
  font-size  : clamp(0.85rem, 1.5vw, 1rem);
  font-family: var(--wc-font);
  line-height: 1.75;
  min-height : 240px;
  caret-color: var(--wc-accent);
  overflow-y : auto;
  overflow-x : hidden;                      /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  word-wrap  : break-word;                  /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  word-break : break-word;                  /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  white-space: pre-wrap;                    /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  max-width  : 100%;                        /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
}

.wc-textarea::placeholder {
  color    : var(--wc-text-muted);
  font-size: 0.88rem;
}
.wc-limit-bar {
  height    : 3px;
  background: var(--wc-border);
  overflow  : hidden;
  flex-shrink: 0;
  width     : 100%;
}

.wc-limit-bar__fill {
  height    : 100%;
  width     : 0%;
  background: var(--wc-success);
  transition: width 0.3s ease, background 0.3s ease;
}

.wc-limit-bar__fill[data-level="warn"]   { background: var(--wc-warning); }
.wc-limit-bar__fill[data-level="danger"] { background: var(--wc-danger);  }
.wc-limit-warning {
  display    : none;
  align-items: center;
  gap        : 6px;
  padding    : 7px 14px;
  background : var(--wc-warning-light);
  color      : var(--wc-warning);
  font-size  : 0.76rem;
  font-weight: 500;
  border-top : 1px solid var(--wc-border);
  flex-shrink: 0;
  width      : 100%;
  overflow   : hidden;
}

.wc-limit-warning[data-level="danger"] {
  background: var(--wc-danger-light);
  color     : var(--wc-danger);
}
.wc-action-bar {
  display         : flex;
  align-items     : center;
  justify-content : space-between;
  padding         : 10px 14px;
  border-top      : 1px solid var(--wc-border);
  background      : var(--wc-surface-2);
  gap             : 10px;
  flex-shrink     : 0;
  flex-wrap       : wrap;
  width           : 100%;
  min-width       : 0;                      /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  overflow        : hidden;
}

.wc-action-bar__left {
  display    : flex;
  align-items: center;
  min-width  : 0;
  overflow   : hidden;
}

.wc-action-bar__right {
  display    : flex;
  align-items: center;
  gap        : 8px;
  flex-wrap  : wrap;
  flex-shrink: 0;
}

.wc-live-badge {
  font-size    : 0.75rem;
  font-weight  : 500;
  color        : var(--wc-text-muted);
  background   : var(--wc-surface);
  padding      : 4px 10px;
  border-radius: var(--wc-radius-sm);
  border       : 1px solid var(--wc-border);
  white-space  : nowrap;
  overflow     : hidden;
  text-overflow: ellipsis;
  max-width    : 100%;
}
.wc-action-btn {
  display      : flex;
  align-items  : center;
  gap          : 5px;
  padding      : 7px 14px;
  border-radius: var(--wc-radius-sm);
  font-size    : 0.78rem;
  font-weight  : 600;
  font-family  : var(--wc-font);
  cursor       : pointer;
  transition   : all var(--wc-transition);
  border       : 1px solid transparent;
  white-space  : nowrap;
  flex-shrink  : 0;
}

.wc-action-btn--ghost {
  background  : transparent;
  border-color: var(--wc-border);
  color       : var(--wc-text-secondary);
}

.wc-action-btn--ghost:hover {
  background  : var(--wc-surface-2);
  border-color: var(--wc-border-2);
  color       : var(--wc-text-primary);
}

.wc-action-btn--primary {
  background  : var(--wc-accent);
  color       : #fff;
  border-color: var(--wc-accent);
  box-shadow  : 0 2px 8px rgba(79,110,247,.3);
}

.wc-action-btn--primary:hover {
  background  : var(--wc-accent-dark);
  border-color: var(--wc-accent-dark);
  transform   : translateY(-1px);
}
.wc-details-panel {
  width          : 280px;
  min-width      : 0;                       /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  max-width      : 280px;
  background     : var(--wc-surface);
  display        : flex;
  flex-direction : column;
  overflow-y     : auto;
  overflow-x     : hidden;                  /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
}

.wc-detail-card {
  padding      : 14px;
  border-bottom: 1px solid var(--wc-border);
  min-width    : 0;                         /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
  overflow     : hidden;
}

.wc-detail-card:last-child { border-bottom: none; }

.wc-detail-card__title {
  display       : flex;
  align-items   : center;
  gap           : 6px;
  font-size     : 0.72rem;
  font-weight   : 700;
  color         : var(--wc-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin        : 0 0 12px 0;
  padding-bottom: 10px;
  border-bottom : 1px solid var(--wc-border);
}
.wc-time-list {
  list-style    : none;
  display       : flex;
  flex-direction: column;
  gap           : 8px;
}

.wc-time-item {
  display        : flex;
  align-items    : center;
  justify-content: space-between;
  gap            : 6px;
  min-width      : 0;
}

.wc-time-item__label {
  display    : flex;
  align-items: center;
  gap        : 5px;
  font-size  : 0.75rem;
  color      : var(--wc-text-secondary);
  flex       : 1;
  min-width  : 0;
  overflow   : hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wc-time-item__value {
  font-size  : 0.8rem;
  font-weight: 700;
  color      : var(--wc-accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.wc-keywords-empty {
  display       : flex;
  flex-direction: column;
  align-items   : center;
  gap           : 6px;
  padding       : 14px 0;
  color         : var(--wc-text-muted);
}

.wc-keywords-empty p {
  font-size : 0.72rem;
  margin    : 0;
  text-align: center;
}

.wc-keyword-list {
  list-style    : none;
  display       : flex;
  flex-direction: column;
  gap           : 6px;
  min-width     : 0;
  overflow      : hidden;
}

.wc-keyword-item {
  display              : grid;
  grid-template-columns: minmax(0,70px) 1fr minmax(0,55px);
  align-items          : center;
  gap                  : 6px;
  min-width            : 0;
  animation            : wc-fade-in 0.2s ease both;
}

.wc-keyword-item__word {
  font-size    : 0.72rem;
  font-weight  : 600;
  color        : var(--wc-text-primary);
  overflow     : hidden;
  text-overflow: ellipsis;
  white-space  : nowrap;
  min-width    : 0;
}

.wc-keyword-item__bar-wrap {
  height       : 5px;
  background   : var(--wc-border);
  border-radius: 99px;
  overflow     : hidden;
  min-width    : 0;
}

.wc-keyword-item__bar {
  height       : 100%;
  background   : var(--wc-accent);
  border-radius: 99px;
  transition   : width 0.4s ease;
}

.wc-keyword-item__count {
  font-size  : 0.68rem;
  color      : var(--wc-text-muted);
  text-align : right;
  white-space: nowrap;
  overflow   : hidden;
  text-overflow: ellipsis;
}
.wc-adv-stats {
  list-style    : none;
  display       : flex;
  flex-direction: column;
  gap           : 6px;
  min-width     : 0;
}

.wc-adv-stat-item {
  display        : flex;
  align-items    : flex-start;
  justify-content: space-between;
  gap            : 6px;
  padding        : 5px 0;
  border-bottom  : 1px dashed var(--wc-border);
  min-width      : 0;
}

.wc-adv-stat-item:last-child { border-bottom: none; }

.wc-adv-stat-item__label {
  font-size  : 0.72rem;
  color      : var(--wc-text-secondary);
  flex       : 1;
  min-width  : 0;
  line-height: 1.4;
}

.wc-adv-stat-item__value {
  font-size    : 0.75rem;
  font-weight  : 700;
  color        : var(--wc-text-primary);
  text-align   : right;
  max-width    : 100px;
  overflow     : hidden;
  text-overflow: ellipsis;
  white-space  : nowrap;
  flex-shrink  : 0;
}

.wc-adv-stat-item__value--mono {
  font-family: var(--wc-mono);
  font-size  : 0.7rem;
}
.wc-badge {
  display      : inline-flex;
  align-items  : center;
  padding      : 2px 7px;
  border-radius: 99px;
  font-size    : 0.65rem;
  font-weight  : 600;
  letter-spacing: 0.03em;
  white-space  : nowrap;
}

.wc-badge--neutral  { background: var(--wc-surface-2);     color: var(--wc-text-muted); }
.wc-badge--easy     { background: var(--wc-success-light); color: var(--wc-success);   }
.wc-badge--moderate { background: var(--wc-warning-light); color: var(--wc-warning);   }
.wc-badge--hard     { background: var(--wc-danger-light);  color: var(--wc-danger);    }
.wc-bottom-stats {
  display    : flex;
  align-items: center;
  background : var(--wc-surface);
  border-top : 1px solid var(--wc-border);
  flex-shrink: 0;
  flex-wrap  : wrap;
  width      : 100%;
  overflow   : hidden;                      /* <svg class="icon" aria-hidden="true" focusable="false"><use href="#i-check"/></svg> KEY FIX */
}

.wc-bottom-stat {
  display        : flex;
  align-items    : center;
  gap            : 5px;
  padding        : 9px 14px;
  border-right   : 1px solid var(--wc-border);
  font-size      : 0.73rem;
  color          : var(--wc-text-muted);
  flex           : 1;
  white-space    : nowrap;
  min-width      : 0;
  overflow       : hidden;
}

.wc-bottom-stat:last-child { border-right: none; }

.wc-bottom-stat strong {
  color      : var(--wc-text-primary);
  font-weight: 700;
  margin-left: 2px;
}
.wc-icon {
  width         : 14px;
  height        : 14px;
  stroke        : currentColor;
  stroke-width  : 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill          : none;
  flex-shrink   : 0;
}

.wc-icon--sm { width: 12px; height: 12px; }
.wc-icon--lg { width: 26px; height: 26px; opacity: 0.4; }
@media (max-width: 900px) {
.wc-stats-bar {
    grid-template-columns: repeat(3, 1fr);
  }

  .wc-stat-card:nth-child(3) { border-right: none; }
  .wc-stat-card:nth-child(4),
  .wc-stat-card:nth-child(5),
  .wc-stat-card:nth-child(6) { border-top: 1px solid var(--wc-border); }
.wc-editor-wrap {
    grid-template-columns: 1fr;
  }

  .wc-editor-panel {
    border-right : none;
    border-bottom: 1px solid var(--wc-border);
  }
.wc-details-panel {
    width                 : 100%;
    max-width             : 100%;
    display               : grid;
    grid-template-columns : repeat(3, 1fr);
    overflow-y            : visible;
    overflow-x            : hidden;
  }

  .wc-detail-card {
    border-right : 1px solid var(--wc-border);
    border-bottom: none;
  }

  .wc-detail-card:last-child { border-right: none; }
.wc-bottom-stat {
    flex    : 1 1 calc(50% - 1px);
    min-width: 120px;
  }

  .wc-bottom-stat:nth-child(2) { border-right: none; }
  .wc-bottom-stat:nth-child(3) { border-top: 1px solid var(--wc-border); }
}
@media (max-width: 600px) {
.wc-stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
.wc-stat-card {
    border-right: none;
    border-top  : none;
  }

  .wc-stat-card:nth-child(odd) {
    border-right: 1px solid var(--wc-border);
  }

  .wc-stat-card:nth-child(n+3) {
    border-top: 1px solid var(--wc-border);
  }

  .wc-stat-card { padding: 11px 6px; }
  .wc-stat-card__value { font-size: 1.25rem; }
  .wc-stat-card__label { font-size: 0.55rem; }
.wc-editor-toolbar {
    flex-direction: column;
    align-items   : flex-start;
  }

  .wc-editor-toolbar__actions {
    width          : 100%;
    justify-content: flex-end;
  }

  .wc-textarea { min-height: 180px; }
.wc-action-bar {
    flex-direction: column;
    align-items   : stretch;
  }

  .wc-action-bar__left  { justify-content: center; }
  .wc-action-bar__right {
    justify-content: center;
    flex-wrap      : wrap;
  }
.wc-details-panel {
    grid-template-columns: 1fr;
  }

  .wc-detail-card {
    border-right : none;
    border-bottom: 1px solid var(--wc-border);
  }
.wc-bottom-stats {
    flex-direction: column;
  }

  .wc-bottom-stat {
    flex         : 1 1 100%;
    border-right : none;
    border-bottom: 1px solid var(--wc-border);
    justify-content: center;
    min-width    : 0;
    width        : 100%;
    overflow     : hidden;
  }

  .wc-bottom-stat:last-child { border-bottom: none; }
.wc-action-btn {
    padding  : 7px 12px;
    font-size: 0.75rem;
  }
}
@keyframes wc-fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0);   }
}

@keyframes wc-count-pop {
  0%   { transform: scale(1);    }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1);    }
}

.wc-stat-card__value.wc-pop {
  animation: wc-count-pop 0.25s ease;
}
.wc-details-panel::-webkit-scrollbar { width: 3px; }
.wc-details-panel::-webkit-scrollbar-track { background: transparent; }
.wc-details-panel::-webkit-scrollbar-thumb {
  background   : var(--wc-border-2);
  border-radius: 99px;
}

.wc-textarea::-webkit-scrollbar { width: 3px; }
.wc-textarea::-webkit-scrollbar-track { background: transparent; }
.wc-textarea::-webkit-scrollbar-thumb {
  background   : var(--wc-border-2);
  border-radius: 99px;
}