/* CountWords — own design. Warm paper background, ink text, teal accent. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #faf7f2;
  color: #1f2937;
  line-height: 1.55;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

.site-header {
  background: #0f766e;
  color: #fff;
  padding: 28px 0 24px;
}
.brand { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.brand span { color: #99f6e4; }
.tagline { margin: 6px 0 0; font-size: 16px; color: #ccfbf1; }

main { padding: 24px 0 40px; }
.tool { background: #fff; border: 1px solid #e7e0d4; border-radius: 12px; padding: 22px; position: relative; }
.field-label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 8px; }

#text {
  width: 100%;
  min-height: 220px;
  padding: 14px 16px;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1f2937;
  background: #fffdf8;
  border: 1px solid #d6cfc0;
  border-radius: 8px;
  resize: vertical;
}
#text:focus { outline: 3px solid #99f6e4; border-color: #0f766e; }

/* Hidden mirror, same font/width as the textarea, for measuring lines. */
#mirror {
  position: absolute;
  visibility: hidden;
  left: 22px;
  right: 22px;
  width: auto;
  padding: 14px 16px;
  border: 1px solid transparent;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.selection {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 6px;
  font-size: 14px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin: 14px 0 4px;
}
.controls .check { font-size: 14px; }
.controls select { font: inherit; padding: 4px 6px; border: 1px solid #d6cfc0; border-radius: 6px; background: #fff; }
.controls .spacer { flex: 1; }
button {
  font: inherit;
  font-size: 14px;
  padding: 8px 16px;
  border: 1px solid #d6cfc0;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
}
button:hover { border-color: #0f766e; }
button.primary { background: #0f766e; border-color: #0f766e; color: #fff; font-weight: 700; }
button.primary:hover { background: #0d5c56; }

h2 { font-size: 19px; margin: 26px 0 12px; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.stat {
  background: #f8f5ef;
  border: 1px solid #e7e0d4;
  border-radius: 8px;
  padding: 12px 14px;
}
.stat.wide { grid-column: span 2; }
.stat .num { display: block; font-size: 24px; font-weight: 800; color: #0f766e; line-height: 1.2; }
.stat .lbl { display: block; font-size: 13px; color: #4b5563; margin-top: 2px; }

.hint { font-size: 14px; color: #4b5563; margin: 0 0 10px; }
table.topwords { width: 100%; border-collapse: collapse; font-size: 15px; }
.topwords th, .topwords td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e7e0d4; }
.topwords th { background: #f8f5ef; font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; }
.topwords td:first-child, .topwords th:first-child { width: 44px; }

.notes { margin-top: 28px; }
.notes h2 { margin-top: 0; }
.notes ul { margin: 0; padding-left: 20px; }
.notes li { margin-bottom: 6px; }
.fine { font-size: 13px; color: #6b7280; }

.site-footer { border-top: 1px solid #e7e0d4; padding: 18px 0 26px; color: #6b7280; font-size: 14px; }
.site-footer p { margin: 0; }

@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat.wide { grid-column: span 2; }
  .tool { padding: 16px; }
  #mirror { left: 16px; right: 16px; }
  .brand { font-size: 26px; }
  .controls .spacer { display: none; }
}
@media (max-width: 390px) {
  .wrap { padding: 0 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .num { font-size: 20px; }
  .stat .lbl { font-size: 12px; }
  #text { min-height: 180px; }
  button { padding: 8px 12px; }
}

/* Footer nav + simple content pages (added at site assembly). */
.site-footer nav { margin-top: 8px; }
.site-footer nav a { color: #0f766e; margin-right: 18px; }
.page h1 { font-size: 26px; margin: 0 0 14px; }
.page p, .page li { font-size: 16px; }
.page ul { padding-left: 20px; }
.page li { margin-bottom: 6px; }
.page a { color: #0f766e; }
