/* wordcounter.lol page styles (on top of lol.css). Shared tokens only. */

/* ---------- Text box ---------- */
.wc-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.5rem; }
.wc-label {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--fg-muted);
}
.wc-mini { font-family: var(--font-mono); font-size: 0.78rem; color: var(--fg-dim); white-space: nowrap; }

.wc-input { position: relative; }
.wc-input textarea {
  display: block; width: 100%;
  min-height: 260px; height: 38vh; max-height: 70vh;
  resize: vertical;
  font: inherit; font-size: 1.02rem; line-height: 1.6;
  color: var(--fg); background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}
.wc-input textarea::placeholder { color: var(--fg-dim); }
.wc-input textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.wc-dropmsg {
  position: absolute; inset: 0; display: none; place-items: center;
  border: 1.5px dashed var(--accent); border-radius: var(--radius-sm);
  background: var(--accent-dim); color: var(--fg); font-weight: 600; pointer-events: none;
}
.wc-input.dragging .wc-dropmsg { display: grid; }

.wc-sel {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; align-items: baseline;
  margin: 0.6rem 0 0; padding: 0.55rem 0.8rem;
  background: var(--accent-dim); border: 1px solid var(--accent); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--fg-muted);
}
.wc-sel b { color: var(--fg); font-weight: 600; }
.wc-sel-label { color: var(--accent); font-weight: 600; }

.wc-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.btn-ghost.sm { padding: 0.45rem 0.9rem; font-size: 0.88rem; font-weight: 500; }
.btn-ghost.sm svg { width: 16px; height: 16px; }
.wc-status { margin-top: 0.5rem; min-height: 0; font-size: 0.82rem; }
.wc-status:empty { display: none; }
.wc-fallback { margin-top: 0.5rem; color: var(--danger); font-size: 0.82rem; }

/* ---------- Stats ---------- */
.wc-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem;
  margin: 1.25rem 0 0; padding: 0;
}
.stat {
  min-width: 0; margin: 0; padding: 0.7rem 0.8rem;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.stat dt { font-size: 0.74rem; color: var(--fg-muted); line-height: 1.3; }
.stat dd { margin: 0.15rem 0 0; font-family: var(--font-mono); font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.stat dd.stat-sub { margin-top: 0.1rem; font-family: var(--font-sans); font-size: 0.72rem; font-weight: 400; color: var(--fg-dim); }
.stat.big { grid-column: span 2; border-color: var(--accent-dim); }
.stat.big dd { font-size: 2.1rem; color: var(--fg); letter-spacing: -0.02em; }
.stat dd.stat-word { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) {
  .wc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat.big { grid-column: span 1; }
  .stat.big dd { font-size: 1.7rem; }
}

/* ---------- Limits ---------- */
.wc-h3 {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--fg-muted); font-weight: 500; margin: 1.75rem 0 0.75rem;
}
.wc-limits { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .wc-limits { grid-template-columns: 1fr; } }
.limit {
  min-width: 0; padding: 0.75rem 0.85rem;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.limit-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.limit-name { font-weight: 600; font-size: 0.9rem; }
.limit-count { font-family: var(--font-mono); font-size: 0.82rem; color: var(--fg-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.limit-count b { color: var(--fg); font-weight: 600; }
.meter { position: relative; height: 6px; margin: 0.55rem 0 0.45rem; border-radius: 6px; background: var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--accent); transition: width .15s ease; }
.meter-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--fg-dim); }
.limit-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.limit-note { font-size: 0.74rem; color: var(--fg-dim); line-height: 1.4; }
.limit-status { font-family: var(--font-mono); font-size: 0.76rem; color: var(--fg-muted); white-space: nowrap; }
.limit.warn .meter > span { background: var(--fg-muted); }
.limit.warn .limit-status { color: var(--fg); font-weight: 600; }
.limit.over { border-color: var(--danger); }
.limit.over .meter > span { background: var(--danger); }
.limit.over .limit-status, .limit.over .limit-count b { color: var(--danger); font-weight: 600; }

.custom-name { display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-weight: 600; }
.custom-name label { font-size: 0.9rem; }
.custom-name input, .custom-name select {
  font: inherit; font-size: 0.85rem; font-weight: 400; color: var(--fg);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; padding: 0.15rem 0.35rem;
}
.custom-name input { width: 6.2rem; font-family: var(--font-mono); }
.custom-name input:focus, .custom-name select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ---------- Top words ---------- */
.wc-top-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; margin-top: 1.75rem; }
.wc-top-head .wc-h3 { margin: 0; }
.check-row { display: flex; gap: 0.55rem; align-items: flex-start; cursor: pointer; }
.check-row input { margin-top: 0.25rem; accent-color: var(--accent); flex-shrink: 0; }
.wc-top { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.wc-top li {
  display: inline-flex; gap: 0.4rem; align-items: baseline; max-width: 100%;
  padding: 0.3rem 0.6rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.88rem;
}
.tw-word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-n { font-family: var(--font-mono); font-size: 0.76rem; color: var(--accent); }
.wc-top-empty { margin-top: 0.6rem; font-size: 0.82rem; color: var(--fg-dim); }

/* ---------- Save toggle ---------- */
.wc-save {
  margin-top: 1.5rem; padding: 0.8rem 0.9rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input);
  font-size: 0.85rem; color: var(--fg-muted);
}
.wc-save strong { color: var(--fg); }

@media (max-width: 430px) {
  .card.wc-tool { padding: 1.1rem; }
  .wc-input textarea { min-height: 220px; height: 34vh; }
  .stat { padding: 0.6rem 0.65rem; }
  .limit-foot { flex-direction: column; gap: 0.2rem; }
}
