/* Writing Coach (every class is c- prefixed) */
.c-coach [hidden] { display: none !important; }
.c-logo { width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center; border-radius: 11px; background: var(--grad); color: var(--accent-ink); }
.c-logo svg { width: 20px; height: 20px; }

/* editor */
.c-type { align-self: flex-start; flex-wrap: wrap; max-width: 100%; }
.c-focus { display: flex; flex-wrap: wrap; gap: 8px; }
.c-focus .chip { padding: 6px 13px; font-size: 13.5px; }
.c-focus .chip.on::before { content: "✓"; font-size: 12px; color: var(--accent); }
.c-label-row { flex-wrap: nowrap; }
.c-label-row .btn { margin: -4px -6px -4px 0; }
.c-text { min-height: 260px; line-height: 1.65; }
.c-count { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

/* instant stats */
.c-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.c-stat {
  min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 2px;
  padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
}
.c-stat b { font-size: 20px; line-height: 1.2; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.c-stat > span { font-size: 12px; line-height: 1.3; color: var(--muted); }
.c-stat.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 8%, var(--panel-2)); }
.c-stat.warn b { color: var(--warn); }
:root[data-theme="light"] .c-stat.warn b { color: color-mix(in srgb, var(--warn) 55%, var(--text)); } /* plain amber is unreadable on white */
.c-words { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 24px; }
.c-word {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.c-word small { font-size: 11px; color: var(--muted); }
.c-none { font-size: 13px; color: var(--faint); }
.c-tip {
  margin: 0; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; color: var(--muted);
  background: color-mix(in srgb, var(--accent-2) 8%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent-2) 35%, transparent);
}
.c-tip b { color: var(--text); }
.c-acts { gap: 10px; }

/* result cards */
.c-result, .c-scorecard, .c-history { scroll-margin-top: 14px; }
.c-head { margin-bottom: 12px; flex-wrap: nowrap; }
.c-head h2 { margin: 0; }
.c-head h2:focus { outline: none; }
.c-head .hint { text-align: right; }
.c-working {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
}
.c-working .working { min-width: 0; }
.c-notes { gap: 8px; margin-bottom: 14px; }
.c-notes:empty { display: none; }
.c-problem { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.c-md h2 { display: flex; align-items: center; gap: 8px; font-size: 16.5px; margin: 22px 0 8px; }
.c-md h2::before { content: ""; flex: none; width: 4px; height: 1.05em; border-radius: 2px; background: var(--grad); }
.c-md > h2:first-child { margin-top: 0; }
.c-md ol > li { margin: 10px 0; padding-left: 2px; }
.c-md ol > li::marker { color: var(--accent); font-weight: 700; }
.c-md strong { color: var(--text); }
.c-disc { margin: 14px 0 0; }
.c-after { gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* rubric */
.c-total { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.c-total b { font-size: 30px; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.c-total span { color: var(--muted); font-weight: 600; }
.c-scorecard .notice { margin-bottom: 12px; }
.c-bars { display: flex; flex-direction: column; gap: 12px; }
.c-bar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 150px; align-items: center; gap: 12px; }
.c-bar-name { font-size: 14px; font-weight: 600; }
.c-bar-val { font-size: 13.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.c-bar-val b { color: var(--text); }
.c-bar .progress { height: 10px; }
.c-lv1 > i { background: var(--bad); }
.c-lv2 > i { background: var(--warn); }
.c-lv4 > i { background: linear-gradient(135deg, var(--good), var(--accent-2)); }
.c-summary { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border-left: 3px solid var(--accent); }

/* history */
.c-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.c-hist-item { display: flex; align-items: center; gap: 4px; padding: 3px 5px 3px 3px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.c-hist-item.on { border-color: color-mix(in srgb, var(--accent) 70%, var(--line)); }
.c-hist-open {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px;
  padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--text); text-align: left;
}
.c-hist-open:hover { background: var(--panel-3); }
.c-hist-item > .btn { flex: none; min-width: 38px; min-height: 38px; }
.c-hist-title { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-hist-meta { font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-history .empty { padding: 22px 10px; }

@media (pointer: coarse) {
  .c-kbd { display: none; }
}
@media (max-width: 600px) {
  .c-type { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .c-type button { padding: 6px 4px; }
  .c-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c-text { min-height: 200px; }
  .c-acts .btn { flex: 1 1 130px; }
  .c-head { flex-wrap: wrap; }
  .c-bar { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .c-bar .progress { grid-column: 1 / -1; grid-row: 2; }
  .c-after .btn { flex: 1 1 auto; }
}
